";
+ // set xml discription
+ $this->setLangContent($plugin->key, $plugin->lang_prefix . '_XML_DESCRIPTION', $plugin->xml_description);
+ // update the readme if set
+ if ($plugin->addreadme == 1 && !empty($plugin->readme))
+ {
+ $plugin->readme = $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->readme)), $this->placeholders);
+ }
+ else
+ {
+ $plugin->addreadme = 0;
+ unset($plugin->readme);
+ }
+ // open some base64 strings
+ if (!empty($plugin->main_class_code))
+ {
+ // set GUI mapper field
+ $guiMapper['field'] = 'main_class_code';
+ // base64 Decode main_class_code.
+ $plugin->main_class_code = $this->setGuiCodePlaceholder(
+ $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->main_class_code)), $this->placeholders),
+ $guiMapper
+ );
+ }
+ // set the head :)
+ if ($plugin->add_head == 1 && !empty($plugin->head))
+ {
+ // set GUI mapper field
+ $guiMapper['field'] = 'head';
+ // base64 Decode head.
+ $plugin->head = $this->setGuiCodePlaceholder(
+ $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->head)), $this->placeholders),
+ $guiMapper
+ );
+ }
+ elseif (!empty($plugin->class_head))
+ {
+ // base64 Decode head.
+ $plugin->head = $this->setGuiCodePlaceholder(
+ $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->class_head)), $this->placeholders),
+ array(
+ 'table' => 'class_extends',
+ 'field' => 'head',
+ 'id' => (int) $plugin->class_id,
+ 'type' => 'php')
+ );
+ }
+ unset($plugin->class_head);
+ // set the comment
+ if (!empty($plugin->comment))
+ {
+ // base64 Decode comment.
+ $plugin->comment = $this->setGuiCodePlaceholder(
+ $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->comment)), $this->placeholders),
+ array(
+ 'table' => 'class_extends',
+ 'field' => 'comment',
+ 'id' => (int) $plugin->class_id,
+ 'type' => 'php')
+ );
+ }
+ // start the config array
+ $plugin->config_fields = array();
+ // create the form arrays
+ $plugin->form_files = array();
+ $plugin->fieldsets_label = array();
+ $plugin->fieldsets_paths = array();
+ // set global fields rule to default component path
+ $plugin->fields_rules_paths = 1;
+ // set the fields data
+ $plugin->fields = (isset($plugin->fields) && ComponentbuilderHelper::checkJson($plugin->fields)) ? json_decode($plugin->fields, true) : null;
+ if (ComponentbuilderHelper::checkArray($plugin->fields))
+ {
+ // ket global key
+ $key = $plugin->key;
+ $dynamic_fields = array('fieldset' => 'basic', 'fields_name' => 'params', 'file' => 'config');
+ foreach ($plugin->fields as $n => &$form)
+ {
+ if (isset($form['fields']) && ComponentbuilderHelper::checkArray($form['fields']))
+ {
+ // make sure the dynamic_field is set to dynamic_value by default
+ foreach ($dynamic_fields as $dynamic_field => $dynamic_value)
+ {
+ if (!isset($form[$dynamic_field]) || !ComponentbuilderHelper::checkString($form[$dynamic_field]))
+ {
+ $form[$dynamic_field] = $dynamic_value;
+ }
+ else
+ {
+ $form[$dynamic_field] = ComponentbuilderHelper::safeString($form[$dynamic_field]);
+ }
+ }
+ // check if field is external form file
+ if (!isset($form['plugin']) || $form['plugin'] != 1)
+ {
+ // now build the form key
+ $unique = $form['file'] . $form['fields_name'] . $form['fieldset'];
+ }
+ else
+ {
+ // now build the form key
+ $unique = $form['fields_name'] . $form['fieldset'];
+ }
+ // set global fields rule path switchs
+ if ($plugin->fields_rules_paths == 1 && isset($form['fields_rules_paths']) && $form['fields_rules_paths'] == 2)
+ {
+ $plugin->fields_rules_paths = 2;
+ }
+ // set where to path is pointing
+ $plugin->fieldsets_paths[$unique] = $form['fields_rules_paths'];
+ // add the label if set to lang
+ if (isset($form['label']) && ComponentbuilderHelper::checkString($form['label']))
+ {
+ $plugin->fieldsets_label[$unique] = $this->setLang($form['label']);
+ }
+ // build the fields
+ $form['fields'] = array_map(function($field) use ($key, $unique){
+ // make sure the alias and title is 0
+ $field['alias'] = 0;
+ $field['title'] = 0;
+ // set the field details
+ $this->setFieldDetails($field, $key, $key, $unique);
+ // update the default if set
+ if (ComponentbuilderHelper::checkString($field['custom_value']) && isset($field['settings']))
+ {
+ if (($old_default = ComponentbuilderHelper::getBetween($field['settings']->xml, 'default="', '"', false)) !== false)
+ {
+ // replace old default
+ $field['settings']->xml = str_replace('default="' . $old_default . '"', 'default="' . $field['custom_value'] . '"', $field['settings']->xml);
+ }
+ else
+ {
+ // add the default (hmmm not ideal but okay it should work)
+ $field['settings']->xml = 'default="' . $field['custom_value'] . '" ' . $field['settings']->xml;
+ }
+ }
+ unset($field['custom_value']);
+ // return field
+ return $field;
+ }, array_values($form['fields']));
+ // check if field is external form file
+ if (!isset($form['plugin']) || $form['plugin'] != 1)
+ {
+ // load the form file
+ if (!isset($plugin->form_files[$form['file']]))
+ {
+ $plugin->form_files[$form['file']] = array();
+ }
+ if (!isset($plugin->form_files[$form['file']][$form['fields_name']]))
+ {
+ $plugin->form_files[$form['file']][$form['fields_name']] = array();
+ }
+ if (!isset($plugin->form_files[$form['file']][$form['fields_name']][$form['fieldset']]))
+ {
+ $plugin->form_files[$form['file']][$form['fields_name']][$form['fieldset']] = array();
+ }
+ // do some house cleaning (for fields)
+ foreach ($form['fields'] as $field)
+ {
+ // so first we lock the field name in
+ $this->getFieldName($field, $plugin->key, $unique);
+ // add the fields to the global form file builder
+ $plugin->form_files[$form['file']][$form['fields_name']][$form['fieldset']][] = $field;
+ }
+ // remove form
+ unset($plugin->fields[$n]);
+ }
+ else
+ {
+ // load the cofig form
+ if (!isset($plugin->config_fields[$form['fields_name']]))
+ {
+ $plugin->config_fields[$form['fields_name']] = array();
+ }
+ if (!isset($plugin->config_fields[$form['fields_name']][$form['fieldset']]))
+ {
+ $plugin->config_fields[$form['fields_name']][$form['fieldset']] = array();
+ }
+ // do some house cleaning (for fields)
+ foreach ($form['fields'] as $field)
+ {
+ // so first we lock the field name in
+ $this->getFieldName($field, $plugin->key, $unique);
+ // add the fields to the config builder
+ $plugin->config_fields[$form['fields_name']][$form['fieldset']][] = $field;
+ }
+ // remove form
+ unset($plugin->fields[$n]);
+ }
+ }
+ else
+ {
+ unset($plugin->fields[$n]);
+ }
+ }
+ }
+ unset($plugin->fields);
+ // set the add targets
+ $addArray = array('files' => 'files', 'folders' => 'folders', 'urls' => 'urls', 'filesfullpath' => 'files', 'foldersfullpath' => 'folders');
+ foreach ($addArray as $addTarget => $targetHere)
+ {
+ // set the add target data
+ $plugin->{'add' . $addTarget} = (isset($plugin->{'add' . $addTarget}) && ComponentbuilderHelper::checkJson($plugin->{'add' . $addTarget})) ? json_decode($plugin->{'add' . $addTarget}, true) : null;
+ if (ComponentbuilderHelper::checkArray($plugin->{'add' . $addTarget}))
+ {
+ if (isset($plugin->{$targetHere}) && ComponentbuilderHelper::checkArray($plugin->{$targetHere}))
+ {
+ foreach ($plugin->{'add' . $addTarget} as $taget)
+ {
+ $plugin->{$targetHere}[] = $taget;
+ }
+ }
+ else
+ {
+ $plugin->{$targetHere} = array_values($plugin->{'add' . $addTarget});
+ }
+ }
+ unset($plugin->{'add' . $addTarget});
+ }
+ // add PHP in plugin install
+ $plugin->add_install_script = false;
+ $addScriptMethods = array('php_preflight', 'php_postflight', 'php_method');
+ $addScriptTypes = array('install', 'update', 'uninstall');
+ foreach ($addScriptMethods as $scriptMethod)
+ {
+ foreach ($addScriptTypes as $scriptType)
+ {
+ if (isset($plugin->{'add_' . $scriptMethod . '_' . $scriptType}) && $plugin->{'add_' . $scriptMethod . '_' . $scriptType} == 1 && ComponentbuilderHelper::checkString($plugin->{$scriptMethod . '_' . $scriptType}))
+ {
+ // set GUI mapper field
+ $guiMapper['field'] = $scriptMethod . '_' . $scriptType;
+ $plugin->{$scriptMethod . '_' . $scriptType} = $this->setGuiCodePlaceholder(
+ $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->{$scriptMethod . '_' . $scriptType})), $this->placeholders),
+ $guiMapper
+ );
+ $plugin->add_install_script = true;
+ }
+ else
+ {
+ unset($plugin->{$scriptMethod . '_' . $scriptType});
+ $plugin->{'add_' . $scriptMethod . '_' . $scriptType} = 0;
+ }
+ }
+ }
+ // add_sql
+ if ($plugin->add_sql == 1 && ComponentbuilderHelper::checkString($plugin->sql))
+ {
+ $plugin->sql = $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->sql)), $this->placeholders);
+ }
+ else
+ {
+ unset($plugin->sql);
+ $plugin->add_sql = 0;
+ }
+ // add_sql_uninstall
+ if ($plugin->add_sql_uninstall == 1 && ComponentbuilderHelper::checkString($plugin->sql_uninstall))
+ {
+ $plugin->sql_uninstall = $this->setPlaceholders($this->setDynamicValues(base64_decode($plugin->sql_uninstall)), $this->placeholders);
+ }
+ else
+ {
+ unset($plugin->sql_uninstall);
+ $plugin->add_sql_uninstall = 0;
+ }
+ // update the URL of the update_server if set
+ if ($plugin->add_update_server == 1 && ComponentbuilderHelper::checkString($plugin->update_server_url))
+ {
+ $plugin->update_server_url = $this->setPlaceholders($this->setDynamicValues($plugin->update_server_url), $this->placeholders);
+ }
+ // add the update/sales server FTP details if that is the expected protocol
+ $serverArray = array('update_server', 'sales_server');
+ foreach ($serverArray as $server)
+ {
+ if ($plugin->{'add_' . $server} == 1 && is_numeric($plugin->{$server}) && $plugin->{$server} > 0)
+ {
+ // get the server protocol
+ $plugin->{$server . '_protocol'} = ComponentbuilderHelper::getVar('server', (int) $plugin->{$server}, 'id', 'protocol');
+ }
+ else
+ {
+ $plugin->{$server} = 0;
+ // only change this for sales server (update server can be added loacaly to the zip file)
+ if ('sales_server' === $server)
+ {
+ $plugin->{'add_' . $server} = 0;
+ }
+ $plugin->{$server . '_protocol'} = 0;
+ }
+ }
+ // set the update server stuff (TODO)
+ // update_server_xml_path
+ // update_server_xml_file_name
+
+ // rest globals
+ $this->target = $_backup_target;
+ $this->lang = $_backup_lang;
+ $this->langPrefix = $_backup_langPrefix;
+
+ $this->joomlaPlugins[$id] = $plugin;
+
+ return true;
}
- // set the update server stuff (TODO)
- // update_server_xml_path
- // update_server_xml_file_name
-
- // rest globals
- $this->target = $_backup_target;
- $this->lang = $_backup_lang;
- $this->langPrefix = $_backup_langPrefix;
-
- return $plugin;
}
return false;
}
@@ -6478,7 +6621,6 @@ class Get
$xml .= PHP_EOL . $this->_t(1) . '' . $plugin->lang_prefix . '_XML_DESCRIPTION';
$xml .= $this->hhh . 'MAINXML' . $this->hhh;
$xml .= PHP_EOL . '';
- $dates = array();
return $xml;
}
diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php
index 7519a0d6d..79d7cbe1c 100644
--- a/admin/helpers/compiler/b_Structure.php
+++ b/admin/helpers/compiler/b_Structure.php
@@ -372,7 +372,7 @@ class Structure extends Get
// load the libraries files/folders and url's
$this->setLibraries();
// load the plugin files/folders and url's
- $this->setPlugins();
+ $this->buildPlugins();
// set the Joomla Version Data
$this->joomlaVersionData = $this->setJoomlaVersionData();
// Trigger Event: jcb_ce_onAfterSetJoomlaVersionData
@@ -422,13 +422,13 @@ class Structure extends Get
* @return void
*
*/
- private function setPlugins()
+ private function buildPlugins()
{
- if (ComponentbuilderHelper::checkArray($this->componentData->joomla_plugins))
+ if (ComponentbuilderHelper::checkArray($this->joomlaPlugins))
{
// Trigger Event: jcb_ce_onBeforeSetPlugins
- $this->triggerEvent('jcb_ce_onBeforeSetPlugins', array(&$this->componentContext, &$this->componentData->joomla_plugins));
- foreach ($this->componentData->joomla_plugins as $plugin)
+ $this->triggerEvent('jcb_ce_onBeforeBuildPlugins', array(&$this->componentContext, &$this->joomlaPlugins));
+ foreach ($this->joomlaPlugins as $plugin)
{
if (ComponentbuilderHelper::checkObject($plugin) && isset($plugin->folder_name)
&& ComponentbuilderHelper::checkString($plugin->folder_name))
@@ -491,6 +491,88 @@ class Structure extends Get
// count the file created
$this->fileCount++;
}
+ // set fields & rules folders if needed
+ if (isset($plugin->fields_rules_paths) && $plugin->fields_rules_paths == 2)
+ {
+ // create fields folder
+ if (!JFolder::exists($plugin->folder_path . '/fields'))
+ {
+ JFolder::create($plugin->folder_path . '/fields');
+ // count the folder created
+ $this->folderCount++;
+ $this->indexHTML($plugin->folder_name . '/fields', $this->compilerPath);
+ }
+ // create rules folder
+ if (!JFolder::exists($plugin->folder_path . '/rules'))
+ {
+ JFolder::create($plugin->folder_path . '/rules');
+ // count the folder created
+ $this->folderCount++;
+ $this->indexHTML($plugin->folder_name . '/rules', $this->compilerPath);
+ }
+ }
+ // set forms folder if needed
+ if (isset($plugin->form_files) && ComponentbuilderHelper::checkArray($plugin->form_files))
+ {
+ // create forms folder
+ if (!JFolder::exists($plugin->folder_path . '/forms'))
+ {
+ JFolder::create($plugin->folder_path . '/forms');
+ // count the folder created
+ $this->folderCount++;
+ $this->indexHTML($plugin->folder_name . '/forms', $this->compilerPath);
+ }
+ // set the template files
+ foreach($plugin->form_files as $file => $fields)
+ {
+ // set file details
+ $fileDetails = array('path' => $plugin->folder_path . '/forms/' . $file . '.xml',
+ 'name' => $file . '.xml', 'zip' => 'forms/' . $file . '.xml');
+ // biuld basic XML
+ $xml = '';
+ $xml .= PHP_EOL . '';
+ $xml .= PHP_EOL . '';
+ // add xml to file
+ $this->writeFile($fileDetails['path'], $xml);
+ $this->newFiles[$plugin->key][] = $fileDetails;
+ // count the file created
+ $this->fileCount++;
+ }
+ }
// set SQL stuff if needed
if ($plugin->add_sql || $plugin->add_sql_uninstall)
{
@@ -1279,13 +1361,50 @@ class Structure extends Get
return false;
}
+ /**
+ * move the fields and Rules
+ *
+ * @param array $field The field data
+ * @param string $path The path to move to
+ *
+ * @return void
+ *
+ */
+ public function moveFieldsRules($field, $path)
+ {
+ // check if this is a custom field that should be moved
+ if (isset($this->extentionCustomfields[$field['type_name']]))
+ {
+ // check files exist
+ if (JFile::exists($this->componentPath . '/admin/models/fields/' . $field['type_name'] . '.php'))
+ {
+ // move the custom field
+ JFile::copy($this->componentPath . '/admin/models/fields/' . $field['type_name'] . '.php', $path . '/fields/' . $field['type_name'] . '.php');
+ }
+ // do this just once
+ unset($this->extentionCustomfields[$field['type_name']]);
+ }
+ // check if this has validation that should be moved
+ if (isset($this->validationLinkedFields[$field['field']]))
+ {
+ // check files exist
+ if (JFile::exists($this->componentPath . '/admin/models/rules/' . $this->validationLinkedFields[$field['field']] . '.php'))
+ {
+ // move the custom field
+ JFile::copy($this->componentPath . '/admin/models/rules/' . $this->validationLinkedFields[$field['field']] . '.php', $path . '/rules/' . $this->validationLinkedFields[$field['field']] . '.php');
+ }
+ // do this just once
+ unset($this->validationLinkedFields[$field['field']]);
+ }
+ }
+
/**
* get the created date of the (view)
- *
+ *
* @param array $view The view values
- *
+ *
* @return string Last Modified Date
- *
+ *
*/
public function getCreatedDate($view)
{
@@ -1304,11 +1423,11 @@ class Structure extends Get
/**
* get the last modified date of a MVC (view)
- *
+ *
* @param array $view The view values
- *
+ *
* @return string Last Modified Date
- *
+ *
*/
public function getLastModifiedDate($view)
{
@@ -1487,10 +1606,9 @@ class Structure extends Get
/**
* set the Joomla Version Data
- *
*
* @return oject The version data
- *
+ *
*/
private function setJoomlaVersionData()
{
@@ -1722,11 +1840,11 @@ class Structure extends Get
/**
* set the index.html file in a folder path
- *
+ *
* @param string $path The path to place the index.html file in
*
* @return void
- *
+ *
*/
private function indexHTML($path, $root = 'component')
{
diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php
index d3a3eb53c..2ccffe31f 100644
--- a/admin/helpers/compiler/c_Fields.php
+++ b/admin/helpers/compiler/c_Fields.php
@@ -333,6 +333,13 @@ class Fields extends Structure
*/
public $movedPublishingFields = array();
+ /**
+ * Extention Custom Fields
+ *
+ * @var array
+ */
+ public $extentionCustomfields = array();
+
/**
* Set the line number in comments
*
@@ -1659,7 +1666,8 @@ class Fields extends Structure
}
$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)
+ if ('config' === $view_name_single && 'configs' === $view_name_list||
+ strpos($view_name_single, 'P|uG!n') !== false)
{
// set lang (just incase)
$listLangName = $langView . '_' . ComponentbuilderHelper::safeString($name, 'U');
@@ -2144,8 +2152,9 @@ class Fields extends Structure
$field->fieldXML->addAttribute($property, $value);
}
}
- // incase the field is in the config and has not been set
- if ('config' === $view_name_single && 'configs' === $view_name_list)
+ // 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 && 'configs' === $view_name_list) ||
+ strpos($view_name_single, 'P|uG!n') !== false)
{
// set lang (just incase)
$listLangName = $langView . '_' . ComponentbuilderHelper::safeString($name, 'U');
@@ -3241,6 +3250,12 @@ class Fields extends Structure
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'ADD_BUTTON' . $this->hhh] = $this->setAddButtonToListField($data['custom']);
}
}
+ // if this field gets used in plugin or module we should track it so if needed we can copy it over
+ if (strpos($view_name_single, 'P|uG!n') !== false &&
+ isset($data['custom']) && isset($data['custom']['type']))
+ {
+ $this->extentionCustomfields[$data['type']] = $data['custom']['type'];
+ }
}
/**
diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php
index ac27493e5..61fddfa43 100644
--- a/admin/helpers/compiler/e_Interpretation.php
+++ b/admin/helpers/compiler/e_Interpretation.php
@@ -16296,13 +16296,7 @@ function vdm_dkim() {
public function getPluginMainXML(&$plugin)
{
- // tweak system to set stuff to the plugin domain
- $_backup_target = $this->target;
- $_backup_lang = $this->lang;
- $_backup_langPrefix = $this->langPrefix;
- $this->target = $plugin->key;
- $this->lang = $plugin->key;
- $this->langPrefix = $plugin->lang_prefix;
+ // set some defaults
$view = '';
$viewType = 0;
// set the custom table key
@@ -16310,31 +16304,21 @@ function vdm_dkim() {
// build the xml
$xml = '';
// build the config fields
- $config_field = '';
+ $config_fields = array();
if (isset($plugin->config_fields) && ComponentbuilderHelper::checkArray($plugin->config_fields))
{
- foreach ($plugin->config_fields as $field)
+ foreach ($plugin->config_fields as $field_name => $fieldsets)
{
- // check the field builder type
- if ($this->fieldBuilderType == 1)
+ foreach ($fieldsets as $fieldset => $fields)
{
- // string manipulation
- $xmlField = $this->setDynamicField($field, $view, $viewType, $plugin->lang_prefix, $plugin->key, $plugin->key, $this->globalPlaceholders, $dbkey, false);
- }
- else
- {
- // simpleXMLElement class
- $newxmlField = $this->setDynamicField($field, $view, $viewType, $plugin->lang_prefix, $plugin->key, $plugin->key, $this->globalPlaceholders, $dbkey, false);
- if (isset($newxmlField->fieldXML))
+ // get the field set
+ $xmlFields = $this->getPluginFieldsetXML($plugin, $fields, $dbkey);
+ // make sure the xml is set and a string
+ if (isset($xmlFields) && ComponentbuilderHelper::checkString($xmlFields))
{
- $xmlField = dom_import_simplexml($newxmlField->fieldXML);
- $xmlField = PHP_EOL . $this->_t(2) . "' . PHP_EOL . $this->_t(1) . $this->xmlPrettyPrint($xmlField, 'field');
+ $config_fields[$field_name.$fieldset] = $xmlFields;
}
- }
- // make sure the xml is set and a string
- if (isset($xmlField) && ComponentbuilderHelper::checkString($xmlField))
- {
- $config_field .= $xmlField;
+ $dbkey++;
}
}
}
@@ -16348,8 +16332,8 @@ function vdm_dkim() {
return $placeholder . '="' . $langstring . '"';
}, $this->langContent[$plugin->key], array_keys($this->langContent[$plugin->key]));
// add to language file
- $this->writeFile($plugin->folder_path . '/language/' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->name) . '.ini', implode(PHP_EOL, $lang));
- $this->writeFile($plugin->folder_path . '/language/' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->name) . '.sys.ini', implode(PHP_EOL, $lang));
+ $this->writeFile($plugin->folder_path . '/language/' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->code_name) . '.ini', implode(PHP_EOL, $lang));
+ $this->writeFile($plugin->folder_path . '/language/' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->code_name) . '.sys.ini', implode(PHP_EOL, $lang));
// set the line counter
$this->lineCount = $this->lineCount + count((array) $lang);
unset($lang);
@@ -16392,8 +16376,8 @@ function vdm_dkim() {
{
$xml .= PHP_EOL . PHP_EOL . $this->_t(1) . '';
$xml .= PHP_EOL . $this->_t(1) . '';
- $xml .= PHP_EOL . $this->_t(2) . '' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->name) . '.ini';
- $xml .= PHP_EOL . $this->_t(2) . '' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->name) . '.sys.ini';
+ $xml .= PHP_EOL . $this->_t(2) . '' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->code_name) . '.ini';
+ $xml .= PHP_EOL . $this->_t(2) . '' . $this->langTag . '/' . $this->langTag . '.plg_' . strtolower($plugin->group) . '_' . strtolower($plugin->code_name) . '.sys.ini';
$xml .= PHP_EOL . $this->_t(1) . '';
}
// add the plugin files
@@ -16436,15 +16420,49 @@ function vdm_dkim() {
}
$xml .= PHP_EOL . $this->_t(1) . '';
// now add the Config Params if needed
- if (ComponentbuilderHelper::checkString($config_field))
+ if (ComponentbuilderHelper::checkArray($config_fields))
{
$xml .= PHP_EOL . PHP_EOL . $this->_t(1) . '';
- $xml .= PHP_EOL . $this->_t(1) . '';
- $xml .= PHP_EOL . $this->_t(1) . '';
- $xml .= PHP_EOL . $this->_t(1) . '';
- $xml .= PHP_EOL . $this->_t(1) . '';
+ // add path to plugin rules and custom fields
+ $xml .= PHP_EOL . $this->_t(1) . '_t(2) . 'addrulepath="/administrator/components/com_' . $this->componentCodeName . '/models/rules"';
+ $xml .= PHP_EOL . $this->_t(2) . 'addfieldpath="/administrator/components/com_' . $this->componentCodeName . '/models/fields"';
+ $xml .= PHP_EOL . $this->_t(1) . '>';
+
+ foreach ($plugin->config_fields as $field_name => $fieldsets)
+ {
+ $xml .= PHP_EOL . $this->_t(1) . '';
+ foreach ($fieldsets as $fieldset => $fields)
+ {
+ // default to the field set name
+ $label = $fieldset;
+ if (isset($plugin->fieldsets_label[$field_name.$fieldset]))
+ {
+ $label = $plugin->fieldsets_label[$field_name.$fieldset];
+ }
+ // add path to plugin rules and custom fields
+ if (isset($plugin->fieldsets_paths[$field_name.$fieldset]) && $plugin->fieldsets_paths[$field_name.$fieldset] == 2)
+ {
+ $xml .= PHP_EOL . $this->_t(1) . '';
+ $xml .= PHP_EOL . $this->_t(1) . '';
+ }
$xml .= PHP_EOL . $this->_t(1) . '';
}
// set update server if found
@@ -16455,14 +16473,48 @@ function vdm_dkim() {
$xml .= PHP_EOL . $this->_t(2) . '' . $plugin->update_server_url . '';
$xml .= PHP_EOL . $this->_t(1) . '';
}
- // rest globals
- $this->target = $_backup_target;
- $this->lang = $_backup_lang;
- $this->langPrefix = $_backup_langPrefix;
return $xml;
}
+ public function getPluginFieldsetXML(&$plugin, &$fields, $dbkey = 'zz')
+ {
+ // set some defaults
+ $view = '';
+ $viewType = 0;
+ // build the fieldset
+ $fieldset = '';
+
+ if (ComponentbuilderHelper::checkArray($fields))
+ {
+ foreach ($fields as $field)
+ {
+ // check the field builder type
+ if ($this->fieldBuilderType == 1)
+ {
+ // string manipulation
+ $xmlField = $this->setDynamicField($field, $view, $viewType, $plugin->lang_prefix, $plugin->key, $plugin->key, $this->globalPlaceholders, $dbkey, false);
+ }
+ else
+ {
+ // simpleXMLElement class
+ $newxmlField = $this->setDynamicField($field, $view, $viewType, $plugin->lang_prefix, $plugin->key, $plugin->key, $this->globalPlaceholders, $dbkey, false);
+ if (isset($newxmlField->fieldXML))
+ {
+ $xmlField = dom_import_simplexml($newxmlField->fieldXML);
+ $xmlField = PHP_EOL . $this->_t(2) . "' . PHP_EOL . $this->_t(1) . $this->xmlPrettyPrint($xmlField, 'field');
+ }
+ }
+ // make sure the xml is set and a string
+ if (isset($xmlField) && ComponentbuilderHelper::checkString($xmlField))
+ {
+ $fieldset .= $xmlField;
+ }
+ }
+ }
+ return $fieldset;
+ }
+
public function getPluginInstallClass(&$plugin)
{
// yes we are adding it
diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php
index 32d568c9d..6172b7649 100644
--- a/admin/helpers/compiler/f_Infusion.php
+++ b/admin/helpers/compiler/f_Infusion.php
@@ -1033,12 +1033,19 @@ class Infusion extends Interpretation
}
// infuze plugin data if set
- if (ComponentbuilderHelper::checkArray($this->componentData->joomla_plugins))
+ if (ComponentbuilderHelper::checkArray($this->joomlaPlugins))
{
- foreach ($this->componentData->joomla_plugins as $plugin)
+ foreach ($this->joomlaPlugins as $plugin)
{
if (ComponentbuilderHelper::checkObject($plugin))
{
+ // tweak system to set stuff to the plugin domain
+ $_backup_target = $this->target;
+ $_backup_lang = $this->lang;
+ $_backup_langPrefix = $this->langPrefix;
+ $this->target = $plugin->key;
+ $this->lang = $plugin->key;
+ $this->langPrefix = $plugin->lang_prefix;
// MAINCLASS
$this->fileContentDynamic[$plugin->key][$this->hhh . 'MAINCLASS' . $this->hhh] = $this->getPluginMainClass($plugin);
// only add install script if needed
@@ -1047,8 +1054,28 @@ class Infusion extends Interpretation
// INSTALLCLASS
$this->fileContentDynamic[$plugin->key][$this->hhh . 'INSTALLCLASS' . $this->hhh] = $this->getPluginInstallClass($plugin);
}
+ // FIELDSET
+ if (isset($plugin->form_files) && ComponentbuilderHelper::checkArray($plugin->form_files))
+ {
+ foreach($plugin->form_files as $file => $files)
+ {
+ foreach ($files as $field_name => $fieldsets)
+ {
+ foreach ($fieldsets as $fieldset => $fields)
+ {
+ // FIELDSET_ . $file.$field_name.$fieldset
+ $this->fileContentDynamic[$plugin->key][$this->hhh . 'FIELDSET_' . $file.$field_name.$fieldset . $this->hhh] =
+ $this->getPluginFieldsetXML($plugin, $fields);
+ }
+ }
+ }
+ }
// MAINXML
$this->fileContentDynamic[$plugin->key][$this->hhh . 'MAINXML' . $this->hhh] = $this->getPluginMainXML($plugin);
+ // rest globals
+ $this->target = $_backup_target;
+ $this->lang = $_backup_lang;
+ $this->langPrefix = $_backup_langPrefix;
}
}
}
diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php
index cff883ed2..bcc867e8f 100644
--- a/admin/helpers/componentbuilder.php
+++ b/admin/helpers/componentbuilder.php
@@ -6406,7 +6406,31 @@ abstract class ComponentbuilderHelper
jimport('joomla.form.form');
}
// get field type
- $field = JFormHelper::loadFieldType($attributes['type'],true);
+ $field = JFormHelper::loadFieldType($attributes['type'], true);
+ // get field xml
+ $XML = self::getFieldXML($attributes, $options);
+ // setup the field
+ $field->setup($XML, $default);
+ // return the field object
+ return $field;
+ }
+ return false;
+ }
+
+ /**
+ * get the field xml
+ *
+ * @param array $attributes The array of attributes
+ * @param array $options The options to apply to the XML element
+ *
+ * @return object
+ *
+ */
+ public static function getFieldXML(&$attributes, $options = null)
+ {
+ // make sure we have attributes and a type value
+ if (self::checkArray($attributes))
+ {
// start field xml
$XML = new SimpleXMLElement('');
// load the attributes
@@ -6417,10 +6441,8 @@ abstract class ComponentbuilderHelper
// load the options
self::xmlAddOptions($XML, $options);
}
- // setup the field
- $field->setup($XML, $default);
- // return the field object
- return $field;
+ // return the field xml
+ return $XML;
}
return false;
}
diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini
index 0c0f74f62..09f062ea3 100644
--- a/admin/language/en-GB/en-GB.com_componentbuilder.ini
+++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini
@@ -6017,7 +6017,7 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_UPDATE_SERVER_LABEL="Add Update Server"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CLASS_EXTENDS="Class Extends"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CLASS_EXTENDS_LABEL="Extends"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CODE="Code"
-COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CONFIGPARAMS="Config/Params"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_COMPONENT="Component"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CREATED_BY_DESC="The user that created this Joomla Plugin."
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CREATED_BY_LABEL="Created By"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CREATED_DATE_DESC="The date this Joomla Plugin was created."
@@ -6034,7 +6034,16 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_EDIT="Editing the Joomla Plugin"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ERROR_UNIQUE_ALIAS="Another Joomla Plugin has the same alias."
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELD="Field"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDS="Fields"
-COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDS_LABEL="Fields"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDSET_DESCRIPTION="Leave default if you don't know what this should be"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDSET_HINT="basic"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDSET_LABEL="Fieldset Name"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDS_DESCRIPTION="All the field that belong to this form."
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDS_LABEL="Related Forms"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDS_NAME_DESCRIPTION="Leave default if you don't know what this should be."
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDS_NAME_HINT="params"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDS_NAME_LABEL="Fields Name"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDS_RULES_PATHS_DESCRIPTION="Where should the custom fields and rules be placed."
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDS_RULES_PATHS_LABEL="Fields & Rules Paths"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELD_DESCRIPTION="Select a field"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELD_LABEL="Field"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS="Joomla Plugin Files, Folders & URLs"
@@ -6153,6 +6162,10 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_URL_LABEL="URL"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_URL_MESSAGE="Error! Please add url here."
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_VERSION_DESC="A count of the number of times this Joomla Plugin Files, Folders & URLs has been revised."
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_VERSION_LABEL="Revision"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILE_DESCRIPTION="Leave default if you don't know what this should be. This field is ignored if this form belongs to the plugin config area."
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILE_HINT="config"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILE_LABEL="File Name"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FORMS_FIELDS="Forms & Fields"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GET_BOILERPLATE_BUTTON_ACCESS="Joomla Plugin Get Boilerplate Button Access"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GET_BOILERPLATE_BUTTON_ACCESS_DESC="Allows the users in this group to access the get boilerplate button."
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP="Joomla Plugin Group"
@@ -6215,6 +6228,9 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_HEAD_LABEL="Class Head"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ID="Id"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_JOOMLA_PLUGIN_GROUP="Joomla Plugin Group"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_JOOMLA_PLUGIN_GROUP_LABEL="Joomla Plugin Group"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_LABEL_DESCRIPTION="Not mandatory, used to Label the Fieldset"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_LABEL_HINT="Name"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_LABEL_LABEL="Label"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_MAIN_CLASS_CODE="Main Class Code"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_MAIN_CLASS_CODE_DESCRIPTION="Add the class properties & methods here."
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_MAIN_CLASS_CODE_LABEL="Class Properties & Methods"
@@ -6272,6 +6288,9 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UPDATE_LABEL="PHP Preflight (up
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_SCRIPT_CONSTRUCT="Php Script Construct"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_SCRIPT_CONSTRUCT_DESCRIPTION="PHP script that should run in __construct of script."
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_SCRIPT_CONSTRUCT_LABEL="PHP Script Construct"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PLUGIN="Plugin"
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PLUGIN_DESCRIPTION="Add this form the the Plugin Config area."
+COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PLUGIN_LABEL="Add to Plugin Config"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PLUGIN_VERSION="Plugin Version"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PLUGIN_VERSION_DESCRIPTION="Add Version Number Here"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PLUGIN_VERSION_HINT="1.0.0"
diff --git a/admin/layouts/joomla_plugin/configparams_fullwidth.php b/admin/layouts/joomla_plugin/forms_fields_fullwidth.php
similarity index 100%
rename from admin/layouts/joomla_plugin/configparams_fullwidth.php
rename to admin/layouts/joomla_plugin/forms_fields_fullwidth.php
diff --git a/admin/models/admin_custom_tabs.php b/admin/models/admin_custom_tabs.php
index 2f02ef692..28d206821 100644
--- a/admin/models/admin_custom_tabs.php
+++ b/admin/models/admin_custom_tabs.php
@@ -363,6 +363,8 @@ class ComponentbuilderModelAdmin_custom_tabs extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.admin_custom_tabs', $data);
}
return $data;
diff --git a/admin/models/admin_fields.php b/admin/models/admin_fields.php
index 9e7504f88..c0647e9d1 100644
--- a/admin/models/admin_fields.php
+++ b/admin/models/admin_fields.php
@@ -384,6 +384,8 @@ class ComponentbuilderModelAdmin_fields extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.admin_fields', $data);
}
return $data;
diff --git a/admin/models/admin_fields_conditions.php b/admin/models/admin_fields_conditions.php
index 2e2013d7e..d8ae43fe2 100644
--- a/admin/models/admin_fields_conditions.php
+++ b/admin/models/admin_fields_conditions.php
@@ -384,6 +384,8 @@ class ComponentbuilderModelAdmin_fields_conditions extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.admin_fields_conditions', $data);
}
return $data;
diff --git a/admin/models/admin_fields_relations.php b/admin/models/admin_fields_relations.php
index 555d5a17f..c8a4b3b05 100644
--- a/admin/models/admin_fields_relations.php
+++ b/admin/models/admin_fields_relations.php
@@ -395,6 +395,8 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.admin_fields_relations', $data);
}
return $data;
diff --git a/admin/models/admin_view.php b/admin/models/admin_view.php
index cd22a3bdd..397995d35 100644
--- a/admin/models/admin_view.php
+++ b/admin/models/admin_view.php
@@ -893,6 +893,8 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.admin_view', $data);
}
return $data;
diff --git a/admin/models/class_extends.php b/admin/models/class_extends.php
index e76ee6c01..87bfe0110 100644
--- a/admin/models/class_extends.php
+++ b/admin/models/class_extends.php
@@ -426,6 +426,8 @@ class ComponentbuilderModelClass_extends extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.class_extends', $data);
}
return $data;
diff --git a/admin/models/class_method.php b/admin/models/class_method.php
index d6a4a8f97..4b0e11468 100644
--- a/admin/models/class_method.php
+++ b/admin/models/class_method.php
@@ -435,6 +435,8 @@ class ComponentbuilderModelClass_method extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.class_method', $data);
}
return $data;
diff --git a/admin/models/class_property.php b/admin/models/class_property.php
index aa9bb5f1c..e723628fb 100644
--- a/admin/models/class_property.php
+++ b/admin/models/class_property.php
@@ -426,6 +426,8 @@ class ComponentbuilderModelClass_property extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.class_property', $data);
}
return $data;
diff --git a/admin/models/component_admin_views.php b/admin/models/component_admin_views.php
index 41ea25f34..87cd48e18 100644
--- a/admin/models/component_admin_views.php
+++ b/admin/models/component_admin_views.php
@@ -395,6 +395,8 @@ class ComponentbuilderModelComponent_admin_views extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.component_admin_views', $data);
}
return $data;
diff --git a/admin/models/component_config.php b/admin/models/component_config.php
index 6d2601dc4..d51bd02b5 100644
--- a/admin/models/component_config.php
+++ b/admin/models/component_config.php
@@ -394,6 +394,8 @@ class ComponentbuilderModelComponent_config extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.component_config', $data);
}
return $data;
diff --git a/admin/models/component_custom_admin_menus.php b/admin/models/component_custom_admin_menus.php
index 6ad3c4e29..735f98485 100644
--- a/admin/models/component_custom_admin_menus.php
+++ b/admin/models/component_custom_admin_menus.php
@@ -394,6 +394,8 @@ class ComponentbuilderModelComponent_custom_admin_menus extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.component_custom_admin_menus', $data);
}
return $data;
diff --git a/admin/models/component_custom_admin_views.php b/admin/models/component_custom_admin_views.php
index fa75cb6e0..e8700e541 100644
--- a/admin/models/component_custom_admin_views.php
+++ b/admin/models/component_custom_admin_views.php
@@ -395,6 +395,8 @@ class ComponentbuilderModelComponent_custom_admin_views extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.component_custom_admin_views', $data);
}
return $data;
diff --git a/admin/models/component_dashboard.php b/admin/models/component_dashboard.php
index 38d85aca3..691091f0b 100644
--- a/admin/models/component_dashboard.php
+++ b/admin/models/component_dashboard.php
@@ -432,6 +432,8 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.component_dashboard', $data);
}
return $data;
diff --git a/admin/models/component_files_folders.php b/admin/models/component_files_folders.php
index a055f8093..a0781b791 100644
--- a/admin/models/component_files_folders.php
+++ b/admin/models/component_files_folders.php
@@ -431,6 +431,8 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.component_files_folders', $data);
}
return $data;
diff --git a/admin/models/component_mysql_tweaks.php b/admin/models/component_mysql_tweaks.php
index ea0bfa93b..6f2940d95 100644
--- a/admin/models/component_mysql_tweaks.php
+++ b/admin/models/component_mysql_tweaks.php
@@ -394,6 +394,8 @@ class ComponentbuilderModelComponent_mysql_tweaks extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.component_mysql_tweaks', $data);
}
return $data;
diff --git a/admin/models/component_placeholders.php b/admin/models/component_placeholders.php
index 1255bc8ab..66ef2998b 100644
--- a/admin/models/component_placeholders.php
+++ b/admin/models/component_placeholders.php
@@ -363,6 +363,8 @@ class ComponentbuilderModelComponent_placeholders extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.component_placeholders', $data);
}
return $data;
diff --git a/admin/models/component_plugins.php b/admin/models/component_plugins.php
index e2f2f116f..bb470b131 100644
--- a/admin/models/component_plugins.php
+++ b/admin/models/component_plugins.php
@@ -364,6 +364,8 @@ class ComponentbuilderModelComponent_plugins extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.component_plugins', $data);
}
return $data;
diff --git a/admin/models/component_site_views.php b/admin/models/component_site_views.php
index 49a5ca3c1..cbee6cb86 100644
--- a/admin/models/component_site_views.php
+++ b/admin/models/component_site_views.php
@@ -395,6 +395,8 @@ class ComponentbuilderModelComponent_site_views extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.component_site_views', $data);
}
return $data;
diff --git a/admin/models/component_updates.php b/admin/models/component_updates.php
index d5736ca78..e48692dac 100644
--- a/admin/models/component_updates.php
+++ b/admin/models/component_updates.php
@@ -394,6 +394,8 @@ class ComponentbuilderModelComponent_updates extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.component_updates', $data);
}
return $data;
diff --git a/admin/models/custom_admin_view.php b/admin/models/custom_admin_view.php
index f73f7132c..27feae8e4 100644
--- a/admin/models/custom_admin_view.php
+++ b/admin/models/custom_admin_view.php
@@ -599,6 +599,8 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.custom_admin_view', $data);
}
return $data;
diff --git a/admin/models/custom_code.php b/admin/models/custom_code.php
index 534c3b3cd..9d43b8aa1 100644
--- a/admin/models/custom_code.php
+++ b/admin/models/custom_code.php
@@ -435,6 +435,8 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.custom_code', $data);
}
return $data;
diff --git a/admin/models/dynamic_get.php b/admin/models/dynamic_get.php
index 0d899b1c5..bfd62a426 100644
--- a/admin/models/dynamic_get.php
+++ b/admin/models/dynamic_get.php
@@ -613,6 +613,8 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.dynamic_get', $data);
}
return $data;
diff --git a/admin/models/field.php b/admin/models/field.php
index 26463a098..a088bc29f 100644
--- a/admin/models/field.php
+++ b/admin/models/field.php
@@ -483,6 +483,8 @@ class ComponentbuilderModelField extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.field', $data);
}
return $data;
diff --git a/admin/models/fields/joomlaplugins.php b/admin/models/fields/joomlaplugins.php
index 7f626b7d5..dbe243a41 100644
--- a/admin/models/fields/joomlaplugins.php
+++ b/admin/models/fields/joomlaplugins.php
@@ -26,7 +26,111 @@ class JFormFieldJoomlaplugins extends JFormFieldList
*
* @var string
*/
- public $type = 'joomlaplugins';
+ public $type = 'joomlaplugins';
+
+ /**
+ * Override to add new button
+ *
+ * @return string The field input markup.
+ *
+ * @since 3.2
+ */
+ protected function getInput()
+ {
+ // see if we should add buttons
+ $set_button = $this->getAttribute('button');
+ // get html
+ $html = parent::getInput();
+ // if true set button
+ if ($set_button === 'true')
+ {
+ $button = array();
+ $script = array();
+ $button_code_name = $this->getAttribute('name');
+ // get the input from url
+ $app = JFactory::getApplication();
+ $jinput = $app->input;
+ // get the view name & id
+ $values = $jinput->getArray(array(
+ 'id' => 'int',
+ 'view' => 'word'
+ ));
+ // check if new item
+ $ref = '';
+ $refJ = '';
+ if (!is_null($values['id']) && strlen($values['view']))
+ {
+ // only load referral if not new item.
+ $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
+ $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
+ // get the return value.
+ $_uri = (string) JUri::getInstance();
+ $_return = urlencode(base64_encode($_uri));
+ // load return value.
+ $ref .= '&return=' . $_return;
+ $refJ .= '&return=' . $_return;
+ }
+ // get button label
+ $button_label = trim($button_code_name);
+ $button_label = preg_replace('/_+/', ' ', $button_label);
+ $button_label = preg_replace('/\s+/', ' ', $button_label);
+ $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label);
+ $button_label = ucfirst(strtolower($button_label));
+ // get user object
+ $user = JFactory::getUser();
+ // only add if user allowed to create joomla_plugin
+ if ($user->authorise('joomla_plugin.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
+ {
+ // build Create button
+ $button[] = '
+ ';
+ }
+ // only add if user allowed to edit joomla_plugin
+ if ($user->authorise('joomla_plugin.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
+ {
+ // build edit button
+ $button[] = '
+ ';
+ // build script
+ $script[] = "
+ jQuery(document).ready(function() {
+ jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) {
+ e.preventDefault();
+ var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
+ ".$button_code_name."Button(".$button_code_name."Value);
+ });
+ var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
+ ".$button_code_name."Button(".$button_code_name."Value);
+ });
+ function ".$button_code_name."Button(value) {
+ if (value > 0) {
+ // hide the create button
+ jQuery('#".$button_code_name."Create').hide();
+ // show edit button
+ jQuery('#".$button_code_name."Edit').show();
+ var url = 'index.php?option=com_componentbuilder&view=joomla_plugins&task=joomla_plugin.edit&id='+value+'".$refJ."';
+ jQuery('#".$button_code_name."Edit').attr('href', url);
+ } else {
+ // show the create button
+ jQuery('#".$button_code_name."Create').show();
+ // hide edit button
+ jQuery('#".$button_code_name."Edit').hide();
+ }
+ }";
+ }
+ // check if button was created for joomla_plugin field.
+ if (is_array($button) && count($button) > 0)
+ {
+ // Load the needed script.
+ $document = JFactory::getDocument();
+ $document->addScriptDeclaration(implode(' ',$script));
+ // return the button attached to input field.
+ return '
' .$html . implode('',$button).'
';
+ }
+ }
+ return $html;
+ }
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/targetfields.php b/admin/models/fields/targetfields.php
index f76be0b5f..7439b32ac 100644
--- a/admin/models/fields/targetfields.php
+++ b/admin/models/fields/targetfields.php
@@ -41,19 +41,26 @@ class JFormFieldTargetfields extends JFormFieldList
$jinput = JFactory::getApplication()->input;
// get the id
$ID = $jinput->getInt('id', 0);
+ // get the view name
+ $VIEW = $jinput->get('view', null, 'WORD');
// rest the fields ids
$fieldIds = array();
- if (is_numeric($ID) && $ID >= 1)
+ // if this is an actual admin view then we are done
+ if ('admin_view' === $VIEW && is_numeric($ID) && $ID >= 1)
+ {
+ $adminView = $ID;
+ }
+ elseif (is_numeric($ID) && $ID >= 1)
{
// get the admin view ID
$adminView = ComponentbuilderHelper::getVar('admin_fields_conditions', (int) $ID, 'id', 'admin_view');
}
- else
+ elseif ('admin_view' !== $VIEW)
{
// get the admin view ID
$adminView = $jinput->getInt('refid', 0);
}
- if (is_numeric($adminView) && $adminView >= 1)
+ if (isset($adminView) && is_numeric($adminView) && $adminView >= 1)
{
// get all the fields linked to the admin view
if ($addFields = ComponentbuilderHelper::getVar('admin_fields', (int) $adminView, 'admin_view', 'addfields'))
diff --git a/admin/models/fieldtype.php b/admin/models/fieldtype.php
index 3e025683c..07f155050 100644
--- a/admin/models/fieldtype.php
+++ b/admin/models/fieldtype.php
@@ -630,6 +630,8 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.fieldtype', $data);
}
return $data;
diff --git a/admin/models/forms/joomla_plugin.xml b/admin/models/forms/joomla_plugin.xml
index 0c5450730..09b9f5df6 100644
--- a/admin/models/forms/joomla_plugin.xml
+++ b/admin/models/forms/joomla_plugin.xml
@@ -409,38 +409,134 @@
type="subform"
name="fields"
label="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDS_LABEL"
- layout="joomla.form.field.subform.repeatable-table"
+ layout="joomla.form.field.subform.repeatable"
multiple="true"
buttons="add,remove,move"
icon="list"
- max="50">
+ max="10">
diff --git a/admin/models/help_document.php b/admin/models/help_document.php
index 76de5c965..ae716ab1e 100644
--- a/admin/models/help_document.php
+++ b/admin/models/help_document.php
@@ -375,6 +375,8 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.help_document', $data);
}
return $data;
diff --git a/admin/models/joomla_component.php b/admin/models/joomla_component.php
index cc9b9fe04..36d4f123e 100644
--- a/admin/models/joomla_component.php
+++ b/admin/models/joomla_component.php
@@ -767,6 +767,8 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.joomla_component', $data);
}
return $data;
diff --git a/admin/models/joomla_plugin.php b/admin/models/joomla_plugin.php
index 0514b95bb..8e7cd9f25 100644
--- a/admin/models/joomla_plugin.php
+++ b/admin/models/joomla_plugin.php
@@ -94,7 +94,7 @@ class ComponentbuilderModelJoomla_plugin extends JModelAdmin
'readme'
)
),
- 'configparams' => array(
+ 'forms_fields' => array(
'fullwidth' => array(
'fields'
)
@@ -572,6 +572,8 @@ class ComponentbuilderModelJoomla_plugin extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.joomla_plugin', $data);
}
return $data;
diff --git a/admin/models/joomla_plugin_files_folders_urls.php b/admin/models/joomla_plugin_files_folders_urls.php
index 638417d60..94cdd1dc6 100644
--- a/admin/models/joomla_plugin_files_folders_urls.php
+++ b/admin/models/joomla_plugin_files_folders_urls.php
@@ -409,6 +409,8 @@ class ComponentbuilderModelJoomla_plugin_files_folders_urls extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.joomla_plugin_files_folders_urls', $data);
}
return $data;
diff --git a/admin/models/joomla_plugin_group.php b/admin/models/joomla_plugin_group.php
index a7b8a40f7..2cae910e6 100644
--- a/admin/models/joomla_plugin_group.php
+++ b/admin/models/joomla_plugin_group.php
@@ -352,6 +352,8 @@ class ComponentbuilderModelJoomla_plugin_group extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.joomla_plugin_group', $data);
}
return $data;
diff --git a/admin/models/joomla_plugin_updates.php b/admin/models/joomla_plugin_updates.php
index 8a5507600..dd64fc9b8 100644
--- a/admin/models/joomla_plugin_updates.php
+++ b/admin/models/joomla_plugin_updates.php
@@ -363,6 +363,8 @@ class ComponentbuilderModelJoomla_plugin_updates extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.joomla_plugin_updates', $data);
}
return $data;
diff --git a/admin/models/language.php b/admin/models/language.php
index afc984dfe..f82a18647 100644
--- a/admin/models/language.php
+++ b/admin/models/language.php
@@ -353,6 +353,8 @@ class ComponentbuilderModelLanguage extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.language', $data);
}
return $data;
diff --git a/admin/models/language_translation.php b/admin/models/language_translation.php
index 5d042d195..986b72386 100644
--- a/admin/models/language_translation.php
+++ b/admin/models/language_translation.php
@@ -397,6 +397,8 @@ class ComponentbuilderModelLanguage_translation extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.language_translation', $data);
}
return $data;
diff --git a/admin/models/layout.php b/admin/models/layout.php
index 135bc4d5a..b4da56b89 100644
--- a/admin/models/layout.php
+++ b/admin/models/layout.php
@@ -451,6 +451,8 @@ class ComponentbuilderModelLayout extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.layout', $data);
}
return $data;
diff --git a/admin/models/library.php b/admin/models/library.php
index 113d048e8..7b5972dd4 100644
--- a/admin/models/library.php
+++ b/admin/models/library.php
@@ -449,6 +449,8 @@ class ComponentbuilderModelLibrary extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.library', $data);
}
return $data;
diff --git a/admin/models/library_config.php b/admin/models/library_config.php
index 928f52550..9f4293ca5 100644
--- a/admin/models/library_config.php
+++ b/admin/models/library_config.php
@@ -363,6 +363,8 @@ class ComponentbuilderModelLibrary_config extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.library_config', $data);
}
return $data;
diff --git a/admin/models/library_files_folders_urls.php b/admin/models/library_files_folders_urls.php
index 4ea18f984..77956996f 100644
--- a/admin/models/library_files_folders_urls.php
+++ b/admin/models/library_files_folders_urls.php
@@ -409,6 +409,8 @@ class ComponentbuilderModelLibrary_files_folders_urls extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.library_files_folders_urls', $data);
}
return $data;
diff --git a/admin/models/placeholder.php b/admin/models/placeholder.php
index 6b78fa74d..45a5f5d4e 100644
--- a/admin/models/placeholder.php
+++ b/admin/models/placeholder.php
@@ -400,6 +400,8 @@ class ComponentbuilderModelPlaceholder extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.placeholder', $data);
}
return $data;
diff --git a/admin/models/server.php b/admin/models/server.php
index 16a14d97e..c54490f3b 100644
--- a/admin/models/server.php
+++ b/admin/models/server.php
@@ -511,6 +511,8 @@ class ComponentbuilderModelServer extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.server', $data);
}
return $data;
diff --git a/admin/models/site_view.php b/admin/models/site_view.php
index 38cf0d417..388096aa7 100644
--- a/admin/models/site_view.php
+++ b/admin/models/site_view.php
@@ -620,6 +620,8 @@ class ComponentbuilderModelSite_view extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.site_view', $data);
}
return $data;
diff --git a/admin/models/snippet.php b/admin/models/snippet.php
index 1eaeb22ee..e01add57a 100644
--- a/admin/models/snippet.php
+++ b/admin/models/snippet.php
@@ -380,6 +380,8 @@ class ComponentbuilderModelSnippet extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.snippet', $data);
}
return $data;
diff --git a/admin/models/snippet_type.php b/admin/models/snippet_type.php
index 0fd4d5192..43f5da38e 100644
--- a/admin/models/snippet_type.php
+++ b/admin/models/snippet_type.php
@@ -353,6 +353,8 @@ class ComponentbuilderModelSnippet_type extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.snippet_type', $data);
}
return $data;
diff --git a/admin/models/template.php b/admin/models/template.php
index 82ab2241d..55ef8ec4b 100644
--- a/admin/models/template.php
+++ b/admin/models/template.php
@@ -451,6 +451,8 @@ class ComponentbuilderModelTemplate extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.template', $data);
}
return $data;
diff --git a/admin/models/validation_rule.php b/admin/models/validation_rule.php
index 0f39411b2..32235de6b 100644
--- a/admin/models/validation_rule.php
+++ b/admin/models/validation_rule.php
@@ -403,6 +403,8 @@ class ComponentbuilderModelValidation_rule extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
+ // run the perprocess of the data
+ $this->preprocessData('com_componentbuilder.validation_rule', $data);
}
return $data;
diff --git a/admin/views/joomla_plugin/tmpl/edit.php b/admin/views/joomla_plugin/tmpl/edit.php
index ed0a25544..83d02bd26 100644
--- a/admin/views/joomla_plugin/tmpl/edit.php
+++ b/admin/views/joomla_plugin/tmpl/edit.php
@@ -65,12 +65,12 @@ $componentParams = $this->params; // will be removed just use $this->params inst
-
+
-
+
diff --git a/componentbuilder.xml b/componentbuilder.xml
index 077162ab7..4615f355f 100644
--- a/componentbuilder.xml
+++ b/componentbuilder.xml
@@ -1,7 +1,7 @@
COM_COMPONENTBUILDER
- 16th August, 2019
+ 22nd August, 2019Llewellyn van der Merwellewellyn@joomlacomponentbuilder.comhttp://www.joomlacomponentbuilder.com
diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php
index 99f6666b1..7eba89ca4 100644
--- a/site/helpers/componentbuilder.php
+++ b/site/helpers/componentbuilder.php
@@ -5670,7 +5670,7 @@ abstract class ComponentbuilderHelper
* @return object
*
*/
- public static function getFieldObject($attributes, $default = '', $options = null)
+ public static function getFieldObject(&$attributes, $default = '', $options = null)
{
// make sure we have attributes and a type value
if (self::checkArray($attributes) && isset($attributes['type']))
@@ -5681,7 +5681,31 @@ abstract class ComponentbuilderHelper
jimport('joomla.form.form');
}
// get field type
- $field = JFormHelper::loadFieldType($attributes['type'],true);
+ $field = JFormHelper::loadFieldType($attributes['type'], true);
+ // get field xml
+ $XML = self::getFieldXML($attributes, $options);
+ // setup the field
+ $field->setup($XML, $default);
+ // return the field object
+ return $field;
+ }
+ return false;
+ }
+
+ /**
+ * get the field xml
+ *
+ * @param array $attributes The array of attributes
+ * @param array $options The options to apply to the XML element
+ *
+ * @return object
+ *
+ */
+ public static function getFieldXML(&$attributes, $options = null)
+ {
+ // make sure we have attributes and a type value
+ if (self::checkArray($attributes))
+ {
// start field xml
$XML = new SimpleXMLElement('');
// load the attributes
@@ -5692,10 +5716,8 @@ abstract class ComponentbuilderHelper
// load the options
self::xmlAddOptions($XML, $options);
}
- // setup the field
- $field->setup($XML, $default);
- // return the field object
- return $field;
+ // return the field xml
+ return $XML;
}
return false;
}