';
$textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_COMPANY_S', $model->info['getKeyFrom']['company']);
}
// add value only if set
- if (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner']))
+ if (isset($model->info['getKeyFrom']['owner']) && StringHelper::check($model->info['getKeyFrom']['owner']))
{
$ownerDetails .= '
';
$textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_OWNER_S', $model->info['getKeyFrom']['owner']);
}
// add value only if set
- if (isset($model->info['getKeyFrom']['website']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['website']))
+ if (isset($model->info['getKeyFrom']['website']) && StringHelper::check($model->info['getKeyFrom']['website']))
{
$ownerDetails .= '
';
$textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_WEBSITE_S', $model->info['getKeyFrom']['website']);
}
// add value only if set
- if (isset($model->info['getKeyFrom']['email']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['email']))
+ if (isset($model->info['getKeyFrom']['email']) && StringHelper::check($model->info['getKeyFrom']['email']))
{
$ownerDetails .= '
';
$textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_EMAIL_S', $model->info['getKeyFrom']['email']);
}
// add value only if set
- if (isset($model->info['getKeyFrom']['license']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['license']))
+ if (isset($model->info['getKeyFrom']['license']) && StringHelper::check($model->info['getKeyFrom']['license']))
{
$ownerDetails .= '
';
$textNotice[] = '- ' . JText::sprintf('COM_COMPONENTBUILDER_LICENSE_S', $model->info['getKeyFrom']['license']);
}
// add value only if set
- if (isset($model->info['getKeyFrom']['copyright']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['copyright']))
+ if (isset($model->info['getKeyFrom']['copyright']) && StringHelper::check($model->info['getKeyFrom']['copyright']))
{
$ownerDetails .= '
';
- // set redirect
- $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
- $this->setRedirect($redirect_url, $message);
- return true;
- }
- // set redirect
- $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
- $this->setRedirect($redirect_url);
- return false;
+ return $success;
}
public function resetPowers()
@@ -186,6 +164,5 @@ class ComponentbuilderControllerPowers extends AdminController
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url);
return false;
- }
-
-}
+ }
+}
\ No newline at end of file
diff --git a/admin/controllers/server.php b/admin/controllers/server.php
index a43fa7e49..fe4552756 100644
--- a/admin/controllers/server.php
+++ b/admin/controllers/server.php
@@ -62,7 +62,7 @@ class ComponentbuilderControllerServer extends FormController
return false;
}
- // In the absense of better information, revert to the component permissions.
+ // In the absence of better information, revert to the component permissions.
return $user->authorise('server.create', $this->option);
}
@@ -85,7 +85,7 @@ class ComponentbuilderControllerServer extends FormController
// Access check.
- $access = ($user->authorise('server.access', 'com_componentbuilder.server.' . (int) $recordId) && $user->authorise('server.access', 'com_componentbuilder'));
+ $access = ($user->authorise('server.access', 'com_componentbuilder.server.' . (int) $recordId) && $user->authorise('server.access', 'com_componentbuilder'));
if (!$access)
{
return false;
diff --git a/admin/controllers/servers.php b/admin/controllers/servers.php
index 5a4bdac5b..d18d9b162 100644
--- a/admin/controllers/servers.php
+++ b/admin/controllers/servers.php
@@ -106,4 +106,4 @@ class ComponentbuilderControllerServers extends AdminController
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=servers', false), $message, 'error');
return;
}
-}
+}
\ No newline at end of file
diff --git a/admin/controllers/site_view.php b/admin/controllers/site_view.php
index 0b0c09199..902fab2ef 100644
--- a/admin/controllers/site_view.php
+++ b/admin/controllers/site_view.php
@@ -62,7 +62,7 @@ class ComponentbuilderControllerSite_view extends FormController
return false;
}
- // In the absense of better information, revert to the component permissions.
+ // In the absence of better information, revert to the component permissions.
return parent::allowAdd($data);
}
@@ -85,7 +85,7 @@ class ComponentbuilderControllerSite_view extends FormController
// Access check.
- $access = ($user->authorise('site_view.access', 'com_componentbuilder.site_view.' . (int) $recordId) && $user->authorise('site_view.access', 'com_componentbuilder'));
+ $access = ($user->authorise('site_view.access', 'com_componentbuilder.site_view.' . (int) $recordId) && $user->authorise('site_view.access', 'com_componentbuilder'));
if (!$access)
{
return false;
diff --git a/admin/controllers/site_views.php b/admin/controllers/site_views.php
index cca006cda..1816faab1 100644
--- a/admin/controllers/site_views.php
+++ b/admin/controllers/site_views.php
@@ -115,4 +115,4 @@ class ComponentbuilderControllerSite_views extends AdminController
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=get_snippets', false));
return;
}
-}
+}
\ No newline at end of file
diff --git a/admin/controllers/snippet.php b/admin/controllers/snippet.php
index ff311a80d..914cf7a12 100644
--- a/admin/controllers/snippet.php
+++ b/admin/controllers/snippet.php
@@ -62,7 +62,7 @@ class ComponentbuilderControllerSnippet extends FormController
return false;
}
- // In the absense of better information, revert to the component permissions.
+ // In the absence of better information, revert to the component permissions.
return parent::allowAdd($data);
}
@@ -85,7 +85,7 @@ class ComponentbuilderControllerSnippet extends FormController
// Access check.
- $access = ($user->authorise('snippet.access', 'com_componentbuilder.snippet.' . (int) $recordId) && $user->authorise('snippet.access', 'com_componentbuilder'));
+ $access = ($user->authorise('snippet.access', 'com_componentbuilder.snippet.' . (int) $recordId) && $user->authorise('snippet.access', 'com_componentbuilder'));
if (!$access)
{
return false;
diff --git a/admin/controllers/snippet_type.php b/admin/controllers/snippet_type.php
index 62d99e746..b94c8a784 100644
--- a/admin/controllers/snippet_type.php
+++ b/admin/controllers/snippet_type.php
@@ -62,7 +62,7 @@ class ComponentbuilderControllerSnippet_type extends FormController
return false;
}
- // In the absense of better information, revert to the component permissions.
+ // In the absence of better information, revert to the component permissions.
return $user->authorise('snippet_type.create', $this->option);
}
@@ -85,7 +85,7 @@ class ComponentbuilderControllerSnippet_type extends FormController
// Access check.
- $access = ($user->authorise('snippet_type.access', 'com_componentbuilder.snippet_type.' . (int) $recordId) && $user->authorise('snippet_type.access', 'com_componentbuilder'));
+ $access = ($user->authorise('snippet_type.access', 'com_componentbuilder.snippet_type.' . (int) $recordId) && $user->authorise('snippet_type.access', 'com_componentbuilder'));
if (!$access)
{
return false;
diff --git a/admin/controllers/snippet_types.php b/admin/controllers/snippet_types.php
index 3b2275d32..5efe65113 100644
--- a/admin/controllers/snippet_types.php
+++ b/admin/controllers/snippet_types.php
@@ -43,4 +43,4 @@ class ComponentbuilderControllerSnippet_types extends AdminController
{
return parent::getModel($name, $prefix, $config);
}
-}
+}
\ No newline at end of file
diff --git a/admin/controllers/snippets.php b/admin/controllers/snippets.php
index 3df7e65b5..e0fe12a80 100644
--- a/admin/controllers/snippets.php
+++ b/admin/controllers/snippets.php
@@ -14,6 +14,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\Utilities\ArrayHelper;
+use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
/**
* Snippets Admin Controller
@@ -132,7 +133,7 @@ class ComponentbuilderControllerSnippets extends AdminController
// Sanitize the input
JArrayHelper::toInteger($pks);
// check if there is any selections
- if (!ComponentbuilderHelper::checkArray($pks))
+ if (!UtilitiesArrayHelper::check($pks))
{
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_NO_SNIPPETS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN');
@@ -179,4 +180,4 @@ class ComponentbuilderControllerSnippets extends AdminController
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error');
return;
}
-}
+}
\ No newline at end of file
diff --git a/admin/controllers/template.php b/admin/controllers/template.php
index b52ee2ab5..619dd4ccb 100644
--- a/admin/controllers/template.php
+++ b/admin/controllers/template.php
@@ -62,7 +62,7 @@ class ComponentbuilderControllerTemplate extends FormController
return false;
}
- // In the absense of better information, revert to the component permissions.
+ // In the absence of better information, revert to the component permissions.
return parent::allowAdd($data);
}
@@ -85,7 +85,7 @@ class ComponentbuilderControllerTemplate extends FormController
// Access check.
- $access = ($user->authorise('template.access', 'com_componentbuilder.template.' . (int) $recordId) && $user->authorise('template.access', 'com_componentbuilder'));
+ $access = ($user->authorise('template.access', 'com_componentbuilder.template.' . (int) $recordId) && $user->authorise('template.access', 'com_componentbuilder'));
if (!$access)
{
return false;
diff --git a/admin/controllers/templates.php b/admin/controllers/templates.php
index 711d9da98..eaa9eba37 100644
--- a/admin/controllers/templates.php
+++ b/admin/controllers/templates.php
@@ -115,4 +115,4 @@ class ComponentbuilderControllerTemplates extends AdminController
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=get_snippets', false));
return;
}
-}
+}
\ No newline at end of file
diff --git a/admin/controllers/validation_rule.php b/admin/controllers/validation_rule.php
index 58cf192ad..e1dba43ac 100644
--- a/admin/controllers/validation_rule.php
+++ b/admin/controllers/validation_rule.php
@@ -62,7 +62,7 @@ class ComponentbuilderControllerValidation_rule extends FormController
return false;
}
- // In the absense of better information, revert to the component permissions.
+ // In the absence of better information, revert to the component permissions.
return $user->authorise('validation_rule.create', $this->option);
}
@@ -85,7 +85,7 @@ class ComponentbuilderControllerValidation_rule extends FormController
// Access check.
- $access = ($user->authorise('validation_rule.access', 'com_componentbuilder.validation_rule.' . (int) $recordId) && $user->authorise('validation_rule.access', 'com_componentbuilder'));
+ $access = ($user->authorise('validation_rule.access', 'com_componentbuilder.validation_rule.' . (int) $recordId) && $user->authorise('validation_rule.access', 'com_componentbuilder'));
if (!$access)
{
return false;
diff --git a/admin/controllers/validation_rules.php b/admin/controllers/validation_rules.php
index 13da517e5..1e87bae50 100644
--- a/admin/controllers/validation_rules.php
+++ b/admin/controllers/validation_rules.php
@@ -14,6 +14,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\Utilities\ArrayHelper;
+use VDM\Joomla\Utilities\StringHelper;
/**
* Validation_rules Admin Controller
@@ -131,7 +132,7 @@ class ComponentbuilderControllerValidation_rules extends AdminController
// run expansion via API
$result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand');
// is there a message returned
- if (!is_numeric($result) && ComponentbuilderHelper::checkString($result))
+ if (!is_numeric($result) && StringHelper::check($result))
{
$this->setRedirect($redirect_url, $result);
return true;
@@ -147,4 +148,4 @@ class ComponentbuilderControllerValidation_rules extends AdminController
return false;
}
-}
+}
\ No newline at end of file
diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php
index e36e9f9a4..5626dd5ca 100644
--- a/admin/helpers/compiler.php
+++ b/admin/helpers/compiler.php
@@ -107,7 +107,7 @@ class Compiler extends Infusion
CFactory::_('Utilities.Folder')->remove(CFactory::_('Utilities.Paths')->component_path . '/site');
// clear form component xml
$xmlPath = CFactory::_('Utilities.Paths')->component_path . '/'
- . CFactory::_('Content')->get('component') . '.xml';
+ . CFactory::_('Compiler.Builder.Content.One')->get('component') . '.xml';
$componentXML = FileHelper::getContent($xmlPath);
$textToSite = GetHelper::between(
$componentXML, '', ''
@@ -239,7 +239,7 @@ class Compiler extends Infusion
);
}
// set assets table rules column Warning
- elseif ($this->accessSize >= 30)
+ elseif (CFactory::_('Utilities.Counter')->accessSize >= 30)
{
$this->app->enqueueMessage(
JText::_('
Assets Table Warning
'), 'Warning'
@@ -256,7 +256,7 @@ class Compiler extends Infusion
if (!$add_assets_table_fix && CFactory::_('Config')->add_assets_table_name_fix)
{
// only add if not already added
- if ($this->accessSize < 30)
+ if (CFactory::_('Utilities.Counter')->accessSize < 30)
{
$this->app->enqueueMessage(
JText::_('
Assets Table Warning
'),
@@ -398,10 +398,7 @@ class Compiler extends Infusion
// now we do the dynamic files
foreach (CFactory::_('Utilities.Files')->get('dynamic') as $view => $files)
{
- if (CFactory::_('Content')->exist_($view)
- && ArrayHelper::check(
- CFactory::_('Content')->get_($view)
- ))
+ if (CFactory::_('Compiler.Builder.Content.Multi')->isArray($view))
{
foreach ($files as $file)
{
@@ -418,7 +415,7 @@ class Compiler extends Infusion
}
}
// free up some memory
- CFactory::_('Content')->remove_($view);
+ CFactory::_('Compiler.Builder.Content.Multi')->remove($view);
}
// free up some memory
CFactory::_('Utilities.Files')->remove('dynamic');
@@ -496,7 +493,7 @@ class Compiler extends Infusion
}
// free up some memory
CFactory::_('Utilities.Files')->remove($module->key);
- CFactory::_('Content')->remove_($module->key);
+ CFactory::_('Compiler.Builder.Content.Multi')->remove($module->key);
}
}
}
@@ -574,7 +571,7 @@ class Compiler extends Infusion
}
// free up some memory
CFactory::_('Utilities.Files')->remove($plugin->key);
- CFactory::_('Content')->remove_($plugin->key);
+ CFactory::_('Compiler.Builder.Content.Multi')->remove($plugin->key);
}
}
}
@@ -599,7 +596,7 @@ class Compiler extends Infusion
}
// free up some memory
CFactory::_('Utilities.Files')->remove($power->key);
- CFactory::_('Content')->remove_($power->key);
+ CFactory::_('Compiler.Builder.Content.Multi')->remove($power->key);
}
}
}
@@ -624,7 +621,7 @@ class Compiler extends Infusion
}
// free up some memory
CFactory::_('Utilities.Files')->remove($key);
- CFactory::_('Content')->remove_($key);
+ CFactory::_('Compiler.Builder.Content.Multi')->remove($key);
}
}
}
@@ -653,7 +650,7 @@ class Compiler extends Infusion
);
// set the file name
- CFactory::_('Content')->set('FILENAME', $name);
+ CFactory::_('Compiler.Builder.Content.One')->set('FILENAME', $name);
// check if the file should get PHP opening
$php = '';
@@ -682,14 +679,25 @@ class Compiler extends Infusion
}
// set the answer
- $answer = CFactory::_('Placeholder')->update($string, CFactory::_('Content')->active, 3);
+ $answer = CFactory::_('Placeholder')->update($string, CFactory::_('Compiler.Builder.Content.One')->allActive(), 3);
// set the dynamic answer
if ($view)
{
- $answer = CFactory::_('Placeholder')->update(
- $answer, CFactory::_('Content')->get_($view), 3
- );
+ $placeholders = CFactory::_('Compiler.Builder.Content.Multi')->get($view, []);
+ if (is_array($placeholders))
+ {
+ $answer = CFactory::_('Placeholder')->update(
+ $answer, $placeholders, 3
+ );
+ }
+ else
+ {
+ echo '
';
+ var_dump($view, $placeholders);
+ exit;
+ }
+ unset($placeholders);
}
// check if this file needs extra care :)
@@ -862,15 +870,15 @@ class Compiler extends Infusion
$value = '@update number ' . $value . ' of this MVC';
}
}
- CFactory::_('Content')->set($key, $value);
+ CFactory::_('Compiler.Builder.Content.One')->set($key, $value);
}
return true;
}
// else insure to reset to global
- CFactory::_('Content')->set('CREATIONDATE', CFactory::_('Content')->get('GLOBALCREATIONDATE'));
- CFactory::_('Content')->set('BUILDDATE', CFactory::_('Content')->get('GLOBALBUILDDATE'));
- CFactory::_('Content')->set('VERSION', CFactory::_('Content')->get('GLOBALVERSION'));
+ CFactory::_('Compiler.Builder.Content.One')->set('CREATIONDATE', CFactory::_('Compiler.Builder.Content.One')->get('GLOBALCREATIONDATE'));
+ CFactory::_('Compiler.Builder.Content.One')->set('BUILDDATE', CFactory::_('Compiler.Builder.Content.One')->get('GLOBALBUILDDATE'));
+ CFactory::_('Compiler.Builder.Content.One')->set('VERSION', CFactory::_('Compiler.Builder.Content.One')->get('GLOBALVERSION'));
}
/**
@@ -897,8 +905,8 @@ class Compiler extends Infusion
// do a final run to update the readme file
$two = 0;
// counter data if not set already
- if (!CFactory::_('Content')->exist('LINE_COUNT')
- || CFactory::_('Content')->get('LINE_COUNT') != CFactory::_('Utilities.Counter')->line)
+ if (!CFactory::_('Compiler.Builder.Content.One')->exists('LINE_COUNT')
+ || CFactory::_('Compiler.Builder.Content.One')->get('LINE_COUNT') != CFactory::_('Utilities.Counter')->line)
{
CFactory::_('Utilities.Counter')->set();
}
@@ -926,7 +934,7 @@ class Compiler extends Infusion
// get the file
$string = FileHelper::getContent($path);
// update the file
- $answer = CFactory::_('Placeholder')->update($string, CFactory::_('Content')->active);
+ $answer = CFactory::_('Placeholder')->update($string, CFactory::_('Compiler.Builder.Content.One')->allActive());
// add to zip array
CFactory::_('Utilities.File')->write($path, $answer);
}
diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php
index 5c43fe637..a86df9a8b 100644
--- a/admin/helpers/compiler/a_Get.php
+++ b/admin/helpers/compiler/a_Get.php
@@ -521,7 +521,7 @@ class Get
* The UIKIT component checker
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.uikit_comp');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Uikit.Comp')->get($key);
*/
public $uikitComp = array();
@@ -545,7 +545,7 @@ class Get
* The Google Chart Switch per view
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.google_chart');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Google.Chart')->get($key);
*/
public $googleChart = [];
@@ -599,7 +599,7 @@ class Get
* The site edit views
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.site_edit_view');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Site.Edit.View')->get($key);
*/
public $siteEditView = [];
@@ -607,7 +607,7 @@ class Get
* The admin list view filter type
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.admin_filter_type');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Admin.Filter.Type')->get($key);
*/
public $adminFilterType = array();
@@ -671,7 +671,7 @@ class Get
* The Footable Script Builder
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.footable_scripts');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Footable.Scripts')->get($key);
*/
public $footableScripts = [];
@@ -727,7 +727,7 @@ class Get
* The custom alias builder
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.custom_alias');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Custom.Alias')->get($key);
*/
public $customAliasBuilder = [];
@@ -762,7 +762,7 @@ class Get
* Category other name bucket
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('category.other.name');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Category.Other.Name')->get($key);
*/
public $catOtherName = array();
@@ -770,7 +770,7 @@ class Get
* The field relations values
*
* @var array
- * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.field_relations');
+ * @deprecate 3.3 Use CFactory::_('Compiler.Builder.Field.Relations')->get($key);
*/
public $fieldRelations = array();
@@ -795,7 +795,7 @@ class Get
* The list join fields
*
* @var array
- * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.list_join');
+ * @deprecate 3.3 Use CFactory::_('Compiler.Builder.List.Join')->get($key);
*/
public $listJoinBuilder = array();
@@ -803,7 +803,7 @@ class Get
* The list head over ride
*
* @var array
- * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.list_head_override');
+ * @deprecate 3.3 Use CFactory::_('Compiler.Builder.List.Head.Override')->get($key);
*/
public $listHeadOverRide = array();
@@ -819,7 +819,7 @@ class Get
* The custom admin view tabs
*
* @var array
- * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.custom_tabs');
+ * @deprecate 3.3 Use CFactory::_('Compiler.Builder.Custom.Tabs')->get($key);
*/
public $customTabs = array();
@@ -843,7 +843,7 @@ class Get
* The get Module Script Switch
*
* @var array
- * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.get_module');
+ * @deprecate 3.3 Use CFactory::_('Compiler.Builder.Get.Module')->get($key);
*/
public $getModule = [];
@@ -851,7 +851,7 @@ class Get
* The template data
*
* @var array
- * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.template_data');
+ * @deprecate 3.3 Use CFactory::_('Compiler.Builder.Template.Data')->get($key);
*/
public $templateData = [];
@@ -859,7 +859,7 @@ class Get
* The layout data
*
* @var array
- * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.layout_data');
+ * @deprecate 3.3 Use CFactory::_('Compiler.Builder.Layout.Data')->get($key);
*/
public $layoutData = [];
@@ -907,7 +907,7 @@ class Get
* The site main get
*
* @var array
- * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.site_main_get');
+ * @deprecate 3.3 Use CFactory::_('Compiler.Builder.Site.Main.Get')->get($key);
*/
public $siteMainGet = [];
@@ -915,7 +915,7 @@ class Get
* The site dynamic get
*
* @var array
- * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.site_dynamic_get');
+ * @deprecate 3.3 Use CFactory::_('Compiler.Builder.Site.Dynamic.Get')->get($key);
*/
public $siteDynamicGet = [];
@@ -923,7 +923,7 @@ class Get
* The get AS lookup
*
* @var array
- * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.get_as_lookup');
+ * @deprecate 3.3 Use CFactory::_('Compiler.Builder.Get.As.Lookup')->get($key);
*/
public $getAsLookup = [];
@@ -931,7 +931,7 @@ class Get
* The site fields
*
* @var array
- * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.site_fields');
+ * @deprecate 3.3 Use CFactory::_('Compiler.Builder.Site.Fields')->get($key);
*/
public $siteFields = [];
@@ -963,7 +963,7 @@ class Get
* The Library Manager
*
* @var array
- * @deprecate 3.3 Use CFactory::_('Registry')->get('builder.library_manager');
+ * @deprecate 3.3 Use CFactory::_('Compiler.Builder.Library.Manager')->get($key);
*/
public $libManager = [];
@@ -1017,7 +1017,7 @@ class Get
* mysql table settings
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.mysql_table_setting');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Mysql.Table.Setting')->get($key);
*/
public $mysqlTableSetting = [];
@@ -1039,7 +1039,7 @@ class Get
$this->joomlaVersion = CFactory::_('Config')->joomla_version;
// set the minfy switch of the JavaScript @deprecated
$this->minify = CFactory::_('Config')->get('minify', 0);
- // set the global language @deprecated @deprecated
+ // set the global language @deprecated
$this->langTag = CFactory::_('Config')->get('lang_tag', 'en-GB');
// also set the helper class langTag (for safeStrings)
ComponentbuilderHelper::$langTag = CFactory::_('Config')->get('lang_tag', 'en-GB');
@@ -1225,9 +1225,7 @@ class Get
* @return void
* @deprecated 3.3 Use CFactory::_('Language')->set($target, $language, $string, $addPrefix);
*/
- public function setLangContent($target, $language, $string,
- $addPrefix = false
- )
+ public function setLangContent($target, $language, $string, $addPrefix = false)
{
CFactory::_('Language')->set($target, $language, $string, $addPrefix);
}
diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php
index 0da7c89ae..c5f72982d 100644
--- a/admin/helpers/compiler/b_Structure.php
+++ b/admin/helpers/compiler/b_Structure.php
@@ -54,7 +54,6 @@ class Structure extends Get
* The line counter
*
* @var int
- * @deprecated 3.3
* @deprecated 3.3 Use CFactory::_('Utilities.Counter')->line;
*/
public $lineCount = 0;
@@ -263,7 +262,7 @@ class Structure extends Get
* Static File Content
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Content')->active
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Content.One')->allActive()
*/
public $fileContentStatic = array();
@@ -271,6 +270,7 @@ class Structure extends Get
* Extention Custom Fields
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Extension.Custom.Fields')->get($key)
*/
public $extentionCustomfields = array();
@@ -296,14 +296,13 @@ class Structure extends Get
* @deprecated 3.3
*/
public $stdRootFiles
- = array('access.xml', 'config.xml', 'controller.php', 'index.html',
- 'README.txt');
+ = array('access.xml', 'config.xml', 'controller.php', 'index.html', 'README.txt');
/**
* Dynamic File Content
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Content')->_active
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Content.Multi')->allActive()
*/
public $fileContentDynamic = array();
@@ -418,17 +417,17 @@ class Structure extends Get
if (parent::__construct())
{
// set incase no extra admin folder are loaded
- CFactory::_('Content')->set('EXSTRA_ADMIN_FOLDERS', '');
+ CFactory::_('Compiler.Builder.Content.One')->set('EXSTRA_ADMIN_FOLDERS', '');
// set incase no extra site folder are loaded
- CFactory::_('Content')->set('EXSTRA_SITE_FOLDERS', '');
+ CFactory::_('Compiler.Builder.Content.One')->set('EXSTRA_SITE_FOLDERS', '');
// set incase no extra media folder are loaded
- CFactory::_('Content')->set('EXSTRA_MEDIA_FOLDERS', '');
+ CFactory::_('Compiler.Builder.Content.One')->set('EXSTRA_MEDIA_FOLDERS', '');
// set incase no extra admin files are loaded
- CFactory::_('Content')->set('EXSTRA_ADMIN_FILES', '');
+ CFactory::_('Compiler.Builder.Content.One')->set('EXSTRA_ADMIN_FILES', '');
// set incase no extra site files are loaded
- CFactory::_('Content')->set('EXSTRA_SITE_FILES', '');
+ CFactory::_('Compiler.Builder.Content.One')->set('EXSTRA_SITE_FILES', '');
// set incase no extra media files are loaded
- CFactory::_('Content')->set('EXSTRA_MEDIA_FILES', '');
+ CFactory::_('Compiler.Builder.Content.One')->set('EXSTRA_MEDIA_FILES', '');
// make sure there is no old build
CFactory::_('Utilities.Folder')->remove(CFactory::_('Utilities.Paths')->component_path);
// load the libraries files/folders and url's
@@ -633,7 +632,6 @@ class Structure extends Get
*
* @return boolean
* @deprecated 3.3 Use CFactory::_('Component.Structure.Multiple')->build();
- *
*/
private function setDynamique()
{
@@ -671,7 +669,7 @@ class Structure extends Get
else
{
// check if this is a custom field that should be moved
- if (isset($this->extentionCustomfields[$field['type_name']]))
+ if (CFactory::_('Compiler.Builder.Extension.Custom.Fields')->exists($field['type_name']))
{
$check = md5($path . 'type' . $field['type_name']);
// lets check if we already moved this
diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php
index 8261e7e87..efa8acd1c 100644
--- a/admin/helpers/compiler/c_Fields.php
+++ b/admin/helpers/compiler/c_Fields.php
@@ -15,13 +15,8 @@ defined('_JEXEC') or die('Restricted access');
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
-use VDM\Joomla\Utilities\ObjectHelper;
-use VDM\Joomla\Utilities\GetHelper;
-use VDM\Joomla\Utilities\String\FieldHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
-use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
-use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
/**
* Compiler class
@@ -34,7 +29,7 @@ class Fields extends Structure
* Metadate Switch
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.meta_data');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Meta.Data')->get($key);
*/
public $metadataBuilder = array();
@@ -42,7 +37,7 @@ class Fields extends Structure
* View access Switch
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.access_switch');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Access.Switch')->get($key);
*/
public $accessBuilder = array();
@@ -50,7 +45,7 @@ class Fields extends Structure
* edit view tabs counter
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.tab_counter');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Tab.Counter')->get($key);
*/
public $tabCounter = array();
@@ -58,7 +53,7 @@ class Fields extends Structure
* layout builder
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.layout');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Layout')->get($key);
*/
public $layoutBuilder = array();
@@ -66,7 +61,7 @@ class Fields extends Structure
* permissions builder
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.has_permissions');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Has.Permissions')->get($key);
*/
public $hasPermissions = array();
@@ -74,6 +69,7 @@ class Fields extends Structure
* used to fix the zero order
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Order.Zero')->get($key);
*/
private $zeroOrderFix = array();
@@ -81,6 +77,7 @@ class Fields extends Structure
* Site field data
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Site.Field.Data')->get($key);
*/
public $siteFieldData = array();
@@ -88,7 +85,7 @@ class Fields extends Structure
* list of fields that are not being escaped
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.do_not_escape');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Do.Not.Escape')->get($key);
*/
public $doNotEscape = array();
@@ -96,7 +93,7 @@ class Fields extends Structure
* list of classes used in the list view for the fields
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->set('builder.list_field_class');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.List.Field.Class')->set($key, true);
*/
public $listFieldClass = array();
@@ -104,7 +101,7 @@ class Fields extends Structure
* tags builder
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.tags');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Tags')->get($key);
*/
public $tagsBuilder = array();
@@ -112,7 +109,7 @@ class Fields extends Structure
* query builder
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.database_tables');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Database.Tables')->get($key);
*/
public $queryBuilder = array();
@@ -120,7 +117,7 @@ class Fields extends Structure
* unique keys for database field
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.database_unique_keys');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Database.Unique.Keys')->get($key);
*/
public $dbUniqueKeys = array();
@@ -128,7 +125,7 @@ class Fields extends Structure
* unique guid swtich
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.database_unique_guid');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Database.Unique.Guid')->get($key);
*/
public $dbUniqueGuid = array();
@@ -136,7 +133,7 @@ class Fields extends Structure
* keys for database field
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.database_keys');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Database.Keys')->get($key);
*/
public $dbKeys = array();
@@ -144,7 +141,7 @@ class Fields extends Structure
* history builder
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.history');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.History')->get($key);
*/
public $historyBuilder = array();
@@ -152,7 +149,7 @@ class Fields extends Structure
* alias builder
*
* @var array
- * @deprecated 3.3 CFactory::_('Registry')->get('builder.alias');
+ * @deprecated 3.3 CFactory::_('Compiler.Builder.Alias')->get($key);
*/
public $aliasBuilder = array();
@@ -160,7 +157,7 @@ class Fields extends Structure
* title builder
*
* @var array
- * @deprecated 3.3 CFactory::_('Registry')->get('builder.title');
+ * @deprecated 3.3 CFactory::_('Compiler.Builder.Title')->get($key);
*/
public $titleBuilder = array();
@@ -168,7 +165,7 @@ class Fields extends Structure
* list builder
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.list');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Lists')->get($key);
*/
public $listBuilder = array();
@@ -176,7 +173,7 @@ class Fields extends Structure
* custom Builder List
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.custom_list');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Custom.List')->get($key);
*/
public $customBuilderList = array();
@@ -184,7 +181,7 @@ class Fields extends Structure
* Hidden Fields Builder
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.hidden_fields');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Hidden.Fields')->get($key);
*/
public $hiddenFieldsBuilder = array();
@@ -192,7 +189,7 @@ class Fields extends Structure
* INT Field Builder
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.integer_fields');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Integer.Fields')->get($key);
*/
public $intFieldsBuilder = array();
@@ -200,7 +197,7 @@ class Fields extends Structure
* Dynamic Fields Builder
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.dynamic_fields');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Dynamic.Fields')->get($key);
*/
public $dynamicfieldsBuilder = array();
@@ -208,7 +205,7 @@ class Fields extends Structure
* Main text Builder
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.main_text_field');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Main.Text.Field')->get($key);
*/
public $maintextBuilder = array();
@@ -216,6 +213,7 @@ class Fields extends Structure
* Custom Builder
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Custom.Field')->get($key);
*/
public $customBuilder = array();
@@ -223,7 +221,7 @@ class Fields extends Structure
* Custom Field Links Builder
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.custom_field_links');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Custom.Field.Links')->get($key);
*/
public $customFieldLinksBuilder = array();
@@ -231,6 +229,7 @@ class Fields extends Structure
* Set Script for User Switch
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Script.User.Switch')->get($key);
*/
public $setScriptUserSwitch = array();
@@ -238,6 +237,7 @@ class Fields extends Structure
* Set Script for Media Switch
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Script.Media.Switch')->get($key);
*/
public $setScriptMediaSwitch = array();
@@ -245,6 +245,7 @@ class Fields extends Structure
* Category builder
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Category')->get($key);
*/
public $categoryBuilder = array();
@@ -252,6 +253,7 @@ class Fields extends Structure
* Category Code builder
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Category.Code')->get($key);
*/
public $catCodeBuilder = array();
@@ -259,6 +261,7 @@ class Fields extends Structure
* Check Box builder
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Check.Box')->get($key);
*/
public $checkboxBuilder = array();
@@ -266,6 +269,7 @@ class Fields extends Structure
* Json String Builder
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Json.String')->get($key);
*/
public $jsonStringBuilder = array();
@@ -273,6 +277,7 @@ class Fields extends Structure
* Json String Builder for return values to array
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Json.Item.Array')->get($key);
*/
public $jsonItemBuilderArray = array();
@@ -280,6 +285,7 @@ class Fields extends Structure
* Json Item Builder
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Json.Item')->get($key);
*/
public $jsonItemBuilder = array();
@@ -287,6 +293,7 @@ class Fields extends Structure
* Base 64 Builder
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Base.Six.Four')->get($key);
*/
public $base64Builder = array();
@@ -294,6 +301,7 @@ class Fields extends Structure
* Basic Encryption Field Modeling
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Model.Basic.Field')->get($key);
*/
public $basicFieldModeling = array();
@@ -301,6 +309,7 @@ class Fields extends Structure
* WHMCS Encryption Field Modeling
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Model.Whmcs.Field')->get($key);
*/
public $whmcsFieldModeling = array();
@@ -308,6 +317,7 @@ class Fields extends Structure
* Medium Encryption Field Modeling
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Model.Medium.Field')->get($key);
*/
public $mediumFieldModeling = array();
@@ -315,6 +325,7 @@ class Fields extends Structure
* Expert Field Modeling
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Model.Expert.Field')->get($key);
*/
public $expertFieldModeling = array();
@@ -322,6 +333,7 @@ class Fields extends Structure
* Expert Mode Initiator
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Model.Expert.Field.Initiator')->get($key);
*/
public $expertFieldModelInitiator = array();
@@ -329,6 +341,7 @@ class Fields extends Structure
* Get Items Method List String Fix Builder
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Items.Method.List.String')->get($key);
*/
public $getItemsMethodListStringFixBuilder = array();
@@ -336,6 +349,7 @@ class Fields extends Structure
* Get Items Method Eximport String Fix Builder
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Items.Method.Eximport.String')->get($key);
*/
public $getItemsMethodEximportStringFixBuilder = array();
@@ -343,6 +357,7 @@ class Fields extends Structure
* Selection Translation Fix Builder
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Selection.Translation')->get($key);
*/
public $selectionTranslationFixBuilder = array();
@@ -350,6 +365,7 @@ class Fields extends Structure
* Sort Builder
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Sort')->get($key);
*/
public $sortBuilder = array();
@@ -357,6 +373,7 @@ class Fields extends Structure
* Search Builder
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Search')->get($key);
*/
public $searchBuilder = array();
@@ -364,6 +381,7 @@ class Fields extends Structure
* Filter Builder
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Filter')->get($key);
*/
public $filterBuilder = array();
@@ -371,6 +389,7 @@ class Fields extends Structure
* Set Group Control
*
* @var array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Field.Group.Control')->get($key);
*/
public $setGroupControl = array();
@@ -378,7 +397,7 @@ class Fields extends Structure
* Set Field Names
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.field_names');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Field.Names')->get($key);
*/
public $fieldsNames = array();
@@ -386,7 +405,7 @@ class Fields extends Structure
* Default Fields set to publishing
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->set('builder.new_publishing_fields');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.New.Publishing.Fields')->set($key);
*/
public $newPublishingFields = array();
@@ -394,7 +413,7 @@ class Fields extends Structure
* Default Fields set to publishing
*
* @var array
- * @deprecated 3.3 Use CFactory::_('Registry')->get('builder.moved_publishing_fields');
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Moved.Publishing.Fields')->set($key);
*/
public $movedPublishingFields = array();
@@ -407,201 +426,12 @@ class Fields extends Structure
* @param string $nameListCode The list view name
*
* @return string The fields set in xml
- *
+ * @deprecated 3.3 Use CFactory::_('Compiler.Creator.Fieldset')->get(...);
*/
- public function setFieldSet($view, $component, $nameSingleCode,
- $nameListCode
- ) {
- // setup the fieldset of this view
- if (isset($view['settings']->fields)
- && ArrayHelper::check($view['settings']->fields))
- {
- // add metadata to the view
- if (isset($view['metadata']) && $view['metadata'])
- {
- CFactory::_('Registry')->set('builder.meta_data.' . $nameSingleCode, $nameListCode);
- }
- // add access to the view
- if (isset($view['access']) && $view['access'])
- {
- CFactory::_('Registry')->set('builder.access_switch.' . $nameSingleCode, true);
- CFactory::_('Registry')->set('builder.access_switch_list.' . $nameListCode, true);
- }
- // main lang prefix
- $langView = CFactory::_('Config')->lang_prefix . '_'
- . CFactory::_('Placeholder')->get('VIEW');
- $langViews = CFactory::_('Config')->lang_prefix . '_'
- . CFactory::_('Placeholder')->get('VIEWS');
- // set default lang
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langView, $view['settings']->name_single
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews, $view['settings']->name_list
- );
- // set global item strings
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_ARCHIVED',
- "%s " . $view['settings']->name_list . " archived."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_ARCHIVED_1',
- "%s " . $view['settings']->name_single . " archived."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_CHECKED_IN_0',
- "No " . $view['settings']->name_single
- . " successfully checked in."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_CHECKED_IN_1',
- "%d " . $view['settings']->name_single
- . " successfully checked in."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_CHECKED_IN_MORE',
- "%d " . $view['settings']->name_list
- . " successfully checked in."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_DELETED',
- "%s " . $view['settings']->name_list . " deleted."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_DELETED_1',
- "%s " . $view['settings']->name_single . " deleted."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_FEATURED',
- "%s " . $view['settings']->name_list . " featured."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_FEATURED_1',
- "%s " . $view['settings']->name_single . " featured."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_PUBLISHED',
- "%s " . $view['settings']->name_list . " published."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_PUBLISHED_1',
- "%s " . $view['settings']->name_single . " published."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_TRASHED',
- "%s " . $view['settings']->name_list . " trashed."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_TRASHED_1',
- "%s " . $view['settings']->name_single . " trashed."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_UNFEATURED',
- "%s " . $view['settings']->name_list . " unfeatured."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_UNFEATURED_1',
- "%s " . $view['settings']->name_single . " unfeatured."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_UNPUBLISHED',
- "%s " . $view['settings']->name_list . " unpublished."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_UNPUBLISHED_1',
- "%s " . $view['settings']->name_single . " unpublished."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_FAILED_PUBLISHING',
- "%s " . $view['settings']->name_list . " failed publishing."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_N_ITEMS_FAILED_PUBLISHING_1',
- "%s " . $view['settings']->name_single . " failed publishing."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_BATCH_OPTIONS',
- "Batch process the selected " . $view['settings']->name_list
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langViews . '_BATCH_TIP',
- "All changes will be applied to all selected "
- . $view['settings']->name_list
- );
- // set some basic defaults
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langView . '_ERROR_UNIQUE_ALIAS',
- "Another " . $view['settings']->name_single
- . " has the same alias."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langView . '_CREATED_DATE_LABEL', "Created Date"
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langView . '_CREATED_DATE_DESC',
- "The date this " . $view['settings']->name_single
- . " was created."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langView . '_MODIFIED_DATE_LABEL', "Modified Date"
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langView . '_MODIFIED_DATE_DESC',
- "The date this " . $view['settings']->name_single
- . " was modified."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langView . '_CREATED_BY_LABEL', "Created By"
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langView . '_CREATED_BY_DESC',
- "The user that created this " . $view['settings']->name_single
- . "."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langView . '_MODIFIED_BY_LABEL', "Modified By"
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langView . '_MODIFIED_BY_DESC',
- "The last user that modified this "
- . $view['settings']->name_single . "."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langView . '_ORDERING_LABEL', "Ordering"
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langView . '_VERSION_LABEL', "Version"
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langView . '_VERSION_DESC',
- "A count of the number of times this "
- . $view['settings']->name_single . " has been revised."
- );
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langView . '_SAVE_WARNING',
- "Alias already existed so a number was added at the end. You can re-edit the "
- . $view['settings']->name_single . " to customise the alias."
- );
- // check what type of field builder to use
- if (CFactory::_('Config')->get('field_builder_type', 2) == 1)
- {
- // build field set using string manipulation
- return $this->stringFieldSet(
- $view, $component, $nameSingleCode, $nameListCode,
- $langView, $langViews
- );
- }
- else
- {
- // build field set with simpleXMLElement class
- return $this->simpleXMLFieldSet(
- $view, $component, $nameSingleCode, $nameListCode,
- $langView, $langViews
- );
- }
- }
-
- return '';
+ public function setFieldSet(array $view, string $component, string $nameSingleCode, string $nameListCode)
+ {
+ return CFactory::_('Compiler.Creator.Fieldset')->
+ get($view, $component, $nameSingleCode, $nameListCode);
}
/**
@@ -615,403 +445,19 @@ class Fields extends Structure
* @param string $langViews The language string of the views
*
* @return string The fields set in xml
- *
+ * @deprecated 3.3 Use CFactory::_('Compiler.Creator.Fieldset.String')->get(...);
*/
- protected function stringFieldSet($view, $component, $nameSingleCode,
- $nameListCode, $langView, $langViews
- ) {
- // set the read only
- $readOnly = false;
- if ($view['settings']->type == 2)
- {
- $readOnly = Indent::_(3) . 'readonly="true"' . PHP_EOL . Indent::_(
- 3
- ) . 'disabled="true"';
- }
- // start adding dynamc fields
- $dynamicFields = '';
- // set the custom table key
- $dbkey = 'g';
- // for plugin event TODO change event api signatures
- $placeholders = CFactory::_('Placeholder')->active;
- $component_context = CFactory::_('Config')->component_context;
- // Trigger Event: jcb_ce_onBeforeBuildFields
- CFactory::_('Event')->trigger(
- 'jcb_ce_onBeforeBuildFields',
- array(&$component_context, &$dynamicFields, &$readOnly,
- &$dbkey, &$view, &$component, &$nameSingleCode,
- &$nameListCode, &$placeholders, &$langView,
- &$langViews)
+ protected function stringFieldSet(array $view, string $component, string $nameSingleCode, string $nameListCode,
+ string $langView, string $langViews): string
+ {
+ return CFactory::_('Compiler.Creator.Fieldset.String')->get(
+ $view,
+ $component,
+ $nameSingleCode,
+ $nameListCode,
+ $langView,
+ $langViews
);
- unset($placeholders);
- // TODO we should add the global and local view switch if field for front end
- foreach ($view['settings']->fields as $field)
- {
- $dynamicFields .= $this->setDynamicField(
- $field, $view, $view['settings']->type, $langView,
- $nameSingleCode, $nameListCode, CFactory::_('Placeholder')->active, $dbkey,
- true
- );
- }
- // for plugin event TODO change event api signatures
- $placeholders = CFactory::_('Placeholder')->active;
- // Trigger Event: jcb_ce_onAfterBuildFields
- CFactory::_('Event')->trigger(
- 'jcb_ce_onAfterBuildFields',
- array(&$component_context, &$dynamicFields, &$readOnly,
- &$dbkey, &$view, &$component, &$nameSingleCode,
- &$nameListCode, &$placeholders, &$langView,
- &$langViews)
- );
- unset($placeholders);
- // set the default fields
- $fieldSet = array();
- $fieldSet[] = '
";
- // check if metadata is added to this view
- if (CFactory::_('Registry')->isString('builder.meta_data.' . $nameSingleCode))
- {
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.robots')
- || !CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.rights')
- || !CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.author'))
- {
- $fieldSet[] = PHP_EOL . Indent::_(1) . "";
- $fieldSet[] = Indent::_(1) . "';
- $fieldSet[] = Indent::_(2) . '";
- $fieldSet[] = Indent::_(1) . "";
- }
- }
-
- // return the set
- return implode(PHP_EOL, $fieldSet);
}
/**
@@ -1024,463 +470,20 @@ class Fields extends Structure
* @param string $langView The language string of the view
* @param string $langViews The language string of the views
*
- * @return string The fields set in xml
- *
+ * @return string The fields set in string xml
+ * @deprecated 3.3 Use CFactory::_('Compiler.Creator.Fieldset.XML')->get(...);
*/
- protected function simpleXMLFieldSet($view, $component, $nameSingleCode,
- $nameListCode, $langView, $langViews
- ) {
- // set the read only
- $readOnlyXML = array();
- if ($view['settings']->type == 2)
- {
- $readOnlyXML['readonly'] = true;
- $readOnlyXML['disabled'] = true;
- }
- // start adding dynamc fields
- $dynamicFieldsXML = array();
- // set the custom table key
- $dbkey = 'g';
- // for plugin event TODO change event api signatures
- $placeholders = CFactory::_('Placeholder')->active;
- $component_context = CFactory::_('Config')->component_context;
- // Trigger Event: jcb_ce_onBeforeBuildFields
- CFactory::_('Event')->trigger(
- 'jcb_ce_onBeforeBuildFields',
- array(&$component_context, &$dynamicFieldsXML, &$readOnlyXML,
- &$dbkey, &$view, &$component, &$nameSingleCode,
- &$nameListCode, &$placeholders, &$langView,
- &$langViews)
+ protected function simpleXMLFieldSet(array $view, string $component, string $nameSingleCode,
+ string $nameListCode, string $langView, string $langViews): string
+ {
+ return CFactory::_('Compiler.Creator.Fieldset.XML')->get(
+ $view,
+ $component,
+ $nameSingleCode,
+ $nameListCode,
+ $langView,
+ $langViews
);
- unset($placeholders);
- // TODO we should add the global and local view switch if field for front end
- foreach ($view['settings']->fields as $field)
- {
- $dynamicFieldsXML[] = $this->setDynamicField(
- $field, $view, $view['settings']->type, $langView,
- $nameSingleCode, $nameListCode, CFactory::_('Placeholder')->active, $dbkey,
- true
- );
- }
- // for plugin event TODO change event api signatures
- $placeholders = CFactory::_('Placeholder')->active;
- // Trigger Event: jcb_ce_onAfterBuildFields
- CFactory::_('Event')->trigger(
- 'jcb_ce_onAfterBuildFields',
- array(&$component_context, &$dynamicFieldsXML, &$readOnlyXML,
- &$dbkey, &$view, &$component, &$nameSingleCode,
- &$nameListCode, &$placeholders, &$langView,
- &$langViews)
- );
- unset($placeholders);
- // set the default fields
- $XML = new simpleXMLElement('');
- $fieldSetXML = $XML->addChild('fieldset');
- $fieldSetXML->addAttribute('name', 'details');
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML, Line::_(__Line__, __Class__) . " Default Fields."
- );
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML,
- Line::_(__Line__, __Class__) . " Id Field. Type: Text (joomla)"
- );
- // if id is not set
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.id'))
- {
- $attributes = array(
- 'name' => 'id',
- 'type' => 'text',
- 'class' => 'readonly',
- 'readonly' => "true",
- 'label' => 'JGLOBAL_FIELD_ID_LABEL',
- 'description' => 'JGLOBAL_FIELD_ID_DESC',
- 'size' => 10,
- 'default' => 0
- );
- $fieldXML = $fieldSetXML->addChild('field');
- ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
- // count the static field created
- CFactory::_('Utilities.Counter')->field++;
- }
- // if created is not set
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.created'))
- {
- $attributes = array(
- 'name' => 'created',
- 'type' => 'calendar',
- 'label' => $langView . '_CREATED_DATE_LABEL',
- 'description' => $langView . '_CREATED_DATE_DESC',
- 'size' => 22,
- 'format' => '%Y-%m-%d %H:%M:%S',
- 'filter' => 'user_utc'
- );
- $attributes = array_merge($attributes, $readOnlyXML);
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML, Line::_(__Line__, __Class__)
- . " Date Created Field. Type: Calendar (joomla)"
- );
- $fieldXML = $fieldSetXML->addChild('field');
- ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
- // count the static field created
- CFactory::_('Utilities.Counter')->field++;
- }
- // if created_by is not set
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.created_by'))
- {
- $attributes = array(
- 'name' => 'created_by',
- 'type' => 'user',
- 'label' => $langView . '_CREATED_BY_LABEL',
- 'description' => $langView . '_CREATED_BY_DESC',
- );
- $attributes = array_merge($attributes, $readOnlyXML);
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML, Line::_(__Line__, __Class__)
- . " User Created Field. Type: User (joomla)"
- );
- $fieldXML = $fieldSetXML->addChild('field');
- ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
- // count the static field created
- CFactory::_('Utilities.Counter')->field++;
- }
- // if published is not set
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.published'))
- {
- $attributes = array(
- 'name' => 'published',
- 'type' => 'list',
- 'label' => 'JSTATUS'
- );
- $attributes = array_merge($attributes, $readOnlyXML);
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML, Line::_(__Line__, __Class__)
- . " Published Field. Type: List (joomla)"
- );
- $fieldXML = $fieldSetXML->addChild('field');
- ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
- // count the static field created
- CFactory::_('Utilities.Counter')->field++;
- foreach (
- array('JPUBLISHED' => 1, 'JUNPUBLISHED' => 0, 'JARCHIVED' => 2,
- 'JTRASHED' => -2) as $text => $value
- )
- {
- $optionXML = $fieldXML->addChild('option');
- $optionXML->addAttribute('value', $value);
- $optionXML[] = $text;
- }
- }
- // if modified is not set
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.modified'))
- {
- $attributes = array(
- 'name' => 'modified',
- 'type' => 'calendar',
- 'class' => 'readonly',
- 'label' => $langView . '_MODIFIED_DATE_LABEL',
- 'description' => $langView . '_MODIFIED_DATE_DESC',
- 'size' => 22,
- 'readonly' => "true",
- 'format' => '%Y-%m-%d %H:%M:%S',
- 'filter' => 'user_utc'
- );
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML, Line::_(__Line__, __Class__)
- . " Date Modified Field. Type: Calendar (joomla)"
- );
- $fieldXML = $fieldSetXML->addChild('field');
- ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
- // count the static field created
- CFactory::_('Utilities.Counter')->field++;
- }
- // if modified_by is not set
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.modified_by'))
- {
- $attributes = array(
- 'name' => 'modified_by',
- 'type' => 'user',
- 'label' => $langView . '_MODIFIED_BY_LABEL',
- 'description' => $langView . '_MODIFIED_BY_DESC',
- 'class' => 'readonly',
- 'readonly' => 'true',
- 'filter' => 'unset'
- );
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML, Line::_(__Line__, __Class__)
- . " User Modified Field. Type: User (joomla)"
- );
- $fieldXML = $fieldSetXML->addChild('field');
- ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
- // count the static field created
- CFactory::_('Utilities.Counter')->field++;
- }
- // check if view has access
- if (CFactory::_('Registry')->exists('builder.access_switch.' . $nameSingleCode)
- && !CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.access'))
- {
- $attributes = array(
- 'name' => 'access',
- 'type' => 'accesslevel',
- 'label' => 'JFIELD_ACCESS_LABEL',
- 'description' => 'JFIELD_ACCESS_DESC',
- 'default' => 1,
- 'required' => "false"
- );
- $attributes = array_merge($attributes, $readOnlyXML);
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML, Line::_(__Line__, __Class__)
- . " Access Field. Type: Accesslevel (joomla)"
- );
- $fieldXML = $fieldSetXML->addChild('field');
- ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
- // count the static field created
- CFactory::_('Utilities.Counter')->field++;
- }
- // if ordering is not set
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.ordering'))
- {
- $attributes = array(
- 'name' => 'ordering',
- 'type' => 'number',
- 'class' => 'inputbox validate-ordering',
- 'label' => $langView . '_ORDERING_LABEL',
- 'description' => '',
- 'default' => 0,
- 'size' => 6,
- 'required' => "false"
- );
- $attributes = array_merge($attributes, $readOnlyXML);
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML, Line::_(__Line__, __Class__)
- . " Ordering Field. Type: Numbers (joomla)"
- );
- $fieldXML = $fieldSetXML->addChild('field');
- ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
- // count the static field created
- CFactory::_('Utilities.Counter')->field++;
- }
- // if version is not set
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.version'))
- {
- $attributes = array(
- 'name' => 'version',
- 'type' => 'text',
- 'class' => 'readonly',
- 'label' => $langView . '_VERSION_LABEL',
- 'description' => $langView . '_VERSION_DESC',
- 'size' => 6,
- 'readonly' => "true",
- 'filter' => 'unset'
- );
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML,
- Line::_(__Line__, __Class__) . " Version Field. Type: Text (joomla)"
- );
- $fieldXML = $fieldSetXML->addChild('field');
- ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
- // count the static field created
- CFactory::_('Utilities.Counter')->field++;
- }
- // check if metadata is added to this view
- if (CFactory::_('Registry')->isString('builder.meta_data.' . $nameSingleCode))
- {
- // metakey
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.metakey'))
- {
- $attributes = array(
- 'name' => 'metakey',
- 'type' => 'textarea',
- 'label' => 'JFIELD_META_KEYWORDS_LABEL',
- 'description' => 'JFIELD_META_KEYWORDS_DESC',
- 'rows' => 3,
- 'cols' => 30
- );
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML, Line::_(__Line__, __Class__)
- . " Metakey Field. Type: Textarea (joomla)"
- );
- $fieldXML = $fieldSetXML->addChild('field');
- ComponentbuilderHelper::xmlAddAttributes(
- $fieldXML, $attributes
- );
- // count the static field created
- CFactory::_('Utilities.Counter')->field++;
- }
- // metadesc
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.metadesc'))
- {
- $attributes['name'] = 'metadesc';
- $attributes['label'] = 'JFIELD_META_DESCRIPTION_LABEL';
- $attributes['description'] = 'JFIELD_META_DESCRIPTION_DESC';
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML, Line::_(__Line__, __Class__)
- . " Metadesc Field. Type: Textarea (joomla)"
- );
- $fieldXML = $fieldSetXML->addChild('field');
- ComponentbuilderHelper::xmlAddAttributes(
- $fieldXML, $attributes
- );
- // count the static field created
- CFactory::_('Utilities.Counter')->field++;
- }
- }
- // fix the permissions field "title" issue gh-629
- // check if the title is not already set
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.title')
- && $this->hasPermissionsSet($view, $nameSingleCode))
- {
- // set the field/tab name
- $field_name = "title";
- $tab_name = "publishing";
-
- $attributes = array(
- 'name' => $field_name,
- 'type' => 'hidden',
- 'default' => $component . ' ' . $nameSingleCode
- );
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML,
- Line::_(__Line__, __Class__)
- . " Was added due to Permissions JS needing a Title field"
- );
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML,
- Line::_(__Line__, __Class__)
- . " Let us know at gh-629 should this change"
- );
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML,
- Line::_(__Line__, __Class__)
- . " https://github.com/vdm-io/Joomla-Component-Builder/issues/629#issuecomment-750117235"
- );
- $fieldXML = $fieldSetXML->addChild('field');
- ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
- // count the static field created
- CFactory::_('Utilities.Counter')->field++;
- // setup needed field values for layout
- $field_array = array();
- $field_array['order_edit'] = 0;
- $field_array['tab'] = 15;
- $field_array['alignment'] = 1;
- // make sure it gets added to view
- $this->setLayoutBuilder(
- $nameSingleCode, $tab_name, $field_name, $field_array
- );
- }
- // load the dynamic fields now
- if (count((array) $dynamicFieldsXML))
- {
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML, Line::_(__Line__, __Class__) . " Dynamic Fields."
- );
- foreach ($dynamicFieldsXML as $dynamicfield)
- {
- ComponentbuilderHelper::xmlAppend($fieldSetXML, $dynamicfield);
- }
- }
- // check if metadata is added to this view
- if (CFactory::_('Registry')->isString('builder.meta_data.' . $nameSingleCode))
- {
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.robots')
- || !CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.author')
- || !CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.rights'))
- {
- ComponentbuilderHelper::xmlComment(
- $fieldSetXML, Line::_(__Line__, __Class__) . " Metadata Fields"
- );
- $fieldsXML = $fieldSetXML->addChild('fields');
- $fieldsXML->addAttribute('name', 'metadata');
- $fieldsXML->addAttribute(
- 'label', 'JGLOBAL_FIELDSET_METADATA_OPTIONS'
- );
- $fieldsFieldSetXML = $fieldsXML->addChild('fieldset');
- $fieldsFieldSetXML->addAttribute('name', 'vdmmetadata');
- $fieldsFieldSetXML->addAttribute(
- 'label', 'JGLOBAL_FIELDSET_METADATA_OPTIONS'
- );
- // robots
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.robots'))
- {
- ComponentbuilderHelper::xmlComment(
- $fieldsFieldSetXML, Line::_(__Line__, __Class__)
- . " Robots Field. Type: List (joomla)"
- );
- $robots = $fieldsFieldSetXML->addChild('field');
- $attributes = array(
- 'name' => 'robots',
- 'type' => 'list',
- 'label' => 'JFIELD_METADATA_ROBOTS_LABEL',
- 'description' => 'JFIELD_METADATA_ROBOTS_DESC'
- );
- ComponentbuilderHelper::xmlAddAttributes(
- $robots, $attributes
- );
- // count the static field created
- CFactory::_('Utilities.Counter')->field++;
- $options = array(
- 'JGLOBAL_USE_GLOBAL' => '',
- 'JGLOBAL_INDEX_FOLLOW' => 'index, follow',
- 'JGLOBAL_NOINDEX_FOLLOW' => 'noindex, follow',
- 'JGLOBAL_INDEX_NOFOLLOW' => 'index, nofollow',
- 'JGLOBAL_NOINDEX_NOFOLLOW' => 'noindex, nofollow',
- );
- foreach ($options as $text => $value)
- {
- $option = $robots->addChild('option');
- $option->addAttribute('value', $value);
- $option[] = $text;
- }
- }
- // author
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.author'))
- {
- ComponentbuilderHelper::xmlComment(
- $fieldsFieldSetXML, Line::_(__Line__, __Class__)
- . " Author Field. Type: Text (joomla)"
- );
- $author = $fieldsFieldSetXML->addChild('field');
- $attributes = array(
- 'name' => 'author',
- 'type' => 'text',
- 'label' => 'JAUTHOR',
- 'description' => 'JFIELD_METADATA_AUTHOR_DESC',
- 'size' => 20
- );
- ComponentbuilderHelper::xmlAddAttributes(
- $author, $attributes
- );
- // count the static field created
- CFactory::_('Utilities.Counter')->field++;
- }
- // rights
- if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.rights'))
- {
- ComponentbuilderHelper::xmlComment(
- $fieldsFieldSetXML, Line::_(__Line__, __Class__)
- . " Rights Field. Type: Textarea (joomla)"
- );
- $rights = $fieldsFieldSetXML->addChild('field');
- $attributes = array(
- 'name' => 'rights',
- 'type' => 'textarea',
- 'label' => 'JFIELD_META_RIGHTS_LABEL',
- 'description' => 'JFIELD_META_RIGHTS_DESC',
- 'required' => 'false',
- 'filter' => 'string',
- 'cols' => 30,
- 'rows' => 2
- );
- ComponentbuilderHelper::xmlAddAttributes(
- $rights, $attributes
- );
- // count the static field created
- CFactory::_('Utilities.Counter')->field++;
- }
- }
- }
-
- // return the set
- return $this->xmlPrettyPrint($XML, 'fieldset');
}
/**
@@ -1490,74 +493,11 @@ class Fields extends Structure
* @param string $nameSingleCode View Single Code Name
*
* @return boolean true if it has permisssions
- *
+ * @deprecated 3.3 Use CFactory::_('Adminview.Permission')->check($view, $nameSingleCode);
*/
protected function hasPermissionsSet(&$view, &$nameSingleCode)
{
- // first check if we have checked this already
- if (!CFactory::_('Registry')->exists('builder.has_permissions.' . $nameSingleCode))
- {
- // when a view has history, it has permissions
- // since it tracks the version access
- if (isset($view['history']) && $view['history'] == 1)
- {
- // set the permission for later
- CFactory::_('Registry')->set('builder.has_permissions.' . $nameSingleCode, true);
-
- // break out here
- return true;
- }
- // check if the view has permissions
- if (isset($view['settings'])
- && ArrayHelper::check(
- $view['settings']->permissions, true
- ))
- {
- foreach ($view['settings']->permissions as $per)
- {
- // check if the permission targets the view
- // 1 = view
- // 3 = both view & component
- if (isset($per['implementation'])
- && (
- $per['implementation'] == 1
- || $per['implementation'] == 3
- ))
- {
- // set the permission for later
- CFactory::_('Registry')->set('builder.has_permissions.' . $nameSingleCode, true);
-
- // break out here
- return true;
- }
- }
- }
- // check if the fields has permissions
- if (isset($view['settings'])
- && ArrayHelper::check(
- $view['settings']->fields, true
- ))
- {
- foreach ($view['settings']->fields as $field)
- {
- // if a field has any permissions
- // the a view has permissions
- if (isset($field['permission'])
- && ArrayHelper::check(
- $field['permission'], true
- ))
- {
- // set the permission for later
- CFactory::_('Registry')->set('builder.has_permissions.' . $nameSingleCode, true);
-
- // break out here
- return true;
- }
- }
- }
- }
-
- return CFactory::_('Registry')->exists('builder.has_permissions.' . $nameSingleCode);
+ return CFactory::_('Adminview.Permission')->check($view, $nameSingleCode);
}
/**
@@ -1566,11 +506,11 @@ class Fields extends Structure
* @param string $view View the field belongs to
* @param string $name The name of the field
*
- *
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Field.Names')->set($view . '.' . $name, $name);
*/
public function setFieldsNames(&$view, &$name)
{
- CFactory::_('Registry')->set('builder.field_names.' . $view . '.' . $name, $name);
+ CFactory::_('Compiler.Builder.Field.Names')->set($view . '.' . $name, $name);
}
/**
@@ -1586,171 +526,14 @@ class Fields extends Structure
* @param string $dbkey The the custom table key
* @param boolean $build The switch to set the build option
*
- * @return SimpleXMLElement The complete field in xml
- *
+ * @return mixed The complete field
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Field.Names')->get(...);
*/
public function setDynamicField(&$field, &$view, &$viewType, &$langView,
- &$nameSingleCode, &$nameListCode, &$placeholders, &$dbkey, $build
- ) {
- // set default return
- if (CFactory::_('Config')->get('field_builder_type', 2) == 1)
- {
- // string manipulation
- $dynamicField = '';
- }
- else
- {
- // simpleXMLElement class
- $dynamicField = false;
- }
- // make sure we have settings
- if (isset($field['settings'])
- && ObjectHelper::check(
- $field['settings']
- ))
- {
- // reset some values
- $name = CFactory::_('Field.Name')->get($field, $nameListCode);
- $typeName = CFactory::_('Field.Type.Name')->get($field);
- $multiple = false;
- $langLabel = '';
- $fieldSet = '';
- $fieldAttributes = array();
- // set field attributes
- $fieldAttributes = $this->setFieldAttributes(
- $field, $viewType, $name, $typeName, $multiple, $langLabel,
- $langView, $nameListCode, $nameSingleCode, $placeholders
- );
- // check if values were set
- if (ArrayHelper::check($fieldAttributes))
- {
- // set the array of field names
- $this->setFieldsNames(
- $nameSingleCode, $fieldAttributes['name']
- );
-
- if (ComponentbuilderHelper::fieldCheck($typeName, 'option'))
- {
- //reset options array
- $optionArray = array();
- // now add to the field set
- $dynamicField = $this->setField(
- 'option', $fieldAttributes, $name, $typeName, $langView,
- $nameSingleCode, $nameListCode, $placeholders,
- $optionArray
- );
- if ($build)
- {
- // set builders
- $this->setBuilders(
- $langLabel, $langView, $nameSingleCode,
- $nameListCode, $name, $view, $field, $typeName,
- $multiple, false, $optionArray
- );
- }
- }
- elseif (ComponentbuilderHelper::fieldCheck($typeName, 'spacer'))
- {
- if ($build)
- {
- // make sure spacers gets loaded to layout
- $tabName = '';
- if (isset($view['settings']->tabs)
- && isset($view['settings']->tabs[(int) $field['tab']]))
- {
- $tabName
- = $view['settings']->tabs[(int) $field['tab']];
- }
- elseif ((int) $field['tab'] == 15)
- {
- // set to publishing tab
- $tabName = 'publishing';
- }
- $this->setLayoutBuilder(
- $nameSingleCode, $tabName, $name, $field
- );
- }
- // now add to the field set
- $dynamicField = $this->setField(
- 'spacer', $fieldAttributes, $name, $typeName, $langView,
- $nameSingleCode, $nameListCode, $placeholders,
- $optionArray
- );
- }
- elseif (ComponentbuilderHelper::fieldCheck(
- $typeName, 'special'
- ))
- {
- // set the repeatable field or subform field
- if ($typeName === 'repeatable' || $typeName === 'subform')
- {
- if ($build)
- {
- // set builders
- $this->setBuilders(
- $langLabel, $langView, $nameSingleCode,
- $nameListCode, $name, $view, $field,
- $typeName, $multiple, false
- );
- }
- // now add to the field set
- $dynamicField = $this->setField(
- 'special', $fieldAttributes, $name, $typeName,
- $langView, $nameSingleCode, $nameListCode,
- $placeholders, $optionArray
- );
- }
- }
- elseif (isset($fieldAttributes['custom'])
- && ArrayHelper::check(
- $fieldAttributes['custom']
- ))
- {
- // set the custom array
- $custom = $fieldAttributes['custom'];
- unset($fieldAttributes['custom']);
- // set db key
- $custom['db'] = $dbkey;
- // increment the db key
- $dbkey++;
- if ($build)
- {
- // set builders
- $this->setBuilders(
- $langLabel, $langView, $nameSingleCode,
- $nameListCode, $name, $view, $field, $typeName,
- $multiple, $custom
- );
- }
- // now add to the field set
- $dynamicField = $this->setField(
- 'custom', $fieldAttributes, $name, $typeName, $langView,
- $nameSingleCode, $nameListCode, $placeholders,
- $optionArray, $custom
- );
- }
- else
- {
- if ($build)
- {
- // set builders
- $this->setBuilders(
- $langLabel, $langView, $nameSingleCode,
- $nameListCode, $name, $view, $field, $typeName,
- $multiple
- );
- }
- // now add to the field set
- $dynamicField = $this->setField(
- 'plain', $fieldAttributes, $name, $typeName, $langView,
- $nameSingleCode, $nameListCode, $placeholders,
- $optionArray
- );
- }
- }
- }
-
- return $dynamicField;
+ &$nameSingleCode, &$nameListCode, &$placeholders, &$dbkey, $build)
+ {
+ CFactory::_('Compiler.Creator.Field.Dynamic')->get($field, $view, $viewType, $langView,
+ $nameSingleCode, $nameListCode, $placeholders, $dbkey, $build);
}
/**
@@ -1765,55 +548,17 @@ class Fields extends Structure
* @param boolean $build The switch to set the build option
* @param int $return_type The return type 1 = string, 2 = array
*
- * @return mix The complete field in xml
- *
+ * @return mixed The complete field in string or array
+ * @deprecated 3.3 Use CFactory::_('Compiler.Builder.Fieldset.Dynamic')->get(...);
*/
- public function getFieldsetXML(&$fields, &$langView, &$nameSingleCode,
- &$nameListCode, &$placeholders, &$dbkey, $build = false,
- $return_type = 1
- ) {
- // set some defaults
- $view = '';
- $viewType = 0;
- // build the fieldset
- if ($return_type == 1)
- {
- $fieldset = '';
- }
- else
- {
- $fieldset = array();
- }
- // loop over the fields to build
- if (ArrayHelper::check($fields))
- {
- foreach ($fields as $field)
- {
- // get the field
- $xmlField = $this->getFieldXMLString(
- $field, $view, $viewType, $langView,
- $nameSingleCode, $nameListCode,
- $placeholders, $dbkey, $build
- );
- // make sure the xml is set and a string
- if (isset($xmlField)
- && StringHelper::check(
- $xmlField
- ))
- {
- if ($return_type == 1)
- {
- $fieldset .= $xmlField;
- }
- else
- {
- $fieldset[] = $xmlField;
- }
- }
- }
- }
-
- return $fieldset;
+ public function getFieldsetXML(array &$fields, string &$langView, string &$nameSingleCode,
+ string &$nameListCode, array &$placeholders, string &$dbkey, bool $build = false,
+ int $returnType = 1)
+ {
+ return CFactory::_('Compiler.Creator.Fieldset.Dynamic')->get(
+ $fields, $langView, $nameSingleCode,
+ $nameListCode, $placeholders, $dbkey, $build, $returnType
+ );
}
/**
@@ -1830,47 +575,17 @@ class Fields extends Structure
* @param boolean $build The switch to set the build option
*
* @return string The complete field in xml-string
- *
+ * @deprecated 3.3 Use CFactory::_('Compiler.Creator.Field.As.String')->get(...);
*/
- public function getFieldXMLString(&$field, &$view, &$viewType, &$langView,
- &$nameSingleCode, &$nameListCode, &$placeholders, &$dbkey,
- $build = false
- ) {
- // check the field builder type
- $xmlField = '';
- if (CFactory::_('Config')->get('field_builder_type', 2) == 1)
- {
- // string manipulation
- $xmlField = $this->setDynamicField(
- $field, $view, $viewType, $langView,
- $nameSingleCode, $nameListCode,
- $placeholders, $dbkey, $build
- );
- }
- else
- {
- // simpleXMLElement class
- $newxmlField = $this->setDynamicField(
- $field, $view, $viewType, $langView,
- $nameSingleCode, $nameListCode,
- $placeholders, $dbkey, $build
- );
- if (isset($newxmlField->fieldXML))
- {
- $xmlField = dom_import_simplexml(
- $newxmlField->fieldXML
- );
- $xmlField = PHP_EOL . Indent::_(2) . "' . PHP_EOL
- . Indent::_(1) . $this->xmlPrettyPrint(
- $xmlField, 'field'
- );
- }
- }
-
- // return the string
- return $xmlField;
+ public function getFieldXMLString(array &$field, array &$view, int &$viewType, string &$langView,
+ string &$nameSingleCode, string &$nameListCode, array &$placeholders, string &$dbkey,
+ bool $build = false): string
+ {
+ // get field
+ return CFactory::_('Compiler.Creator.Field.As.String')->get(
+ $field, $view, $viewType, $langView,
+ $nameSingleCode, $nameListCode, $placeholders, $dbkey, $build
+ );
}
/**
@@ -1884,38 +599,22 @@ class Fields extends Structure
* @param string $nameSingleCode The single view name
* @param string $nameListCode The list view name
* @param array $placeholders The place holder and replace values
- * @param string $optionArray The option bucket array used to set the field options if needed.
+ * @param array|null $optionArray The option bucket array used to set the field options if needed.
* @param array $custom Used when field is from config
* @param string $taber The tabs to add in layout (only in string manipulation)
*
* @return SimpleXMLElement The field in xml
- *
+ * @deprecated 3.3 Use CFactory::_('Compiler.Creator.Field.Type')->get(...);
*/
private function setField($setType, &$fieldAttributes, &$name, &$typeName,
&$langView, &$nameSingleCode, &$nameListCode, $placeholders,
&$optionArray, $custom = null, $taber = ''
) {
- // count the dynamic fields created
- CFactory::_('Utilities.Counter')->field++;
- // check what type of field builder to use
- if (CFactory::_('Config')->get('field_builder_type', 2) == 1)
- {
- // build field set using string manipulation
- return $this->stringSetField(
- $setType, $fieldAttributes, $name, $typeName, $langView,
- $nameSingleCode, $nameListCode, $placeholders, $optionArray,
- $custom, $taber
- );
- }
- else
- {
- // build field set with simpleXMLElement class
- return $this->simpleXMLSetField(
- $setType, $fieldAttributes, $name, $typeName, $langView,
- $nameSingleCode, $nameListCode, $placeholders, $optionArray,
- $custom
- );
- }
+ return CFactory::_('Compiler.Creator.Field.Type')->get(
+ $setType, $fieldAttributes, $name, $typeName,
+ $langView, $nameSingleCode, $nameListCode, $placeholders,
+ $optionArray, $custom, $taber
+ );
}
/**
@@ -1929,1010 +628,22 @@ class Fields extends Structure
* @param string $nameSingleCode The single view name
* @param string $nameListCode The list view name
* @param array $placeholders The place holder and replace values
- * @param string $optionArray The option bucket array used to set the field options if needed.
+ * @param array|null $optionArray The option bucket array used to set the field options if needed.
* @param array $custom Used when field is from config
* @param string $taber The tabs to add in layout
*
* @return SimpleXMLElement The field in xml
- *
+ * @deprecated 3.3 Use CFactory::_('Compiler.Creator.Field.String')->get(...);
*/
protected function stringSetField($setType, &$fieldAttributes, &$name,
- &$typeName, &$langView, &$nameSingleCode, &$nameListCode,
- $placeholders, &$optionArray, $custom = null, $taber = ''
- ) {
- $field = '';
- if ($setType === 'option')
- {
- // now add to the field set
- $field .= PHP_EOL . Indent::_(1) . $taber . Indent::_(1)
- . "";
- $field .= PHP_EOL . Indent::_(1) . $taber . Indent::_(1)
- . " $value)
- {
- if ($property != 'option')
- {
- $field .= PHP_EOL . Indent::_(2) . $taber . Indent::_(1)
- . $property . '="' . $value . '"';
- }
- elseif ($property === 'option')
- {
- $optionSet = '';
- if (strtolower($typeName) === 'groupedlist'
- && strpos(
- (string) $value, ','
- ) !== false
- && strpos((string) $value, '@@') !== false)
- {
- // reset the group temp arrays
- $groups_ = array();
- $grouped_ = array('group' => array(),
- 'option' => array());
- $order_ = array();
- // mulitpal options
- $options = explode(',', (string) $value);
- foreach ($options as $option)
- {
- if (strpos($option, '@@') !== false)
- {
- // set the group label
- $valueKeyArray = explode('@@', $option);
- if (count((array) $valueKeyArray) == 2)
- {
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $valueKeyArray[0], true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue,
- $valueKeyArray[0]
- );
- // now add group label
- $groups_[$valueKeyArray[1]] = PHP_EOL
- . Indent::_(1) . $taber . Indent::_(2)
- . '';
- // set order
- $order_['group' . $valueKeyArray[1]]
- = $valueKeyArray[1];
- }
- }
- elseif (strpos($option, '|') !== false)
- {
- // has other value then text
- $valueKeyArray = explode('|', $option);
- if (count((array) $valueKeyArray) == 3)
- {
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $valueKeyArray[1], true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue,
- $valueKeyArray[1]
- );
- // now add to option set
- $grouped_['group'][$valueKeyArray[2]][]
- = PHP_EOL . Indent::_(1) . $taber
- . Indent::_(3) . '';
- $optionArray[$valueKeyArray[0]]
- = $langValue;
- // set order
- $order_['group' . $valueKeyArray[2]]
- = $valueKeyArray[2];
- }
- else
- {
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $valueKeyArray[1], true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue,
- $valueKeyArray[1]
- );
- // now add to option set
- $grouped_['option'][$valueKeyArray[0]]
- = PHP_EOL . Indent::_(1) . $taber
- . Indent::_(2) . '';
- $optionArray[$valueKeyArray[0]]
- = $langValue;
- // set order
- $order_['option' . $valueKeyArray[0]]
- = $valueKeyArray[0];
- }
- }
- else
- {
- // text is also the value
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $option, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $option
- );
- // now add to option set
- $grouped_['option'][$option] = PHP_EOL
- . Indent::_(1) . $taber . Indent::_(2)
- . '';
- $optionArray[$option] = $langValue;
- // set order
- $order_['option' . $option] = $option;
- }
- }
- // now build the groups
- foreach ($order_ as $pointer_ => $_id)
- {
- // load the default key
- $key_ = 'group';
- if (strpos($pointer_, 'option') !== false)
- {
- // load the option field
- $key_ = 'option';
- }
- // check if this is a group loader
- if ('group' === $key_ && isset($groups_[$_id])
- && isset($grouped_[$key_][$_id])
- && ArrayHelper::check(
- $grouped_[$key_][$_id]
- ))
- {
- // set group label
- $optionSet .= $groups_[$_id];
- foreach ($grouped_[$key_][$_id] as $option_)
- {
- $optionSet .= $option_;
- }
- unset($groups_[$_id]);
- unset($grouped_[$key_][$_id]);
- // close the group
- $optionSet .= PHP_EOL . Indent::_(1) . $taber
- . Indent::_(2) . '';
- }
- elseif (isset($grouped_[$key_][$_id])
- && StringHelper::check(
- $grouped_[$key_][$_id]
- ))
- {
- $optionSet .= $grouped_[$key_][$_id];
- }
- }
- }
- elseif (strpos((string) $value, ',') !== false)
- {
- // mulitpal options
- $options = explode(',', (string) $value);
- foreach ($options as $option)
- {
- if (strpos($option, '|') !== false)
- {
- // has other value then text
- list($v, $t) = explode('|', $option);
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $t, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $t
- );
- // now add to option set
- $optionSet .= PHP_EOL . Indent::_(1)
- . $taber . Indent::_(2) . '';
- $optionArray[$v] = $langValue;
- }
- else
- {
- // text is also the value
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $option, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $option
- );
- // now add to option set
- $optionSet .= PHP_EOL . Indent::_(2)
- . $taber . Indent::_(1) . '';
- $optionArray[$option] = $langValue;
- }
- }
- }
- else
- {
- // one option
- if (strpos((string) $value, '|') !== false)
- {
- // has other value then text
- list($v, $t) = explode('|', (string) $value);
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $t, true
- );
- // add to lang array
- CFactory::_('Language')->set(CFactory::_('Config')->lang_target, $langValue, $t);
- // now add to option set
- $optionSet .= PHP_EOL . Indent::_(2) . $taber
- . Indent::_(1) . '';
- $optionArray[$v] = $langValue;
- }
- else
- {
- // text is also the value
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $value, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $value
- );
- // now add to option set
- $optionSet .= PHP_EOL . Indent::_(2)
- . $taber . Indent::_(1) . '';
- $optionArray[$value] = $langValue;
- }
- }
- }
- }
- // if options were found
- if (StringHelper::check($optionSet))
- {
- $field .= '>';
- $field .= PHP_EOL . Indent::_(3) . $taber . "";
- $field .= $optionSet;
- $field .= PHP_EOL . Indent::_(2) . $taber . "";
- }
- // if no options found and must have a list of options
- elseif (ComponentbuilderHelper::fieldCheck($typeName, 'list'))
- {
- $optionArray = false;
- $field .= PHP_EOL . Indent::_(2) . $taber . "/>";
- $field .= PHP_EOL . Indent::_(2) . $taber . ""
- . PHP_EOL;
- }
- else
- {
- $optionArray = false;
- $field .= PHP_EOL . Indent::_(2) . $taber . "/>";
- }
- }
- elseif ($setType === 'plain')
- {
- // now add to the field set
- $field .= PHP_EOL . Indent::_(2) . $taber . "";
- $field .= PHP_EOL . Indent::_(2) . $taber . " $value)
- {
- if ($property != 'option')
- {
- $field .= PHP_EOL . Indent::_(2) . $taber . Indent::_(1)
- . $property . '="' . $value . '"';
- }
- }
- $field .= PHP_EOL . Indent::_(2) . $taber . "/>";
- }
- elseif ($setType === 'spacer')
- {
- // now add to the field set
- $field .= PHP_EOL . Indent::_(2) . "";
- $field .= PHP_EOL . Indent::_(2) . " $value)
- {
- if ($property != 'option')
- {
- $field .= " " . $property . '="' . $value . '"';
- }
- }
- $field .= " />";
- }
- elseif ($setType === 'special')
- {
- // set the repeatable field
- if ($typeName === 'repeatable')
- {
- // now add to the field set
- $field .= PHP_EOL . Indent::_(2) . "";
- $field .= PHP_EOL . Indent::_(2) . " $value)
- {
- if ($property != 'fields')
- {
- $field .= PHP_EOL . Indent::_(3) . $property . '="'
- . $value . '"';
- }
- }
- $field .= ">";
- $field .= PHP_EOL . Indent::_(3) . '';
- $field .= PHP_EOL . Indent::_(4)
- . '";
- $field .= PHP_EOL . Indent::_(3) . "";
- $field .= PHP_EOL . Indent::_(2) . "";
- }
- // set the subform fields (it is a repeatable without the modal)
- elseif ($typeName === 'subform')
- {
- // now add to the field set
- $field .= PHP_EOL . Indent::_(2) . $taber . "";
- $field .= PHP_EOL . Indent::_(2) . $taber . " $value)
- {
- if ($property != 'fields')
- {
- $field .= PHP_EOL . Indent::_(3) . $taber . $property
- . '="' . $value . '"';
- }
- }
- $field .= ">";
- $field .= PHP_EOL . Indent::_(3) . $taber
- . '";
- $field .= PHP_EOL . Indent::_(2) . $taber . "";
- }
- }
- elseif ($setType === 'custom')
- {
- // now add to the field set
- $field .= PHP_EOL . Indent::_(2) . $taber . "";
- $field .= PHP_EOL . Indent::_(2) . $taber . " $value)
- {
- if ($property != 'option')
- {
- $field .= PHP_EOL . Indent::_(2) . $taber . Indent::_(1)
- . $property . '="' . $value . '"';
- }
- elseif ($property === 'option')
- {
- $optionSet = '';
- if (strtolower($typeName) === 'groupedlist'
- && strpos(
- (string) $value, ','
- ) !== false
- && strpos((string) $value, '@@') !== false)
- {
- // reset the group temp arrays
- $groups_ = array();
- $grouped_ = array('group' => array(),
- 'option' => array());
- $order_ = array();
- // mulitpal options
- $options = explode(',', (string) $value);
- foreach ($options as $option)
- {
- if (strpos($option, '@@') !== false)
- {
- // set the group label
- $valueKeyArray = explode('@@', $option);
- if (count((array) $valueKeyArray) == 2)
- {
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $valueKeyArray[0], true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue,
- $valueKeyArray[0]
- );
- // now add group label
- $groups_[$valueKeyArray[1]] = PHP_EOL
- . Indent::_(1) . $taber . Indent::_(2)
- . '';
- // set order
- $order_['group' . $valueKeyArray[1]]
- = $valueKeyArray[1];
- }
- }
- elseif (strpos($option, '|') !== false)
- {
- // has other value then text
- $valueKeyArray = explode('|', $option);
- if (count((array) $valueKeyArray) == 3)
- {
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $valueKeyArray[1], true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue,
- $valueKeyArray[1]
- );
- // now add to option set
- $grouped_['group'][$valueKeyArray[2]][]
- = PHP_EOL . Indent::_(1) . $taber
- . Indent::_(3) . '';
- $optionArray[$valueKeyArray[0]]
- = $langValue;
- // set order
- $order_['group' . $valueKeyArray[2]]
- = $valueKeyArray[2];
- }
- else
- {
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $valueKeyArray[1], true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue,
- $valueKeyArray[1]
- );
- // now add to option set
- $grouped_['option'][$valueKeyArray[0]]
- = PHP_EOL . Indent::_(1) . $taber
- . Indent::_(2) . '';
- $optionArray[$valueKeyArray[0]]
- = $langValue;
- // set order
- $order_['option' . $valueKeyArray[0]]
- = $valueKeyArray[0];
- }
- }
- else
- {
- // text is also the value
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $option, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $option
- );
- // now add to option set
- $grouped_['option'][$option] = PHP_EOL
- . Indent::_(1) . $taber . Indent::_(2)
- . '';
- $optionArray[$option] = $langValue;
- // set order
- $order_['option' . $option] = $option;
- }
- }
- // now build the groups
- foreach ($order_ as $pointer_ => $_id)
- {
- // load the default key
- $key_ = 'group';
- if (strpos($pointer_, 'option') !== false)
- {
- // load the option field
- $key_ = 'option';
- }
- // check if this is a group loader
- if ('group' === $key_ && isset($groups_[$_id])
- && isset($grouped_[$key_][$_id])
- && ArrayHelper::check(
- $grouped_[$key_][$_id]
- ))
- {
- // set group label
- $optionSet .= $groups_[$_id];
- foreach ($grouped_[$key_][$_id] as $option_)
- {
- $optionSet .= $option_;
- }
- unset($groups_[$_id]);
- unset($grouped_[$key_][$_id]);
- // close the group
- $optionSet .= PHP_EOL . Indent::_(1) . $taber
- . Indent::_(2) . '';
- }
- elseif (isset($grouped_[$key_][$_id])
- && StringHelper::check(
- $grouped_[$key_][$_id]
- ))
- {
- $optionSet .= $grouped_[$key_][$_id];
- }
- }
- }
- elseif (strpos((string) $value, ',') !== false)
- {
- // mulitpal options
- $options = explode(',', (string) $value);
- foreach ($options as $option)
- {
- if (strpos($option, '|') !== false)
- {
- // has other value then text
- list($v, $t) = explode('|', $option);
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $t, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $t
- );
- // now add to option set
- $optionSet .= PHP_EOL . Indent::_(1)
- . $taber . Indent::_(2) . '';
- $optionArray[$v] = $langValue;
- }
- else
- {
- // text is also the value
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $option, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $option
- );
- // now add to option set
- $optionSet .= PHP_EOL . Indent::_(2)
- . $taber . Indent::_(1) . '';
- $optionArray[$option] = $langValue;
- }
- }
- }
- else
- {
- // one option
- if (strpos((string) $value, '|') !== false)
- {
- // has other value then text
- list($v, $t) = explode('|', (string) $value);
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $t, true
- );
- // add to lang array
- CFactory::_('Language')->set(CFactory::_('Config')->lang_target, $langValue, $t);
- // now add to option set
- $optionSet .= PHP_EOL . Indent::_(2) . $taber
- . Indent::_(1) . '';
- $optionArray[$v] = $langValue;
- }
- else
- {
- // text is also the value
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $value, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $value
- );
- // now add to option set
- $optionSet .= PHP_EOL . Indent::_(2)
- . $taber . Indent::_(1) . '';
- $optionArray[$value] = $langValue;
- }
- }
- }
- }
- // if options were found
- if (StringHelper::check($optionSet))
- {
- $field .= '>';
- $field .= PHP_EOL . Indent::_(3) . $taber . "";
- $field .= $optionSet;
- $field .= PHP_EOL . Indent::_(2) . $taber . "";
- }
- // if no options found and must have a list of options
- elseif (ComponentbuilderHelper::fieldCheck($typeName, 'list'))
- {
- $optionArray = false;
- $field .= PHP_EOL . Indent::_(2) . $taber . "/>";
- $field .= PHP_EOL . Indent::_(2) . $taber . ""
- . PHP_EOL;
- }
- else
- {
- $optionArray = false;
- $field .= PHP_EOL . Indent::_(2) . $taber . "/>";
- }
- // incase the field is in the config and has not been set
- if ('config' === $nameSingleCode && 'configs' === $nameListCode
- || (strpos($nameSingleCode, 'P|uG!n') !== false
- || strpos(
- $nameSingleCode, 'M0dU|3'
- ) !== false))
- {
- // set lang (just incase)
- $listLangName = $langView . '_'
- . StringHelper::safe($name, 'U');
- // set the custom array
- $data = array('type' => $typeName, 'code' => $name,
- 'lang' => $listLangName, 'custom' => $custom);
- // set the custom field file
- $this->setCustomFieldTypeFile(
- $data, $nameListCode, $nameSingleCode
- );
- }
- }
-
- // return field
- return $field;
+ &$typeName, &$langView, &$nameSingleCode, &$nameListCode,
+ $placeholders, &$optionArray, $custom = null, $taber = '')
+ {
+ return CFactory::_('Compiler.Creator.Field.String')->get(
+ $setType, $fieldAttributes, $name,
+ $typeName, $langView, $nameSingleCode, $nameListCode,
+ $placeholders, $optionArray, $custom, $taber
+ );
}
/**
@@ -2950,974 +661,17 @@ class Fields extends Structure
* @param array $custom Used when field is from config
*
* @return SimpleXMLElement The field in xml
- *
+ * @deprecated 3.3 Use CFactory::_('Compiler.Creator.Field.XML')->get(...);
*/
protected function simpleXMLSetField($setType, &$fieldAttributes, &$name,
- &$typeName, &$langView, &$nameSingleCode, &$nameListCode,
- $placeholders, &$optionArray, $custom = null
- ) {
- $field = new stdClass();
- if ($setType === 'option')
- {
- // now add to the field set
- $field->fieldXML = new SimpleXMLElement('');
- $field->comment = Line::_(__Line__, __Class__) . " " . ucfirst($name)
- . " Field. Type: " . StringHelper::safe(
- $typeName, 'F'
- ) . ". (joomla)";
-
- foreach ($fieldAttributes as $property => $value)
- {
- if ($property != 'option')
- {
- $field->fieldXML->addAttribute($property, $value);
- }
- elseif ($property === 'option')
- {
- ComponentbuilderHelper::xmlComment(
- $field->fieldXML,
- Line::_(__Line__, __Class__) . " Option Set."
- );
- if (strtolower($typeName) === 'groupedlist'
- && strpos(
- (string) $value, ','
- ) !== false
- && strpos((string) $value, '@@') !== false)
- {
- // reset the group temp arrays
- $groups_ = array();
- $grouped_ = array('group' => array(),
- 'option' => array());
- $order_ = array();
- // mulitpal options
- $options = explode(',', (string) $value);
- foreach ($options as $option)
- {
- if (strpos($option, '@@') !== false)
- {
- // set the group label
- $valueKeyArray = explode('@@', $option);
- if (count((array) $valueKeyArray) == 2)
- {
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $valueKeyArray[0], true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue,
- $valueKeyArray[0]
- );
- // now add group label
- $groups_[$valueKeyArray[1]] = $langValue;
- // set order
- $order_['group' . $valueKeyArray[1]]
- = $valueKeyArray[1];
- }
- }
- elseif (strpos($option, '|') !== false)
- {
- // has other value then text
- $valueKeyArray = explode('|', $option);
- if (count((array) $valueKeyArray) == 3)
- {
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $valueKeyArray[1], true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue,
- $valueKeyArray[1]
- );
- // now add to option set
- $grouped_['group'][$valueKeyArray[2]][]
- = array('value' => $valueKeyArray[0],
- 'text' => $langValue);
- $optionArray[$valueKeyArray[0]]
- = $langValue;
- // set order
- $order_['group' . $valueKeyArray[2]]
- = $valueKeyArray[2];
- }
- else
- {
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $valueKeyArray[1], true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue,
- $valueKeyArray[1]
- );
- // now add to option set
- $grouped_['option'][$valueKeyArray[0]]
- = array('value' => $valueKeyArray[0],
- 'text' => $langValue);
- $optionArray[$valueKeyArray[0]]
- = $langValue;
- // set order
- $order_['option' . $valueKeyArray[0]]
- = $valueKeyArray[0];
- }
- }
- else
- {
- // text is also the value
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $option, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $option
- );
- // now add to option set
- $grouped_['option'][$option]
- = array('value' => $option,
- 'text' => $langValue);
- $optionArray[$option] = $langValue;
- // set order
- $order_['option' . $option] = $option;
- }
- }
- // now build the groups
- foreach ($order_ as $pointer_ => $_id)
- {
- // load the default key
- $key_ = 'group';
- if (strpos($pointer_, 'option') !== false)
- {
- // load the option field
- $key_ = 'option';
- }
- // check if this is a group loader
- if ('group' === $key_ && isset($groups_[$_id])
- && isset($grouped_[$key_][$_id])
- && ArrayHelper::check(
- $grouped_[$key_][$_id]
- ))
- {
- // set group label
- $groupXML = $field->fieldXML->addChild('group');
- $groupXML->addAttribute(
- 'label', $groups_[$_id]
- );
-
- foreach ($grouped_[$key_][$_id] as $option_)
- {
- $groupOptionXML = $groupXML->addChild(
- 'option'
- );
- $groupOptionXML->addAttribute(
- 'value', $option_['value']
- );
- $groupOptionXML[] = $option_['text'];
- }
- unset($groups_[$_id]);
- unset($grouped_[$key_][$_id]);
- }
- elseif (isset($grouped_[$key_][$_id])
- && StringHelper::check(
- $grouped_[$key_][$_id]
- ))
- {
- $optionXML = $field->fieldXML->addChild(
- 'option'
- );
- $optionXML->addAttribute(
- 'value', $grouped_[$key_][$_id]['value']
- );
- $optionXML[] = $grouped_[$key_][$_id]['text'];
- }
- }
- }
- elseif (strpos((string) $value, ',') !== false)
- {
- // mulitpal options
- $options = explode(',', (string) $value);
- foreach ($options as $option)
- {
- $optionXML = $field->fieldXML->addChild('option');
- if (strpos($option, '|') !== false)
- {
- // has other value then text
- list($v, $t) = explode('|', $option);
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $t, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $t
- );
- // now add to option set
- $optionXML->addAttribute('value', $v);
- $optionArray[$v] = $langValue;
- }
- else
- {
- // text is also the value
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $option, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $option
- );
- // now add to option set
- $optionXML->addAttribute('value', $option);
- $optionArray[$option] = $langValue;
- }
- $optionXML[] = $langValue;
- }
- }
- else
- {
- // one option
- $optionXML = $field->fieldXML->addChild('option');
- if (strpos((string) $value, '|') !== false)
- {
- // has other value then text
- list($v, $t) = explode('|', (string) $value);
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $t, true
- );
- // add to lang array
- CFactory::_('Language')->set(CFactory::_('Config')->lang_target, $langValue, $t);
- // now add to option set
- $optionXML->addAttribute('value', $v);
- $optionArray[$v] = $langValue;
- }
- else
- {
- // text is also the value
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $value, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $value
- );
- // now add to option set
- $optionXML->addAttribute('value', $value);
- $optionArray[$value] = $langValue;
- }
- $optionXML[] = $langValue;
- }
- }
- }
- // if no options found and must have a list of options
- if (!$field->fieldXML->count()
- && ComponentbuilderHelper::fieldCheck($typeName, 'list'))
- {
- ComponentbuilderHelper::xmlComment(
- $field->fieldXML, Line::_(__Line__, __Class__)
- . " No Manual Options Were Added In Field Settings."
- );
- }
- }
- elseif ($setType === 'plain')
- {
- // now add to the field set
- $field->fieldXML = new SimpleXMLElement('');
- $field->comment = Line::_(__Line__, __Class__) . " " . ucfirst($name)
- . " Field. Type: " . StringHelper::safe(
- $typeName, 'F'
- ) . ". (joomla)";
-
- foreach ($fieldAttributes as $property => $value)
- {
- if ($property != 'option')
- {
- $field->fieldXML->addAttribute($property, $value);
- }
- }
- }
- elseif ($setType === 'spacer')
- {
- // now add to the field set
- $field->fieldXML = new SimpleXMLElement('');
- $field->comment = Line::_(__Line__, __Class__) . " " . ucfirst($name)
- . " Field. Type: " . StringHelper::safe(
- $typeName, 'F'
- ) . ". A None Database Field. (joomla)";
-
- foreach ($fieldAttributes as $property => $value)
- {
- if ($property != 'option')
- {
- $field->fieldXML->addAttribute($property, $value);
- }
- }
- }
- elseif ($setType === 'special')
- {
- // set the repeatable field
- if ($typeName === 'repeatable')
- {
- // now add to the field set
- $field->fieldXML = new SimpleXMLElement('');
- $field->comment = Line::_(__Line__, __Class__) . " " . ucfirst(
- $name
- ) . " Field. Type: " . StringHelper::safe(
- $typeName, 'F'
- ) . ". (depreciated)";
-
- foreach ($fieldAttributes as $property => $value)
- {
- if ($property != 'fields')
- {
- $field->fieldXML->addAttribute($property, $value);
- }
- }
- $fieldsXML = $field->fieldXML->addChild('fields');
- $fieldsXML->addAttribute(
- 'name', $fieldAttributes['name'] . '_fields'
- );
- $fieldsXML->addAttribute('label', '');
- $fieldSetXML = $fieldsXML->addChild('fieldset');
- $fieldSetXML->addAttribute('hidden', 'true');
- $fieldSetXML->addAttribute(
- 'name', $fieldAttributes['name'] . '_modal'
- );
- $fieldSetXML->addAttribute('repeat', 'true');
-
- if (strpos((string) $fieldAttributes['fields'], ',') !== false)
- {
- // mulitpal fields
- $fieldsSets = (array) explode(
- ',', (string) $fieldAttributes['fields']
- );
- }
- elseif (is_numeric($fieldAttributes['fields']))
- {
- // single field
- $fieldsSets[] = (int) $fieldAttributes['fields'];
- }
- // only continue if we have a field set
- if (ArrayHelper::check($fieldsSets))
- {
- // set the resolver
- $_resolverKey = $fieldAttributes['name'];
- // load the field data
- $fieldsSets = array_map(
- function ($id) use (
- $nameSingleCode, $nameListCode, $_resolverKey
- ) {
- // start field
- $field = array();
- $field['field'] = $id;
- // set the field details
- CFactory::_('Field')->set(
- $field, $nameSingleCode, $nameListCode,
- $_resolverKey
- );
-
- // return field
- return $field;
- }, array_values($fieldsSets)
- );
- // start the build
- foreach ($fieldsSets as $fieldData)
- {
- // if we have settings continue
- if (ObjectHelper::check(
- $fieldData['settings']
- ))
- {
- $r_name = CFactory::_('Field.Name')->get(
- $fieldData, $nameListCode, $_resolverKey
- );
- $r_typeName = CFactory::_('Field.Type.Name')->get($fieldData);
- $r_multiple = false;
- $r_langLabel = '';
- // get field values
- $r_fieldValues = $this->setFieldAttributes(
- $fieldData, $view, $r_name, $r_typeName,
- $r_multiple, $r_langLabel, $langView,
- $nameListCode, $nameSingleCode,
- $placeholders, true
- );
- // check if values were set
- if (ArrayHelper::check(
- $r_fieldValues
- ))
- {
- //reset options array
- $r_optionArray = array();
- if (ComponentbuilderHelper::fieldCheck(
- $r_typeName, 'option'
- ))
- {
- // now add to the field set
- ComponentbuilderHelper::xmlAppend(
- $fieldSetXML, $this->setField(
- 'option', $r_fieldValues, $r_name,
- $r_typeName, $langView,
- $nameSingleCode, $nameListCode,
- $placeholders, $r_optionArray
- )
- );
- }
- elseif (isset($r_fieldValues['custom'])
- && ArrayHelper::check(
- $r_fieldValues['custom']
- ))
- {
- // add to custom
- $custom = $r_fieldValues['custom'];
- unset($r_fieldValues['custom']);
- // now add to the field set
- ComponentbuilderHelper::xmlAppend(
- $fieldSetXML, $this->setField(
- 'custom', $r_fieldValues, $r_name,
- $r_typeName, $langView,
- $nameSingleCode, $nameListCode,
- $placeholders, $r_optionArray
- )
- );
- // set lang (just incase)
- $r_listLangName = $langView . '_'
- . FieldHelper::safe(
- $r_name, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $r_listLangName,
- StringHelper::safe(
- $r_name, 'W'
- )
- );
- // if label was set use instead
- if (StringHelper::check(
- $r_langLabel
- ))
- {
- $r_listLangName = $r_langLabel;
- }
- // set the custom array
- $data = array('type' => $r_typeName,
- 'code' => $r_name,
- 'lang' => $r_listLangName,
- 'custom' => $custom);
- // set the custom field file
- $this->setCustomFieldTypeFile(
- $data, $nameListCode,
- $nameSingleCode
- );
- }
- else
- {
- // now add to the field set
- ComponentbuilderHelper::xmlAppend(
- $fieldSetXML, $this->setField(
- 'plain', $r_fieldValues, $r_name,
- $r_typeName, $langView,
- $nameSingleCode, $nameListCode,
- $placeholders, $r_optionArray
- )
- );
- }
- }
- }
- }
- }
- }
- // set the subform fields (it is a repeatable without the modal)
- elseif ($typeName === 'subform')
- {
- // now add to the field set
- $field->fieldXML = new SimpleXMLElement('');
- $field->comment = Line::_(__Line__, __Class__) . " " . ucfirst(
- $name
- ) . " Field. Type: " . StringHelper::safe(
- $typeName, 'F'
- ) . ". (joomla)";
- // add all properties
- foreach ($fieldAttributes as $property => $value)
- {
- if ($property != 'fields' && $property != 'formsource')
- {
- $field->fieldXML->addAttribute($property, $value);
- }
- }
- // if we detect formsource we do not add the form
- if (isset($fieldAttributes['formsource'])
- && StringHelper::check(
- $fieldAttributes['formsource']
- ))
- {
- $field->fieldXML->addAttribute(
- 'formsource', $fieldAttributes['formsource']
- );
- }
- // add the form
- else
- {
- $form = $field->fieldXML->addChild('form');
- $attributes = array(
- 'hidden' => 'true',
- 'name' => 'list_' . $fieldAttributes['name']
- . '_modal',
- 'repeat' => 'true'
- );
- ComponentbuilderHelper::xmlAddAttributes(
- $form, $attributes
- );
-
- if (strpos((string) $fieldAttributes['fields'], ',') !== false)
- {
- // multiple fields
- $fieldsSets = (array) explode(
- ',', (string) $fieldAttributes['fields']
- );
- }
- elseif (is_numeric($fieldAttributes['fields']))
- {
- // single field
- $fieldsSets[] = (int) $fieldAttributes['fields'];
- }
- // only continue if we have a field set
- if (ArrayHelper::check($fieldsSets))
- {
- // set the resolver
- $_resolverKey = $fieldAttributes['name'];
- // load the field data
- $fieldsSets = array_map(
- function ($id) use (
- $nameSingleCode, $nameListCode,
- $_resolverKey
- ) {
- // start field
- $field = array();
- $field['field'] = $id;
- // set the field details
- CFactory::_('Field')->set(
- $field, $nameSingleCode, $nameListCode,
- $_resolverKey
- );
-
- // return field
- return $field;
- }, array_values($fieldsSets)
- );
- // start the build
- foreach ($fieldsSets as $fieldData)
- {
- // if we have settings continue
- if (ObjectHelper::check(
- $fieldData['settings']
- ))
- {
- $r_name = CFactory::_('Field.Name')->get(
- $fieldData, $nameListCode, $_resolverKey
- );
- $r_typeName = CFactory::_('Field.Type.Name')->get($fieldData);
- $r_multiple = false;
- $r_langLabel = '';
- // get field values
- $r_fieldValues = $this->setFieldAttributes(
- $fieldData, $view, $r_name, $r_typeName,
- $r_multiple, $r_langLabel, $langView,
- $nameListCode, $nameSingleCode,
- $placeholders, true
- );
- // check if values were set
- if (ArrayHelper::check(
- $r_fieldValues
- ))
- {
- //reset options array
- $r_optionArray = array();
- if (ComponentbuilderHelper::fieldCheck(
- $r_typeName, 'option'
- ))
- {
- // now add to the field set
- ComponentbuilderHelper::xmlAppend(
- $form, $this->setField(
- 'option', $r_fieldValues, $r_name,
- $r_typeName, $langView,
- $nameSingleCode, $nameListCode,
- $placeholders, $r_optionArray
- )
- );
- }
- elseif ($r_typeName === 'subform')
- {
- // set nested depth
- if (isset($fieldAttributes['nested_depth']))
- {
- $r_fieldValues['nested_depth']
- = ++$fieldAttributes['nested_depth'];
- }
- else
- {
- $r_fieldValues['nested_depth'] = 1;
- }
- // only continue if nest is bellow 20 (this should be a safe limit)
- if ($r_fieldValues['nested_depth']
- <= 20)
- {
- // now add to the field set
- ComponentbuilderHelper::xmlAppend(
- $form, $this->setField(
- 'special', $r_fieldValues,
- $r_name, $r_typeName, $langView,
- $nameSingleCode,
- $nameListCode, $placeholders,
- $r_optionArray
- )
- );
- }
-
- }
- elseif (isset($r_fieldValues['custom'])
- && ArrayHelper::check(
- $r_fieldValues['custom']
- ))
- {
- // add to custom
- $custom = $r_fieldValues['custom'];
- unset($r_fieldValues['custom']);
- // now add to the field set
- ComponentbuilderHelper::xmlAppend(
- $form, $this->setField(
- 'custom', $r_fieldValues, $r_name,
- $r_typeName, $langView,
- $nameSingleCode, $nameListCode,
- $placeholders, $r_optionArray
- )
- );
- // set lang (just incase)
- $r_listLangName = $langView . '_'
- . FieldHelper::safe(
- $r_name, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $r_listLangName,
- StringHelper::safe(
- $r_name, 'W'
- )
- );
- // if label was set use instead
- if (StringHelper::check(
- $r_langLabel
- ))
- {
- $r_listLangName = $r_langLabel;
- }
- // set the custom array
- $data = array('type' => $r_typeName,
- 'code' => $r_name,
- 'lang' => $r_listLangName,
- 'custom' => $custom);
- // set the custom field file
- $this->setCustomFieldTypeFile(
- $data, $nameListCode,
- $nameSingleCode
- );
- }
- else
- {
- // now add to the field set
- ComponentbuilderHelper::xmlAppend(
- $form, $this->setField(
- 'plain', $r_fieldValues, $r_name,
- $r_typeName, $langView,
- $nameSingleCode, $nameListCode,
- $placeholders, $r_optionArray
- )
- );
- }
- }
- }
- }
- }
- }
- }
- }
- elseif ($setType === 'custom')
- {
- // now add to the field set
- $field->fieldXML = new SimpleXMLElement('');
- $field->comment = Line::_(__Line__, __Class__) . " " . ucfirst($name)
- . " Field. Type: " . StringHelper::safe(
- $typeName, 'F'
- ) . ". (custom)";
- foreach ($fieldAttributes as $property => $value)
- {
- if ($property != 'option')
- {
- $field->fieldXML->addAttribute($property, $value);
- }
- elseif ($property === 'option')
- {
- ComponentbuilderHelper::xmlComment(
- $field->fieldXML,
- Line::_(__Line__, __Class__) . " Option Set."
- );
- if (strtolower($typeName) === 'groupedlist'
- && strpos(
- (string) $value, ','
- ) !== false
- && strpos((string) $value, '@@') !== false)
- {
- // reset the group temp arrays
- $groups_ = array();
- $grouped_ = array('group' => array(),
- 'option' => array());
- $order_ = array();
- // mulitpal options
- $options = explode(',', (string) $value);
- foreach ($options as $option)
- {
- if (strpos($option, '@@') !== false)
- {
- // set the group label
- $valueKeyArray = explode('@@', $option);
- if (count((array) $valueKeyArray) == 2)
- {
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $valueKeyArray[0], true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue,
- $valueKeyArray[0]
- );
- // now add group label
- $groups_[$valueKeyArray[1]] = $langValue;
- // set order
- $order_['group' . $valueKeyArray[1]]
- = $valueKeyArray[1];
- }
- }
- elseif (strpos($option, '|') !== false)
- {
- // has other value then text
- $valueKeyArray = explode('|', $option);
- if (count((array) $valueKeyArray) == 3)
- {
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $valueKeyArray[1], true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue,
- $valueKeyArray[1]
- );
- // now add to option set
- $grouped_['group'][$valueKeyArray[2]][]
- = array('value' => $valueKeyArray[0],
- 'text' => $langValue);
- $optionArray[$valueKeyArray[0]]
- = $langValue;
- // set order
- $order_['group' . $valueKeyArray[2]]
- = $valueKeyArray[2];
- }
- else
- {
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $valueKeyArray[1], true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue,
- $valueKeyArray[1]
- );
- // now add to option set
- $grouped_['option'][$valueKeyArray[0]]
- = array('value' => $valueKeyArray[0],
- 'text' => $langValue);
- $optionArray[$valueKeyArray[0]]
- = $langValue;
- // set order
- $order_['option' . $valueKeyArray[0]]
- = $valueKeyArray[0];
- }
- }
- else
- {
- // text is also the value
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $option, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $option
- );
- // now add to option set
- $grouped_['option'][$option]
- = array('value' => $option,
- 'text' => $langValue);
- $optionArray[$option] = $langValue;
- // set order
- $order_['option' . $option] = $option;
- }
- }
- // now build the groups
- foreach ($order_ as $pointer_ => $_id)
- {
- // load the default key
- $key_ = 'group';
- if (strpos($pointer_, 'option') !== false)
- {
- // load the option field
- $key_ = 'option';
- }
- // check if this is a group loader
- if ('group' === $key_ && isset($groups_[$_id])
- && isset($grouped_[$key_][$_id])
- && ArrayHelper::check(
- $grouped_[$key_][$_id]
- ))
- {
- // set group label
- $groupXML = $field->fieldXML->addChild('group');
- $groupXML->addAttribute(
- 'label', $groups_[$_id]
- );
-
- foreach ($grouped_[$key_][$_id] as $option_)
- {
- $groupOptionXML = $groupXML->addChild(
- 'option'
- );
- $groupOptionXML->addAttribute(
- 'value', $option_['value']
- );
- $groupOptionXML[] = $option_['text'];
- }
- unset($groups_[$_id]);
- unset($grouped_[$key_][$_id]);
- }
- elseif (isset($grouped_[$key_][$_id])
- && StringHelper::check(
- $grouped_[$key_][$_id]
- ))
- {
- $optionXML = $field->fieldXML->addChild(
- 'option'
- );
- $optionXML->addAttribute(
- 'value', $grouped_[$key_][$_id]['value']
- );
- $optionXML[] = $grouped_[$key_][$_id]['text'];
- }
- }
- }
- elseif (strpos((string) $value, ',') !== false)
- {
- // municipal options
- $options = explode(',', (string) $value);
- foreach ($options as $option)
- {
- $optionXML = $field->fieldXML->addChild('option');
- if (strpos($option, '|') !== false)
- {
- // has other value then text
- list($v, $t) = explode('|', $option);
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $t, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $t
- );
- // now add to option set
- $optionXML->addAttribute('value', $v);
- $optionArray[$v] = $langValue;
- }
- else
- {
- // text is also the value
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $option, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $option
- );
- // now add to option set
- $optionXML->addAttribute('value', $option);
- $optionArray[$option] = $langValue;
- }
- $optionXML[] = $langValue;
- }
- }
- else
- {
- // one option
- $optionXML = $field->fieldXML->addChild('option');
- if (strpos((string) $value, '|') !== false)
- {
- // has other value then text
- list($v, $t) = explode('|', (string) $value);
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $t, true
- );
- // add to lang array
- CFactory::_('Language')->set(CFactory::_('Config')->lang_target, $langValue, $t);
- // now add to option set
- $optionXML->addAttribute('value', $v);
- $optionArray[$v] = $langValue;
- }
- else
- {
- // text is also the value
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $value, true
- );
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $langValue, $value
- );
- // now add to option set
- $optionXML->addAttribute('value', $value);
- $optionArray[$value] = $langValue;
- }
- $optionXML[] = $langValue;
- }
- }
- }
- // incase the field is in the config and has not been set (or is part of a plugin or module)
- if (('config' === $nameSingleCode
- && 'configs' === $nameListCode)
- || (strpos($nameSingleCode, 'P|uG!n') !== false
- || strpos(
- $nameSingleCode, 'M0dU|3'
- ) !== false))
- {
- // set lang (just incase)
- $listLangName = $langView . '_'
- . StringHelper::safe($name, 'U');
- // set the custom array
- $data = array('type' => $typeName, 'code' => $name,
- 'lang' => $listLangName, 'custom' => $custom);
- // set the custom field file
- $this->setCustomFieldTypeFile(
- $data, $nameListCode, $nameSingleCode
- );
- }
- }
-
- return $field;
+ &$typeName, &$langView, &$nameSingleCode, &$nameListCode,
+ $placeholders, &$optionArray, $custom = null)
+ {
+ return CFactory::_('Compiler.Creator.Field.XML')->get(
+ $setType, $fieldAttributes, $name,
+ $typeName, $langView, $nameSingleCode, $nameListCode,
+ $placeholders, $optionArray, $custom
+ );
}
/**
@@ -3929,126 +683,11 @@ class Fields extends Structure
* @param array $field The field details
*
* @return void
- *
+ * @deprecated 3.3 Use CFactory::_('Compiler.Creator.Layout')->set(...);
*/
- public function setLayoutBuilder(&$nameSingleCode, &$tabName, &$name,
- &$field
- ) {
- // first fix the zero order
- // to insure it lands before all the other fields
- // as zero is expected to behave
- if ($field['order_edit'] == 0)
- {
- // get the value
- $zero_counter = CFactory::_('Registry')->get('builder.zero_order_fix.' . $nameSingleCode . '.' . $field['tab'], -999);
- if ($zero_counter != -999)
- {
- $zero_counter++;
- }
- $field['order_edit'] = $zero_counter;
- // set the value
- CFactory::_('Registry')->set('builder.zero_order_fix.' . $nameSingleCode . '.' . $field['tab'], $zero_counter);
- }
- // get the default fields
- $default_fields = CFactory::_('Config')->default_fields;
- // now build the layout
- if (StringHelper::check($tabName)
- && strtolower($tabName) != 'publishing')
- {
- CFactory::_('Registry')->set('builder.tab_counter.' . $nameSingleCode . '.' . $field['tab'], $tabName);
- if (CFactory::_('Registry')->exists('builder.layout.' . $nameSingleCode . '.' . $tabName . '.'
- . $field['alignment'] . '.' . $field['order_edit']))
- {
- $size = (int) count(
- (array) CFactory::_('Registry')->get('builder.layout.' . $nameSingleCode . '.' . $tabName . '.'
- . $field['alignment'])
- ) + 1;
- while (CFactory::_('Registry')->exists('builder.layout.' . $nameSingleCode . '.' . $tabName . '.'
- . $field['alignment'] . '.' . $size))
- {
- $size++;
- }
- CFactory::_('Registry')->set('builder.layout.'
- . $nameSingleCode . '.'
- . $tabName . '.'
- . $field['alignment'] . '.'
- . $size, $name);
- }
- else
- {
- CFactory::_('Registry')->set('builder.layout.'
- . $nameSingleCode . '.'
- . $tabName . '.'
- . $field['alignment'] . '.'
- . $field['order_edit'], $name);
- }
- // check if default fields were overwritten
- if (in_array($name, $default_fields))
- {
- // just to eliminate
- CFactory::_('Registry')->set('builder.moved_publishing_fields.' . $nameSingleCode . '.' . $name, true);
- }
- }
- elseif ($tabName === 'publishing' || $tabName === 'Publishing')
- {
- if (!in_array($name, $default_fields))
- {
- if (CFactory::_('Registry')->exists('builder.new_publishing_fields.' . $nameSingleCode . '.' .
- $field['alignment'] . '.' . $field['order_edit']))
- {
- $size = (int) count(
- (array) CFactory::_('Registry')->get('builder.new_publishing_fields.' . $nameSingleCode . '.' .
- $field['alignment'])
- ) + 1;
- while (CFactory::_('Registry')->exists('builder.new_publishing_fields.' . $nameSingleCode . '.' .
- $field['alignment'] . '.' . $size))
- {
- $size++;
- }
- CFactory::_('Registry')->set('builder.new_publishing_fields.' . $nameSingleCode . '.' .
- $field['alignment'] . '.' . $size, $name);
- }
- else
- {
- CFactory::_('Registry')->set('builder.new_publishing_fields.' . $nameSingleCode . '.' .
- $field['alignment'] . '.' . $field['order_edit'], $name);
- }
- }
- }
- else
- {
- CFactory::_('Registry')->set('builder.tab_counter.' . $nameSingleCode . '.1', 'Details');
- if (CFactory::_('Registry')->exists('builder.layout.' . $nameSingleCode . '.Details.'
- . $field['alignment'] . '.' . $field['order_edit']))
- {
- $size = (int) count(
- (array) CFactory::_('Registry')->get('builder.layout.' . $nameSingleCode . '.Details.'
- . $field['alignment'])
- ) + 1;
- while (CFactory::_('Registry')->exists('builder.layout.' . $nameSingleCode . '.Details.'
- . $field['alignment'] . '.' . $size))
- {
- $size++;
- }
- CFactory::_('Registry')->set('builder.layout.'
- . $nameSingleCode . '.Details.'
- . $field['alignment'] . '.'
- . $size, $name);
- }
- else
- {
- CFactory::_('Registry')->set('builder.layout.'
- . $nameSingleCode . '.Details.'
- . $field['alignment'] . '.'
- . $field['order_edit'], $name);
- }
- // check if default fields were overwritten
- if (in_array($name, $default_fields))
- {
- // just to eliminate
- CFactory::_('Registry')->set('builder.moved_publishing_fields.' . $nameSingleCode . '.' . $name, true);
- }
- }
+ public function setLayoutBuilder($nameSingleCode, $tabName, $name, &$field)
+ {
+ CFactory::_('Compiler.Creator.Layout')->set($nameSingleCode, $tabName, $name, $field);
}
/**
@@ -4060,62 +699,11 @@ class Fields extends Structure
* @param string $type The field type
*
* @return void
- *
+ * @deprecated 3.3 Use CFactory::_('Compiler.Creator.Site.Field.Data')->set(...);
*/
public function buildSiteFieldData($view, $field, $set, $type)
{
- $decode = array('json', 'base64', 'basic_encryption',
- 'whmcs_encryption', 'medium_encryption', 'expert_mode');
- $textareas = array('textarea', 'editor');
- if (($site_fields = CFactory::_('Registry')->
- extract('builder.site_fields.' . $view . '.' . $field)) !== null)
- {
- foreach ($site_fields as $codeString => $site_field)
- {
- // get the code array
- $codeArray = explode('___', (string) $codeString);
- // set the code
- $code = trim($codeArray[0]);
- // set the decoding methods
- if (in_array($set, $decode))
- {
- if (isset($this->siteFieldData['decode'][$site_field->site][$code][$site_field->as][$site_field->key])
- && isset($this->siteFieldData['decode'][$site_field->site][$code][$site_field->as][$site_field->key]['decode']))
- {
- if (!in_array(
- $set,
- $this->siteFieldData['decode'][$site_field->site][$code][$site_field->as][$site_field->key]['decode']
- ))
- {
- $this->siteFieldData['decode'][$site_field->site][$code][$site_field->as][$site_field->key]['decode'][]
- = $set;
- }
- }
- else
- {
- $this->siteFieldData['decode'][$site_field->site][$code][$site_field->as][$site_field->key]
- = array('decode' => [$set],
- 'type' => $type,
- 'admin_view' => $view);
- }
- }
- // set the uikit checker
- if ((2 == CFactory::_('Config')->uikit || 1 == CFactory::_('Config')->uikit)
- && in_array(
- $type, $textareas
- ))
- {
- $this->siteFieldData['uikit'][$site_field->site][$code][$site_field->as][$site_field->key]
- = (array) $site_field;
- }
- // set the textareas checker
- if (in_array($type, $textareas))
- {
- $this->siteFieldData['textareas'][$site_field->site][$code][$site_field->as][$site_field->key]
- = (array) $site_field;
- }
- }
- }
+ CFactory::_('Compiler.Creator.Site.Field.Data')->set($view, $field, $set, $type);
}
/**
@@ -4134,1167 +722,51 @@ class Fields extends Structure
* @param boolean $repeatable The repeatable field switch
*
* @return array The field attributes
- *
+ * @deprecated 3.3 Use CFactory::_('Field.Attributes')->set(...);
*/
private function setFieldAttributes(&$field, &$viewType, &$name, &$typeName,
- &$multiple, &$langLabel, $langView, $nameListCode, $nameSingleCode,
- $placeholders, $repeatable = false
- ) {
- // reset array
- $fieldAttributes = array();
- $setCustom = false;
- $setReadonly = false;
- // setup joomla default fields
- if (!ComponentbuilderHelper::fieldCheck($typeName))
- {
- $fieldAttributes['custom'] = array();
- // is this an own custom field
- if (isset($field['settings']->own_custom))
- {
- $fieldAttributes['custom']['own_custom']
- = $field['settings']->own_custom;
- }
- $setCustom = true;
- }
- // setup a default field
- if (ArrayHelper::check($field['settings']->properties))
- {
- // we need a deeper php code search tracker
- $phpTracker = array();
- foreach ($field['settings']->properties as $property)
- {
- // reset
- $xmlValue = '';
- $langValue = '';
- if ($property['name'] === 'type')
- {
- // get type name
- $xmlValue = $typeName;
+ &$multiple, &$langLabel, $langView, $nameListCode, $nameSingleCode,
+ $placeholders, $repeatable = false
+ )
+ {
+ // set notice that we could not get a valid string from the target
+ $this->app->enqueueMessage(
+ JText::sprintf('
%s Warning
', __CLASS__), 'Error'
+ );
+ $this->app->enqueueMessage(
+ JText::sprintf(
+ 'Use of a deprecated method (%s)!', __METHOD__
+ ), 'Error'
+ );
- // add to custom if it is custom
- if ($setCustom)
- {
- // set the type just to make sure.
- $fieldAttributes['custom']['type'] = $typeName;
- }
- }
- elseif ($property['name'] === 'name')
- {
- // get the actual field name
- $xmlValue = CFactory::_('Placeholder')->update($name, $placeholders);
- }
- elseif ($property['name'] === 'validate')
- {
- // check if we have validate (validation rule set)
- $xmlValue = GetHelper::between(
- $field['settings']->xml, 'validate="', '"'
- );
- if (StringHelper::check($xmlValue))
- {
- $xmlValue = StringHelper::safe(
- $xmlValue
- );
- }
- }
- elseif ($property['name'] === 'extension'
- || $property['name'] === 'directory'
- || $property['name'] === 'formsource')
- {
- // get value & replace the placeholders
- $xmlValue = CFactory::_('Placeholder')->update(
- GetHelper::between(
- $field['settings']->xml, $property['name'] . '="',
- '"'
- ), $placeholders
- );
- }
- // catch all PHP here
- elseif (strpos((string) $property['name'], 'type_php') !== false
- && $setCustom)
- {
- // set the line number
- $phpLine = (int) preg_replace(
- '/[^0-9]/', '', (string) $property['name']
- );
- // set the type key
- $phpKey = (string) trim(
- str_replace(
- 'type_', '',
- preg_replace('/[0-9]+/', '', (string) $property['name'])
- ), '_'
- );
- // load the php for the custom field file
- $fieldAttributes['custom'][$phpKey][$phpLine]
- = CFactory::_('Customcode')->update(
- ComponentbuilderHelper::openValidBase64(
- GetHelper::between(
- $field['settings']->xml,
- $property['name'] . '="', '"'
- )
- )
- );
- // load tracker
- $phpTracker['type_' . $phpKey] = $phpKey;
- }
- elseif ($property['name'] === 'prime_php' && $setCustom)
- {
- // load the php for the custom field file
- $fieldAttributes['custom']['prime_php']
- = (int) GetHelper::between(
- $field['settings']->xml, $property['name'] . '="', '"'
- );
- }
- elseif ($property['name'] === 'extends' && $setCustom)
- {
- // load the class that is being extended
- $fieldAttributes['custom']['extends']
- = GetHelper::between(
- $field['settings']->xml, 'extends="', '"'
- );
- }
- elseif ($property['name'] === 'view' && $setCustom)
- {
- // load the view name & replace the placeholders
- $fieldAttributes['custom']['view']
- = StringHelper::safe(
- CFactory::_('Placeholder')->update(
- GetHelper::between(
- $field['settings']->xml, 'view="', '"'
- ), $placeholders
- )
- );
- }
- elseif ($property['name'] === 'views' && $setCustom)
- {
- // load the views name & replace the placeholders
- $fieldAttributes['custom']['views']
- = StringHelper::safe(
- CFactory::_('Placeholder')->update(
- GetHelper::between(
- $field['settings']->xml, 'views="', '"'
- ), $placeholders
- )
- );
- }
- elseif ($property['name'] === 'component' && $setCustom)
- {
- // load the component name & replace the placeholders
- $fieldAttributes['custom']['component']
- = CFactory::_('Placeholder')->update(
- GetHelper::between(
- $field['settings']->xml, 'component="', '"'
- ), $placeholders
- );
- }
- elseif ($property['name'] === 'table' && $setCustom)
- {
- // load the main table that is queried & replace the placeholders
- $fieldAttributes['custom']['table']
- = CFactory::_('Placeholder')->update(
- GetHelper::between(
- $field['settings']->xml, 'table="', '"'
- ), $placeholders
- );
- }
- elseif ($property['name'] === 'value_field' && $setCustom)
- {
- // load the text key
- $fieldAttributes['custom']['text']
- = StringHelper::safe(
- GetHelper::between(
- $field['settings']->xml, 'value_field="', '"'
- )
- );
- }
- elseif ($property['name'] === 'key_field' && $setCustom)
- {
- // load the id key
- $fieldAttributes['custom']['id']
- = StringHelper::safe(
- GetHelper::between(
- $field['settings']->xml, 'key_field="', '"'
- )
- );
- }
- elseif ($property['name'] === 'button' && $repeatable
- && $setCustom)
- {
- // dont load the button to repeatable
- $xmlValue = 'false';
- // do not add button
- $fieldAttributes['custom']['add_button'] = 'false';
- }
- elseif ($property['name'] === 'button' && $setCustom)
- {
- // load the button string value if found
- $xmlValue = (string) StringHelper::safe(
- GetHelper::between(
- $field['settings']->xml, 'button="', '"'
- )
- );
- // add to custom values
- $fieldAttributes['custom']['add_button']
- = (StringHelper::check($xmlValue)
- || 1 == $xmlValue) ? $xmlValue : 'false';
- }
- elseif ($property['name'] === 'required'
- && 'repeatable' === $typeName)
- {
- // dont load the required to repeatable field type
- $xmlValue = 'false';
- }
- elseif ($viewType == 2
- && ($property['name'] === 'readonly'
- || $property['name'] === 'disabled'))
- {
- // set read only
- $xmlValue = 'true';
- // trip the switch for readonly
- if ($property['name'] === 'readonly')
- {
- $setReadonly = true;
- }
- }
- elseif ($property['name'] === 'multiple')
- {
- $xmlValue = (string) GetHelper::between(
- $field['settings']->xml, $property['name'] . '="', '"'
- );
- // add the multipal
- if ('true' === $xmlValue)
- {
- $multiple = true;
- }
- }
- // make sure the name is added as a cless name for use in javascript
- elseif ($property['name'] === 'class'
- && ($typeName === 'note'
- || $typeName === 'spacer'))
- {
- $xmlValue = GetHelper::between(
- $field['settings']->xml, 'class="', '"'
- );
- // add the type class
- if (StringHelper::check($xmlValue))
- {
- if (strpos($xmlValue, $name) === false)
- {
- $xmlValue = $xmlValue . ' ' . $name;
- }
- }
- else
- {
- $xmlValue = $name;
- }
- }
- else
- {
- // set the rest of the fields
- $xmlValue = (string) CFactory::_('Placeholder')->update(
- GetHelper::between(
- $field['settings']->xml, $property['name'] . '="',
- '"'
- ), $placeholders
- );
- }
-
- // check if translatable
- if (StringHelper::check($xmlValue)
- && isset($property['translatable'])
- && $property['translatable'] == 1)
- {
- // update label if field use multiple times
- if ($property['name'] === 'label')
- {
- if (isset($fieldAttributes['name'])
- && CFactory::_('Registry')->get("unique.names.$nameListCode.names." . $fieldAttributes['name']) !== null)
- {
- $xmlValue .= ' ('
- . StringHelper::safe(
- CFactory::_('Registry')->get("unique.names.$nameListCode.names." . $fieldAttributes['name'])
- ) . ')';
- }
- }
- // replace placeholders
- $xmlValue = CFactory::_('Placeholder')->update(
- $xmlValue, $placeholders
- );
- // insure custom lables dont get messed up
- if ($setCustom)
- {
- $customLabel = $xmlValue;
- }
- // set lang key
- $langValue = $langView . '_'
- . FieldHelper::safe(
- $name . ' ' . $property['name'], true
- );
- // add to lang array
- CFactory::_('Language')->set(CFactory::_('Config')->lang_target, $langValue, $xmlValue);
- // use lang value
- $xmlValue = $langValue;
- }
- elseif (isset($field['alias']) && $field['alias']
- && isset($property['translatable'])
- && $property['translatable'] == 1)
- {
- if ($property['name'] === 'label')
- {
- $xmlValue = 'JFIELD_ALIAS_LABEL';
- }
- elseif ($property['name'] === 'description')
- {
- $xmlValue = 'JFIELD_ALIAS_DESC';
- }
- elseif ($property['name'] === 'hint')
- {
- $xmlValue = 'JFIELD_ALIAS_PLACEHOLDER';
- }
- }
- elseif (isset($field['title']) && $field['title']
- && isset($property['translatable'])
- && $property['translatable'] == 1)
- {
- if ($property['name'] === 'label')
- {
- $xmlValue = 'JGLOBAL_TITLE';
- }
- }
- // only load value if found or is mandatory
- if (StringHelper::check($xmlValue)
- || (isset($property['mandatory'])
- && $property['mandatory'] == 1
- && !$setCustom))
- {
- // make sure mantory fields are added
- if (!StringHelper::check($xmlValue))
- {
- if (isset($property['example'])
- && StringHelper::check(
- $property['example']
- ))
- {
- $xmlValue = $property['example'];
- }
- }
- // load to langBuilder down the line
- if ($property['name'] === 'label')
- {
- if ($setCustom)
- {
- $fieldAttributes['custom']['label'] = $customLabel;
- }
- $langLabel = $xmlValue;
- }
- // now set the value
- $fieldAttributes[$property['name']] = $xmlValue;
- }
- // validate that the default field is set
- elseif ($property['name'] === 'default'
- && ($xmlValidateValue
- = GetHelper::between(
- $field['settings']->xml, 'default="', '"', 'none-set'
- )) !== 'none-set')
- {
- // we must allow empty defaults
- $fieldAttributes['default'] = $xmlValue;
- }
- }
- // check if all php is loaded using the tracker
- if (ArrayHelper::check($phpTracker))
- {
- // litle search validation
- $confirmation
- = '8qvZHoyuFYQqpj0YQbc6F3o5DhBlmS-_-a8pmCZfOVSfANjkmV5LG8pCdAY2JNYu6cB';
- foreach ($phpTracker as $searchKey => $phpKey)
- {
- // we must search for more code in the xml just encase
- foreach (range(2, 30) as $phpLine)
- {
- $get_ = $searchKey . '_' . $phpLine;
- if (!isset($fieldAttributes['custom'][$phpKey][$phpLine])
- && ($value
- = ComponentbuilderHelper::getValueFromXMLstring(
- $field['settings']->xml, $get_, $confirmation
- )) !== $confirmation)
- {
- $fieldAttributes['custom'][$phpKey][$phpLine]
- = CFactory::_('Customcode')->update(
- ComponentbuilderHelper::openValidBase64($value)
- );
- }
- }
- }
- }
- // do some nice twigs beyond the default
- if (isset($fieldAttributes['name']))
- {
- // check if we have class value for the list view of this field
- $listclass = GetHelper::between(
- $field['settings']->xml, 'listclass="', '"'
- );
- if (StringHelper::check($listclass))
- {
- CFactory::_('Registry')->set('builder.list_field_class.' . $nameListCode . '.' . $fieldAttributes['name'], $listclass);
- }
- // check if we find reason to remove this field from being escaped
- $escaped = GetHelper::between(
- $field['settings']->xml, 'escape="', '"'
- );
- if (StringHelper::check($escaped))
- {
- CFactory::_('Registry')->set('builder.do_not_escape.' .
- $nameListCode . '.' . $fieldAttributes['name'], true);
- }
- // check if we have display switch for dynamic placement
- $display = GetHelper::between(
- $field['settings']->xml, 'display="', '"'
- );
- if (StringHelper::check($display))
- {
- $fieldAttributes['display'] = $display;
- }
- // make sure validation is set if found (even it not part of field properties)
- if (!isset($fieldAttributes['validate']))
- {
- // check if we have validate (validation rule set)
- $validationRule = GetHelper::between(
- $field['settings']->xml, 'validate="', '"'
- );
- if (StringHelper::check($validationRule))
- {
- $fieldAttributes['validate']
- = StringHelper::safe(
- $validationRule
- );
- }
- }
- // make sure ID is always readonly
- if ($fieldAttributes['name'] === 'id' && !$setReadonly)
- {
- $fieldAttributes['readonly'] = 'true';
- }
- }
- }
-
- return $fieldAttributes;
+ return false;
}
/**
* set Builders
*
- * @param string $langLabel The language string for field label
- * @param string $langView The language string of the view
- * @param string $nameSingleCode The single view name
- * @param string $nameListCode The list view name
- * @param string $name The field name
- * @param array $view The view data
- * @param array $field The field data
- * @param string $typeName The field type
- * @param boolean $multiple The switch to set multiple selection option
- * @param boolean $custom The custom field switch
- * @param boolean $options The options switch
+ * @param string $langLabel The language string for field label
+ * @param string $langView The language string of the view
+ * @param string $nameSingleCode The single view name
+ * @param string $nameListCode The list view name
+ * @param string $name The field name
+ * @param array $view The view data
+ * @param array $field The field data
+ * @param string $typeName The field type
+ * @param bool $multiple The switch to set multiple selection option
+ * @param array|null $custom The custom field switch
+ * @param array|null $options The options switch
*
* @return void
- *
+ * @deprecated 3.3 Use CFactory::_('Compiler.Creator.Builders')->set(...);
*/
public function setBuilders($langLabel, $langView, $nameSingleCode,
- $nameListCode, $name, $view, $field, $typeName, $multiple,
- $custom = false, $options = false
- ) {
- // check if this is a tag field
- if ($typeName === 'tag')
- {
- // set tags for this view but don't load to DB
- CFactory::_('Registry')->set('builder.tags.' . $nameSingleCode, true);
- }
- // dbSwitch
- $dbSwitch = true;
- if (isset($field['list']) && $field['list'] == 2)
- {
- // do not add this field to the database
- $dbSwitch = false;
- }
- elseif (isset($field['settings']->datatype))
- {
- // insure default not none if number type
- $numberKeys = array('INT', 'TINYINT', 'BIGINT', 'FLOAT', 'DECIMAL',
- 'DOUBLE');
- // don't use these as index or uniqe keys
- $textKeys = array('TEXT', 'TINYTEXT', 'MEDIUMTEXT', 'LONGTEXT',
- 'BLOB', 'TINYBLOB', 'MEDIUMBLOB', 'LONGBLOB');
- // build the query values
- CFactory::_('Registry')->set('builder.database_tables.' . $nameSingleCode . '.' . $name . '.type',
- $field['settings']->datatype);
- // check if this is a number
- if (in_array($field['settings']->datatype, $numberKeys))
- {
- if ($field['settings']->datadefault === 'Other')
- {
- // setup the checking
- $number_check = $field['settings']->datadefault_other;
- // Decimals in SQL needs some help
- if ('DECIMAL' === $field['settings']->datatype
- && !is_numeric($number_check))
- {
- $number_check = str_replace(
- ',', '.', (string) $field['settings']->datadefault_other
- );
- }
- // check if we have a valid number value
- if (!is_numeric($number_check))
- {
- $field['settings']->datadefault_other = '0';
- }
- }
- elseif (!is_numeric($field['settings']->datadefault))
- {
- $field['settings']->datadefault = '0';
- }
- }
- // check if this is not text
- if (!in_array($field['settings']->datatype, $textKeys))
- {
- CFactory::_('Registry')->set('builder.database_tables.' . $nameSingleCode . '.' . $name . '.lenght',
- $field['settings']->datalenght);
- CFactory::_('Registry')->set('builder.database_tables.' . $nameSingleCode . '.' . $name . '.lenght_other',
- $field['settings']->datalenght_other);
- CFactory::_('Registry')->set('builder.database_tables.' . $nameSingleCode . '.' . $name . '.default',
- $field['settings']->datadefault);
- CFactory::_('Registry')->set('builder.database_tables.' . $nameSingleCode . '.' . $name . '.other',
- $field['settings']->datadefault_other);
- }
- // fall back unto EMPTY for text
- else
- {
- CFactory::_('Registry')->set('builder.database_tables.' . $nameSingleCode . '.' . $name . '.default',
- 'EMPTY');
- }
- // to identify the field
- CFactory::_('Registry')->set('builder.database_tables.' . $nameSingleCode . '.' . $name . '.ID',
- $field['settings']->id);
- CFactory::_('Registry')->set('builder.database_tables.' . $nameSingleCode . '.' . $name . '.null_switch',
- $field['settings']->null_switch);
- // set index types
- $_guid = true;
- if ($field['settings']->indexes == 1
- && !in_array(
- $field['settings']->datatype, $textKeys
- ))
- {
- // build unique keys of this view for db
- CFactory::_('Registry')->appendArray('builder.database_unique_keys.' . $nameSingleCode, $name);
- // prevent guid from being added twice
- if ('guid' === $name)
- {
- $_guid = false;
- }
- }
- elseif (($field['settings']->indexes == 2
- || (isset($field['alias'])
- && $field['alias'])
- || (isset($field['title']) && $field['title'])
- || $typeName === 'category')
- && !in_array($field['settings']->datatype, $textKeys))
- {
- // build keys of this view for db
- CFactory::_('Registry')->appendArray('builder.database_keys.' . $nameSingleCode, $name);
- }
- // special treatment for GUID
- if ('guid' === $name && $_guid)
- {
- CFactory::_('Registry')->set('builder.database_unique_guid.' . $nameSingleCode, true);
- }
- }
- // set list switch
- $listSwitch = (isset($field['list'])
- && ($field['list'] == 1
- || $field['list'] == 3
- || $field['list'] == 4));
- // set list join
- $listJoin
- = CFactory::_('Registry')->exists('builder.list_join.' . $nameListCode . '.' . (int) $field['field']);
- // add history to this view
- if (isset($view['history']) && $view['history'])
- {
- CFactory::_('Registry')->set('builder.history.' . $nameSingleCode, true);
- }
- // set Alias (only one title per view)
- if ($dbSwitch && isset($field['alias']) && $field['alias']
- && !CFactory::_('Registry')->get('builder.alias.' . $nameSingleCode))
- {
- CFactory::_('Registry')->set('builder.alias.' . $nameSingleCode, $name);
- }
- // set Titles (only one title per view)
- if ($dbSwitch && isset($field['title']) && $field['title']
- && !CFactory::_('Registry')->get('builder.title.' . $nameSingleCode))
- {
- CFactory::_('Registry')->set('builder.title.' . $nameSingleCode, $name);
- }
- // category name fix
- if ($typeName === 'category')
- {
- if (CFactory::_('Registry')->get('category.other.name.' . $nameListCode . '.name'))
- {
- $tempName = CFactory::_('Registry')->get('category.other.name.' . $nameListCode . '.name');
- }
- else
- {
- $tempName = $nameListCode . ' categories';
- }
- // set lang
- $listLangName = $langView . '_'
- . FieldHelper::safe($tempName, true);
- // set field name
- $listFieldName = StringHelper::safe($tempName, 'W');
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $listLangName, $listFieldName
- );
- }
- else
- {
- // if label was set use instead
- if (StringHelper::check($langLabel))
- {
- $listLangName = $langLabel;
- // get field label from the lang label
- if (CFactory::_('Language')->exist(CFactory::_('Config')->lang_target, $langLabel))
- {
- $listFieldName
- = CFactory::_('Language')->get(CFactory::_('Config')->lang_target, $langLabel);
- }
- else
- {
- // get it from the field xml string
- $listFieldName = (string) CFactory::_('Placeholder')->update_(
- GetHelper::between(
- $field['settings']->xml, 'label="',
- '"'
- )
- );
- }
- // make sure there is no html in the list field name
- $listFieldName = strip_tags($listFieldName);
- }
- else
- {
- // set lang (just in case)
- $listLangName = $langView . '_'
- . FieldHelper::safe($name, true);
- // set field name
- $listFieldName = StringHelper::safe($name, 'W');
- // add to lang array
- CFactory::_('Language')->set(
- CFactory::_('Config')->lang_target, $listLangName, $listFieldName
- );
- }
- }
- // build the list values
- if (($listSwitch || $listJoin) && $typeName != 'repeatable'
- && $typeName != 'subform')
- {
- // load to list builder
- if ($listSwitch)
- {
- // append values
- CFactory::_('Registry')->appendArray('builder.list.' . $nameListCode, [
- 'id' => (int) $field['field'],
- 'type' => $typeName,
- 'code' => $name,
- 'lang' => $listLangName,
- 'title' => (isset($field['title']) && $field['title'])
- ? true : false,
- 'alias' => (isset($field['alias']) && $field['alias'])
- ? true : false,
- 'link' => (isset($field['link']) && $field['link'])
- ? true : false,
- 'sort' => (isset($field['sort']) && $field['sort'])
- ? true : false,
- 'custom' => $custom,
- 'multiple' => $multiple,
- 'options' => $options,
- 'target' => (int) $field['list']
- ]);
- }
- // build custom builder list
- if ($listSwitch || $listJoin)
- {
- CFactory::_('Registry')->set('builder.custom_list.' . $nameSingleCode . '.' . $name, true);
- }
- }
- // load the list join builder
- if ($listJoin)
- {
- CFactory::_('Registry')->set('builder.list_join.' . $nameListCode . '.' . (int) $field['field'], [
- 'type' => $typeName,
- 'code' => $name,
- 'lang' => $listLangName,
- 'title' => (isset($field['title']) && $field['title']) ? true
- : false,
- 'alias' => (isset($field['alias']) && $field['alias']) ? true
- : false,
- 'link' => (isset($field['link']) && $field['link']) ? true
- : false,
- 'sort' => (isset($field['sort']) && $field['sort']) ? true
- : false,
- 'custom' => $custom,
- 'multiple' => $multiple,
- 'options' => $options
- ]);
- }
- // update the field relations
- if (($field_relations =
- CFactory::_('Registry')->get('builder.field_relations.' . $nameListCode . '.' . (int) $field['field'])) !== null)
- {
- $field_relations = (array) $field_relations;
- foreach ($field_relations as $area => &$field_values)
- {
- $field_values['type'] = $typeName;
- $field_values['code'] = $name;
- $field_values['custom'] = $custom;
- }
- CFactory::_('Registry')->set('builder.field_relations.' . $nameListCode . '.' . (int) $field['field'], $field_relations);
- }
- // set the hidden field of this view
- if ($dbSwitch && $typeName === 'hidden')
- {
- CFactory::_('Registry')->appendArray('builder.hidden_fields.' . $nameSingleCode, ',"' . $name . '"');
- }
- // set all int fields of this view
- if ($dbSwitch && isset($field['settings']->datatype)
- && ($field['settings']->datatype === 'INT'
- || $field['settings']->datatype === 'TINYINT'
- || $field['settings']->datatype === 'BIGINT'))
- {
- CFactory::_('Registry')->appendArray('builder.integer_fields.' . $nameSingleCode, ',"' . $name . '"');
- }
- // Get the default fields
- $default_fields = CFactory::_('Config')->default_fields;
- // set all dynamic field of this view
- if ($dbSwitch && $typeName != 'category' && $typeName != 'repeatable'
- && $typeName != 'subform' && !in_array($name, $default_fields))
- {
- CFactory::_('Registry')->appendArray('builder.dynamic_fields.' . $nameSingleCode, '"' . $name . '":"' . $name . '"');
- }
- // TODO we may need to add a switch instead (since now it uses the first editor field)
- // set the main(biggest) text field of this view
- if ($dbSwitch && $typeName === 'editor')
- {
- if (!CFactory::_('Registry')->exists('builder.main_text_field.' . $nameSingleCode))
- {
- CFactory::_('Registry')->set('builder.main_text_field.' . $nameSingleCode, $name);
- }
- }
- // set the custom builder
- if (ArrayHelper::check($custom)
- && $typeName != 'category'
- && $typeName != 'repeatable'
- && $typeName != 'subform')
- {
- $this->customBuilder[$nameListCode][] = array('type' => $typeName,
- 'code' => $name,
- 'lang' => $listLangName,
- 'custom' => $custom,
- 'method' => $field['settings']->store);
-
- // only load this if table is set
- if (isset($custom['table'])
- && StringHelper::check(
- $custom['table']
- ))
- {
- // set the custom fields needed in content type data
- CFactory::_('Registry')->appendArray('builder.custom_field_links.' . $nameSingleCode, ',{"sourceColumn": "'
- . $name . '","targetTable": "' . $custom['table'] . '","targetColumn": "' . $custom['id']
- . '","displayColumn": "' . $custom['text'] . '"}');
- }
- // build script switch for user
- if ($custom['extends'] === 'user')
- {
- $this->setScriptUserSwitch[$typeName] = $typeName;
- }
- }
- if ($typeName === 'media')
- {
- $this->setScriptMediaSwitch[$typeName] = $typeName;
- }
- // setup category for this view
- if ($dbSwitch && $typeName === 'category')
- {
- if (CFactory::_('Registry')->get('category.other.name.' . $nameListCode . '.view')
- && CFactory::_('Registry')->get('category.other.name.' . $nameListCode . '.views'))
- {
- $otherViews = CFactory::_('Registry')->get('category.other.name.' . $nameListCode . '.views');
- $otherView = CFactory::_('Registry')->get('category.other.name.' . $nameListCode . '.view');
- }
- else
- {
- $otherViews = $nameListCode;
- $otherView = $nameSingleCode;
- }
- // get the xml extension name
- $_extension = CFactory::_('Placeholder')->update_(
- GetHelper::between(
- $field['settings']->xml, 'extension="', '"'
- )
- );
- // if they left out the extension for some reason
- if (!StringHelper::check($_extension))
- {
- $_extension = 'com_' . CFactory::_('Config')->component_code_name . '.'
- . $otherView;
- }
- // check the context (does our target match)
- if (strpos((string) $_extension, '.') !== false)
- {
- $target_view = trim(explode('.', (string) $_extension)[1]);
- // from my understanding the target extension view and the otherView must align
- // so I will here check that it does, and if not raise an error message to fix this
- if ($target_view !== $otherView)
- {
- $target_extension = trim(explode('.', (string) $_extension)[0]);
- $correction = $target_extension . '.' . $otherView;
- $this->app->enqueueMessage(
- JText::sprintf(
- '