diff --git a/README.md b/README.md
index 8ab0e94ec..f80f39c77 100644
--- a/README.md
+++ b/README.md
@@ -144,11 +144,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
-+ *Last Build*: 24th June, 2020
++ *Last Build*: 7th July, 2020
+ *Version*: 2.11.2
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
-+ *Line count*: **282642**
++ *Line count*: **282473**
+ *Field count*: **1522**
+ *File count*: **1785**
+ *Folder count*: **295**
diff --git a/admin/README.txt b/admin/README.txt
index 8ab0e94ec..f80f39c77 100644
--- a/admin/README.txt
+++ b/admin/README.txt
@@ -144,11 +144,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
-+ *Last Build*: 24th June, 2020
++ *Last Build*: 7th July, 2020
+ *Version*: 2.11.2
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
-+ *Line count*: **282642**
++ *Line count*: **282473**
+ *Field count*: **1522**
+ *File count*: **1785**
+ *Folder count*: **295**
diff --git a/admin/compiler/joomla_3/JFormFieldCustom.php b/admin/compiler/joomla_3/JFormFieldCustom.php
index 85aa5469e..6ab1c0ffb 100644
--- a/admin/compiler/joomla_3/JFormFieldCustom.php
+++ b/admin/compiler/joomla_3/JFormFieldCustom.php
@@ -17,9 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
-// import the ###JFORM_extends### field type
-jimport('joomla.form.helper');
-JFormHelper::loadFieldClass('###JFORM_extends###');
+###JFORM_TYPE_HEADER###
/**
* ###Type### Form Field class for the ###Component### component
diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php
index 3f3ffa46d..5d618a1a8 100644
--- a/admin/helpers/compiler/a_Get.php
+++ b/admin/helpers/compiler/a_Get.php
@@ -322,8 +322,8 @@ class Get
= array(
'Joomla' . '.JText._(',
'JText:' . ':script(',
- 'JText:' . ':_(',
- 'JText:' . ':sprintf(',
+ 'Text:' . ':_(', // namespace and J version will be found
+ 'Text:' . ':sprintf(', // namespace and J version will be found
'JustTEXT:' . ':_('
);
@@ -1201,7 +1201,7 @@ class Get
array(&$this->componentContext, &$component)
);
- // set upater
+ // set updater
$updater = array(
'unique' => array(
'addadmin_views' => array('table' => 'component_admin_views',
@@ -1281,7 +1281,8 @@ class Get
);
// set the add targets
- $addArrayF = array('files' => 'files', 'folders' => 'folders',
+ $addArrayF = array('files' => 'files',
+ 'folders' => 'folders',
'filesfullpath' => 'files',
'foldersfullpath' => 'folders');
foreach ($addArrayF as $addTarget => $targetHere)
@@ -10370,7 +10371,7 @@ class Get
$locker['LOCKBASE64((((' . $value . '))))'] = "base64_decode( preg_replace('/\s+/', ''," .
PHP_EOL . $this->_t(2) . "'" .
wordwrap(base64_encode($value), 64, PHP_EOL . $this->_t(2), true) .
- "'));";
+ "'))";
}
// update the script
return $this->setPlaceholders($script, $locker);
diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php
index bb99927e2..e70dc64d8 100644
--- a/admin/helpers/compiler/c_Fields.php
+++ b/admin/helpers/compiler/c_Fields.php
@@ -2328,6 +2328,7 @@ class Fields extends Structure
. ComponentbuilderHelper::safeString($typeName, 'F')
. ". (custom) -->";
$field .= PHP_EOL . $this->_t(2) . $taber . " $value)
{
if ($property != 'option')
@@ -2335,8 +2336,274 @@ class Fields extends Structure
$field .= PHP_EOL . $this->_t(2) . $taber . $this->_t(1)
. $property . '="' . $value . '"';
}
+ elseif ($property === 'option')
+ {
+ $optionSet = '';
+ if (strtolower($typeName) === 'groupedlist'
+ && strpos(
+ $value, ','
+ ) !== false
+ && strpos($value, '@@') !== false)
+ {
+ // reset the group temp arrays
+ $groups_ = array();
+ $grouped_ = array('group' => array(),
+ 'option' => array());
+ $order_ = array();
+ // mulitpal options
+ $options = explode(',', $value);
+ foreach ($options as $option)
+ {
+ if (strpos($option, '@@') !== false)
+ {
+ // set the group label
+ $valueKeyArray = explode('@@', $option);
+ if (count((array) $valueKeyArray) == 2)
+ {
+ $langValue = $langView . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $valueKeyArray[0], true
+ );
+ // add to lang array
+ $this->setLangContent(
+ $this->lang, $langValue,
+ $valueKeyArray[0]
+ );
+ // now add group label
+ $groups_[$valueKeyArray[1]] = PHP_EOL
+ . $this->_t(1) . $taber . $this->_t(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 . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $valueKeyArray[1], true
+ );
+ // add to lang array
+ $this->setLangContent(
+ $this->lang, $langValue,
+ $valueKeyArray[1]
+ );
+ // now add to option set
+ $grouped_['group'][$valueKeyArray[2]][]
+ = PHP_EOL . $this->_t(1) . $taber
+ . $this->_t(3) . '';
+ $optionArray[$valueKeyArray[0]]
+ = $langValue;
+ // set order
+ $order_['group' . $valueKeyArray[2]]
+ = $valueKeyArray[2];
+ }
+ else
+ {
+ $langValue = $langView . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $valueKeyArray[1], true
+ );
+ // add to lang array
+ $this->setLangContent(
+ $this->lang, $langValue,
+ $valueKeyArray[1]
+ );
+ // now add to option set
+ $grouped_['option'][$valueKeyArray[0]]
+ = PHP_EOL . $this->_t(1) . $taber
+ . $this->_t(2) . '';
+ $optionArray[$valueKeyArray[0]]
+ = $langValue;
+ // set order
+ $order_['option' . $valueKeyArray[0]]
+ = $valueKeyArray[0];
+ }
+ }
+ else
+ {
+ // text is also the value
+ $langValue = $langView . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $option, true
+ );
+ // add to lang array
+ $this->setLangContent(
+ $this->lang, $langValue, $option
+ );
+ // now add to option set
+ $grouped_['option'][$option] = PHP_EOL
+ . $this->_t(1) . $taber . $this->_t(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])
+ && ComponentbuilderHelper::checkArray(
+ $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 . $this->_t(1) . $taber
+ . $this->_t(2) . '';
+ }
+ elseif (isset($grouped_[$key_][$_id])
+ && ComponentbuilderHelper::checkString(
+ $grouped_[$key_][$_id]
+ ))
+ {
+ $optionSet .= $grouped_[$key_][$_id];
+ }
+ }
+ }
+ elseif (strpos($value, ',') !== false)
+ {
+ // mulitpal options
+ $options = explode(',', $value);
+ foreach ($options as $option)
+ {
+ if (strpos($option, '|') !== false)
+ {
+ // has other value then text
+ list($v, $t) = explode('|', $option);
+ $langValue = $langView . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $t, true
+ );
+ // add to lang array
+ $this->setLangContent(
+ $this->lang, $langValue, $t
+ );
+ // now add to option set
+ $optionSet .= PHP_EOL . $this->_t(1)
+ . $taber . $this->_t(2) . '';
+ $optionArray[$v] = $langValue;
+ }
+ else
+ {
+ // text is also the value
+ $langValue = $langView . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $option, true
+ );
+ // add to lang array
+ $this->setLangContent(
+ $this->lang, $langValue, $option
+ );
+ // now add to option set
+ $optionSet .= PHP_EOL . $this->_t(2)
+ . $taber . $this->_t(1) . '';
+ $optionArray[$option] = $langValue;
+ }
+ }
+ }
+ else
+ {
+ // one option
+ if (strpos($value, '|') !== false)
+ {
+ // has other value then text
+ list($v, $t) = explode('|', $value);
+ $langValue = $langView . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $t, true
+ );
+ // add to lang array
+ $this->setLangContent($this->lang, $langValue, $t);
+ // now add to option set
+ $optionSet .= PHP_EOL . $this->_t(2) . $taber
+ . $this->_t(1) . '';
+ $optionArray[$v] = $langValue;
+ }
+ else
+ {
+ // text is also the value
+ $langValue = $langView . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $value, true
+ );
+ // add to lang array
+ $this->setLangContent(
+ $this->lang, $langValue, $value
+ );
+ // now add to option set
+ $optionSet .= PHP_EOL . $this->_t(2)
+ . $taber . $this->_t(1) . '';
+ $optionArray[$value] = $langValue;
+ }
+ }
+ }
+ }
+ // if options were found
+ if (ComponentbuilderHelper::checkString($optionSet))
+ {
+ $field .= '>';
+ $field .= PHP_EOL . $this->_t(3) . $taber . "";
+ $field .= $optionSet;
+ $field .= PHP_EOL . $this->_t(2) . $taber . "";
+ }
+ // if no options found and must have a list of options
+ elseif (ComponentbuilderHelper::fieldCheck($typeName, 'list'))
+ {
+ $optionArray = false;
+ $field .= PHP_EOL . $this->_t(2) . $taber . "/>";
+ $field .= PHP_EOL . $this->_t(2) . $taber . ""
+ . PHP_EOL;
+ }
+ else
+ {
+ $optionArray = false;
+ $field .= PHP_EOL . $this->_t(2) . $taber . "/>";
}
- $field .= PHP_EOL . $this->_t(2) . $taber . "/>";
// incase the field is in the config and has not been set
if ('config' === $view_name_single && 'configs' === $view_name_list
|| (strpos($view_name_single, 'P|uG!n') !== false
@@ -3083,6 +3350,244 @@ class Fields extends Structure
{
$field->fieldXML->addAttribute($property, $value);
}
+ elseif ($property === 'option')
+ {
+ ComponentbuilderHelper::xmlComment(
+ $field->fieldXML,
+ $this->setLine(__LINE__) . " Option Set."
+ );
+ if (strtolower($typeName) === 'groupedlist'
+ && strpos(
+ $value, ','
+ ) !== false
+ && strpos($value, '@@') !== false)
+ {
+ // reset the group temp arrays
+ $groups_ = array();
+ $grouped_ = array('group' => array(),
+ 'option' => array());
+ $order_ = array();
+ // mulitpal options
+ $options = explode(',', $value);
+ foreach ($options as $option)
+ {
+ if (strpos($option, '@@') !== false)
+ {
+ // set the group label
+ $valueKeyArray = explode('@@', $option);
+ if (count((array) $valueKeyArray) == 2)
+ {
+ $langValue = $langView . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $valueKeyArray[0], true
+ );
+ // add to lang array
+ $this->setLangContent(
+ $this->lang, $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 . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $valueKeyArray[1], true
+ );
+ // add to lang array
+ $this->setLangContent(
+ $this->lang, $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 . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $valueKeyArray[1], true
+ );
+ // add to lang array
+ $this->setLangContent(
+ $this->lang, $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 . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $option, true
+ );
+ // add to lang array
+ $this->setLangContent(
+ $this->lang, $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])
+ && ComponentbuilderHelper::checkArray(
+ $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])
+ && ComponentbuilderHelper::checkString(
+ $grouped_[$key_][$_id]
+ ))
+ {
+ $optionXML = $field->fieldXML->addChild(
+ 'option'
+ );
+ $optionXML->addAttribute(
+ 'value', $grouped_[$key_][$_id]['value']
+ );
+ $optionXML[] = $grouped_[$key_][$_id]['text'];
+ }
+ }
+ }
+ elseif (strpos($value, ',') !== false)
+ {
+ // mulitpal options
+ $options = explode(',', $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 . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $t, true
+ );
+ // add to lang array
+ $this->setLangContent(
+ $this->lang, $langValue, $t
+ );
+ // now add to option set
+ $optionXML->addAttribute('value', $v);
+ $optionArray[$v] = $langValue;
+ }
+ else
+ {
+ // text is also the value
+ $langValue = $langView . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $option, true
+ );
+ // add to lang array
+ $this->setLangContent(
+ $this->lang, $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($value, '|') !== false)
+ {
+ // has other value then text
+ list($v, $t) = explode('|', $value);
+ $langValue = $langView . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $t, true
+ );
+ // add to lang array
+ $this->setLangContent($this->lang, $langValue, $t);
+ // now add to option set
+ $optionXML->addAttribute('value', $v);
+ $optionArray[$v] = $langValue;
+ }
+ else
+ {
+ // text is also the value
+ $langValue = $langView . '_'
+ . ComponentbuilderHelper::safeFieldName(
+ $value, true
+ );
+ // add to lang array
+ $this->setLangContent(
+ $this->lang, $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' === $view_name_single
@@ -4149,9 +4654,10 @@ class Fields extends Structure
if ($target_view !== $otherView)
{
$target_extension = trim(explode('.', $_extension)[0]);
- $correction = $target_extension . '.' . $otherView;
+ $correction = $target_extension . '.' . $otherView;
$this->app->enqueueMessage(
- JText::sprintf('
Category targeting view mismatch
+ JText::sprintf(
+ '
Category targeting view mismatch
The
category field in (%s) admin view has a mismatching target view.
To correct the mismatch, the extension value %s
in the
@@ -4160,7 +4666,10 @@ class Fields extends Structure
best category integration with Joomla.
Please watch
this tutorial before proceeding!!!,
- code fix', $field['field'], $view_name_single, $_extension, $field['field'], $correction), 'Error'
+ code fix',
+ $field['field'], $view_name_single, $_extension,
+ $field['field'], $correction
+ ), 'Error'
);
}
}
@@ -4369,15 +4878,15 @@ class Fields extends Structure
&& $typeName != 'repeatable'
&& $typeName != 'subform'))
{
- $this->filterBuilder[$view_name_list][] = array('type' => $typeName,
- 'code' => $name,
- 'lang' => $listLangName,
- 'database' => $view_name_single,
- 'function' => ComponentbuilderHelper::safeString(
+ $this->filterBuilder[$view_name_list][] = array('type' => $typeName,
+ 'code' => $name,
+ 'lang' => $listLangName,
+ 'database' => $view_name_single,
+ 'function' => ComponentbuilderHelper::safeString(
$name, 'F'
),
- 'custom' => $custom,
- 'options' => $options);
+ 'custom' => $custom,
+ 'options' => $options);
}
// build the layout
@@ -4442,21 +4951,21 @@ class Fields extends Structure
);
// set the [[[PLACEHOLDER]]] options
$replace = array(
- $this->bbb . 'JPREFIX' . $this->ddd => $jprefix,
+ $this->bbb . 'JPREFIX' . $this->ddd => $jprefix,
$this->bbb . 'TABLE'
- . $this->ddd => $data['custom']['table'],
+ . $this->ddd => $data['custom']['table'],
$this->bbb . 'ID'
- . $this->ddd => $data['custom']['id'],
+ . $this->ddd => $data['custom']['id'],
$this->bbb . 'TEXT'
- . $this->ddd => $data['custom']['text'],
- $this->bbb . 'CODE_TEXT' . $this->ddd => $data['code'] . '_'
+ . $this->ddd => $data['custom']['text'],
+ $this->bbb . 'CODE_TEXT' . $this->ddd => $data['code'] . '_'
. $data['custom']['text'],
- $this->bbb . 'CODE' . $this->ddd => $data['code'],
- $this->bbb . 'view_type' . $this->ddd => $view_name_single
+ $this->bbb . 'CODE' . $this->ddd => $data['code'],
+ $this->bbb . 'view_type' . $this->ddd => $view_name_single
. '_' . $data['type'],
- $this->bbb . 'type' . $this->ddd => $data['type'],
+ $this->bbb . 'type' . $this->ddd => $data['type'],
$this->bbb . 'com_component'
- . $this->ddd => (isset($data['custom']['component'])
+ . $this->ddd => (isset($data['custom']['component'])
&& ComponentbuilderHelper::checkString(
$data['custom']['component']
)) ? ComponentbuilderHelper::safeString(
@@ -4464,19 +4973,19 @@ class Fields extends Structure
) : 'com_' . $this->componentCodeName,
// set the generic values
$this->bbb . 'component'
- . $this->ddd => $this->componentCodeName,
+ . $this->ddd => $this->componentCodeName,
$this->bbb . 'Component'
- . $this->ddd => $this->fileContentStatic[$this->hhh
+ . $this->ddd => $this->fileContentStatic[$this->hhh
. 'Component' . $this->hhh],
$this->bbb . 'view'
- . $this->ddd => (isset($data['custom']['view'])
+ . $this->ddd => (isset($data['custom']['view'])
&& ComponentbuilderHelper::checkString(
$data['custom']['view']
)) ? ComponentbuilderHelper::safeString(
$data['custom']['view']
) : $view_name_single,
$this->bbb . 'views'
- . $this->ddd => (isset($data['custom']['views'])
+ . $this->ddd => (isset($data['custom']['views'])
&& ComponentbuilderHelper::checkString(
$data['custom']['views']
)) ? ComponentbuilderHelper::safeString(
@@ -4544,12 +5053,21 @@ class Fields extends Structure
$this->buildDynamique(
$target, 'fieldcustom', $data['custom']['type']
);
+ // get the extends name
+ $JFORM_extends = ComponentbuilderHelper::safeString(
+ $data['custom']['extends']
+ );
+ // JFORM_TYPE_HEADER <<>>
+ $add_default_header = true;
+ $this->fileContentDynamic['customfield_'
+ . $data['type']][$this->hhh . 'JFORM_TYPE_HEADER' . $this->hhh]
+ = "//" . $this->setLine(
+ __LINE__
+ ) . " Import the " . $JFORM_extends . " field type classes needed";
// JFORM_extens <<>>
$this->fileContentDynamic['customfield_'
. $data['type']][$this->hhh . 'JFORM_extends' . $this->hhh]
- = ComponentbuilderHelper::safeString(
- $data['custom']['extends']
- );
+ = $JFORM_extends;
// JFORM_EXTENDS <<>>
$this->fileContentDynamic['customfield_'
. $data['type']][$this->hhh . 'JFORM_EXTENDS' . $this->hhh]
@@ -4582,15 +5100,56 @@ class Fields extends Structure
);
}
}
- // JFORM_TYPE_PHP <<>>
- $this->fileContentDynamic['customfield_'
- . $data['type']][$this->hhh . 'JFORM_TYPE_PHP'
- . $this->hhh]
- .= PHP_EOL . $this->setPlaceholders(
- $phpBucket, $replace
- );
+ // check if this is header text
+ if('HEADER' === $x)
+ {
+ $this->fileContentDynamic['customfield_'
+ . $data['type']][$this->hhh . 'JFORM_TYPE_HEADER'
+ . $this->hhh]
+ .= PHP_EOL . $this->setPlaceholders(
+ $phpBucket, $replace
+ );
+ // stop default headers from loading
+ $add_default_header = false;
+ }
+ else
+ {
+ // JFORM_TYPE_PHP <<>>
+ $this->fileContentDynamic['customfield_'
+ . $data['type']][$this->hhh . 'JFORM_TYPE_PHP'
+ . $this->hhh]
+ .= PHP_EOL . $this->setPlaceholders(
+ $phpBucket, $replace
+ );
+ }
}
}
+ // check if we should add default header
+ if ($add_default_header)
+ {
+ $this->fileContentDynamic['customfield_'
+ . $data['type']][$this->hhh . 'JFORM_TYPE_HEADER'
+ . $this->hhh]
+ .= PHP_EOL . "jimport('joomla.form.helper');";
+ $this->fileContentDynamic['customfield_'
+ . $data['type']][$this->hhh . 'JFORM_TYPE_HEADER'
+ . $this->hhh]
+ .= PHP_EOL . "JFormHelper::loadFieldClass('"
+ . $JFORM_extends . "');";
+ }
+ // check the the JFormHelper::loadFieldClass(..) was set
+ elseif (strpos(
+ $this->fileContentDynamic['customfield_'
+ . $data['type']][$this->hhh . 'JFORM_TYPE_HEADER'
+ . $this->hhh], 'JFormHelper::loadFieldClass('
+ ) === false)
+ {
+ $this->fileContentDynamic['customfield_'
+ . $data['type']][$this->hhh . 'JFORM_TYPE_HEADER'
+ . $this->hhh]
+ .= PHP_EOL . "JFormHelper::loadFieldClass('"
+ . $JFORM_extends . "');";
+ }
}
else
{
diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php
index 14f012682..c1bd7ea1e 100644
--- a/admin/helpers/compiler/e_Interpretation.php
+++ b/admin/helpers/compiler/e_Interpretation.php
@@ -1849,9 +1849,20 @@ class Interpretation extends Fields
$method = array();
$method[] = PHP_EOL . PHP_EOL . $this->_t(1) . "/**";
$method[] = $this->_t(1) . " * Greate user and update given table";
+ $method[] = $this->_t(1) . " *";
+ $method[] = $this->_t(1) . " * @param array \$credentials Array('name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string)";
+ $method[] = $this->_t(1) . " * @param int \$autologin";
+ $method[] = $this->_t(1) . " * @param array \$params Array('useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int)";
+ $method[] = $this->_t(1) . " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration";
+ $method[] = $this->_t(1) . " *";
+ $method[] = $this->_t(1) . " * @return int|Error User ID on success, or an error.";
$method[] = $this->_t(1) . " */";
$method[] = $this->_t(1)
- . "public static function createUser(\$new)";
+ . "public static function createUser(\$credentials, \$autologin = 0,";
+ $method[] = $this->_t(2) . "\$params = array(";
+ $method[] = $this->_t(3) . "'useractivation' => 0, 'sendpassword' => 1";
+ $method[] = $this->_t(2) . "), \$mode = 1";
+ $method[] = $this->_t(1) . ")";
$method[] = $this->_t(1) . "{";
$method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
. " load the user component language files if there is an error.";
@@ -1864,75 +1875,144 @@ class Interpretation extends Fields
$method[] = $this->_t(2)
. "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);";
$method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
- . " load the user regestration model";
- $method[] = $this->_t(2)
- . "\$model = self::getModel('registration', JPATH_ROOT. '/components/com_users', 'Users');";
- $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
- . " make sure no activation is needed";
- $method[] = $this->_t(2)
- . "\$useractivation = self::setParams('com_users','useractivation',0);";
- $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
- . " make sure password is send";
- $method[] = $this->_t(2)
- . "\$sendpassword = self::setParams('com_users','sendpassword',1);";
- $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
- . " Check if password was set";
- $method[] = $this->_t(2)
- . "if (isset(\$new['password']) && isset(\$new['password2']) && self::checkString(\$new['password']) && self::checkString(\$new['password2']))";
+ . " Load the correct user model.";
+ $method[] = $this->_t(2) . "if (\$mode == 1)";
$method[] = $this->_t(2) . "{";
$method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
- . " Use the users passwords";
- $method[] = $this->_t(3) . "\$password = \$new['password'];";
- $method[] = $this->_t(3) . "\$password2 = \$new['password2'];";
+ . " Load the backend-user model";
+ $method[] = $this->_t(3)
+ . "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/com_users', 'Users');";
$method[] = $this->_t(2) . "}";
$method[] = $this->_t(2) . "else";
$method[] = $this->_t(2) . "{";
$method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
- . " Set random password";
- $method[] = $this->_t(3) . "\$password = self::randomkey(8);";
- $method[] = $this->_t(3) . "\$password2 = \$password;";
+ . " Load the user site-registration model";
+ $method[] = $this->_t(3)
+ . "\$model = self::getModel('registration', JPATH_ROOT. '/components/com_users', 'Users');";
$method[] = $this->_t(2) . "}";
$method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
- . " set username if not set";
+ . " Check if we have params/config";
+ $method[] = $this->_t(2) . "if (self::checkArray(\$params))";
+ $method[] = $this->_t(2) . "{";
+ $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
+ . " Make changes to user config";
+ $method[] = $this->_t(3)
+ . "foreach (\$params as \$param => \$set)";
+ $method[] = $this->_t(3) . "{";
+ $method[] = $this->_t(4) . "//" . $this->setLine(__LINE__)
+ . " If you know of a better path, let me know";
+ $method[] = $this->_t(4)
+ ."\$params[\$param] = self::setParams('com_users', \$param, \$set);";
+ $method[] = $this->_t(3) . "}";
+ $method[] = $this->_t(2) . "}";
+ $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
+ . " Set username to email if not set";
$method[] = $this->_t(2)
- . "if (!isset(\$new['username']) || !self::checkString(\$new['username']))";
+ . "if (!isset(\$credentials['username']) || !self::checkString(\$credentials['username']))";
$method[] = $this->_t(2) . "{";
$method[] = $this->_t(3)
- . "\$new['username'] = self::safeString(\$new['name']);";
+ . "\$credentials['username'] = \$credentials['email'];";
$method[] = $this->_t(2) . "}";
$method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
- . " linup new user data";
+ . " Lineup new user data array";
$method[] = $this->_t(2) . "\$data = array(";
- $method[] = $this->_t(3) . "'username' => \$new['username'],";
- $method[] = $this->_t(3) . "'name' => \$new['name'],";
- $method[] = $this->_t(3) . "'email1' => \$new['email'],";
- $method[] = $this->_t(3)
- . "'password1' => \$password, // First password field";
- $method[] = $this->_t(3)
- . "'password2' => \$password2, // Confirm password field";
+ $method[] = $this->_t(3) . "'username' => \$credentials['username'],";
+ $method[] = $this->_t(3) . "'name' => \$credentials['name']";
$method[] = $this->_t(3) . "'block' => 0 );";
$method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
- . " register the new user";
- $method[] = $this->_t(2) . "\$userId = \$model->register(\$data);";
+ . " Added details based on mode";
+ $method[] = $this->_t(2) . "if (\$mode == 1)";
+ $method[] = $this->_t(2) . "{";
+ $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
+ . " Site-registration mode";
+ $method[] = $this->_t(3) . "\$data['email1'] = \$credentials['email'];";
+ $method[] = $this->_t(2) . "}";
+ $method[] = $this->_t(2) . "else";
+ $method[] = $this->_t(2) . "{";
+ $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
+ . " Admin-registration mode";
+ $method[] = $this->_t(3) . "\$data['email'] = \$credentials['email'];";
+ $method[] = $this->_t(3) . "\$data['registerDate'] = JFactory::getDate()->toSql();";
+ $method[] = $this->_t(2) . "}";
+
$method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
- . " set activation back to default";
+ . " Check if password was set";
$method[] = $this->_t(2)
- . "self::setParams('com_users','useractivation',\$useractivation);";
+ . "if (\$mode = 1 && (!isset(\$credentials['password']) || !isset(\$credentials['password2']) || !self::checkString(\$credentials['password']) || !self::checkString(\$credentials['password2'])))";
+ $method[] = $this->_t(2) . "{";
+ $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
+ . " Set random password when empty password was submitted,";
+ $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
+ . " and we are using the site-registration mode";
+ $method[] = $this->_t(3) . "\$credentials['password'] = self::randomkey(8);";
+ $method[] = $this->_t(3) . "\$credentials['password2'] = \$credentials['password'];";
+ $method[] = $this->_t(2) . "}";
+
$method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
- . " set send password back to default";
+ . " Now Add password if set";
$method[] = $this->_t(2)
- . "self::setParams('com_users','sendpassword',\$sendpassword);";
+ . "if (isset(\$credentials['password']) && isset(\$credentials['password2']) && self::checkString(\$credentials['password']) && self::checkString(\$credentials['password2'])))";
+ $method[] = $this->_t(2) . "{";
+ $method[] = $this->_t(3) . "if (\$mode = 1)";
+ $method[] = $this->_t(3) . "{";
+ $method[] = $this->_t(4) . "\$data['password1'] = \$credentials['password'];";
+ $method[] = $this->_t(3) . "}";
+ $method[] = $this->_t(3) . "else";
+ $method[] = $this->_t(3) . "{";
+ $method[] = $this->_t(4) . "\$data['password'] = \$credentials['password'];";
+ $method[] = $this->_t(3) . "}";
+ $method[] = $this->_t(3) . "\$data['password2'] = \$credentials['password2'];";
+ $method[] = $this->_t(2) . "}";
+ $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
+ . " Create the new user";
+ $method[] = $this->_t(2) . "if (\$mode = 1)";
+ $method[] = $this->_t(2) . "{";
+ $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
+ . " Site-registration mode";
+ $method[] = $this->_t(3) . "\$userId = \$model->register(\$data);";
+ $method[] = $this->_t(2) . "}";
+ $method[] = $this->_t(2) . "else";
+ $method[] = $this->_t(2) . "{";
+ $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
+ . " Admin-registration mode";
+ $method[] = $this->_t(3) . "\$model->save(\$data);";
+ $method[] = $this->_t(3) . "\$userId = \$model->getState('user.id', 0);";
+ $method[] = $this->_t(2) . "}";
+
+ $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
+ . " Check if we have params";
+ $method[] = $this->_t(2) . "if (self::checkArray(\$params))";
+ $method[] = $this->_t(2) . "{";
+ $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
+ . " Change user params/config back";
+ $method[] = $this->_t(3)
+ . "foreach (\$params as \$param => \$set)";
+ $method[] = $this->_t(3) . "{";
+ $method[] = $this->_t(4) . "//" . $this->setLine(__LINE__)
+ . " If you know of a better path, let me know";
+ $method[] = $this->_t(4)
+ ."self::setParams('com_users', \$param, \$set);";
+ $method[] = $this->_t(3) . "}";
+ $method[] = $this->_t(2) . "}";
$method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
. " if user is created";
$method[] = $this->_t(2) . "if (\$userId > 0)";
$method[] = $this->_t(2) . "{";
+ $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
+ . " Auto Login if Needed";
+ $method[] = $this->_t(3) . "if (\$autologin && isset(\$credentials['password']))";
+ $method[] = $this->_t(3) . "{";
+ $method[] = $this->_t(4) . "JFactory::getApplication()->login(\$credentials);";
+ $method[] = $this->_t(3) . "}";
+ $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
+ . " Return ID";
$method[] = $this->_t(3) . "return \$userId;";
$method[] = $this->_t(2) . "}";
$method[] = $this->_t(2) . "return \$model->getError();";
$method[] = $this->_t(1) . "}";
$method[] = PHP_EOL . $this->_t(1)
- . "protected static function setParams(\$component,\$target,\$value)";
+ . "public static function setParams(\$component,\$target,\$value)";
$method[] = $this->_t(1) . "{";
$method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
. " Get the params and set the new values";
@@ -5663,10 +5743,16 @@ class Interpretation extends Fields
// return buttons if they were build
if (ComponentbuilderHelper::checkArray($buttons))
{
- // set the custom get form method JAVASCRIPT_FOR_BUTTONS
- $this->fileContentDynamic[$view['settings']->code][$this->hhh
- . $TARGET . '_JAVASCRIPT_FOR_BUTTONS' . $this->hhh]
- = $this->setJavaScriptForButtons();
+ // just to check if the submission script is manually added
+ if (!isset($view['settings']->php_document) ||
+ strpos(implode(' ', $view['settings']->php_document),
+ '/submitbutton.js') === false)
+ {
+ // set the custom get form method JAVASCRIPT_FOR_BUTTONS
+ $this->fileContentDynamic[$view['settings']->code][$this->hhh
+ . $TARGET . '_JAVASCRIPT_FOR_BUTTONS' . $this->hhh]
+ = $this->setJavaScriptForButtons();
+ }
// insure the form is added (only if no form exist)
if (isset($view['settings']->default)
&& strpos(
@@ -26396,10 +26482,10 @@ function vdm_dkim() {
$xml .= PHP_EOL . $this->_t(1) . '_t(2)
. 'addrulepath="/administrator/components/com_'
- . $this->componentCodeName . '/modules/rules"';
+ . $this->componentCodeName . '/models/rules"';
$xml .= PHP_EOL . $this->_t(2)
. 'addfieldpath="/administrator/components/com_'
- . $this->componentCodeName . '/modules/fields"';
+ . $this->componentCodeName . '/models/fields"';
$xml .= PHP_EOL . $this->_t(1) . '>';
}
else
@@ -26432,12 +26518,24 @@ function vdm_dkim() {
. $fieldset . ' fieldset points to the module -->';
$xml .= PHP_EOL . $this->_t(1) . '