Stable release of v5.0.0-alpha1
First alpha release of Component Builder towards Joomla 5 (very unstable...).
This commit is contained in:
@@ -0,0 +1,709 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\EventInterface as Event;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Language;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Component;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Field\Name as FieldName;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Field\TypeName;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Counter;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\Permission;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\AssetsRules;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\CustomTabs;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\PermissionViews;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\PermissionFields;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\PermissionComponent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\CustomButtonPermissions;
|
||||
use VDM\Joomla\Utilities\MathHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Access Sections Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class AccessSections
|
||||
{
|
||||
/**
|
||||
* The Config Class.
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The EventInterface Class.
|
||||
*
|
||||
* @var Event
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Event $event;
|
||||
|
||||
/**
|
||||
* The Language Class.
|
||||
*
|
||||
* @var Language
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Language $language;
|
||||
|
||||
/**
|
||||
* The Component Class.
|
||||
*
|
||||
* @var Component
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Component $component;
|
||||
|
||||
/**
|
||||
* The Name Class.
|
||||
*
|
||||
* @var FieldName
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected FieldName $fieldname;
|
||||
|
||||
/**
|
||||
* The TypeName Class.
|
||||
*
|
||||
* @var TypeName
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected TypeName $typename;
|
||||
|
||||
/**
|
||||
* The Counter Class.
|
||||
*
|
||||
* @var Counter
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Counter $counter;
|
||||
|
||||
/**
|
||||
* The Permission Class.
|
||||
*
|
||||
* @var Permission
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Permission $permission;
|
||||
|
||||
/**
|
||||
* The AssetsRules Class.
|
||||
*
|
||||
* @var AssetsRules
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected AssetsRules $assetsrules;
|
||||
|
||||
/**
|
||||
* The CustomTabs Class.
|
||||
*
|
||||
* @var CustomTabs
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CustomTabs $customtabs;
|
||||
|
||||
/**
|
||||
* The PermissionViews Class.
|
||||
*
|
||||
* @var PermissionViews
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected PermissionViews $permissionviews;
|
||||
|
||||
/**
|
||||
* The PermissionFields Class.
|
||||
*
|
||||
* @var PermissionFields
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected PermissionFields $permissionfields;
|
||||
|
||||
/**
|
||||
* The PermissionComponent Class.
|
||||
*
|
||||
* @var PermissionComponent
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected PermissionComponent $permissioncomponent;
|
||||
|
||||
/**
|
||||
* The CustomButtonPermissions Class.
|
||||
*
|
||||
* @var CustomButtonPermissions
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CustomButtonPermissions $custombuttonpermissions;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config $config The Config Class.
|
||||
* @param Event $event The EventInterface Class.
|
||||
* @param Language $language The Language Class.
|
||||
* @param Component $component The Component Class.
|
||||
* @param FieldName $fieldname The Name Class.
|
||||
* @param TypeName $typename The TypeName Class.
|
||||
* @param Counter $counter The Counter Class.
|
||||
* @param Permission $permission The Permission Class.
|
||||
* @param AssetsRules $assetsrules The AssetsRules Class.
|
||||
* @param CustomTabs $customtabs The CustomTabs Class.
|
||||
* @param PermissionViews $permissionviews The PermissionViews Class.
|
||||
* @param PermissionFields $permissionfields The PermissionFields Class.
|
||||
* @param PermissionComponent $permissioncomponent The PermissionComponent Class.
|
||||
* @param CustomButtonPermissions $custombuttonpermissions The CustomButtonPermissions Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Config $config, Event $event, Language $language,
|
||||
Component $component, FieldName $fieldname,
|
||||
TypeName $typename, Counter $counter,
|
||||
Permission $permission, AssetsRules $assetsrules,
|
||||
CustomTabs $customtabs, PermissionViews $permissionviews,
|
||||
PermissionFields $permissionfields,
|
||||
PermissionComponent $permissioncomponent,
|
||||
CustomButtonPermissions $custombuttonpermissions)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->event = $event;
|
||||
$this->language = $language;
|
||||
$this->component = $component;
|
||||
$this->fieldname = $fieldname;
|
||||
$this->typename = $typename;
|
||||
$this->counter = $counter;
|
||||
$this->permission = $permission;
|
||||
$this->assetsrules = $assetsrules;
|
||||
$this->customtabs = $customtabs;
|
||||
$this->permissionviews = $permissionviews;
|
||||
$this->permissionfields = $permissionfields;
|
||||
$this->permissioncomponent = $permissioncomponent;
|
||||
$this->custombuttonpermissions = $custombuttonpermissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Access Sections
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(): string
|
||||
{
|
||||
// access size counter
|
||||
$this->counter->accessSize = 12; // ;)
|
||||
|
||||
// Trigger Event: jcb_ce_onBeforeBuildAccessSections
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onBeforeBuildAccessSections'
|
||||
);
|
||||
|
||||
// Get the default fields
|
||||
$default_fields = $this->config->default_fields;
|
||||
$this->permissioncomponent->add('->HEAD<-', [
|
||||
'name' => 'core.admin',
|
||||
'title' => 'JACTION_ADMIN',
|
||||
'description' => 'JACTION_ADMIN_COMPONENT_DESC'
|
||||
], true);
|
||||
$this->permissioncomponent->add('->HEAD<-', [
|
||||
'name' => 'core.options',
|
||||
'title' => 'JACTION_OPTIONS',
|
||||
'description' => 'JACTION_OPTIONS_COMPONENT_DESC'
|
||||
], true);
|
||||
$this->permissioncomponent->add('->HEAD<-', [
|
||||
'name' => 'core.manage',
|
||||
'title' => 'JACTION_MANAGE',
|
||||
'description' => 'JACTION_MANAGE_COMPONENT_DESC'
|
||||
], true);
|
||||
|
||||
if ($this->config->get('add_eximport', false))
|
||||
{
|
||||
$exportTitle = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe('Export Data', 'U');
|
||||
$exportDesc = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe('Export Data', 'U')
|
||||
. '_DESC';
|
||||
$this->language->set('bothadmin', $exportTitle, 'Export Data');
|
||||
$this->language->set(
|
||||
'bothadmin', $exportDesc,
|
||||
' Allows users in this group to export data.'
|
||||
);
|
||||
$this->permissioncomponent->add('->HEAD<-', [
|
||||
'name' => 'core.export',
|
||||
'title' => $exportTitle,
|
||||
'description' => $exportDesc
|
||||
], true);
|
||||
|
||||
// the size needs increase
|
||||
$this->counter->accessSize++;
|
||||
$importTitle = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe('Import Data', 'U');
|
||||
$importDesc = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe('Import Data', 'U')
|
||||
. '_DESC';
|
||||
$this->language->set('bothadmin', $importTitle, 'Import Data');
|
||||
$this->language->set(
|
||||
'bothadmin', $importDesc,
|
||||
' Allows users in this group to import data.'
|
||||
);
|
||||
$this->permissioncomponent->add('->HEAD<-', [
|
||||
'name' => 'core.import',
|
||||
'title' => $importTitle,
|
||||
'description' => $importDesc
|
||||
], true);
|
||||
|
||||
// the size needs increase
|
||||
$this->counter->accessSize++;
|
||||
}
|
||||
|
||||
// version permission
|
||||
$batchTitle = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe('Use Batch', 'U');
|
||||
$batchDesc = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe('Use Batch', 'U') . '_DESC';
|
||||
$this->language->set('bothadmin', $batchTitle, 'Use Batch');
|
||||
$this->language->set(
|
||||
'bothadmin', $batchDesc,
|
||||
' Allows users in this group to use batch copy/update method.'
|
||||
);
|
||||
$this->permissioncomponent->add('->HEAD<-', [
|
||||
'name' => 'core.batch',
|
||||
'title' => $batchTitle,
|
||||
'description' => $batchDesc
|
||||
], true);
|
||||
|
||||
// version permission
|
||||
$importTitle = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe('Edit Versions', 'U');
|
||||
$importDesc = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe('Edit Versions', 'U')
|
||||
. '_DESC';
|
||||
$this->language->set('bothadmin', $importTitle, 'Edit Version');
|
||||
$this->language->set(
|
||||
'bothadmin', $importDesc,
|
||||
' Allows users in this group to edit versions.'
|
||||
);
|
||||
$this->permissioncomponent->add('->HEAD<-', [
|
||||
'name' => 'core.version',
|
||||
'title' => $importTitle,
|
||||
'description' => $importDesc
|
||||
], true);
|
||||
|
||||
// set the defaults
|
||||
$this->permissioncomponent->add('->HEAD<-', [
|
||||
'name' => 'core.create',
|
||||
'title' => 'JACTION_CREATE',
|
||||
'description' => 'JACTION_CREATE_COMPONENT_DESC'
|
||||
], true);
|
||||
$this->permissioncomponent->add('->HEAD<-', [
|
||||
'name' => 'core.delete',
|
||||
'title' => 'JACTION_DELETE',
|
||||
'description' => 'JACTION_DELETE_COMPONENT_DESC'
|
||||
], true);
|
||||
$this->permissioncomponent->add('->HEAD<-', [
|
||||
'name' => 'core.edit',
|
||||
'title' => 'JACTION_EDIT',
|
||||
'description' => 'JACTION_EDIT_COMPONENT_DESC'
|
||||
], true);
|
||||
$this->permissioncomponent->add('->HEAD<-', [
|
||||
'name' => 'core.edit.state',
|
||||
'title' => 'JACTION_EDITSTATE',
|
||||
'description' => 'JACTION_ACCESS_EDITSTATE_DESC'
|
||||
], true);
|
||||
$this->permissioncomponent->add('->HEAD<-', [
|
||||
'name' => 'core.edit.own',
|
||||
'title' => 'JACTION_EDITOWN',
|
||||
'description' => 'JACTION_EDITOWN_COMPONENT_DESC'
|
||||
], true);
|
||||
|
||||
// set the Joomla fields
|
||||
if ($this->config->get('set_joomla_fields', false))
|
||||
{
|
||||
$this->permissioncomponent->add('->HEAD<-', [
|
||||
'name' => 'core.edit.value',
|
||||
'title' => 'JACTION_EDITVALUE',
|
||||
'description' => 'JACTION_EDITVALUE_COMPONENT_DESC'
|
||||
], true);
|
||||
|
||||
// the size needs increase
|
||||
$this->counter->accessSize++;
|
||||
}
|
||||
|
||||
// new custom created by permissions
|
||||
$created_byTitle = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe('Edit Created By', 'U');
|
||||
$created_byDesc = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe('Edit Created By', 'U')
|
||||
. '_DESC';
|
||||
$this->language->set('bothadmin', $created_byTitle, 'Edit Created By');
|
||||
$this->language->set(
|
||||
'bothadmin', $created_byDesc,
|
||||
' Allows users in this group to edit created by.'
|
||||
);
|
||||
$this->permissioncomponent->add('->HEAD<-', [
|
||||
'name' => 'core.edit.created_by',
|
||||
'title' => $created_byTitle,
|
||||
'description' => $created_byDesc
|
||||
], true);
|
||||
|
||||
// new custom created date permissions
|
||||
$createdTitle = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe('Edit Created Date', 'U');
|
||||
$createdDesc = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe('Edit Created Date', 'U')
|
||||
. '_DESC';
|
||||
$this->language->set('bothadmin', $createdTitle, 'Edit Created Date');
|
||||
$this->language->set(
|
||||
'bothadmin', $createdDesc,
|
||||
' Allows users in this group to edit created date.'
|
||||
);
|
||||
$this->permissioncomponent->add('->HEAD<-', [
|
||||
'name' => 'core.edit.created',
|
||||
'title' => $createdTitle,
|
||||
'description' => $createdDesc
|
||||
], true);
|
||||
|
||||
// set the menu controller lookup
|
||||
$menuControllers = ['access', 'submenu', 'dashboard_list', 'dashboard_add'];
|
||||
|
||||
// set the custom admin views permissions
|
||||
if ($this->component->isArray('custom_admin_views'))
|
||||
{
|
||||
foreach ($this->component->get('custom_admin_views') as $custom_admin_view)
|
||||
{
|
||||
// new custom permissions to access this view
|
||||
$customAdminName = $custom_admin_view['settings']->name;
|
||||
$customAdminCode = $custom_admin_view['settings']->code;
|
||||
$customAdminTitle = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe(
|
||||
$customAdminName . ' Access', 'U'
|
||||
);
|
||||
$customAdminDesc = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe(
|
||||
$customAdminName . ' Access', 'U'
|
||||
) . '_DESC';
|
||||
$sortKey = StringHelper::safe(
|
||||
$customAdminName . ' Access'
|
||||
);
|
||||
$this->language->set(
|
||||
'bothadmin', $customAdminTitle, $customAdminName . ' Access'
|
||||
);
|
||||
$this->language->set(
|
||||
'bothadmin', $customAdminDesc,
|
||||
' Allows the users in this group to access '
|
||||
. StringHelper::safe($customAdminName, 'w')
|
||||
. '.'
|
||||
);
|
||||
$this->permissioncomponent->set($sortKey, [
|
||||
'name' => "$customAdminCode.access",
|
||||
'title' => $customAdminTitle,
|
||||
'description' => $customAdminDesc
|
||||
]);
|
||||
|
||||
// the size needs increase
|
||||
$this->counter->accessSize++;
|
||||
|
||||
// add the custom permissions to use the buttons of this view
|
||||
$this->custombuttonpermissions->add(
|
||||
$custom_admin_view['settings'], $customAdminName,
|
||||
$customAdminCode
|
||||
);
|
||||
|
||||
// add menu controll view that has menus options
|
||||
foreach ($menuControllers as $menuController)
|
||||
{
|
||||
// add menu controll view that has menus options
|
||||
if (isset($custom_admin_view[$menuController])
|
||||
&& $custom_admin_view[$menuController])
|
||||
{
|
||||
$targetView_ = 'views.';
|
||||
if ($menuController === 'dashboard_add')
|
||||
{
|
||||
$targetView_ = 'view.';
|
||||
}
|
||||
|
||||
// menucontroller
|
||||
$menucontrollerView['action'] = $targetView_
|
||||
. $menuController;
|
||||
$menucontrollerView['implementation'] = '2';
|
||||
if (isset($custom_admin_view['settings']->permissions)
|
||||
&& ArrayHelper::check(
|
||||
$custom_admin_view['settings']->permissions
|
||||
))
|
||||
{
|
||||
array_push(
|
||||
$custom_admin_view['settings']->permissions,
|
||||
$menucontrollerView
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$custom_admin_view['settings']->permissions
|
||||
= [];
|
||||
$custom_admin_view['settings']->permissions[]
|
||||
= $menucontrollerView;
|
||||
}
|
||||
unset($menucontrollerView);
|
||||
}
|
||||
}
|
||||
|
||||
$this->permission ->set(
|
||||
$custom_admin_view, $customAdminCode, $customAdminCode,
|
||||
$menuControllers, 'customAdmin'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// set the site views permissions
|
||||
if ($this->component->isArray('site_views'))
|
||||
{
|
||||
foreach ($this->component->get('site_views') as $site_view)
|
||||
{
|
||||
// new custom permissions to access this view
|
||||
$siteName = $site_view['settings']->name;
|
||||
$siteCode = $site_view['settings']->code;
|
||||
$siteTitle = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe(
|
||||
$siteName . ' Access Site', 'U'
|
||||
);
|
||||
$siteDesc = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe(
|
||||
$siteName . ' Access Site', 'U'
|
||||
) . '_DESC';
|
||||
$sortKey = StringHelper::safe(
|
||||
$siteName . ' Access Site'
|
||||
);
|
||||
|
||||
if (isset($site_view['access']) && $site_view['access'] == 1)
|
||||
{
|
||||
$this->language->set(
|
||||
'bothadmin', $siteTitle, $siteName . ' (Site) Access'
|
||||
);
|
||||
$this->language->set(
|
||||
'bothadmin', $siteDesc,
|
||||
' Allows the users in this group to access site '
|
||||
. StringHelper::safe($siteName, 'w')
|
||||
. '.'
|
||||
);
|
||||
$this->permissioncomponent->set($sortKey, [
|
||||
'name' => "site.$siteCode.access",
|
||||
'title' => $siteTitle,
|
||||
'description' => $siteDesc
|
||||
]);
|
||||
|
||||
// the size needs increase
|
||||
$this->counter->accessSize++;
|
||||
|
||||
// check if this site view requires access rule to default to public
|
||||
if (isset($site_view['public_access'])
|
||||
&& $site_view['public_access'] == 1)
|
||||
{
|
||||
// we use one as public group (TODO we see if we run into any issues)
|
||||
$this->assetsrules->add('site', '"site.' . $siteCode
|
||||
. '.access":{"1":1}');
|
||||
}
|
||||
}
|
||||
|
||||
// add the custom permissions to use the buttons of this view
|
||||
$this->custombuttonpermissions->add(
|
||||
$site_view['settings'], $siteName, $siteCode
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->component->isArray('admin_views'))
|
||||
{
|
||||
foreach ($this->component->get('admin_views') as $view)
|
||||
{
|
||||
// set view name
|
||||
$nameView = StringHelper::safe(
|
||||
$view['settings']->name_single
|
||||
);
|
||||
$nameViews = StringHelper::safe(
|
||||
$view['settings']->name_list
|
||||
);
|
||||
|
||||
// add custom tab permissions if found
|
||||
if (($tabs_ = $this->customtabs->get($nameView)) !== null
|
||||
&& ArrayHelper::check($tabs_))
|
||||
{
|
||||
foreach ($tabs_ as $_customTab)
|
||||
{
|
||||
if (isset($_customTab['permission'])
|
||||
&& $_customTab['permission'] == 1)
|
||||
{
|
||||
$this->permissioncomponent->set($_customTab['sortKey'], [
|
||||
'name' => $_customTab['view'] . '.' . $_customTab['code'] . '.viewtab',
|
||||
'title' => $_customTab['lang_permission'],
|
||||
'description' => $_customTab['lang_permission_desc']
|
||||
]);
|
||||
|
||||
// the size needs increase
|
||||
$this->counter->accessSize++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add the custom permissions to use the buttons of this view
|
||||
$this->custombuttonpermissions->add(
|
||||
$view['settings'], $view['settings']->name_single, $nameView
|
||||
);
|
||||
|
||||
if ($nameView != 'component')
|
||||
{
|
||||
// add menu controll view that has menus options
|
||||
foreach ($menuControllers as $menuController)
|
||||
{
|
||||
// add menu controll view that has menus options
|
||||
if (isset($view[$menuController])
|
||||
&& $view[$menuController])
|
||||
{
|
||||
$targetView_ = 'views.';
|
||||
if ($menuController === 'dashboard_add')
|
||||
{
|
||||
$targetView_ = 'view.';
|
||||
}
|
||||
// menucontroller
|
||||
$menucontrollerView['action'] = $targetView_ . $menuController;
|
||||
$menucontrollerView['implementation'] = '2';
|
||||
if (isset($view['settings']->permissions)
|
||||
&& ArrayHelper::check(
|
||||
$view['settings']->permissions
|
||||
))
|
||||
{
|
||||
array_push(
|
||||
$view['settings']->permissions,
|
||||
$menucontrollerView
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$view['settings']->permissions = [];
|
||||
$view['settings']->permissions[] = $menucontrollerView;
|
||||
}
|
||||
unset($menucontrollerView);
|
||||
}
|
||||
}
|
||||
|
||||
// check if there are fields
|
||||
if (ArrayHelper::check($view['settings']->fields))
|
||||
{
|
||||
// field permission options
|
||||
$permission_options = [1 => 'edit', 2 => 'access', 3 => 'view'];
|
||||
|
||||
// check the fields for their permission settings
|
||||
foreach ($view['settings']->fields as $field)
|
||||
{
|
||||
// see if field require permissions to be set
|
||||
if (isset($field['permission'])
|
||||
&& ArrayHelper::check(
|
||||
$field['permission']
|
||||
))
|
||||
{
|
||||
if (ArrayHelper::check(
|
||||
$field['settings']->properties
|
||||
))
|
||||
{
|
||||
$fieldType = $this->typename->get($field);
|
||||
$fieldName = $this->fieldname->get(
|
||||
$field, $nameViews
|
||||
);
|
||||
|
||||
// loop the permission options
|
||||
foreach ($field['permission'] as $permission_id)
|
||||
{
|
||||
// set the permission key word
|
||||
$permission_option = $permission_options[(int) $permission_id];
|
||||
|
||||
// reset the bucket
|
||||
$fieldView = [];
|
||||
|
||||
// set the permission for this field
|
||||
$fieldView['action'] = 'view.' . $permission_option . '.' . $fieldName;
|
||||
$fieldView['implementation'] = '3';
|
||||
|
||||
// check if persmissions was already set
|
||||
if (isset($view['settings']->permissions)
|
||||
&& ArrayHelper::check(
|
||||
$view['settings']->permissions
|
||||
))
|
||||
{
|
||||
array_push($view['settings']->permissions, $fieldView);
|
||||
}
|
||||
else
|
||||
{
|
||||
$view['settings']->permissions = [];
|
||||
$view['settings']->permissions[] = $fieldView;
|
||||
}
|
||||
|
||||
// ensure that no default field get loaded
|
||||
if (!in_array($fieldName, $default_fields))
|
||||
{
|
||||
// load to global field permission set
|
||||
$this->permissionfields->
|
||||
set("$nameView.$fieldName.$permission_option", $fieldType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->permission ->set(
|
||||
$view, $nameView, $nameViews, $menuControllers
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Trigger Event: jcb_ce_onAfterBuildAccessSections
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onAfterBuildAccessSections'
|
||||
);
|
||||
|
||||
/// now build the section
|
||||
$component = $this->permissioncomponent->build();
|
||||
|
||||
// add views to the component section
|
||||
$component .= $this->permissionviews->build();
|
||||
|
||||
// remove the fix, is not needed
|
||||
if ($this->counter->accessSize < 30)
|
||||
{
|
||||
// since we have less than 30 actions
|
||||
// we do not need the fix for this component
|
||||
$this->config->set('add_assets_table_fix', 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// get the worst case column size required (can be worse I know)
|
||||
// access/action size x 20 characters x 8 groups
|
||||
$character_length = (int) MathHelper::bc(
|
||||
'mul', $this->counter->accessSize, 20, 0
|
||||
);
|
||||
|
||||
// set worse case
|
||||
$this->config->set('access_worse_case', (int) MathHelper::bc(
|
||||
'mul', $character_length, 8, 0
|
||||
));
|
||||
}
|
||||
|
||||
// return the build
|
||||
return $component;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,80 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\CategoryCode;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
|
||||
|
||||
/**
|
||||
* Access Sections Category Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class AccessSectionsCategory
|
||||
{
|
||||
/**
|
||||
* The CategoryCode Class.
|
||||
*
|
||||
* @var CategoryCode
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CategoryCode $categorycode;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param CategoryCode $categorycode The CategoryCode Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(CategoryCode $categorycode)
|
||||
{
|
||||
$this->categorycode = $categorycode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Access Sections Category
|
||||
*
|
||||
* @param string $nameSingleCode
|
||||
* @param string $nameListCode
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(string $nameSingleCode, string $nameListCode): string
|
||||
{
|
||||
$component = '';
|
||||
// check if view has category
|
||||
$otherViews = $this->categorycode->getString("{$nameSingleCode}.views");
|
||||
if ($otherViews !== null && $otherViews == $nameListCode)
|
||||
{
|
||||
$component .= PHP_EOL . Indent::_(1)
|
||||
. '<section name="category.' . $otherViews . '">';
|
||||
$component .= PHP_EOL . Indent::_(2)
|
||||
. '<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />';
|
||||
$component .= PHP_EOL . Indent::_(2)
|
||||
. '<action name="core.delete" title="JACTION_DELETE" description="COM_CATEGORIES_ACCESS_DELETE_DESC" />';
|
||||
$component .= PHP_EOL . Indent::_(2)
|
||||
. '<action name="core.edit" title="JACTION_EDIT" description="COM_CATEGORIES_ACCESS_EDIT_DESC" />';
|
||||
$component .= PHP_EOL . Indent::_(2)
|
||||
. '<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_CATEGORIES_ACCESS_EDITSTATE_DESC" />';
|
||||
$component .= PHP_EOL . Indent::_(2)
|
||||
. '<action name="core.edit.own" title="JACTION_EDITOWN" description="COM_CATEGORIES_ACCESS_EDITOWN_DESC" />';
|
||||
$component .= PHP_EOL . Indent::_(1) . "</section>";
|
||||
}
|
||||
|
||||
return $component;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,63 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
|
||||
|
||||
/**
|
||||
* Access Sections Joomla Fields Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class AccessSectionsJoomlaFields
|
||||
{
|
||||
/**
|
||||
* Set Access Sections Joomla Fields
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(): string
|
||||
{
|
||||
$component = '';
|
||||
// set all the core field permissions
|
||||
$component .= PHP_EOL . Indent::_(1) . '<section name="fieldgroup">';
|
||||
$component .= PHP_EOL . Indent::_(2)
|
||||
. '<action name="core.create" title="JACTION_CREATE" description="COM_FIELDS_GROUP_PERMISSION_CREATE_DESC" />';
|
||||
$component .= PHP_EOL . Indent::_(2)
|
||||
. '<action name="core.delete" title="JACTION_DELETE" description="COM_FIELDS_GROUP_PERMISSION_DELETE_DESC" />';
|
||||
$component .= PHP_EOL . Indent::_(2)
|
||||
. '<action name="core.edit" title="JACTION_EDIT" description="COM_FIELDS_GROUP_PERMISSION_EDIT_DESC" />';
|
||||
$component .= PHP_EOL . Indent::_(2)
|
||||
. '<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_FIELDS_GROUP_PERMISSION_EDITSTATE_DESC" />';
|
||||
$component .= PHP_EOL . Indent::_(2)
|
||||
. '<action name="core.edit.own" title="JACTION_EDITOWN" description="COM_FIELDS_GROUP_PERMISSION_EDITOWN_DESC" />';
|
||||
$component .= PHP_EOL . Indent::_(2)
|
||||
. '<action name="core.edit.value" title="JACTION_EDITVALUE" description="COM_FIELDS_GROUP_PERMISSION_EDITVALUE_DESC" />';
|
||||
$component .= PHP_EOL . Indent::_(1) . '</section>';
|
||||
$component .= PHP_EOL . Indent::_(1) . '<section name="field">';
|
||||
$component .= PHP_EOL . Indent::_(2)
|
||||
. '<action name="core.delete" title="JACTION_DELETE" description="COM_FIELDS_FIELD_PERMISSION_DELETE_DESC" />';
|
||||
$component .= PHP_EOL . Indent::_(2)
|
||||
. '<action name="core.edit" title="JACTION_EDIT" description="COM_FIELDS_FIELD_PERMISSION_EDIT_DESC" />';
|
||||
$component .= PHP_EOL . Indent::_(2)
|
||||
. '<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_FIELDS_FIELD_PERMISSION_EDITSTATE_DESC" />';
|
||||
$component .= PHP_EOL . Indent::_(2)
|
||||
. '<action name="core.edit.value" title="JACTION_EDITVALUE" description="COM_FIELDS_FIELD_PERMISSION_EDITVALUE_DESC" />';
|
||||
$component .= PHP_EOL . Indent::_(1) . '</section>';
|
||||
|
||||
return $component;
|
||||
}
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@ use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Language;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\Layout;
|
||||
@@ -82,6 +83,14 @@ final class Builders
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The Power Class.
|
||||
*
|
||||
* @var Power
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Power $power;
|
||||
|
||||
/**
|
||||
* The Language Class.
|
||||
*
|
||||
@@ -454,6 +463,7 @@ final class Builders
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config $config The Config Class.
|
||||
* @param Power $power The Power Class.
|
||||
* @param Language $language The Language Class.
|
||||
* @param Placeholder $placeholder The Placeholder Class.
|
||||
* @param Layout $layout The Layout Class.
|
||||
@@ -503,7 +513,7 @@ final class Builders
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Config $config, Language $language,
|
||||
public function __construct(Config $config, Power $power, Language $language,
|
||||
Placeholder $placeholder, Layout $layout,
|
||||
SiteFieldData $sitefielddata, Tags $tags,
|
||||
DatabaseTables $databasetables,
|
||||
@@ -536,6 +546,7 @@ final class Builders
|
||||
ComponentFields $componentfields, ?CMSApplication $app = null)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->power = $power;
|
||||
$this->language = $language;
|
||||
$this->placeholder = $placeholder;
|
||||
$this->layout = $layout;
|
||||
@@ -789,6 +800,8 @@ final class Builders
|
||||
);
|
||||
}
|
||||
}
|
||||
// extends value
|
||||
$extends_field = $custom['extends'] ?? '';
|
||||
// build the list values
|
||||
if (($listSwitch || $listJoin) && $typeName != 'repeatable'
|
||||
&& $typeName != 'subform')
|
||||
@@ -914,7 +927,7 @@ final class Builders
|
||||
);
|
||||
}
|
||||
// build script switch for user
|
||||
if ($custom['extends'] === 'user')
|
||||
if ($extends_field === 'user')
|
||||
{
|
||||
$this->scriptuserswitch->set($typeName, $typeName);
|
||||
}
|
||||
@@ -986,7 +999,7 @@ final class Builders
|
||||
}
|
||||
// setup checkbox for this view
|
||||
if ($dbSwitch && ($typeName === 'checkbox' ||
|
||||
(ArrayHelper::check($custom) && isset($custom['extends']) && $custom['extends'] === 'checkboxes')))
|
||||
(ArrayHelper::check($custom) && $extends_field === 'checkboxes')))
|
||||
{
|
||||
$this->checkbox->add($nameSingleCode, $name, true);
|
||||
}
|
||||
@@ -1029,6 +1042,8 @@ final class Builders
|
||||
$this->sitefielddata->set(
|
||||
$nameSingleCode, $name, 'basic_encryption', $typeName
|
||||
);
|
||||
// make sure to load FOF encryption (power)
|
||||
$this->power->get('99175f6d-dba8-4086-8a65-5c4ec175e61d', 1);
|
||||
// add open close method to field data
|
||||
$field['store'] = 'basic_encryption';
|
||||
break;
|
||||
@@ -1039,6 +1054,8 @@ final class Builders
|
||||
$this->sitefielddata->set(
|
||||
$nameSingleCode, $name, 'whmcs_encryption', $typeName
|
||||
);
|
||||
// make sure to load FOF encryption (power)
|
||||
$this->power->get('99175f6d-dba8-4086-8a65-5c4ec175e61d', 1);
|
||||
// add open close method to field data
|
||||
$field['store'] = 'whmcs_encryption';
|
||||
break;
|
||||
@@ -1049,6 +1066,8 @@ final class Builders
|
||||
$this->sitefielddata->set(
|
||||
$nameSingleCode, $name, 'medium_encryption', $typeName
|
||||
);
|
||||
// make sure to load FOF encryption (power)
|
||||
$this->power->get('99175f6d-dba8-4086-8a65-5c4ec175e61d', 1);
|
||||
// add open close method to field data
|
||||
$field['store'] = 'medium_encryption';
|
||||
break;
|
||||
|
@@ -0,0 +1,388 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Component;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\EventInterface as Event;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Component\Placeholder as CPlaceholder;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ExtensionsParams;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsetsCustomfield as Customfield;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\FieldAsString;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\ConfigFieldsetsGlobal;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\ConfigFieldsetsSiteControl;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\ConfigFieldsetsGroupControl;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\ConfigFieldsetsUikit;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\ConfigFieldsetsGooglechart;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\ConfigFieldsetsEmailHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\ConfigFieldsetsEncryption;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\ConfigFieldsetsCustomfield;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
use VDM\Joomla\Utilities\MathHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Config Fieldsets Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class ConfigFieldsets
|
||||
{
|
||||
/**
|
||||
* The Config Class.
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The Component Class.
|
||||
*
|
||||
* @var Component
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Component $component;
|
||||
|
||||
/**
|
||||
* The EventInterface Class.
|
||||
*
|
||||
* @var Event
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Event $event;
|
||||
|
||||
/**
|
||||
* The Placeholder Class.
|
||||
*
|
||||
* @var Placeholder
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Placeholder $placeholder;
|
||||
|
||||
/**
|
||||
* The Placeholder Class.
|
||||
*
|
||||
* @var CPlaceholder
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CPlaceholder $cplaceholder;
|
||||
|
||||
/**
|
||||
* The ExtensionsParams Class.
|
||||
*
|
||||
* @var ExtensionsParams
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ExtensionsParams $extensionsparams;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @var Customfield
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Customfield $customfield;
|
||||
|
||||
/**
|
||||
* The FieldAsString Class.
|
||||
*
|
||||
* @var FieldAsString
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected FieldAsString $fieldasstring;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsGlobal Class.
|
||||
*
|
||||
* @var ConfigFieldsetsGlobal
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsetsGlobal $configfieldsetsglobal;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsSiteControl Class.
|
||||
*
|
||||
* @var ConfigFieldsetsSiteControl
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsetsSiteControl $configfieldsetssitecontrol;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsGroupControl Class.
|
||||
*
|
||||
* @var ConfigFieldsetsGroupControl
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsetsGroupControl $configfieldsetsgroupcontrol;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsUikit Class.
|
||||
*
|
||||
* @var ConfigFieldsetsUikit
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsetsUikit $configfieldsetsuikit;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsGooglechart Class.
|
||||
*
|
||||
* @var ConfigFieldsetsGooglechart
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsetsGooglechart $configfieldsetsgooglechart;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsEmailHelper Class.
|
||||
*
|
||||
* @var ConfigFieldsetsEmailHelper
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsetsEmailHelper $configfieldsetsemailhelper;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsEncryption Class.
|
||||
*
|
||||
* @var ConfigFieldsetsEncryption
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsetsEncryption $configfieldsetsencryption;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @var ConfigFieldsetsCustomfield
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsetsCustomfield $configfieldsetscustomfield;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config $config The Config Class.
|
||||
* @param Component $component The Component Class.
|
||||
* @param Event $event The EventInterface Class.
|
||||
* @param Placeholder $placeholder The Placeholder Class.
|
||||
* @param CPlaceholder $cplaceholder The Placeholder Class.
|
||||
* @param ExtensionsParams $extensionsparams The ExtensionsParams Class.
|
||||
* @param Customfield $customfield The ConfigFieldsetsCustomfield Class.
|
||||
* @param FieldAsString $fieldasstring The FieldAsString Class.
|
||||
* @param ConfigFieldsetsGlobal $configfieldsetsglobal The ConfigFieldsetsGlobal Class.
|
||||
* @param ConfigFieldsetsSiteControl $configfieldsetssitecontrol The ConfigFieldsetsSiteControl Class.
|
||||
* @param ConfigFieldsetsGroupControl $configfieldsetsgroupcontrol The ConfigFieldsetsGroupControl Class.
|
||||
* @param ConfigFieldsetsUikit $configfieldsetsuikit The ConfigFieldsetsUikit Class.
|
||||
* @param ConfigFieldsetsGooglechart $configfieldsetsgooglechart The ConfigFieldsetsGooglechart Class.
|
||||
* @param ConfigFieldsetsEmailHelper $configfieldsetsemailhelper The ConfigFieldsetsEmailHelper Class.
|
||||
* @param ConfigFieldsetsEncryption $configfieldsetsencryption The ConfigFieldsetsEncryption Class.
|
||||
* @param ConfigFieldsetsCustomfield $configfieldsetscustomfield The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Config $config, Component $component, Event $event,
|
||||
Placeholder $placeholder, CPlaceholder $cplaceholder,
|
||||
ExtensionsParams $extensionsparams,
|
||||
Customfield $customfield, FieldAsString $fieldasstring,
|
||||
ConfigFieldsetsGlobal $configfieldsetsglobal,
|
||||
ConfigFieldsetsSiteControl $configfieldsetssitecontrol,
|
||||
ConfigFieldsetsGroupControl $configfieldsetsgroupcontrol,
|
||||
ConfigFieldsetsUikit $configfieldsetsuikit,
|
||||
ConfigFieldsetsGooglechart $configfieldsetsgooglechart,
|
||||
ConfigFieldsetsEmailHelper $configfieldsetsemailhelper,
|
||||
ConfigFieldsetsEncryption $configfieldsetsencryption,
|
||||
ConfigFieldsetsCustomfield $configfieldsetscustomfield)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->component = $component;
|
||||
$this->event = $event;
|
||||
$this->placeholder = $placeholder;
|
||||
$this->cplaceholder = $cplaceholder;
|
||||
$this->extensionsparams = $extensionsparams;
|
||||
$this->customfield = $customfield;
|
||||
$this->fieldasstring = $fieldasstring;
|
||||
$this->configfieldsetsglobal = $configfieldsetsglobal;
|
||||
$this->configfieldsetssitecontrol = $configfieldsetssitecontrol;
|
||||
$this->configfieldsetsgroupcontrol = $configfieldsetsgroupcontrol;
|
||||
$this->configfieldsetsuikit = $configfieldsetsuikit;
|
||||
$this->configfieldsetsgooglechart = $configfieldsetsgooglechart;
|
||||
$this->configfieldsetsemailhelper = $configfieldsetsemailhelper;
|
||||
$this->configfieldsetsencryption = $configfieldsetsencryption;
|
||||
$this->configfieldsetscustomfield = $configfieldsetscustomfield;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Config Fieldsets
|
||||
*
|
||||
* @param int $timer
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function set(int $timer = 0): void
|
||||
{
|
||||
// main lang prefix
|
||||
$lang = $this->config->lang_prefix . '_CONFIG';
|
||||
if (1 == $timer) // this is before the admin views are build
|
||||
{
|
||||
// start loading Global params
|
||||
$autorName = StringHelper::html(
|
||||
$this->component->get('author')
|
||||
);
|
||||
$autorEmail = StringHelper::html(
|
||||
$this->component->get('email')
|
||||
);
|
||||
$this->extensionsparams->add('component', '"autorName":"' . $autorName
|
||||
. '","autorEmail":"' . $autorEmail . '"');
|
||||
|
||||
// set the custom fields
|
||||
if ($this->component->isArray('config'))
|
||||
{
|
||||
// set component code name
|
||||
$component = $this->config->component_code_name;
|
||||
$nameSingleCode = 'config';
|
||||
$nameListCode = 'configs';
|
||||
|
||||
// set place holders
|
||||
$placeholders = [];
|
||||
$placeholders[Placefix::_h('component')]
|
||||
= $this->config->component_code_name;
|
||||
$placeholders[Placefix::_h('Component')]
|
||||
= StringHelper::safe(
|
||||
$this->component->get('name_code'), 'F'
|
||||
);
|
||||
$placeholders[Placefix::_h('COMPONENT')]
|
||||
= StringHelper::safe(
|
||||
$this->component->get('name_code'), 'U'
|
||||
);
|
||||
$placeholders[Placefix::_h('view')]
|
||||
= $nameSingleCode;
|
||||
$placeholders[Placefix::_h('views')]
|
||||
= $nameListCode;
|
||||
$placeholders[Placefix::_('component')]
|
||||
= $this->config->component_code_name;
|
||||
$placeholders[Placefix::_('Component')]
|
||||
= $placeholders[Placefix::_h('Component')];
|
||||
$placeholders[Placefix::_('COMPONENT')]
|
||||
= $placeholders[Placefix::_h('COMPONENT')];
|
||||
$placeholders[Placefix::_('view')]
|
||||
= $nameSingleCode;
|
||||
$placeholders[Placefix::_('views')]
|
||||
= $nameListCode;
|
||||
|
||||
// load the global placeholders
|
||||
foreach ($this->cplaceholder->get() as $globalPlaceholder => $gloabalValue)
|
||||
{
|
||||
$placeholders[$globalPlaceholder] = $gloabalValue;
|
||||
}
|
||||
$view = [];
|
||||
$viewType = 0;
|
||||
// set the custom table key
|
||||
$dbkey = 'g';
|
||||
|
||||
// Trigger Event: jcb_ce_onBeforeSetConfigFieldsets
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onBeforeSetConfigFieldsets', [&$timer]
|
||||
);
|
||||
|
||||
// build the config fields
|
||||
foreach ($this->component->get('config') as $field)
|
||||
{
|
||||
// get the xml string
|
||||
$xmlField = $this->fieldasstring->get(
|
||||
$field, $view, $viewType, $lang, $nameSingleCode,
|
||||
$nameListCode, $placeholders, $dbkey, false
|
||||
);
|
||||
|
||||
// make sure the xml is set and a string
|
||||
if (isset($xmlField) && StringHelper::check($xmlField))
|
||||
{
|
||||
$this->customfield->add($field['tabname'], $xmlField, true);
|
||||
// set global params to db on install
|
||||
$fieldName = StringHelper::safe(
|
||||
$this->placeholder->update(
|
||||
GetHelper::between(
|
||||
$xmlField, 'name="', '"'
|
||||
), $placeholders
|
||||
)
|
||||
);
|
||||
$fieldDefault = $this->placeholder->update(
|
||||
GetHelper::between(
|
||||
$xmlField, 'default="', '"'
|
||||
), $placeholders
|
||||
);
|
||||
if (isset($field['custom_value'])
|
||||
&& StringHelper::check(
|
||||
$field['custom_value']
|
||||
))
|
||||
{
|
||||
// add array if found
|
||||
if ((strpos((string) $field['custom_value'], '["') !== false)
|
||||
&& (strpos((string) $field['custom_value'], '"]')
|
||||
!== false))
|
||||
{
|
||||
// load the Global checkin defautls
|
||||
$this->extensionsparams->add('component', '"' . $fieldName
|
||||
. '":' . $field['custom_value']);
|
||||
}
|
||||
else
|
||||
{
|
||||
// load the Global checkin defautls
|
||||
$this->extensionsparams->add('component', '"' . $fieldName
|
||||
. '":"' . $field['custom_value'] . '"');
|
||||
}
|
||||
}
|
||||
elseif (StringHelper::check($fieldDefault))
|
||||
{
|
||||
// load the Global checkin defautls
|
||||
$this->extensionsparams->add('component', '"' . $fieldName . '":"'
|
||||
. $fieldDefault . '"');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// first run we must set the global
|
||||
$this->configfieldsetsglobal->set($lang, $autorName, $autorEmail);
|
||||
$this->configfieldsetssitecontrol->set($lang);
|
||||
}
|
||||
elseif (2 == $timer) // this is after the admin views are build
|
||||
{
|
||||
// Trigger Event: jcb_ce_onBeforeSetConfigFieldsets
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onBeforeSetConfigFieldsets', [&$timer]
|
||||
);
|
||||
|
||||
// these field sets can only be added after admin view is build
|
||||
$this->configfieldsetsgroupcontrol->set($lang);
|
||||
|
||||
// these can be added anytime really (but looks best after groups
|
||||
$this->configfieldsetsuikit->set($lang);
|
||||
$this->configfieldsetsgooglechart->set($lang);
|
||||
$this->configfieldsetsemailhelper->set($lang);
|
||||
$this->configfieldsetsencryption->set($lang);
|
||||
|
||||
// these are the custom settings
|
||||
$this->configfieldsetscustomfield->set($lang);
|
||||
}
|
||||
|
||||
// Trigger Event: jcb_ce_onAfterSetConfigFieldsets
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onAfterSetConfigFieldsets', [&$timer]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,142 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Language;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsetsCustomfield as Customfield;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsets;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
|
||||
|
||||
/**
|
||||
* Config Fieldsets Customfield Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class ConfigFieldsetsCustomfield
|
||||
{
|
||||
/**
|
||||
* The Config Class.
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The Language Class.
|
||||
*
|
||||
* @var Language
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Language $language;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @var Customfield
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Customfield $customfield;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsets Class.
|
||||
*
|
||||
* @var ConfigFieldsets
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsets $configfieldsets;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config $config The Config Class.
|
||||
* @param Language $language The Language Class.
|
||||
* @param Customfield $customfield The ConfigFieldsetsCustomfield Class.
|
||||
* @param ConfigFieldsets $configfieldsets The ConfigFieldsets Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Config $config, Language $language,
|
||||
Customfield $customfield,
|
||||
ConfigFieldsets $configfieldsets)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->language = $language;
|
||||
$this->customfield = $customfield;
|
||||
$this->configfieldsets = $configfieldsets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Custom Control Config Fieldsets
|
||||
*
|
||||
* @param string $lang
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function set(string $lang): void
|
||||
{
|
||||
// add custom new global fields set
|
||||
if ($this->customfield->isActive())
|
||||
{
|
||||
foreach ($this->customfield->allActive() as $tab => $tabFields)
|
||||
{
|
||||
$tabCode = StringHelper::safe($tab)
|
||||
. '_custom_config';
|
||||
$tabUpper = StringHelper::safe($tab, 'U');
|
||||
$tabLower = StringHelper::safe($tab);
|
||||
// remove display targeted fields
|
||||
$bucket = [];
|
||||
foreach ($tabFields as $tabField)
|
||||
{
|
||||
$display = GetHelper::between(
|
||||
$tabField, 'display="', '"'
|
||||
);
|
||||
if (!StringHelper::check($display)
|
||||
|| $display === 'config')
|
||||
{
|
||||
// remove this display since it is not used in Joomla
|
||||
$bucket[] = str_replace(
|
||||
'display="config"', '', (string) $tabField
|
||||
);
|
||||
}
|
||||
}
|
||||
// only add the tab if it has values
|
||||
if (ArrayHelper::check($bucket))
|
||||
{
|
||||
// setup lang
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_' . $tabUpper, $tab
|
||||
);
|
||||
// start field set
|
||||
$this->configfieldsets->add('component', Indent::_(1) . "<fieldset");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . 'name="'
|
||||
. $tabCode . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . 'label="' . $lang
|
||||
. '_' . $tabUpper . '">');
|
||||
// set the fields
|
||||
$this->configfieldsets->add('component', implode("", $bucket));
|
||||
// close field set
|
||||
$this->configfieldsets->add('component', Indent::_(1) . "</fieldset>");
|
||||
}
|
||||
// remove after loading
|
||||
$this->customfield->remove($tab);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,916 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Language;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Component;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsets;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsetsCustomfield as Customfield;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
|
||||
|
||||
/**
|
||||
* Config Fieldsets Email Helper Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class ConfigFieldsetsEmailHelper
|
||||
{
|
||||
/**
|
||||
* The Config Class.
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The Language Class.
|
||||
*
|
||||
* @var Language
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Language $language;
|
||||
|
||||
/**
|
||||
* The Component Class.
|
||||
*
|
||||
* @var Component
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Component $component;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsets Class.
|
||||
*
|
||||
* @var ConfigFieldsets
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsets $configfieldsets;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @var Customfield
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Customfield $customfield;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config $config The Config Class.
|
||||
* @param Language $language The Language Class.
|
||||
* @param Component $component The Component Class.
|
||||
* @param ConfigFieldsets $configfieldsets The ConfigFieldsets Class.
|
||||
* @param Customfield $customfield The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Config $config, Language $language, Component $component,
|
||||
ConfigFieldsets $configfieldsets,
|
||||
Customfield $customfield)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->language = $language;
|
||||
$this->component = $component;
|
||||
$this->configfieldsets = $configfieldsets;
|
||||
$this->customfield = $customfield;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Email Helper Config Fieldsets
|
||||
*
|
||||
* @param string $lang
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $lang): void
|
||||
{
|
||||
if ($this->component->get('add_email_helper'))
|
||||
{
|
||||
// main lang prefix
|
||||
$lang = $lang . '';
|
||||
|
||||
// set main lang string
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_MAIL_CONFIGURATION', "Mail Configuration"
|
||||
);
|
||||
|
||||
$this->language->set($this->config->lang_target, $lang . '_DKIM', "DKIM");
|
||||
|
||||
// start building field set for email helper functions
|
||||
$this->configfieldsets->add('component', PHP_EOL . Indent::_(1) . "<fieldset");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. "name=\"mail_configuration_custom_config\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "label=\"" . $lang
|
||||
. "_MAIL_CONFIGURATION\">");
|
||||
|
||||
// add custom Mail Configurations
|
||||
if ($this->customfield->isArray('Mail Configuration'))
|
||||
{
|
||||
$this->configfieldsets->add('component', implode(
|
||||
"", $this->customfield->get('Mail Configuration')
|
||||
));
|
||||
$this->customfield->remove('Mail Configuration');
|
||||
}
|
||||
else
|
||||
{
|
||||
// set all the laguage strings
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_MAILONLINE_LABEL', "Mailer Status"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_MAILONLINE_DESCRIPTION',
|
||||
"Warning this will stop all emails from going out."
|
||||
);
|
||||
$this->language->set($this->config->lang_target, $lang . '_ON', "On");
|
||||
$this->language->set($this->config->lang_target, $lang . '_OFF', "Off");
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_MAILER_LABEL', "Mailer"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_MAILER_DESCRIPTION',
|
||||
"Select what mailer you would like to use to send emails."
|
||||
);
|
||||
$this->language->set($this->config->lang_target, $lang . '_GLOBAL', "Global");
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_PHP_MAIL', "PHP Mail"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SENDMAIL', "Sendmail"
|
||||
);
|
||||
$this->language->set($this->config->lang_target, $lang . '_SMTP', "SMTP");
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_EMAILFROM_LABEL', " From Email"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_EMAILFROM_DESCRIPTION',
|
||||
"The global email address that will be used to send system email."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_EMAILFROM_HINT', "Email Address Here"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_FROMNAME_LABEL', "From Name"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_FROMNAME_DESCRIPTION',
|
||||
"Text displayed in the header "From:" field when sending a site email. Usually the site name."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_FROMNAME_HINT', "From Name Here"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_EMAILREPLY_LABEL', " Reply to Email"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_EMAILREPLY_DESCRIPTION',
|
||||
"The global email address that will be used to set as the reply email. (leave blank for none)"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_EMAILREPLY_HINT',
|
||||
"Email Address Here"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_REPLYNAME_LABEL', "Reply to Name"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_REPLYNAME_DESCRIPTION',
|
||||
"Text displayed in the header "Reply To:" field when replying to the site email. Usually the the person that receives the response. (leave blank for none)"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_REPLYNAME_HINT', "Reply Name Here"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SENDMAIL_LABEL', "Sendmail Path"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SENDMAIL_DESCRIPTION',
|
||||
"Enter the path to the sendmail program directory on your host server."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SENDMAIL_HINT', "/usr/sbin/sendmail"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SMTPAUTH_LABEL',
|
||||
"SMTP Authentication"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SMTPAUTH_DESCRIPTION',
|
||||
"Select yes if your SMTP host requires SMTP Authentication."
|
||||
);
|
||||
$this->language->set($this->config->lang_target, $lang . '_YES', "Yes");
|
||||
$this->language->set($this->config->lang_target, $lang . '_NO', "No");
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SMTPSECURE_LABEL', "SMTP Security"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SMTPSECURE_DESCRIPTION',
|
||||
"Select the security model that your SMTP server uses."
|
||||
);
|
||||
$this->language->set($this->config->lang_target, $lang . '_NONE', "None");
|
||||
$this->language->set($this->config->lang_target, $lang . '_SSL', "SSL");
|
||||
$this->language->set($this->config->lang_target, $lang . '_TLS', "TLS");
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SMTPPORT_LABEL', "SMTP Port"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SMTPPORT_DESCRIPTION',
|
||||
"Enter the port number of your SMTP server. Use 25 for most unsecured servers and 465 for most secure servers."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SMTPPORT_HINT', "25"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SMTPUSER_LABEL', "SMTP Username"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SMTPUSER_DESCRIPTION',
|
||||
"Enter the username for access to the SMTP host."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SMTPUSER_HINT', "email@demo.com"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SMTPPASS_LABEL', "SMTP Password"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SMTPPASS_DESCRIPTION',
|
||||
"Enter the password for access to the SMTP host."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SMTPHOST_LABEL', "SMTP Host"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SMTPHOST_DESCRIPTION',
|
||||
"Enter the name of the SMTP host."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SMTPHOST_HINT', "localhost"
|
||||
);
|
||||
|
||||
// set the mailer fields
|
||||
$this->configfieldsets->add('component', PHP_EOL . Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Mailonline Field. Type: Radio. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"radio\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"mailonline\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_MAILONLINE_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_MAILONLINE_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "class=\"btn-group btn-group-yesno\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"1\">");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "<!--"
|
||||
. Line::_(__Line__, __Class__) . " Option Set. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "<option value=\"1\">");
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. "_ON</option>");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "<option value=\"0\">");
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. "_OFF</option>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Mailer Field. Type: List. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"list\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"mailer\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_MAILER_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_MAILER_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "class=\"list_class\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "multiple=\"false\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"WORD\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "required=\"true\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"global\">");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "<!--"
|
||||
. Line::_(__Line__, __Class__) . " Option Set. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "<option value=\"global\">");
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. "_GLOBAL</option>");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "<option value=\"default\">");
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. "_PHP_MAIL</option>");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "<option value=\"sendmail\">");
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. "_SENDMAIL</option>");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "<option value=\"smtp\">");
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. "_SMTP</option>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Emailfrom Field. Type: Text. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"emailfrom\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_EMAILFROM_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"60\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"150\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_EMAILFROM_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"STRING\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "validate=\"email\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add email address here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_EMAILFROM_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "showon=\"mailer:smtp,sendmail,default\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Fromname Field. Type: Text. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"fromname\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_FROMNAME_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"60\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"150\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_FROMNAME_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"STRING\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add some name here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_FROMNAME_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "showon=\"mailer:smtp,sendmail,default\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Email reply to Field. Type: Text. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"replyto\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_EMAILREPLY_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"60\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"150\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_EMAILREPLY_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"STRING\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "validate=\"email\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add email address here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_EMAILREPLY_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "showon=\"mailer:smtp,sendmail,default\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Reply to name Field. Type: Text. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"replytoname\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_REPLYNAME_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"60\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"150\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_REPLYNAME_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"STRING\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add some name here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_REPLYNAME_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "showon=\"mailer:smtp,sendmail,default\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Sendmail Field. Type: Text. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"sendmail\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_SENDMAIL_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"60\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"150\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_SENDMAIL_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "required=\"false\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"PATH\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add path to you local sendmail here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_SENDMAIL_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "showon=\"mailer:sendmail\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Smtpauth Field. Type: Radio. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"radio\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"smtpauth\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_SMTPAUTH_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_SMTPAUTH_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "class=\"btn-group btn-group-yesno\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"0\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "showon=\"mailer:smtp\">");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "<!--"
|
||||
. Line::_(__Line__, __Class__) . " Option Set. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "<option value=\"1\">");
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. "_YES</option>");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "<option value=\"0\">");
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. "_NO</option>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Smtpsecure Field. Type: List. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"list\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"smtpsecure\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_SMTPSECURE_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_SMTPSECURE_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "class=\"list_class\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "multiple=\"false\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"WORD\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"none\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "showon=\"mailer:smtp\">");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "<!--"
|
||||
. Line::_(__Line__, __Class__) . " Option Set. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "<option value=\"none\">");
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. "_NONE</option>");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "<option value=\"ssl\">");
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. "_SSL</option>");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "<option value=\"tls\">");
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. "_TLS</option>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Smtpport Field. Type: Text. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"smtpport\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_SMTPPORT_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"60\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"150\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"25\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_SMTPPORT_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"INT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add the port number of your SMTP server here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_SMTPPORT_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "showon=\"mailer:smtp\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Smtpuser Field. Type: Text. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"smtpuser\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_SMTPUSER_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"60\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"150\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_SMTPUSER_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"STRING\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add the username for SMTP server here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_SMTPUSER_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "showon=\"mailer:smtp\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Smtppass Field. Type: Password. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"password\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"smtppass\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_SMTPPASS_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"60\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_SMTPPASS_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"raw\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add the password for SMTP server here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "showon=\"mailer:smtp\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Smtphost Field. Type: Text. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"smtphost\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_SMTPHOST_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"60\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"150\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "default=\"localhost\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_SMTPHOST_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"STRING\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add the name of the SMTP host here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_SMTPHOST_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "showon=\"mailer:smtp\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
}
|
||||
// close that fieldset
|
||||
$this->configfieldsets->add('component', Indent::_(1) . "</fieldset>");
|
||||
|
||||
// start dkim field set
|
||||
$this->configfieldsets->add('component', Indent::_(1) . "<fieldset");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. "name=\"dkim_custom_config\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "label=\"" . $lang
|
||||
. "_DKIM\">");
|
||||
// add custom DKIM fields
|
||||
if ($this->customfield->isArray('DKIM'))
|
||||
{
|
||||
$this->configfieldsets->add('component', implode(
|
||||
"", $this->customfield->get('DKIM')
|
||||
));
|
||||
$this->customfield->remove('DKIM');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_LABEL', "Enable DKIM"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_DESCRIPTION',
|
||||
"Set this option to Yes if you want to sign your emails using DKIM."
|
||||
);
|
||||
$this->language->set($this->config->lang_target, $lang . '_YES', "Yes");
|
||||
$this->language->set($this->config->lang_target, $lang . '_NO', "No");
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_DOMAIN_LABEL', "Domain"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_DOMAIN_DESCRIPTION',
|
||||
"Set the domain. Eg. domain.com"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_DOMAIN_HINT', "domain.com"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_SELECTOR_LABEL', "Selector"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_SELECTOR_DESCRIPTION',
|
||||
"Set your DKIM/DNS selector."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_SELECTOR_HINT', "vdm"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_PASSPHRASE_LABEL', "Passphrase"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_PASSPHRASE_DESCRIPTION',
|
||||
"Enter your passphrase here."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_IDENTITY_LABEL', "Identity"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_IDENTITY_DESCRIPTION',
|
||||
"Set DKIM identity. This can be in the format of an email address 'you@yourdomain.com' typically used as the source of the email."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_IDENTITY_HINT',
|
||||
"you@yourdomain.com"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_PRIVATE_KEY_LABEL',
|
||||
"Private key"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_PRIVATE_KEY_DESCRIPTION',
|
||||
"set private key"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_PUBLIC_KEY_LABEL', "Public key"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_PUBLIC_KEY_DESCRIPTION',
|
||||
"set public key"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_NOTE_DKIM_USE_LABEL',
|
||||
"Server Configuration"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_NOTE_DKIM_USE_DESCRIPTION', "<p>Using the below details, you need to configure your DNS by adding a TXT record on your domain: <b><span id='a_dkim_domain'></span></b></p>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var jformDkimDomain = document.querySelector('#jform_dkim_domain');
|
||||
if (!jformDkimDomain.value) {
|
||||
jformDkimDomain.value = window.location.hostname;
|
||||
}
|
||||
document.querySelector('#jform_dkim_key').addEventListener('click', function() {
|
||||
this.select();
|
||||
});
|
||||
document.querySelector('#jform_dkim_value').addEventListener('click', function() {
|
||||
this.select();
|
||||
});
|
||||
vdm_dkim();
|
||||
});
|
||||
function vdm_dkim() {
|
||||
var jformDkimDomain = document.querySelector('#jform_dkim_domain');
|
||||
document.querySelector('#a_dkim_domain').textContent = jformDkimDomain.value;
|
||||
var jformDkimKey = document.querySelector('#jform_dkim_key');
|
||||
jformDkimKey.value = document.querySelector('#jform_dkim_selector').value + '._domainkey';
|
||||
var jformDkimPublicKey = document.querySelector('#jform_dkim_public_key').value;
|
||||
var jformDkimValue = document.querySelector('#jform_dkim_value');
|
||||
if (!jformDkimPublicKey) {
|
||||
jformDkimValue.value = 'v=DKIM1;k=rsa;g=*;s=email;h=sha1;t=s;p=PUBLICKEY';
|
||||
} else {
|
||||
jformDkimValue.value = 'v=DKIM1;k=rsa;g=*;s=email;h=sha1;t=s;p=' + jformDkimPublicKey;
|
||||
}
|
||||
}
|
||||
</script>"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_KEY_LABEL', "Key"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_KEY_DESCRIPTION',
|
||||
"This is the KEY to use in the DNS record."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_KEY_HINT', "vdm._domainkey"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_VALUE_LABEL', "Value"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_VALUE_DESCRIPTION',
|
||||
"This is the TXT value to use in the DNS. Replace the PUBLICKEY with your public key."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_DKIM_VALUE_HINT',
|
||||
"v=DKIM1;k=rsa;g=*;s=email;h=sha1;t=s;p=PUBLICKEY"
|
||||
);
|
||||
|
||||
$this->configfieldsets->add('component', PHP_EOL . Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Dkim Field. Type: Radio. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"radio\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"dkim\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_DKIM_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_DKIM_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "class=\"btn-group btn-group-yesno\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"0\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "required=\"true\">");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "<!--"
|
||||
. Line::_(__Line__, __Class__) . " Option Set. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "<option value=\"1\">");
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. "_YES</option>");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "<option value=\"0\">");
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. "_NO</option>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Dkim_domain Field. Type: Text. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"dkim_domain\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_DKIM_DOMAIN_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"60\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"150\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_DKIM_DOMAIN_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"STRING\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add DKIM Domain here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_DKIM_DOMAIN_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "showon=\"dkim:1\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "onchange=\"vdm_dkim();\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Dkim_selector Field. Type: Text. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"dkim_selector\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_DKIM_SELECTOR_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"60\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"150\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"vdm\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_DKIM_SELECTOR_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"STRING\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add DKIM/DNS selector here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_DKIM_SELECTOR_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "showon=\"dkim:1\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "onchange=\"vdm_dkim();\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Dkim_passphrase Field. Type: Password. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"password\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"dkim_passphrase\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_DKIM_PASSPHRASE_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"60\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_DKIM_PASSPHRASE_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"raw\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add passphrase here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "showon=\"dkim:1\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Dkim_identity Field. Type: Text. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"dkim_identity\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_DKIM_IDENTITY_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"60\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"150\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_DKIM_IDENTITY_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"raw\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add DKIM Identity here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_DKIM_IDENTITY_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "showon=\"dkim:1\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Dkim_private_key Field. Type: Textarea. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"textarea\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"dkim_private_key\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_DKIM_PRIVATE_KEY_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "rows=\"15\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "cols=\"5\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_DKIM_PRIVATE_KEY_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "class=\"input-xxlarge span12\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "showon=\"dkim:1\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Dkim_public_key Field. Type: Textarea. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"textarea\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"dkim_public_key\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_DKIM_PUBLIC_KEY_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "rows=\"5\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "cols=\"5\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_DKIM_PUBLIC_KEY_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "class=\"input-xxlarge span12\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "showon=\"dkim:1\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "onchange=\"vdm_dkim();\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Note_dkim_use Field. Type: Note. A None Database Field. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. "<field type=\"note\" name=\"note_dkim_use\" label=\""
|
||||
. $lang . "_NOTE_DKIM_USE_LABEL\" description=\"" . $lang
|
||||
. "_NOTE_DKIM_USE_DESCRIPTION\" heading=\"h4\" class=\"note_dkim_use\" showon=\"dkim:1\" />");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Dkim_key Field. Type: Text. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"dkim_key\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_DKIM_KEY_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"40\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"150\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_DKIM_KEY_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"STRING\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add KEY here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_DKIM_KEY_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "showon=\"dkim:1\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--"
|
||||
. Line::_(__Line__, __Class__)
|
||||
. " Dkim_value Field. Type: Text. (joomla) -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"dkim_value\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_DKIM_VALUE_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"80\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"350\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\""
|
||||
. $lang . "_DKIM_VALUE_DESCRIPTION\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"STRING\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add TXT record here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_DKIM_VALUE_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "showon=\"dkim:1\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
}
|
||||
|
||||
// close that fieldset
|
||||
$this->configfieldsets->add('component', Indent::_(1) . "</fieldset>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,414 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Language;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Component;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsets;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsetsCustomfield as Customfield;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
|
||||
|
||||
/**
|
||||
* Config Fieldsets Encryption Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class ConfigFieldsetsEncryption
|
||||
{
|
||||
/**
|
||||
* The Config Class.
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The Language Class.
|
||||
*
|
||||
* @var Language
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Language $language;
|
||||
|
||||
/**
|
||||
* The Component Class.
|
||||
*
|
||||
* @var Component
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Component $component;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsets Class.
|
||||
*
|
||||
* @var ConfigFieldsets
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsets $configfieldsets;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @var Customfield
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Customfield $customfield;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config $config The Config Class.
|
||||
* @param Language $language The Language Class.
|
||||
* @param Component $component The Component Class.
|
||||
* @param ConfigFieldsets $configfieldsets The ConfigFieldsets Class.
|
||||
* @param Customfield $customfield The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Config $config, Language $language, Component $component,
|
||||
ConfigFieldsets $configfieldsets,
|
||||
Customfield $customfield)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->language = $language;
|
||||
$this->component = $component;
|
||||
$this->configfieldsets = $configfieldsets;
|
||||
$this->customfield = $customfield;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Encryption Config Fieldsets
|
||||
*
|
||||
* @param string $lang
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $lang): void
|
||||
{
|
||||
// enable the loading of dynamic field sets
|
||||
$dynamicAddFields = [];
|
||||
|
||||
// Add encryption if needed
|
||||
if ($this->config->basic_encryption
|
||||
|| $this->config->whmcs_encryption
|
||||
|| $this->config->medium_encryption
|
||||
|| $this->component->get('add_license')
|
||||
|| $this->customfield->isArray('Encryption Settings'))
|
||||
{
|
||||
$dynamicAddFields[] = "Encryption Settings";
|
||||
// start building field set for encryption functions
|
||||
$this->configfieldsets->add('component', Indent::_(1) . "<fieldset");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. 'name="encryption_config"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . 'label="' . $lang
|
||||
. '_ENCRYPTION_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . 'description="' . $lang
|
||||
. '_ENCRYPTION_DESC">');
|
||||
|
||||
// set tab lang
|
||||
if (($this->config->basic_encryption
|
||||
|| $this->config->medium_encryption
|
||||
|| $this->config->whmcs_encryption)
|
||||
&& $this->component->get('add_license')
|
||||
&& $this->component->get('license_type', 0) == 3)
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_ENCRYPTION_LABEL',
|
||||
"License & Encryption Settings"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_ENCRYPTION_DESC',
|
||||
"The license & encryption keys are set here."
|
||||
);
|
||||
// add the next dynamic option
|
||||
$dynamicAddFields[] = "License & Encryption Settings";
|
||||
}
|
||||
elseif (($this->config->basic_encryption
|
||||
|| $this->config->medium_encryption
|
||||
|| $this->config->whmcs_encryption)
|
||||
&& $this->component->get('add_license')
|
||||
&& $this->component->get('license_type', 0) == 2)
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_ENCRYPTION_LABEL',
|
||||
"Update & Encryption Settings"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_ENCRYPTION_DESC',
|
||||
"The update & encryption keys are set here."
|
||||
);
|
||||
// add the next dynamic option
|
||||
$dynamicAddFields[] = "Update & Encryption Settings";
|
||||
}
|
||||
elseif ($this->component->get('add_license')
|
||||
&& $this->component->get('license_type', 0) == 3)
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_ENCRYPTION_LABEL', "License Settings"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_ENCRYPTION_DESC',
|
||||
"The license key is set here."
|
||||
);
|
||||
// add the next dynamic option
|
||||
$dynamicAddFields[] = "License Settings";
|
||||
}
|
||||
elseif ($this->component->get('add_license')
|
||||
&& $this->component->get('license_type', 0) == 2)
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_ENCRYPTION_LABEL', "Update Settings"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_ENCRYPTION_DESC',
|
||||
"The update key is set here."
|
||||
);
|
||||
// add the next dynamic option
|
||||
$dynamicAddFields[] = "Update Settings";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_ENCRYPTION_LABEL',
|
||||
"Encryption Settings"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_ENCRYPTION_DESC',
|
||||
"The encryption key for the field encryption is set here."
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->config->basic_encryption)
|
||||
{
|
||||
// set field lang
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_BASIC_KEY_LABEL', "Basic Key"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_BASIC_KEY_DESC',
|
||||
"Set the basic local key here."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_BASIC_KEY_NOTE_LABEL',
|
||||
"Basic Encryption"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_BASIC_KEY_NOTE_DESC',
|
||||
"When using the basic encryption please use set a 32 character passphrase.<br />Never change this passphrase once it is set! <b>DATA WILL GET CORRUPTED IF YOU DO!</b>"
|
||||
);
|
||||
|
||||
// set the field
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field type="note" name="basic_key_note" class="alert alert-info" label="'
|
||||
. $lang . '_BASIC_KEY_NOTE_LABEL" description="' . $lang
|
||||
. '_BASIC_KEY_NOTE_DESC" />');
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="basic_key"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="text"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $lang
|
||||
. '_BASIC_KEY_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $lang . '_BASIC_KEY_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'size="60"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default=""');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
}
|
||||
|
||||
if ($this->config->medium_encryption)
|
||||
{
|
||||
// set field lang
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_MEDIUM_KEY_LABEL',
|
||||
"Medium Key (Path)"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_MEDIUM_KEY_DESC',
|
||||
"Set the full path to where the key file must be stored. Make sure it is behind the root folder of your website, so that it is not public accessible."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_MEDIUM_KEY_NOTE_LABEL',
|
||||
"Medium Encryption"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_MEDIUM_KEY_NOTE_DESC',
|
||||
"When using the medium encryption option, the system generates its own key and stores it in a file at the folder/path you set here.<br />Never change this key once it is set, or remove the key file! <b>DATA WILL GET CORRUPTED IF YOU DO!</b> Also make sure the full path to where the the key file should be stored, is behind the root folder of your website/system, so that it is not public accessible. Making a backup of this key file over a <b>secure connection</b> is recommended!"
|
||||
);
|
||||
|
||||
// set the field
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field type="note" name="medium_key_note" class="alert alert-info" label="'
|
||||
. $lang . '_MEDIUM_KEY_NOTE_LABEL" description="' . $lang
|
||||
. '_MEDIUM_KEY_NOTE_DESC" />');
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="medium_key_path"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="text"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $lang
|
||||
. '_MEDIUM_KEY_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $lang . '_MEDIUM_KEY_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'size="160"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'filter="PATH"');
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. 'hint="/home/user/hiddenfolder123/"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default=""');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
// set some error message if the path does not exist
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_MEDIUM_KEY_PATH_ERROR',
|
||||
"Medium key path (for encryption of various fields) does not exist, or is not writable. Please check the path and update it in the global option of this component."
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->config->whmcs_encryption
|
||||
|| $this->component->get('add_license'))
|
||||
{
|
||||
// set field lang label and description
|
||||
if ($this->component->get('add_license')
|
||||
&& $this->component->get('license_type', 0) == 3)
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_WHMCS_KEY_LABEL',
|
||||
$this->component->get('companyname', '') . " License Key"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_WHMCS_KEY_DESC',
|
||||
"Add the license key you recieved from "
|
||||
. $this->component->get('companyname', '') . " here."
|
||||
);
|
||||
}
|
||||
elseif ($this->component->get('add_license')
|
||||
&& $this->component->get('license_type', 0) == 2)
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_WHMCS_KEY_LABEL',
|
||||
$this->component->get('companyname', '') . " Update Key"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_WHMCS_KEY_DESC',
|
||||
"Add the update key you recieved from "
|
||||
. $this->component->get('companyname', '') . " here."
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_WHMCS_KEY_LABEL',
|
||||
$this->component->get('companyname', '') . " Key"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_WHMCS_KEY_DESC',
|
||||
"Add the key you recieved from "
|
||||
. $this->component->get('companyname', '') . " here."
|
||||
);
|
||||
}
|
||||
|
||||
// adjust the notice based on license
|
||||
if ($this->component->get('license_type',0) == 3)
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_WHMCS_KEY_NOTE_LABEL',
|
||||
"Your " . $this->component->get('companyname','')
|
||||
. " License Key"
|
||||
);
|
||||
}
|
||||
elseif ($this->component->get('license_type',0) == 2)
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_WHMCS_KEY_NOTE_LABEL',
|
||||
"Your " . $this->component->get('companyname','')
|
||||
. " Update Key"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->config->whmcs_encryption)
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_WHMCS_KEY_NOTE_LABEL',
|
||||
"Your " . $this->component->get('companyname','')
|
||||
. " Field Encryption Key"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_WHMCS_KEY_NOTE_LABEL',
|
||||
"Your " . $this->component->get('companyname','') . " Key"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// add the description based on global settings
|
||||
if ($this->config->whmcs_encryption)
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_WHMCS_KEY_NOTE_DESC',
|
||||
"You need to get this key from <a href='"
|
||||
. $this->component->get('whmcs_buy_link','')
|
||||
. "' target='_blank'>"
|
||||
. $this->component->get('companyname','')
|
||||
. "</a>.<br />When using the "
|
||||
. $this->component->get('companyname','')
|
||||
. " field encryption you can never change this key once it is set! <b>DATA WILL GET CORRUPTED IF YOU DO!</b>"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_WHMCS_KEY_NOTE_DESC',
|
||||
"You need to get this key from <a href='"
|
||||
. $this->component->get('whmcs_buy_link','')
|
||||
. "' target='_blank'>"
|
||||
. $this->component->get('companyname','') . "</a>."
|
||||
);
|
||||
}
|
||||
|
||||
// set the fields
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field type="note" name="whmcs_key_note" class="alert alert-info" label="'
|
||||
. $lang . '_WHMCS_KEY_NOTE_LABEL" description="' . $lang
|
||||
. '_WHMCS_KEY_NOTE_DESC" />');
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="whmcs_key"'); // We had to change this from license_key & advanced_key to whmcs_key
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="text"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $lang
|
||||
. '_WHMCS_KEY_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $lang . '_WHMCS_KEY_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'size="60"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default=""');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
}
|
||||
|
||||
// load the dynamic field sets
|
||||
foreach ($dynamicAddFields as $dynamicAddField)
|
||||
{
|
||||
// add custom Encryption Settings fields
|
||||
if ($this->customfield->isArray($dynamicAddField))
|
||||
{
|
||||
$this->configfieldsets->add('component', implode(
|
||||
"", $this->customfield->get($dynamicAddField)
|
||||
));
|
||||
$this->customfield->remove($dynamicAddField);
|
||||
}
|
||||
}
|
||||
|
||||
// close that fieldset
|
||||
$this->configfieldsets->add('component', Indent::_(1) . "</fieldset>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,634 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Language;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Component;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\Contributors;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsets;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ExtensionsParams;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsetsCustomfield as Customfield;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
|
||||
|
||||
/**
|
||||
* Config Fieldsets Global Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class ConfigFieldsetsGlobal
|
||||
{
|
||||
/**
|
||||
* The Config Class.
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The Language Class.
|
||||
*
|
||||
* @var Language
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Language $language;
|
||||
|
||||
/**
|
||||
* The Component Class.
|
||||
*
|
||||
* @var Component
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Component $component;
|
||||
|
||||
/**
|
||||
* The Contributors Class.
|
||||
*
|
||||
* @var Contributors
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Contributors $contributors;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsets Class.
|
||||
*
|
||||
* @var ConfigFieldsets
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsets $configfieldsets;
|
||||
|
||||
/**
|
||||
* The ExtensionsParams Class.
|
||||
*
|
||||
* @var ExtensionsParams
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ExtensionsParams $extensionsparams;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @var Customfield
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Customfield $customfield;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config $config The Config Class.
|
||||
* @param Language $language The Language Class.
|
||||
* @param Component $component The Component Class.
|
||||
* @param Contributors $contributors The Contributors Class.
|
||||
* @param ConfigFieldsets $configfieldsets The ConfigFieldsets Class.
|
||||
* @param ExtensionsParams $extensionsparams The ExtensionsParams Class.
|
||||
* @param Customfield $customfield The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Config $config, Language $language, Component $component,
|
||||
Contributors $contributors,
|
||||
ConfigFieldsets $configfieldsets,
|
||||
ExtensionsParams $extensionsparams,
|
||||
Customfield $customfield)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->language = $language;
|
||||
$this->component = $component;
|
||||
$this->contributors = $contributors;
|
||||
$this->configfieldsets = $configfieldsets;
|
||||
$this->extensionsparams = $extensionsparams;
|
||||
$this->customfield = $customfield;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Global Config Fieldsets
|
||||
*
|
||||
* @param string $lang
|
||||
* @param string $authorName
|
||||
* @param string $authorEmail
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $lang, string $authorName, string $authorEmail): void
|
||||
{
|
||||
// start building field set for config
|
||||
$this->configfieldsets->add('component', '<fieldset');
|
||||
|
||||
if ($this->config->get('joomla_version', 3) == 3)
|
||||
{
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. 'addrulepath="/administrator/components/com_' . $this->config->component_code_name
|
||||
. '/models/rules"');
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. 'addfieldpath="/administrator/components/com_' . $this->config->component_code_name
|
||||
. '/models/fields"');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. 'addruleprefix="' . $this->config->namespace_prefix
|
||||
. '\Component\\' . StringHelper::safe($this->config->component_code_name, 'F')
|
||||
. '\Administrator\Rule"');
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. 'addfieldprefix="' . $this->config->namespace_prefix
|
||||
. '\Component\\' . StringHelper::safe($this->config->component_code_name, 'F')
|
||||
. '\Administrator\Field"');
|
||||
}
|
||||
$this->configfieldsets->add('component', Indent::_(2) . 'name="global_config"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . 'label="' . $lang
|
||||
. '_GLOBAL_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . 'description="' . $lang
|
||||
. '_GLOBAL_DESC">');
|
||||
// setup lang
|
||||
$this->language->set($this->config->lang_target, $lang . '_GLOBAL_LABEL', "Global");
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_GLOBAL_DESC', "The Global Parameters"
|
||||
);
|
||||
|
||||
// add auto checkin if required
|
||||
if ($this->config->get('add_checkin', false))
|
||||
{
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'name="check_in"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="list"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="0"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $lang
|
||||
. '_CHECK_TIMER_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="' . $lang
|
||||
. '_CHECK_TIMER_DESC">');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . 'value="-5 hours">'
|
||||
. $lang . '_CHECK_TIMER_OPTION_ONE</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . 'value="-12 hours">'
|
||||
. $lang . '_CHECK_TIMER_OPTION_TWO</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . 'value="-1 day">' . $lang
|
||||
. '_CHECK_TIMER_OPTION_THREE</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . 'value="-2 day">' . $lang
|
||||
. '_CHECK_TIMER_OPTION_FOUR</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . 'value="-1 week">' . $lang
|
||||
. '_CHECK_TIMER_OPTION_FIVE</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . 'value="0">' . $lang
|
||||
. '_CHECK_TIMER_OPTION_SIX</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field type="spacer" name="spacerAuthor" hr="true" />');
|
||||
// setup lang
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHECK_TIMER_LABEL', "Check in timer"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHECK_TIMER_DESC',
|
||||
"Set the intervals for the auto checkin fuction of tables that checks out the items to an user."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHECK_TIMER_OPTION_ONE',
|
||||
"Every five hours"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHECK_TIMER_OPTION_TWO',
|
||||
"Every twelve hours"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHECK_TIMER_OPTION_THREE', "Once a day"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHECK_TIMER_OPTION_FOUR',
|
||||
"Every second day"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHECK_TIMER_OPTION_FIVE', "Once a week"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHECK_TIMER_OPTION_SIX', "Never"
|
||||
);
|
||||
// load the Global checkin defautls
|
||||
$this->extensionsparams->add('component', '"check_in":"-1 day"');
|
||||
}
|
||||
|
||||
// set history control
|
||||
if ($this->config->get('set_tag_history', false))
|
||||
{
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'name="save_history"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="radio"');
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. 'class="btn-group btn-group-yesno"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="1"');
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. 'label="JGLOBAL_SAVE_HISTORY_OPTIONS_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. 'description="JGLOBAL_SAVE_HISTORY_OPTIONS_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . ">");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. '<option value="1">JYES</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. '<option value="0">JNO</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'name="history_limit"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="text"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'filter="integer"');
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. 'label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. 'description="JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="10"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field type="spacer" name="spacerHistory" hr="true" />');
|
||||
// load the Global checkin defautls
|
||||
$this->extensionsparams->add('component', '"save_history":"1","history_limit":"10"');
|
||||
}
|
||||
// add custom global fields
|
||||
if ($this->customfield->isArray('Global'))
|
||||
{
|
||||
$this->configfieldsets->add('component', implode(
|
||||
"", $this->customfield->get('Global')
|
||||
));
|
||||
$this->customfield->remove('Global');
|
||||
}
|
||||
// set the author details
|
||||
$this->configfieldsets->add('component', Indent::_(2) . '<field name="autorTitle"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="spacer"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $lang
|
||||
. '_AUTHOR"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . '<field name="autorName"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="text"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $lang
|
||||
. '_AUTHOR_NAME_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="' . $lang
|
||||
. '_AUTHOR_NAME_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'size="60"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="' . $authorName . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'readonly="true"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'class="readonly"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . '<field name="autorEmail"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="email"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $lang
|
||||
. '_AUTHOR_EMAIL_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="' . $lang
|
||||
. '_AUTHOR_EMAIL_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'size="60"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="' . $authorEmail . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'readonly="true"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'class="readonly"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
// setup lang
|
||||
$this->language->set($this->config->lang_target, $lang . '_AUTHOR', "Author Info");
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_AUTHOR_NAME_LABEL', "Author Name"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_AUTHOR_NAME_DESC',
|
||||
"The name of the author of this component."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_AUTHOR_EMAIL_LABEL', "Author Email"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_AUTHOR_EMAIL_DESC',
|
||||
"The email address of the author of this component."
|
||||
);
|
||||
|
||||
// set if contributors were added
|
||||
$langCont = $lang . '_CONTRIBUTOR';
|
||||
if ($this->config->get('add_contributors', false)
|
||||
&& $this->component->isArray('contributors'))
|
||||
{
|
||||
foreach (
|
||||
$this->component->get('contributors') as $counter => $contributor
|
||||
)
|
||||
{
|
||||
// make sure we dont use 0
|
||||
$counter++;
|
||||
// get the word for this number
|
||||
$COUNTER = StringHelper::safe($counter, 'U');
|
||||
// set the dynamic values
|
||||
$cbTitle = htmlspecialchars(
|
||||
(string) $contributor['title'], ENT_XML1, 'UTF-8'
|
||||
);
|
||||
$cbName = htmlspecialchars(
|
||||
(string) $contributor['name'], ENT_XML1, 'UTF-8'
|
||||
);
|
||||
$cbEmail = htmlspecialchars(
|
||||
(string) $contributor['email'], ENT_XML1, 'UTF-8'
|
||||
);
|
||||
$cbWebsite = htmlspecialchars(
|
||||
(string) $contributor['website'], ENT_XML1, 'UTF-8'
|
||||
); // StringHelper::html($contributor['website']);
|
||||
// load to the $fieldsets
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field type="spacer" name="spacerContributor' . $counter
|
||||
. '" hr="true" />');
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="contributor' . $counter . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="spacer"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'class="text"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $langCont
|
||||
. '_' . $COUNTER . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="titleContributor' . $counter . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="text"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $langCont
|
||||
. '_TITLE_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $langCont . '_TITLE_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'size="60"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="' . $cbTitle
|
||||
. '"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="nameContributor' . $counter . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="text"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $langCont
|
||||
. '_NAME_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $langCont . '_NAME_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'size="60"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="' . $cbName
|
||||
. '"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="emailContributor' . $counter . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="email"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $langCont
|
||||
. '_EMAIL_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $langCont . '_EMAIL_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'size="60"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="' . $cbEmail
|
||||
. '"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="linkContributor' . $counter . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="url"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $langCont
|
||||
. '_LINK_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $langCont . '_LINK_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'size="60"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="'
|
||||
. $cbWebsite . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="useContributor' . $counter . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="list"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="'
|
||||
. (int) $contributor['use'] . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $langCont
|
||||
. '_USE_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $langCont . '_USE_DESC">');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="0">'
|
||||
. $langCont . '_USE_NONE</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="1">'
|
||||
. $langCont . '_USE_EMAIL</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="2">'
|
||||
. $langCont . '_USE_WWW</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="showContributor' . $counter . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="list"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="'
|
||||
. (int) $contributor['show'] . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $langCont
|
||||
. '_SHOW_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $langCont . '_SHOW_DESC">');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="0">'
|
||||
. $langCont . '_SHOW_NONE</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="1">'
|
||||
. $langCont . '_SHOW_BACK</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="2">'
|
||||
. $langCont . '_SHOW_FRONT</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="3">'
|
||||
. $langCont . '_SHOW_ALL</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
// add the contributor
|
||||
$this->contributors->add('bom', PHP_EOL . Indent::_(1) . "@"
|
||||
. strtolower((string) $contributor['title']) . Indent::_(2)
|
||||
. $contributor['name'] . ' <' . $contributor['website']
|
||||
. '>');
|
||||
// setup lang
|
||||
$Counter = StringHelper::safe($counter, 'Ww');
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_' . $COUNTER,
|
||||
"Contributor " . $Counter
|
||||
);
|
||||
// load the Global checkin defautls
|
||||
$this->extensionsparams->add('component', '"titleContributor' . $counter
|
||||
. '":"' . $cbTitle . '"');
|
||||
$this->extensionsparams->add('component', '"nameContributor' . $counter
|
||||
. '":"' . $cbName . '"');
|
||||
$this->extensionsparams->add('component', '"emailContributor' . $counter
|
||||
. '":"' . $cbEmail . '"');
|
||||
$this->extensionsparams->add('component', '"linkContributor' . $counter
|
||||
. '":"' . $cbWebsite . '"');
|
||||
$this->extensionsparams->add('component', '"useContributor' . $counter . '":"'
|
||||
. (int) $contributor['use'] . '"');
|
||||
$this->extensionsparams->add('component', '"showContributor' . $counter
|
||||
. '":"' . (int) $contributor['show'] . '"');
|
||||
}
|
||||
}
|
||||
|
||||
// add more contributors if required
|
||||
if (1 == $this->component->get('emptycontributors', 0))
|
||||
{
|
||||
if (isset($counter))
|
||||
{
|
||||
$min = $counter + 1;
|
||||
unset($counter);
|
||||
}
|
||||
else
|
||||
{
|
||||
$min = 1;
|
||||
}
|
||||
$max = $min + $this->component->get('number') - 1;
|
||||
$moreContributerFields = range($min, $max, 1);
|
||||
foreach ($moreContributerFields as $counter)
|
||||
{
|
||||
$COUNTER = StringHelper::safe($counter, 'U');
|
||||
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field type="spacer" name="spacerContributor' . $counter
|
||||
. '" hr="true" />');
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="contributor' . $counter . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="spacer"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'class="text"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $langCont
|
||||
. '_' . $COUNTER . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="titleContributor' . $counter . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="text"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $langCont
|
||||
. '_TITLE_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $langCont . '_TITLE_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'size="60"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default=""');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="nameContributor' . $counter . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="text"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $langCont
|
||||
. '_NAME_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $langCont . '_NAME_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'size="60"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default=""');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="emailContributor' . $counter . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="email"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $langCont
|
||||
. '_EMAIL_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $langCont . '_EMAIL_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'size="60"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default=""');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="linkContributor' . $counter . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="url"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $langCont
|
||||
. '_LINK_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $langCont . '_LINK_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'size="60"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default=""');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="useContributor' . $counter . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="list"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="0"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $langCont
|
||||
. '_USE_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $langCont . '_USE_DESC">');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="0">'
|
||||
. $langCont . '_USE_NONE</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="1">'
|
||||
. $langCont . '_USE_EMAIL</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="2">'
|
||||
. $langCont . '_USE_WWW</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="showContributor' . $counter . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="list"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="0"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $langCont
|
||||
. '_SHOW_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $langCont . '_SHOW_DESC">');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="0">'
|
||||
. $langCont . '_SHOW_NONE</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="1">'
|
||||
. $langCont . '_SHOW_BACK</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="2">'
|
||||
. $langCont . '_SHOW_FRONT</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="3">'
|
||||
. $langCont . '_SHOW_ALL</option>');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
// setup lang
|
||||
$Counter = StringHelper::safe($counter, 'Ww');
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_' . $COUNTER,
|
||||
"Contributor " . $Counter
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->config->get('add_contributors', false)
|
||||
|| $this->component->get('emptycontributors', 0) == 1)
|
||||
{
|
||||
// setup lang
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_TITLE_LABEL', "Contributor Job Title"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_TITLE_DESC',
|
||||
"The job title that best describes the contributor's relationship to this component."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_NAME_LABEL', "Contributor Name"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_NAME_DESC',
|
||||
"The name of this contributor."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_EMAIL_LABEL', "Contributor Email"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_EMAIL_DESC',
|
||||
"The email of this contributor."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_LINK_LABEL', "Contributor Website"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_LINK_DESC',
|
||||
"The link to this contributor's website."
|
||||
);
|
||||
$this->language->set($this->config->lang_target, $langCont . '_USE_LABEL', "Use");
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_USE_DESC',
|
||||
"How should we link to this contributor."
|
||||
);
|
||||
$this->language->set($this->config->lang_target, $langCont . '_USE_NONE', "None");
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_USE_EMAIL', "Email"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_USE_WWW', "Website"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_SHOW_LABEL', "Show"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_SHOW_DESC',
|
||||
"Select where you want this contributor's details to show in the component."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_SHOW_NONE', "Hide"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_SHOW_BACK', "Back-end"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_SHOW_FRONT', "Front-end"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $langCont . '_SHOW_ALL', "Both Front & Back-end"
|
||||
);
|
||||
}
|
||||
|
||||
// close that fieldset
|
||||
$this->configfieldsets->add('component', Indent::_(1) . "</fieldset>");
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,633 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Language;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsets;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsetsCustomfield as Customfield;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ExtensionsParams;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
|
||||
|
||||
/**
|
||||
* Config Fieldsets Googlechart Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class ConfigFieldsetsGooglechart
|
||||
{
|
||||
/**
|
||||
* The Config Class.
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The Language Class.
|
||||
*
|
||||
* @var Language
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Language $language;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsets Class.
|
||||
*
|
||||
* @var ConfigFieldsets
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsets $configfieldsets;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @var Customfield
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Customfield $customfield;
|
||||
|
||||
/**
|
||||
* The ExtensionsParams Class.
|
||||
*
|
||||
* @var ExtensionsParams
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ExtensionsParams $extensionsparams;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config $config The Config Class.
|
||||
* @param Language $language The Language Class.
|
||||
* @param ConfigFieldsets $configfieldsets The ConfigFieldsets Class.
|
||||
* @param Customfield $customfield The ConfigFieldsetsCustomfield Class.
|
||||
* @param ExtensionsParams $extensionsparams The ExtensionsParams Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Config $config, Language $language,
|
||||
ConfigFieldsets $configfieldsets,
|
||||
Customfield $customfield,
|
||||
ExtensionsParams $extensionsparams)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->language = $language;
|
||||
$this->configfieldsets = $configfieldsets;
|
||||
$this->customfield = $customfield;
|
||||
$this->extensionsparams = $extensionsparams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Email Helper Config Fieldsets
|
||||
*
|
||||
* @param string $lang
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $lang): void
|
||||
{
|
||||
if ($this->config->get('google_chart', false))
|
||||
{
|
||||
$this->configfieldsets->add('component', PHP_EOL . Indent::_(1) . "<fieldset");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. "name=\"googlechart_config\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "label=\"" . $lang
|
||||
. "_CHART_SETTINGS_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "description=\"" . $lang
|
||||
. "_CHART_SETTINGS_DESC\">");
|
||||
$this->configfieldsets->add('component', Indent::_(2));
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. "<field type=\"note\" name=\"chart_admin_naote\" class=\"alert alert-info\" label=\""
|
||||
. $lang . "_ADMIN_CHART_NOTE_LABEL\" description=\"" . $lang
|
||||
. "_ADMIN_CHART_NOTE_DESC\" />");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Admin_chartbackground Field. Type: Color. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"color\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"admin_chartbackground\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"#F7F7FA\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_CHARTBACKGROUND_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_CHARTBACKGROUND_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Admin_mainwidth Field. Type: Text. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"admin_mainwidth\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_MAINWIDTH_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"20\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"50\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_MAINWIDTH_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"INT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add area width here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_MAINWIDTH_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(__LINE__,__CLASS__)
|
||||
. " Spacer_chartadmin_hr_a Field. Type: Spacer. A None Database Field. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. "<field type=\"spacer\" name=\"spacer_chartadmin_hr_a\" hr=\"true\" class=\"spacer_chartadmin_hr_a\" />");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(__LINE__,__CLASS__)
|
||||
. " Admin_chartareatop Field. Type: Text. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"admin_chartareatop\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_CHARTAREATOP_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"20\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"50\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_CHARTAREATOP_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"INT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add top spacing here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_CHARTAREATOP_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Admin_chartarealeft Field. Type: Text. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"admin_chartarealeft\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_CHARTAREALEFT_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"20\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"50\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_CHARTAREALEFT_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"INT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add left spacing here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_CHARTAREALEFT_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Admin_chartareawidth Field. Type: Text. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"admin_chartareawidth\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_CHARTAREAWIDTH_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"20\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"50\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_CHARTAREAWIDTH_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"INT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add chart width here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_CHARTAREAWIDTH_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " Spacer_chartadmin_hr_b Field. Type: Spacer. A None Database Field. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. "<field type=\"spacer\" name=\"spacer_chartadmin_hr_b\" hr=\"true\" class=\"spacer_chartadmin_hr_b\" />");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Admin_legendtextstylefontcolor Field. Type: Color. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"color\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"admin_legendtextstylefontcolor\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"#63B1F2\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_LEGENDTEXTSTYLEFONTCOLOR_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_LEGENDTEXTSTYLEFONTCOLOR_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Admin_legendtextstylefontsize Field. Type: Text. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"admin_legendtextstylefontsize\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_LEGENDTEXTSTYLEFONTSIZE_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"20\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"50\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_LEGENDTEXTSTYLEFONTSIZE_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"INT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add size of the legend here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_LEGENDTEXTSTYLEFONTSIZE_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " Spacer_chartadmin_hr_c Field. Type: Spacer. A None Database Field. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. "<field type=\"spacer\" name=\"spacer_chartadmin_hr_c\" hr=\"true\" class=\"spacer_chartadmin_hr_c\" />");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Admin_vaxistextstylefontcolor Field. Type: Color. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"color\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"admin_vaxistextstylefontcolor\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"#63B1F2\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_VAXISTEXTSTYLEFONTCOLOR_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_VAXISTEXTSTYLEFONTCOLOR_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " Spacer_chartadmin_hr_d Field. Type: Spacer. A None Database Field. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. "<field type=\"spacer\" name=\"spacer_chartadmin_hr_d\" hr=\"true\" class=\"spacer_chartadmin_hr_d\" />");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Admin_haxistextstylefontcolor Field. Type: Color. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"color\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"admin_haxistextstylefontcolor\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"#63B1F2\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_HAXISTEXTSTYLEFONTCOLOR_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_HAXISTEXTSTYLEFONTCOLOR_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " Admin_haxistitletextstylefontcolor Field. Type: Color. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"color\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"admin_haxistitletextstylefontcolor\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"#63B1F2\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_HAXISTITLETEXTSTYLEFONTCOLOR_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_HAXISTITLETEXTSTYLEFONTCOLOR_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2));
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. "<field type=\"note\" name=\"chart_site_note\" class=\"alert alert-info\" label=\""
|
||||
. $lang . "_SITE_CHART_NOTE_LABEL\" description=\"" . $lang
|
||||
. "_SITE_CHART_NOTE_DESC\" />");
|
||||
$this->configfieldsets->add('component', Indent::_(2));
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Site_chartbackground Field. Type: Color. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"color\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"site_chartbackground\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"#F7F7FA\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_CHARTBACKGROUND_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_CHARTBACKGROUND_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Site_mainwidth Field. Type: Text. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "name=\"site_mainwidth\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_MAINWIDTH_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"20\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"50\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_MAINWIDTH_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"INT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add area width here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_MAINWIDTH_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " Spacer_chartsite_hr_a Field. Type: Spacer. A None Database Field. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. "<field type=\"spacer\" name=\"spacer_chartsite_hr_a\" hr=\"true\" class=\"spacer_chartsite_hr_a\" />");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Site_chartareatop Field. Type: Text. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"site_chartareatop\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_CHARTAREATOP_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"20\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"50\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_CHARTAREATOP_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"INT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add top spacing here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_CHARTAREATOP_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Site_chartarealeft Field. Type: Text. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"site_chartarealeft\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_CHARTAREALEFT_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"20\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"50\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_CHARTAREALEFT_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"INT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add left spacing here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_CHARTAREALEFT_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Site_chartareawidth Field. Type: Text. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"site_chartareawidth\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_CHARTAREAWIDTH_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"20\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"50\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_CHARTAREAWIDTH_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"INT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add chart width here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_CHARTAREAWIDTH_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " Spacer_chartsite_hr_b Field. Type: Spacer. A None Database Field. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. "<field type=\"spacer\" name=\"spacer_chartsite_hr_b\" hr=\"true\" class=\"spacer_chartsite_hr_b\" />");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Site_legendtextstylefontcolor Field. Type: Color. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"color\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"site_legendtextstylefontcolor\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"#63B1F2\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_LEGENDTEXTSTYLEFONTCOLOR_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_LEGENDTEXTSTYLEFONTCOLOR_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Site_legendtextstylefontsize Field. Type: Text. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"text\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"site_legendtextstylefontsize\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_LEGENDTEXTSTYLEFONTSIZE_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "size=\"20\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "maxlength=\"50\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_LEGENDTEXTSTYLEFONTSIZE_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "class=\"text_area\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "filter=\"INT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "message=\"Error! Please add size of the legend here.\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "hint=\"" . $lang
|
||||
. "_LEGENDTEXTSTYLEFONTSIZE_HINT\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " Spacer_chartsite_hr_c Field. Type: Spacer. A None Database Field. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. "<field type=\"spacer\" name=\"spacer_chartsite_hr_c\" hr=\"true\" class=\"spacer_chartsite_hr_c\" />");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Site_vaxistextstylefontcolor Field. Type: Color. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"color\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"site_vaxistextstylefontcolor\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"#63B1F2\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_VAXISTEXTSTYLEFONTCOLOR_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_VAXISTEXTSTYLEFONTCOLOR_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " Spacer_chartsite_hr_d Field. Type: Spacer. A None Database Field. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. "<field type=\"spacer\" name=\"spacer_chartsite_hr_d\" hr=\"true\" class=\"spacer_chartsite_hr_d\" />");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . " Site_haxistextstylefontcolor Field. Type: Color. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"color\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"site_haxistextstylefontcolor\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"#63B1F2\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_HAXISTEXTSTYLEFONTCOLOR_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_HAXISTEXTSTYLEFONTCOLOR_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " Site_haxistitletextstylefontcolor Field. Type: Color. -->");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "<field");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "type=\"color\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. "name=\"site_haxistitletextstylefontcolor\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "default=\"#63B1F2\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "label=\"" . $lang
|
||||
. "_HAXISTITLETEXTSTYLEFONTCOLOR_LABEL\"");
|
||||
$this->configfieldsets->add('component', Indent::_(3) . "description=\"" . $lang
|
||||
. "_HAXISTITLETEXTSTYLEFONTCOLOR_DESC\"");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
|
||||
// add custom Encryption Settings fields
|
||||
if ($this->customfield->isArray('Chart Settings'))
|
||||
{
|
||||
$this->configfieldsets->add('component', implode(
|
||||
"", $this->customfield->get('Chart Settings')
|
||||
));
|
||||
$this->customfield->remove('Chart Settings');
|
||||
}
|
||||
|
||||
$this->configfieldsets->add('component', Indent::_(1) . "</fieldset>");
|
||||
|
||||
// set params defaults
|
||||
$this->extensionsparams->add('component',
|
||||
'"admin_chartbackground":"#F7F7FA","admin_mainwidth":"1000","admin_chartareatop":"20","admin_chartarealeft":"20","admin_chartareawidth":"170","admin_legendtextstylefontcolor":"10","admin_legendtextstylefontsize":"20","admin_vaxistextstylefontcolor":"#63B1F2","admin_haxistextstylefontcolor":"#63B1F2","admin_haxistitletextstylefontcolor":"#63B1F2","site_chartbackground":"#F7F7FA","site_mainwidth":"1000","site_chartareatop":"20","site_chartarealeft":"20","site_chartareawidth":"170","site_legendtextstylefontcolor":"10","site_legendtextstylefontsize":"20","site_vaxistextstylefontcolor":"#63B1F2","site_haxistextstylefontcolor":"#63B1F2","site_haxistitletextstylefontcolor":"#63B1F2"'
|
||||
);
|
||||
|
||||
// set field lang
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHART_SETTINGS_LABEL', "Chart Settings"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHART_SETTINGS_DESC',
|
||||
"The Google Chart Display Settings Are Made Here."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_ADMIN_CHART_NOTE_LABEL', "Admin Settings"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_ADMIN_CHART_NOTE_DESC',
|
||||
"The following settings are used on the back-end of the site called (admin)."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SITE_CHART_NOTE_LABEL', "Site Settings"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_SITE_CHART_NOTE_DESC',
|
||||
"The following settings are used on the front-end of the site called (site)."
|
||||
);
|
||||
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHARTAREALEFT_DESC',
|
||||
"Set in pixels the spacing from the left of the chart area to the beginning of the chart it self. Please don't add the px sign"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHARTAREALEFT_HINT', "170"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHARTAREALEFT_LABEL', "Left Spacing"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHARTAREATOP_DESC',
|
||||
"Set in pixels the spacing from the top of the chart area to the beginning of the chart it self. Please don't add the px sign"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHARTAREATOP_HINT', "20"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHARTAREATOP_LABEL', "Top Spacing"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHARTAREAWIDTH_DESC',
|
||||
"Set in % the width of the chart it self inside the chart area. Please don't add the % sign"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHARTAREAWIDTH_HINT', "60"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHARTAREAWIDTH_LABEL', "Chart Width"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHARTBACKGROUND_DESC',
|
||||
"Select the chart background color here."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_CHARTBACKGROUND_LABEL',
|
||||
"Chart Background"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_HAXISTEXTSTYLEFONTCOLOR_DESC',
|
||||
"Select the horizontal axis font color."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_HAXISTEXTSTYLEFONTCOLOR_LABEL',
|
||||
"hAxis Font Color"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_HAXISTITLETEXTSTYLEFONTCOLOR_DESC',
|
||||
"Select the horizontal axis title's font color."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_HAXISTITLETEXTSTYLEFONTCOLOR_LABEL',
|
||||
"hAxis Title Font Color"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_LEGENDTEXTSTYLEFONTCOLOR_DESC',
|
||||
"Select the legend font color."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_LEGENDTEXTSTYLEFONTCOLOR_LABEL',
|
||||
"Legend Font Color"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_LEGENDTEXTSTYLEFONTSIZE_DESC',
|
||||
"Set in pixels the font size of the legend"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_LEGENDTEXTSTYLEFONTSIZE_HINT', "10"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_LEGENDTEXTSTYLEFONTSIZE_LABEL',
|
||||
"Legend Font Size"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_MAINWIDTH_DESC',
|
||||
"Set the width of the entire chart area"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_MAINWIDTH_HINT', "1000"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_MAINWIDTH_LABEL', "Chart Area Width"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_VAXISTEXTSTYLEFONTCOLOR_DESC',
|
||||
"Select the vertical axis font color."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_VAXISTEXTSTYLEFONTCOLOR_LABEL',
|
||||
"vAxis Font Color"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,163 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Language;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\FieldGroupControl;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsets;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ExtensionsParams;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsetsCustomfield as Customfield;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
|
||||
|
||||
/**
|
||||
* Config Fieldsets Group Control Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class ConfigFieldsetsGroupControl
|
||||
{
|
||||
/**
|
||||
* The Config Class.
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The Language Class.
|
||||
*
|
||||
* @var Language
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Language $language;
|
||||
|
||||
/**
|
||||
* The FieldGroupControl Class.
|
||||
*
|
||||
* @var FieldGroupControl
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected FieldGroupControl $fieldgroupcontrol;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsets Class.
|
||||
*
|
||||
* @var ConfigFieldsets
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsets $configfieldsets;
|
||||
|
||||
/**
|
||||
* The ExtensionsParams Class.
|
||||
*
|
||||
* @var ExtensionsParams
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ExtensionsParams $extensionsparams;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @var Customfield
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Customfield $customfield;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config $config The Config Class.
|
||||
* @param Language $language The Language Class.
|
||||
* @param FieldGroupControl $fieldgroupcontrol The FieldGroupControl Class.
|
||||
* @param ConfigFieldsets $configfieldsets The ConfigFieldsets Class.
|
||||
* @param ExtensionsParams $extensionsparams The ExtensionsParams Class.
|
||||
* @param Customfield $customfield The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Config $config, Language $language,
|
||||
FieldGroupControl $fieldgroupcontrol,
|
||||
ConfigFieldsets $configfieldsets,
|
||||
ExtensionsParams $extensionsparams,
|
||||
Customfield $customfield)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->language = $language;
|
||||
$this->fieldgroupcontrol = $fieldgroupcontrol;
|
||||
$this->configfieldsets = $configfieldsets;
|
||||
$this->extensionsparams = $extensionsparams;
|
||||
$this->customfield = $customfield;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Group Control Config Fieldsets
|
||||
*
|
||||
* @param string $lang
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function set(string $lang): void
|
||||
{
|
||||
// start loading Group control params if needed
|
||||
if ($this->fieldgroupcontrol->isActive())
|
||||
{
|
||||
// start building field set for config
|
||||
$this->configfieldsets->add('component', Indent::_(1) . "<fieldset");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . 'name="group_config"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . 'label="' . $lang
|
||||
. '_GROUPS_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . 'description="' . $lang
|
||||
. '_GROUPS_DESC">');
|
||||
// setup lang
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_GROUPS_LABEL', "Target Groups"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_GROUPS_DESC',
|
||||
"The Parameters for the targeted groups are set here."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_TARGET_GROUP_DESC',
|
||||
"Set the group/s being targeted by this user type."
|
||||
);
|
||||
|
||||
foreach ($this->fieldgroupcontrol->allActive() as $selector => $label)
|
||||
{
|
||||
$this->configfieldsets->add('component', Indent::_(2) . '<field name="'
|
||||
. $selector . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="usergroup"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $label . '"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $lang . '_TARGET_GROUP_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'multiple="true"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "/>");
|
||||
// set params defaults
|
||||
$this->extensionsparams->add('component', '"' . $selector . '":["2"]');
|
||||
}
|
||||
// add custom Target Groups fields
|
||||
if ($this->customfield->isArray('Target Groups'))
|
||||
{
|
||||
$this->configfieldsets->add('component', implode(
|
||||
"", $this->customfield->get('Target Groups')
|
||||
));
|
||||
$this->customfield->remove('Target Groups');
|
||||
}
|
||||
// close that fieldse
|
||||
$this->configfieldsets->add('component', Indent::_(1) . "</fieldset>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,225 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Component;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsets;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsetsCustomfield as Customfield;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\HasMenuGlobal;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\FrontendParams;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\Request;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Config Fieldsets Site Control Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class ConfigFieldsetsSiteControl
|
||||
{
|
||||
/**
|
||||
* The Component Class.
|
||||
*
|
||||
* @var Component
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Component $component;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsets Class.
|
||||
*
|
||||
* @var ConfigFieldsets
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsets $configfieldsets;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @var Customfield
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Customfield $customfield;
|
||||
|
||||
/**
|
||||
* The HasMenuGlobal Class.
|
||||
*
|
||||
* @var HasMenuGlobal
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected HasMenuGlobal $hasmenuglobal;
|
||||
|
||||
/**
|
||||
* The FrontendParams Class.
|
||||
*
|
||||
* @var FrontendParams
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected FrontendParams $frontendparams;
|
||||
|
||||
/**
|
||||
* The Request Class.
|
||||
*
|
||||
* @var Request
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Request $request;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Component $component The Component Class.
|
||||
* @param ConfigFieldsets $configfieldsets The ConfigFieldsets Class.
|
||||
* @param Customfield $customfield The ConfigFieldsetsCustomfield Class.
|
||||
* @param HasMenuGlobal $hasmenuglobal The HasMenuGlobal Class.
|
||||
* @param FrontendParams $frontendparams The FrontendParams Class.
|
||||
* @param Request $request The Request Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Component $component, ConfigFieldsets $configfieldsets,
|
||||
Customfield $customfield, HasMenuGlobal $hasmenuglobal,
|
||||
FrontendParams $frontendparams, Request $request)
|
||||
{
|
||||
$this->component = $component;
|
||||
$this->configfieldsets = $configfieldsets;
|
||||
$this->customfield = $customfield;
|
||||
$this->hasmenuglobal = $hasmenuglobal;
|
||||
$this->frontendparams = $frontendparams;
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Site Control Config Fieldsets
|
||||
*
|
||||
* @param string $lang
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $lang): void
|
||||
{
|
||||
$front_end = [];
|
||||
// do quick build of front-end views
|
||||
if ($this->component->isArray('site_views'))
|
||||
{
|
||||
// load the names only to link the page params
|
||||
foreach ($this->component->get('site_views') as $siteView)
|
||||
{
|
||||
// now load the view name to the front-end array
|
||||
$front_end[] = $siteView['settings']->name;
|
||||
}
|
||||
}
|
||||
|
||||
// add frontend view stuff including menus
|
||||
if ($this->customfield->isActive())
|
||||
{
|
||||
foreach ($this->customfield->allActive() as $tab => $tabFields)
|
||||
{
|
||||
$tabCode = StringHelper::safe($tab) . '_custom_config';
|
||||
$tabUpper = StringHelper::safe($tab, 'U');
|
||||
$tabLower = StringHelper::safe($tab);
|
||||
|
||||
// load the request id setters for menu views
|
||||
$viewRequest = 'name="' . $tabLower . '_request_id';
|
||||
foreach ($tabFields as $et => $id_field)
|
||||
{
|
||||
if (strpos((string) $id_field, $viewRequest) !== false)
|
||||
{
|
||||
$this->request->set(
|
||||
$tabLower, $id_field, $viewRequest, 'id'
|
||||
);
|
||||
$this->customfield->remove("$tab.$et");
|
||||
unset($tabFields[$et]);
|
||||
}
|
||||
elseif (strpos((string) $id_field, '_request_id') !== false)
|
||||
{
|
||||
// not loaded to a tab "view" name
|
||||
$_viewRequest = GetHelper::between(
|
||||
$id_field, 'name="', '_request_id'
|
||||
);
|
||||
$searchIdKe = 'name="' . $_viewRequest
|
||||
. '_request_id';
|
||||
$this->request->set(
|
||||
$_viewRequest, $id_field, $searchIdKe, 'id'
|
||||
);
|
||||
$this->customfield->remove("$tab.$et");
|
||||
unset($tabFields[$et]);
|
||||
}
|
||||
}
|
||||
|
||||
// load the request catid setters for menu views
|
||||
$viewRequestC = 'name="' . $tabLower . '_request_catid';
|
||||
foreach ($tabFields as $ci => $catid_field)
|
||||
{
|
||||
if (strpos((string) $catid_field, $viewRequestC) !== false)
|
||||
{
|
||||
|
||||
$this->request->set(
|
||||
$tabLower, $catid_field, $viewRequestC, 'catid'
|
||||
);
|
||||
$this->customfield->remove("$tab.$ci");
|
||||
unset($tabFields[$ci]);
|
||||
}
|
||||
elseif (strpos((string) $catid_field, '_request_catid') !== false)
|
||||
{
|
||||
// not loaded to a tab "view" name
|
||||
$_viewRequestC = GetHelper::between(
|
||||
$catid_field, 'name="', '_request_catid'
|
||||
);
|
||||
$searchCatidKe = 'name="' . $_viewRequestC
|
||||
. '_request_catid';
|
||||
$this->request->set(
|
||||
$_viewRequestC, $catid_field, $searchCatidKe, 'catid'
|
||||
);
|
||||
$this->customfield->remove("$tab.$ci");
|
||||
unset($tabFields[$ci]);
|
||||
}
|
||||
}
|
||||
|
||||
// load the global menu setters for single fields
|
||||
$menuSetter = $tabLower . '_menu';
|
||||
$pageSettings = [];
|
||||
foreach ($tabFields as $ct => $field)
|
||||
{
|
||||
if (strpos((string) $field, $menuSetter) !== false)
|
||||
{
|
||||
// set the values needed to insure route is done correclty
|
||||
$this->hasmenuglobal->set($tabLower, $menuSetter);
|
||||
}
|
||||
elseif (strpos((string) $field, '_menu"') !== false)
|
||||
{
|
||||
// not loaded to a tab "view" name
|
||||
$_tabLower = GetHelper::between(
|
||||
$field, 'name="', '_menu"'
|
||||
);
|
||||
// set the values needed to insure route is done correclty
|
||||
$this->hasmenuglobal->set($_tabLower, $_tabLower . '_menu');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pageSettings[$ct] = $field;
|
||||
}
|
||||
}
|
||||
|
||||
// insure we load the needed params
|
||||
if (in_array($tab, $front_end))
|
||||
{
|
||||
$this->frontendparams->set($tab, $pageSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,367 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Language;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsets;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ExtensionsParams;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\ConfigFieldsetsCustomfield as Customfield;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
|
||||
|
||||
/**
|
||||
* Config Fieldsets Uikit Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class ConfigFieldsetsUikit
|
||||
{
|
||||
/**
|
||||
* The Config Class.
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The Language Class.
|
||||
*
|
||||
* @var Language
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Language $language;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsets Class.
|
||||
*
|
||||
* @var ConfigFieldsets
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ConfigFieldsets $configfieldsets;
|
||||
|
||||
/**
|
||||
* The ExtensionsParams Class.
|
||||
*
|
||||
* @var ExtensionsParams
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ExtensionsParams $extensionsparams;
|
||||
|
||||
/**
|
||||
* The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @var Customfield
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Customfield $customfield;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config $config The Config Class.
|
||||
* @param Language $language The Language Class.
|
||||
* @param ConfigFieldsets $configfieldsets The ConfigFieldsets Class.
|
||||
* @param ExtensionsParams $extensionsparams The ExtensionsParams Class.
|
||||
* @param Customfield $customfield The ConfigFieldsetsCustomfield Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Config $config, Language $language,
|
||||
ConfigFieldsets $configfieldsets,
|
||||
ExtensionsParams $extensionsparams,
|
||||
Customfield $customfield)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->language = $language;
|
||||
$this->configfieldsets = $configfieldsets;
|
||||
$this->extensionsparams = $extensionsparams;
|
||||
$this->customfield = $customfield;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Uikit Config Fieldsets
|
||||
*
|
||||
* @param string $lang
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $lang): void
|
||||
{
|
||||
if ($this->config->uikit > 0)
|
||||
{
|
||||
// main lang prefix
|
||||
$lang = $lang . '';
|
||||
// start building field set for uikit functions
|
||||
$this->configfieldsets->add('component', Indent::_(1) . "<fieldset");
|
||||
$this->configfieldsets->add('component', Indent::_(2) . 'name="uikit_config"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . 'label="' . $lang
|
||||
. '_UIKIT_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . 'description="' . $lang
|
||||
. '_UIKIT_DESC">');
|
||||
// set tab lang
|
||||
if (1 == $this->config->uikit)
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_LABEL', "Uikit2 Settings"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_DESC', "<b>The Parameters for the uikit are set here.</b><br />Uikit is a lightweight and modular front-end framework
|
||||
for developing fast and powerful web interfaces. For more info visit <a href='https://getuikit.com/v2/' target='_blank'>https://getuikit.com/v2/</a>"
|
||||
);
|
||||
}
|
||||
elseif (2 == $this->config->uikit)
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_LABEL',
|
||||
"Uikit2 and Uikit3 Settings"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_DESC', "<b>The Parameters for the uikit are set here.</b><br />Uikit is a lightweight and modular front-end framework
|
||||
for developing fast and powerful web interfaces. For more info visit <a href='https://getuikit.com/v2/' target='_blank'>version 2</a> or <a href='https://getuikit.com/' target='_blank'>version 3</a>"
|
||||
);
|
||||
}
|
||||
elseif (3 == $this->config->uikit)
|
||||
{
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_LABEL', "Uikit3 Settings"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_DESC', "<b>The Parameters for the uikit are set here.</b><br />Uikit is a lightweight and modular front-end framework
|
||||
for developing fast and powerful web interfaces. For more info visit <a href='https://getuikit.com/' target='_blank'>https://getuikit.com/</a>"
|
||||
);
|
||||
}
|
||||
|
||||
// set field lang
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_JQUERY_LOAD_LABEL', "Load Joomla jQuery"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_JQUERY_LOAD_DESC',
|
||||
"Would you like to load the Joomla jQuery Framework?"
|
||||
);
|
||||
$this->language->set($this->config->lang_target, $lang . '_JQUERY_LOAD', "Load jQuery");
|
||||
$this->language->set($this->config->lang_target, $lang . '_JQUERY_REMOVE', "Remove jQuery");
|
||||
|
||||
// set the field
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="add_jquery_framework"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="radio"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $lang
|
||||
. '_JQUERY_LOAD_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="' . $lang
|
||||
. '_JQUERY_LOAD_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. 'class="btn-group btn-group-yesno"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="">');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<!--' . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . ' Option Set. -->');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="0">');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. '_JQUERY_REMOVE</option>"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="1">');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. '_JQUERY_LOAD</option>"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
// set params defaults
|
||||
$this->extensionsparams->add('component', '"add_jquery_framework":"1"');
|
||||
|
||||
// add version selection
|
||||
if (2 == $this->config->uikit)
|
||||
{
|
||||
// set field lang
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_VERSION_LABEL',
|
||||
"Uikit Versions"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_VERSION_DESC',
|
||||
"Select what version you would like to use"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_V2', "Version 2"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_V3', "Version 3"
|
||||
);
|
||||
// set the field
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="uikit_version"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="radio"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $lang
|
||||
. '_UIKIT_VERSION_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $lang . '_UIKIT_VERSION_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. 'class="btn-group btn-group-yesno"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="2">');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<!--'
|
||||
. Line::_(__Line__, __Class__) . ' Option Set. -->');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="2">');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. '_UIKIT_V2</option>"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="3">');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. '_UIKIT_V3</option>"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
// set params defaults
|
||||
$this->extensionsparams->add('component', '"uikit_version":"2"');
|
||||
}
|
||||
|
||||
// set field lang
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_LOAD_LABEL', "Loading Options"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_LOAD_DESC',
|
||||
"Set the uikit loading option."
|
||||
);
|
||||
$this->language->set($this->config->lang_target, $lang . '_AUTO_LOAD', "Auto");
|
||||
$this->language->set($this->config->lang_target, $lang . '_FORCE_LOAD', "Force");
|
||||
$this->language->set($this->config->lang_target, $lang . '_DONT_LOAD', "Not");
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_ONLY_EXTRA', "Only Extra"
|
||||
);
|
||||
// set the field
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="uikit_load"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="radio"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $lang
|
||||
. '_UIKIT_LOAD_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="' . $lang
|
||||
. '_UIKIT_LOAD_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. 'class="btn-group btn-group-yesno"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="">');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<!--' . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . ' Option Set. -->');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="">');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. '_AUTO_LOAD</option>"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="1">');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. '_FORCE_LOAD</option>"');
|
||||
if (2 == $this->config->uikit || 1 == $this->config->uikit)
|
||||
{
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="3">');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. '_ONLY_EXTRA</option>"');
|
||||
}
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="2">');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. '_DONT_LOAD</option>"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
// set params defaults
|
||||
$this->extensionsparams->add('component', '"uikit_load":"1"');
|
||||
|
||||
// set field lang
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_MIN_LABEL', "Load Minified"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_MIN_DESC',
|
||||
"Should the minified version of uikit files be loaded?"
|
||||
);
|
||||
$this->language->set($this->config->lang_target, $lang . '_YES', "Yes");
|
||||
$this->language->set($this->config->lang_target, $lang . '_NO', "No");
|
||||
// set the field
|
||||
$this->configfieldsets->add('component', Indent::_(2) . '<field name="uikit_min"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="radio"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $lang
|
||||
. '_UIKIT_MIN_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="' . $lang
|
||||
. '_UIKIT_MIN_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. 'class="btn-group btn-group-yesno"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="">');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<!--' . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
) . ' Option Set. -->');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="">');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang . '_NO</option>"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value=".min">');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang . '_YES</option>"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
// set params defaults
|
||||
$this->extensionsparams->add('component', '"uikit_min":""');
|
||||
|
||||
if (2 == $this->config->uikit || 1 == $this->config->uikit)
|
||||
{
|
||||
// set field lang
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_STYLE_LABEL', "css Style"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_UIKIT_STYLE_DESC',
|
||||
"Set the css style that should be used."
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_FLAT_LOAD', "Flat"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_ALMOST_FLAT_LOAD', "Almost Flat"
|
||||
);
|
||||
$this->language->set(
|
||||
$this->config->lang_target, $lang . '_GRADIANT_LOAD', "Gradient"
|
||||
);
|
||||
// set the field
|
||||
$this->configfieldsets->add('component', Indent::_(2)
|
||||
. '<field name="uikit_style"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'type="radio"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'label="' . $lang
|
||||
. '_UIKIT_STYLE_LABEL"');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'description="'
|
||||
. $lang . '_UIKIT_STYLE_DESC"');
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. 'class="btn-group btn-group-yesno"');
|
||||
if (2 == $this->config->uikit)
|
||||
{
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. 'showon="uikit_version:2"');
|
||||
}
|
||||
$this->configfieldsets->add('component', Indent::_(3) . 'default="">');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<!--'
|
||||
. Line::_(__Line__, __Class__) . ' Option Set. -->');
|
||||
$this->configfieldsets->add('component', Indent::_(3) . '<option value="">');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. '_FLAT_LOAD</option>"');
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. '<option value=".almost-flat">');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. '_ALMOST_FLAT_LOAD</option>"');
|
||||
$this->configfieldsets->add('component', Indent::_(3)
|
||||
. '<option value=".gradient">');
|
||||
$this->configfieldsets->add('component', Indent::_(4) . $lang
|
||||
. '_GRADIANT_LOAD</option>"');
|
||||
$this->configfieldsets->add('component', Indent::_(2) . "</field>");
|
||||
// set params defaults
|
||||
$this->extensionsparams->add('component', '"uikit_style":""');
|
||||
}
|
||||
// add custom Uikit Settings fields
|
||||
if ($this->customfield->isArray('Uikit Settings'))
|
||||
{
|
||||
$this->configfieldsets->add('component', implode(
|
||||
"", $this->customfield->get('Uikit Settings')
|
||||
));
|
||||
$this->customfield->remove('Uikit Settings');
|
||||
}
|
||||
// close that fieldset
|
||||
$this->configfieldsets->add('component', Indent::_(1) . "</fieldset>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,141 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Language;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\PermissionComponent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Counter;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Custom Button Permissions Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class CustomButtonPermissions
|
||||
{
|
||||
/**
|
||||
* The Config Class.
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* The Language Class.
|
||||
*
|
||||
* @var Language
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Language $language;
|
||||
|
||||
/**
|
||||
* The PermissionComponent Class.
|
||||
*
|
||||
* @var PermissionComponent
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected PermissionComponent $permissioncomponent;
|
||||
|
||||
/**
|
||||
* The Counter Class.
|
||||
*
|
||||
* @var Counter
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Counter $counter;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Config $config The Config Class.
|
||||
* @param Language $language The Language Class.
|
||||
* @param PermissionComponent $permissioncomponent The PermissionComponent Class.
|
||||
* @param Counter $counter The Counter Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Config $config, Language $language,
|
||||
PermissionComponent $permissioncomponent,
|
||||
Counter $counter)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->language = $language;
|
||||
$this->permissioncomponent = $permissioncomponent;
|
||||
$this->counter = $counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Custom Button Permissions
|
||||
*
|
||||
* @param object $settings The view settings
|
||||
* @param string $nameView The view name
|
||||
* @param string $code The view code name.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function add(object $settings, string $nameView, string $code): void
|
||||
{
|
||||
// add the custom permissions to use the buttons of this view
|
||||
if (isset($settings->custom_buttons)
|
||||
&& ArrayHelper::check($settings->custom_buttons))
|
||||
{
|
||||
foreach ($settings->custom_buttons as $custom_buttons)
|
||||
{
|
||||
$customButtonName = $custom_buttons['name'];
|
||||
$customButtonCode = StringHelper::safe(
|
||||
$customButtonName
|
||||
);
|
||||
$customButtonTitle = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe(
|
||||
$nameView . ' ' . $customButtonName . ' Button Access',
|
||||
'U'
|
||||
);
|
||||
$customButtonDesc = $this->config->lang_prefix . '_'
|
||||
. StringHelper::safe(
|
||||
$nameView . ' ' . $customButtonName . ' Button Access',
|
||||
'U'
|
||||
) . '_DESC';
|
||||
$sortButtonKey = StringHelper::safe(
|
||||
$nameView . ' ' . $customButtonName . ' Button Access'
|
||||
);
|
||||
|
||||
$this->language->set(
|
||||
'bothadmin', $customButtonTitle,
|
||||
$nameView . ' ' . $customButtonName . ' Button Access'
|
||||
);
|
||||
|
||||
$this->language->set(
|
||||
'bothadmin', $customButtonDesc,
|
||||
' Allows the users in this group to access the '
|
||||
. StringHelper::safe($customButtonName, 'w')
|
||||
. ' button.'
|
||||
);
|
||||
|
||||
$this->permissioncomponent->set($sortButtonKey, [
|
||||
'name' => "$code.$customButtonCode",
|
||||
'title' => $customButtonTitle,
|
||||
'description' => $customButtonDesc
|
||||
]);
|
||||
|
||||
// the size needs increase
|
||||
$this->counter->accessSize++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -231,18 +231,16 @@ final class FieldsetString implements Fieldsetinterface
|
||||
$dynamic_fields = '';
|
||||
// set the custom table key
|
||||
$dbkey = 'g';
|
||||
// for plugin event TODO change event api signatures
|
||||
$placeholders = $this->placeholder->active;
|
||||
$component_context = $this->config->component_context;
|
||||
|
||||
// Trigger Event: jcb_ce_onBeforeBuildFields
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onBeforeBuildFields',
|
||||
array(&$component_context, &$dynamic_fields, &$read_only,
|
||||
[&$dynamic_fields, &$read_only,
|
||||
&$dbkey, &$view, &$component, &$nameSingleCode,
|
||||
&$nameListCode, &$placeholders, &$lang_view,
|
||||
&$lang_views)
|
||||
&$nameListCode, &$lang_view,
|
||||
&$lang_views]
|
||||
);
|
||||
unset($placeholders);
|
||||
|
||||
// TODO we should add the global and local view switch if field for front end
|
||||
foreach ($view['settings']->fields as $field)
|
||||
{
|
||||
@@ -252,17 +250,16 @@ final class FieldsetString implements Fieldsetinterface
|
||||
true
|
||||
);
|
||||
}
|
||||
// for plugin event TODO change event api signatures
|
||||
$placeholders = $this->placeholder->active;
|
||||
|
||||
// Trigger Event: jcb_ce_onAfterBuildFields
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onAfterBuildFields',
|
||||
array(&$component_context, &$dynamic_fields, &$read_only,
|
||||
[&$dynamic_fields, &$read_only,
|
||||
&$dbkey, &$view, &$component, &$nameSingleCode,
|
||||
&$nameListCode, &$placeholders, &$lang_view,
|
||||
&$lang_views)
|
||||
&$nameListCode, &$lang_view,
|
||||
&$lang_views]
|
||||
);
|
||||
unset($placeholders);
|
||||
|
||||
// set the default fields
|
||||
$field_set = array();
|
||||
$field_set[] = '<fieldset name="details">';
|
||||
@@ -444,6 +441,7 @@ final class FieldsetString implements Fieldsetinterface
|
||||
$field_set[] = Indent::_(3) . 'description="' . $lang_view
|
||||
. '_VERSION_DESC"';
|
||||
$field_set[] = Indent::_(3) . 'size="6"';
|
||||
$field_set[] = Indent::_(3) . 'default="1"';
|
||||
$field_set[] = Indent::_(3) . 'readonly="true"';
|
||||
$field_set[] = Indent::_(3) . 'filter="unset"';
|
||||
$field_set[] = Indent::_(2) . "/>";
|
||||
|
@@ -239,18 +239,16 @@ final class FieldsetXML implements Fieldsetinterface
|
||||
$dynamic_fields_xml = [];
|
||||
// set the custom table key
|
||||
$dbkey = 'g';
|
||||
// for plugin event TODO change event api signatures
|
||||
$placeholders = $this->placeholder->active;
|
||||
$component_context = $this->config->component_context;
|
||||
|
||||
// Trigger Event: jcb_ce_onBeforeBuildFields
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onBeforeBuildFields',
|
||||
array(&$component_context, &$dynamic_fields_xml, &$read_only_xml,
|
||||
[&$dynamic_fields_xml, &$read_only_xml,
|
||||
&$dbkey, &$view, &$component, &$nameSingleCode,
|
||||
&$nameListCode, &$placeholders, &$lang_view,
|
||||
&$lang_views)
|
||||
&$nameListCode, &$lang_view,
|
||||
&$lang_views]
|
||||
);
|
||||
unset($placeholders);
|
||||
|
||||
// TODO we should add the global and local view switch if field for front end
|
||||
foreach ($view['settings']->fields as $field)
|
||||
{
|
||||
@@ -260,17 +258,16 @@ final class FieldsetXML implements Fieldsetinterface
|
||||
true
|
||||
);
|
||||
}
|
||||
// for plugin event TODO change event api signatures
|
||||
$placeholders = $this->placeholder->active;
|
||||
|
||||
// Trigger Event: jcb_ce_onAfterBuildFields
|
||||
$this->event->trigger(
|
||||
'jcb_ce_onAfterBuildFields',
|
||||
array(&$component_context, &$dynamic_fields_xml, &$read_only_xml,
|
||||
[&$dynamic_fields_xml, &$read_only_xml,
|
||||
&$dbkey, &$view, &$component, &$nameSingleCode,
|
||||
&$nameListCode, &$placeholders, &$lang_view,
|
||||
&$lang_views)
|
||||
&$nameListCode, &$lang_view,
|
||||
&$lang_views]
|
||||
);
|
||||
unset($placeholders);
|
||||
|
||||
// set the default fields
|
||||
$main_xml = new \simpleXMLElement('<a/>');
|
||||
$field_set_xml = $main_xml->addChild('fieldset');
|
||||
@@ -466,6 +463,7 @@ final class FieldsetXML implements Fieldsetinterface
|
||||
'label' => $lang_view . '_VERSION_LABEL',
|
||||
'description' => $lang_view . '_VERSION_DESC',
|
||||
'size' => 6,
|
||||
'default' => 1,
|
||||
'readonly' => "true",
|
||||
'filter' => 'unset'
|
||||
];
|
||||
|
@@ -0,0 +1,79 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\Request as RequestBuilder;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Request Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class Request
|
||||
{
|
||||
/**
|
||||
* The Request Class.
|
||||
*
|
||||
* @var RequestBuilder
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected RequestBuilder $requestbuilder;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param RequestBuilder $requestbuilder The Request Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(RequestBuilder $requestbuilder)
|
||||
{
|
||||
$this->requestbuilder = $requestbuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the request values
|
||||
*
|
||||
* @param string $view
|
||||
* @param string $field
|
||||
* @param string $search
|
||||
* @param string $target
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $view, string $field, string $search, string $target): void
|
||||
{
|
||||
$key = GetHelper::between($field, $search, '"');
|
||||
if (!StringHelper::check($key))
|
||||
{
|
||||
// is not having special var
|
||||
$key = $target;
|
||||
// update field
|
||||
$field = str_replace($search . '"', 'name="' . $key . '"', (string) $field);
|
||||
}
|
||||
else
|
||||
{
|
||||
// update field
|
||||
$field = str_replace(
|
||||
$search . $key . '"', 'name="' . $key . '"', (string) $field
|
||||
);
|
||||
}
|
||||
|
||||
// set the values needed for view requests to be made
|
||||
$this->requestbuilder->set("$target.$view.$key", $field);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,263 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Dispenser;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\Request;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\Router as Builder;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\RouterConstructorDefault as DefaultConstructor;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\RouterConstructorManual as ManualConstructor;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\RouterMethodsDefault as DefaultMethods;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Creator\RouterMethodsManual as ManualMethods;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Router Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class Router
|
||||
{
|
||||
/**
|
||||
* The Dispenser Class.
|
||||
*
|
||||
* @var Dispenser
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Dispenser $dispenser;
|
||||
|
||||
/**
|
||||
* The Request Class.
|
||||
*
|
||||
* @var Request
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Request $request;
|
||||
|
||||
/**
|
||||
* The Router Class.
|
||||
*
|
||||
* @var Builder
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Builder $builder;
|
||||
|
||||
/**
|
||||
* The RouterConstructorDefault Class.
|
||||
*
|
||||
* @var DefaultConstructor
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected DefaultConstructor $defaultconstructor;
|
||||
|
||||
/**
|
||||
* The RouterConstructorManual Class.
|
||||
*
|
||||
* @var ManualConstructor
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ManualConstructor $manualconstructor;
|
||||
|
||||
/**
|
||||
* The RouterMethodsDefault Class.
|
||||
*
|
||||
* @var DefaultMethods
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected DefaultMethods $defaultmethods;
|
||||
|
||||
/**
|
||||
* The RouterMethodsManual Class.
|
||||
*
|
||||
* @var ManualMethods
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ManualMethods $manualmethods;
|
||||
|
||||
/**
|
||||
* The Router Build Mode Before Parent Construct.
|
||||
*
|
||||
* @var int|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?int $mode_before = null;
|
||||
|
||||
/**
|
||||
* The Router Build Mode Methods.
|
||||
*
|
||||
* @var int|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected ?int $mode_method = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Dispenser $dispenser The Dispenser Class.
|
||||
* @param Request $request The Request Class.
|
||||
* @param Builder $builder The Router Class.
|
||||
* @param DefaultConstructor $defaultconstructor The RouterConstructorDefault Class.
|
||||
* @param ManualConstructor $manualconstructor The RouterConstructorManual Class.
|
||||
* @param DefaultMethods $defaultmethods The RouterMethodsDefault Class.
|
||||
* @param ManualMethods $manualmethods The RouterMethodsManual Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Dispenser $dispenser, Request $request,
|
||||
Builder $builder, DefaultConstructor $defaultconstructor,
|
||||
ManualConstructor $manualconstructor,
|
||||
DefaultMethods $defaultmethods,
|
||||
ManualMethods $manualmethods)
|
||||
{
|
||||
$this->dispenser = $dispenser;
|
||||
$this->request = $request;
|
||||
$this->builder = $builder;
|
||||
$this->defaultconstructor = $defaultconstructor;
|
||||
$this->manualconstructor = $manualconstructor;
|
||||
$this->defaultmethods = $defaultmethods;
|
||||
$this->manualmethods = $manualmethods;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Constructor Before Parent Call
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getConstructor(): string
|
||||
{
|
||||
$this->init();
|
||||
|
||||
if ($this->mode_before == 3)
|
||||
{
|
||||
return $this->dispenser->get(
|
||||
'_site_router_', 'constructor_before_parent',
|
||||
PHP_EOL . PHP_EOL, null, true
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->mode_before == 2)
|
||||
{
|
||||
return $this->manualconstructor->get();
|
||||
}
|
||||
|
||||
return $this->defaultconstructor->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Constructor After Parent Call
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getConstructorAfterParent(): string
|
||||
{
|
||||
return $this->dispenser->get(
|
||||
'_site_router_', 'constructor_after_parent',
|
||||
PHP_EOL . PHP_EOL, null, true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Methods
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getMethods(): string
|
||||
{
|
||||
$this->init();
|
||||
|
||||
if ($this->mode_method == 0)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($this->mode_method == 3)
|
||||
{
|
||||
return $this->dispenser->get(
|
||||
'_site_router_', 'methods',
|
||||
PHP_EOL . PHP_EOL, null, true
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->mode_before == 2 && $this->mode_method == 1)
|
||||
{
|
||||
return $this->manualmethods->get();
|
||||
}
|
||||
|
||||
if ($this->mode_method == 1)
|
||||
{
|
||||
return $this->defaultmethods->get();
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Constructor Before Parent Call
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function init(): void
|
||||
{
|
||||
if ($this->mode_before === null)
|
||||
{
|
||||
$this->mode_before = (int) $this->builder->get('mode_before', 0);
|
||||
$this->mode_method = (int) $this->builder->get('mode_method', 0);
|
||||
|
||||
$this->updateKeys();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the keys
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private function updateKeys(): void
|
||||
{
|
||||
if (($requests = $this->request->allActive()) === [] ||
|
||||
($views = $this->builder->get('views')) === null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($views as &$router)
|
||||
{
|
||||
// if the key is null, and not 'id'
|
||||
// then we must not update it
|
||||
// since this is a list view and
|
||||
// should not add an ID as key value
|
||||
if ($router->key === 'id')
|
||||
{
|
||||
foreach ($requests as $key => $request)
|
||||
{
|
||||
if (isset($request[$router->view]))
|
||||
{
|
||||
$router->key = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($router);
|
||||
|
||||
$this->request->set('views', $views);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,77 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\Router;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
|
||||
|
||||
/**
|
||||
* Router Constructor Default Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class RouterConstructorDefault
|
||||
{
|
||||
/**
|
||||
* The Router Class.
|
||||
*
|
||||
* @var Router
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Router $router;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Router $router The Router Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Router $router)
|
||||
{
|
||||
$this->router = $router;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Construct Code
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(): string
|
||||
{
|
||||
$views = $this->router->get('views');
|
||||
if ($views !== null)
|
||||
{
|
||||
$code = [];
|
||||
foreach ($views as $view)
|
||||
{
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Add the ({$view->view}:view) router configuration";
|
||||
$code[] = Indent::_(2) . "\${$view->view} = new RouterViewConfiguration('{$view->view}');";
|
||||
// add key only if we have one see: ...Compiler\Creator\Router->updateKeys();
|
||||
if (!empty($view->key) && !empty($view->alias))
|
||||
{
|
||||
$code[] = Indent::_(2) . "\${$view->view}->setKey('{$view->key}');";
|
||||
}
|
||||
$code[] = Indent::_(2) . "\$this->registerView(\${$view->view});";
|
||||
}
|
||||
return PHP_EOL . implode(PHP_EOL, $code);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,77 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\Router;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
|
||||
|
||||
/**
|
||||
* Router Constructor Default Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class RouterConstructorManual
|
||||
{
|
||||
/**
|
||||
* The Router Class.
|
||||
*
|
||||
* @var Router
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Router $router;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Router $router The Router Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Router $router)
|
||||
{
|
||||
$this->router = $router;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Construct Code (SOON)
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(): string
|
||||
{
|
||||
$views = $this->router->get('views');
|
||||
if ($views !== null)
|
||||
{
|
||||
$code = [];
|
||||
foreach ($views as $view)
|
||||
{
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Add the ({$view->view}:view) router configuration";
|
||||
$code[] = Indent::_(2) . "\${$view->view} = new RouterViewConfiguration('{$view->view}');";
|
||||
// add key only if we have one see: ...Compiler\Creator\Router->updateKeys();
|
||||
if (!empty($view->key) && !empty($view->alias))
|
||||
{
|
||||
$code[] = Indent::_(2) . "\${$view->view}->setKey('{$view->key}');";
|
||||
}
|
||||
$code[] = Indent::_(2) . "\$this->registerView(\${$view->view});";
|
||||
}
|
||||
return PHP_EOL . implode(PHP_EOL, $code);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,137 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\Router;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
|
||||
|
||||
/**
|
||||
* Router Methods Default Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class RouterMethodsDefault
|
||||
{
|
||||
/**
|
||||
* The Router Class.
|
||||
*
|
||||
* @var Router
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Router $router;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Router $router The Router Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Router $router)
|
||||
{
|
||||
$this->router = $router;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Methods Code
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(): string
|
||||
{
|
||||
$views = $this->router->get('views');
|
||||
if ($views !== null)
|
||||
{
|
||||
$code = [];
|
||||
foreach ($views as $view)
|
||||
{
|
||||
// we only add these if we can get an ID (int) value
|
||||
// else you will need to use the manual or customcode options
|
||||
if (empty($view->key) || empty($view->alias))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(1) . "/**";
|
||||
$code[] = Indent::_(1) . " * Method to get the segment(s) for {$view->view}";
|
||||
$code[] = Indent::_(1) . " *";
|
||||
$code[] = Indent::_(1) . " * @param string \$segment Segment of the article to retrieve the ID for";
|
||||
$code[] = Indent::_(1) . " * @param array \$query The request that is parsed right now";
|
||||
$code[] = Indent::_(1) . " *";
|
||||
$code[] = Indent::_(1) . " * @return mixed The {$view->key} of this item or false";
|
||||
$code[] = Indent::_(1) . " * @since 4.4.0";
|
||||
$code[] = Indent::_(1) . " */";
|
||||
$code[] = Indent::_(1) . "public function get{$view->View}Id(\$segment, \$query)";
|
||||
$code[] = Indent::_(1) . "{";
|
||||
$code[] = Indent::_(2) . "if (\$this->noIDs)";
|
||||
$code[] = Indent::_(2) . "{";
|
||||
$code[] = Indent::_(3) . "\$dbquery = \$this->db->getQuery(true);";
|
||||
$code[] = Indent::_(3) . "\$dbquery->select(\$this->db->quoteName('{$view->key}'))";
|
||||
$code[] = Indent::_(4) . "->from(\$this->db->quoteName('{$view->table}'))";
|
||||
$code[] = Indent::_(4) . "->where(";
|
||||
$code[] = Indent::_(5) . "[";
|
||||
$code[] = Indent::_(6) . "\$this->db->quoteName('{$view->alias}') . ' = :alias'";
|
||||
$code[] = Indent::_(5) . "]";
|
||||
$code[] = Indent::_(4) . ")";
|
||||
$code[] = Indent::_(4) . "->bind(':alias', \$segment);";
|
||||
$code[] = Indent::_(3) . "\$this->db->setQuery(\$dbquery);";
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(3) . "return (int) \$this->db->loadResult();";
|
||||
$code[] = Indent::_(2) . "}";
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(2) . "return (int) \$segment;";
|
||||
$code[] = Indent::_(1) . "}";
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(1) . "/**";
|
||||
$code[] = Indent::_(1) . " * Method to get the segment(s) for {$view->view}";
|
||||
$code[] = Indent::_(1) . " *";
|
||||
$code[] = Indent::_(1) . " * @param string \$id ID of the contact to retrieve the segments for";
|
||||
$code[] = Indent::_(1) . " * @param array \$query The request that is built right now";
|
||||
$code[] = Indent::_(1) . " *";
|
||||
$code[] = Indent::_(1) . " * @return array|string The segments of this item";
|
||||
$code[] = Indent::_(1) . " * @since 4.4.0";
|
||||
$code[] = Indent::_(1) . " */";
|
||||
$code[] = Indent::_(1) . "public function get{$view->View}Segment(\$id, \$query)";
|
||||
$code[] = Indent::_(1) . "{";
|
||||
$code[] = Indent::_(2) . "if (strpos(\$id, ':') === false)";
|
||||
$code[] = Indent::_(2) . "{";
|
||||
$code[] = Indent::_(3) . "\$id = (int) \$id;";
|
||||
$code[] = Indent::_(3) . "\$dbquery = \$this->db->getQuery(true);";
|
||||
$code[] = Indent::_(3) . "\$dbquery->select(\$this->db->quoteName('{$view->alias}'))";
|
||||
$code[] = Indent::_(4) . "->from(\$this->db->quoteName('{$view->table}'))";
|
||||
$code[] = Indent::_(4) . "->where(\$this->db->quoteName('{$view->key}') . ' = :id')";
|
||||
$code[] = Indent::_(4) . "->bind(':id', \$id, ParameterType::INTEGER);";
|
||||
$code[] = Indent::_(3) . "\$this->db->setQuery(\$dbquery);";
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(3) . "\$id .= ':' . \$this->db->loadResult();";
|
||||
$code[] = Indent::_(2) . "}";
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(2) . "if (\$this->noIDs)";
|
||||
$code[] = Indent::_(2) . "{";
|
||||
$code[] = Indent::_(3) . "list(\$void, \$segment) = explode(':', \$id, 2);";
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(3) . "return [\$void => \$segment];";
|
||||
$code[] = Indent::_(2) . "}";
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(2) . "return [(int) \$id => \$id];";
|
||||
$code[] = Indent::_(1) . "}";
|
||||
}
|
||||
return PHP_EOL . implode(PHP_EOL, $code);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,137 @@
|
||||
<?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\Creator;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Builder\Router;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
|
||||
|
||||
/**
|
||||
* Router Methods Manual Creator Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class RouterMethodsManual
|
||||
{
|
||||
/**
|
||||
* The Router Class.
|
||||
*
|
||||
* @var Router
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Router $router;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Router $router The Router Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(Router $router)
|
||||
{
|
||||
$this->router = $router;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Methods Code (SOON)
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(): string
|
||||
{
|
||||
$views = $this->router->get('views');
|
||||
if ($views !== null)
|
||||
{
|
||||
$code = [];
|
||||
foreach ($views as $view)
|
||||
{
|
||||
// we only add these if we can get an ID (int) value
|
||||
// else you will need to use the manual or customcode options
|
||||
if (empty($view->key) || empty($view->alias))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(1) . "/**";
|
||||
$code[] = Indent::_(1) . " * Method to get the segment(s) for an {$view->view}";
|
||||
$code[] = Indent::_(1) . " *";
|
||||
$code[] = Indent::_(1) . " * @param string \$segment Segment of the article to retrieve the ID for";
|
||||
$code[] = Indent::_(1) . " * @param array \$query The request that is parsed right now";
|
||||
$code[] = Indent::_(1) . " *";
|
||||
$code[] = Indent::_(1) . " * @return mixed The {$view->key} of this item or false";
|
||||
$code[] = Indent::_(1) . " * @since 4.4.0";
|
||||
$code[] = Indent::_(1) . " */";
|
||||
$code[] = Indent::_(1) . "public function get{$view->View}Id(\$segment, \$query)";
|
||||
$code[] = Indent::_(1) . "{";
|
||||
$code[] = Indent::_(2) . "if (\$this->noIDs)";
|
||||
$code[] = Indent::_(2) . "{";
|
||||
$code[] = Indent::_(3) . "\$dbquery = \$this->db->getQuery(true);";
|
||||
$code[] = Indent::_(3) . "\$dbquery->select(\$this->db->quoteName('{$view->key}'))";
|
||||
$code[] = Indent::_(4) . "->from(\$this->db->quoteName('{$view->table}'))";
|
||||
$code[] = Indent::_(4) . "->where(";
|
||||
$code[] = Indent::_(5) . "[";
|
||||
$code[] = Indent::_(6) . "\$this->db->quoteName('{$view->alias}') . ' = :alias'";
|
||||
$code[] = Indent::_(5) . "]";
|
||||
$code[] = Indent::_(4) . ")";
|
||||
$code[] = Indent::_(4) . "->bind(':alias', \$segment);";
|
||||
$code[] = Indent::_(3) . "\$this->db->setQuery(\$dbquery);";
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(3) . "return (int) \$this->db->loadResult();";
|
||||
$code[] = Indent::_(2) . "}";
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(2) . "return (int) \$segment;";
|
||||
$code[] = Indent::_(1) . "}";
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(1) . "/**";
|
||||
$code[] = Indent::_(1) . " * Method to get the segment(s) for a {$view->view}";
|
||||
$code[] = Indent::_(1) . " *";
|
||||
$code[] = Indent::_(1) . " * @param string \$id ID of the contact to retrieve the segments for";
|
||||
$code[] = Indent::_(1) . " * @param array \$query The request that is built right now";
|
||||
$code[] = Indent::_(1) . " *";
|
||||
$code[] = Indent::_(1) . " * @return array|string The segments of this item";
|
||||
$code[] = Indent::_(1) . " * @since 4.4.0";
|
||||
$code[] = Indent::_(1) . " */";
|
||||
$code[] = Indent::_(1) . "public function get{$view->View}Segment(\$id, \$query)";
|
||||
$code[] = Indent::_(1) . "{";
|
||||
$code[] = Indent::_(2) . "if (strpos(\$id, ':') === false)";
|
||||
$code[] = Indent::_(2) . "{";
|
||||
$code[] = Indent::_(3) . "\$id = (int) \$id;";
|
||||
$code[] = Indent::_(3) . "\$dbquery = \$this->db->getQuery(true);";
|
||||
$code[] = Indent::_(3) . "\$dbquery->select(\$this->db->quoteName('{$view->alias}'))";
|
||||
$code[] = Indent::_(4) . "->from(\$this->db->quoteName('{$view->table}'))";
|
||||
$code[] = Indent::_(4) . "->where(\$this->db->quoteName('{$view->key}') . ' = :id')";
|
||||
$code[] = Indent::_(4) . "->bind(':id', \$id, ParameterType::INTEGER);";
|
||||
$code[] = Indent::_(3) . "\$this->db->setQuery(\$dbquery);";
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(3) . "\$id .= ':' . \$this->db->loadResult();";
|
||||
$code[] = Indent::_(2) . "}";
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(2) . "if (\$this->noIDs)";
|
||||
$code[] = Indent::_(2) . "{";
|
||||
$code[] = Indent::_(3) . "list(\$void, \$segment) = explode(':', \$id, 2);";
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(3) . "return [\$void => \$segment];";
|
||||
$code[] = Indent::_(2) . "}";
|
||||
$code[] = '';
|
||||
$code[] = Indent::_(2) . "return [(int) \$id => \$id];";
|
||||
$code[] = Indent::_(1) . "}";
|
||||
}
|
||||
return PHP_EOL . implode(PHP_EOL, $code);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user