Resolve gh-609 to make sure that custom code set in a field that gets linked to a module will get added to the module.

This commit is contained in:
Llewellyn van der Merwe 2020-12-05 08:17:54 +02:00
parent e7670a1edd
commit dfbd2b2a6d
Signed by untrusted user: Llewellyn
GPG Key ID: EFC0C720A240551C
7 changed files with 319 additions and 478 deletions

View File

@ -144,13 +144,13 @@ 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*: 3rd December, 2020
+ *Last Build*: 5th December, 2020
+ *Version*: 2.12.1
+ *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*: **289032**
+ *Field count*: **1537**
+ *File count*: **1880**
+ *File count*: **1902**
+ *Folder count*: **304**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).

View File

@ -144,13 +144,13 @@ 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*: 3rd December, 2020
+ *Last Build*: 5th December, 2020
+ *Version*: 2.12.1
+ *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*: **289032**
+ *Field count*: **1537**
+ *File count*: **1880**
+ *File count*: **1902**
+ *Folder count*: **304**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).

View File

@ -3986,8 +3986,6 @@ class Get
$this->_fieldData[$id]->css_view_decoded = true;
}
}
// add this only once to view.
$this->customFieldScript[$name_single][$id] = true;
}
// check if we should load scripts for list views
if (ComponentbuilderHelper::checkString($name_list)
@ -4058,7 +4056,7 @@ class Get
$this->setCustomScriptBuilder(
$this->_fieldData[$id]->css_views,
'css_views',
$name_list,
$name_single,
false,
array('prefix' => PHP_EOL),
$convert__,
@ -4070,10 +4068,11 @@ class Get
$this->_fieldData[$id]->css_views_decoded = true;
}
}
// add this only once to view.
$this->customFieldScript[$name_list][$id] = true;
}
// add this only once to single view.
$this->customFieldScript[$name_single][$id] = true;
// add this only once to list view.
$this->customFieldScript[$name_list][$id] = true;
}
if ($id > 0 && isset($this->_fieldData[$id]))
{
@ -5235,6 +5234,57 @@ class Get
return false;
}
/**
* get the a script from the custom script builder
*
* @param string $first The first key
* @param string $second The second key
* @param string $prefix The prefix to add in front of the script if found
* @param string $note The switch/note to add to the script
* @param bool $unset The switch to unset the value if found
* @param string $default The switch/string to use as default return if script not found
* @param string $sufix The sufix to add after the script if found
*
* @return mix The string/script if found or the default value if not found
*
*/
public function getCustomScriptBuilder($first, $second, $prefix = '',
$note = null, $unset = null, $default = null, $sufix = ''
) {
// default is to return an empty string
$script = '';
// check if there is any custom script
if (isset($this->customScriptBuilder[$first][$second])
&& ComponentbuilderHelper::checkString(
$this->customScriptBuilder[$first][$second]
))
{
// add not if set
if ($note)
{
$script .= $note;
}
// load the actual script
$script .= $prefix . str_replace(
array_keys($this->placeholders),
array_values($this->placeholders),
$this->customScriptBuilder[$first][$second]
) . $sufix;
// clear some memory
if ($unset)
{
unset($this->customScriptBuilder[$first][$second]);
}
}
// if not found return default
if (!ComponentbuilderHelper::checkString($script) && $default)
{
return $default;
}
return $script;
}
/**
* To limit the SQL Demo date build in the views
*
@ -8699,7 +8749,7 @@ class Get
$unique = $form['fields_name']
. $form['fieldset'];
}
// set global fields rule path switchs
// set global fields rule path switches
if ($module->fields_rules_paths == 1
&& isset($form['fields_rules_paths'])
&& $form['fields_rules_paths'] == 2)
@ -9095,6 +9145,39 @@ class Get
return $xml;
}
/**
* get the module admin custom script field
*
* @return string
*
*/
public function getModAdminVvvvvvvdm($fieldScriptBucket)
{
$form_field_class = array();
$form_field_class[] = $this->hhh . 'BOM' . $this->hhh . PHP_EOL;
$form_field_class[] = "//" . $this->setLine(__LINE__) . " No direct access to this file";
$form_field_class[] = "defined('_JEXEC') or die('Restricted access');";
$form_field_class[] = PHP_EOL . "use Joomla\CMS\Form\FormField;";
$form_field_class[] = "use Joomla\CMS\Factory;";
$form_field_class[] = PHP_EOL . "class JFormFieldModadminvvvvvvvdm extends FormField";
$form_field_class[] = "{";
$form_field_class[] = $this->_t(1) . "protected \$type = 'modadminvvvvvvvdm';";
$form_field_class[] = PHP_EOL . $this->_t(1) . "protected function getLabel()";
$form_field_class[] = $this->_t(1) . "{";
$form_field_class[] = $this->_t(2) . "return;";
$form_field_class[] = $this->_t(1) . "}";
$form_field_class[] = PHP_EOL . $this->_t(1) . "protected function getInput()";
$form_field_class[] = $this->_t(1) . "{";
$form_field_class[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the document";
$form_field_class[] = $this->_t(2) . "\$document = Factory::getDocument();";
$form_field_class[] = implode(PHP_EOL, $fieldScriptBucket);
$form_field_class[] = $this->_t(2) . "return; // noting for now :)";
$form_field_class[] = $this->_t(1) . "}";
$form_field_class[] = "}";
return implode(PHP_EOL, $form_field_class);
}
/**
* get the Joomla plugins IDs
*

View File

@ -501,16 +501,8 @@ class Structure extends Get
$this->dynamicPaths[$module->key] = $module->folder_path;
// make sure there is no old build
$this->removeFolder($module->folder_path);
// creat the main component folder
if (!JFolder::exists($module->folder_path))
{
JFolder::create($module->folder_path);
// count the folder created
$this->folderCount++;
$this->indexHTML(
$module->folder_name, $this->compilerPath
);
}
// creat the main module folder
$this->createFolder($module->folder_path);
// set main mod file
$fileDetails = array('path' => $module->folder_path . '/'
. $module->file_name . '.php',
@ -592,15 +584,7 @@ class Structure extends Get
// count the file created
$this->fileCount++;
// set tmpl folder
if (!JFolder::exists($module->folder_path . '/tmpl'))
{
JFolder::create($module->folder_path . '/tmpl');
// count the folder created
$this->folderCount++;
$this->indexHTML(
$module->folder_name . '/tmpl', $this->compilerPath
);
}
$this->createFolder($module->folder_path . '/tmpl');
// set default file
$fileDetails = array('path' => $module->folder_path
. '/tmpl/default.php',
@ -652,32 +636,116 @@ class Structure extends Get
// count the file created
$this->fileCount++;
}
// set fields & rules folders if needed
// set the folders target path
$target_path = '';
if ($module->target_client === 'administrator')
{
$target_path = '/administrator';
}
// check if we have custom fields needed for scripts
$module->add_scripts_field = false;
$field_script_bucket = array();
// add any css from the fields
if (($css = $this->getCustomScriptBuilder(
'css_view', $module->key
)) !== null
&& ComponentbuilderHelper::checkString($css))
{
// make sure this script does not have PHP
if (strpos($css, '<?php') === false)
{
// make sure the field is added
$module->add_scripts_field = true;
// create the css folder
$this->createFolder($module->folder_path . '/css');
// add the CSS file
$fileDetails = array('path' => $module->folder_path
. '/css/mod_admin.css',
'name' => 'mod_admin.css',
'zip' => 'mod_admin.css');
$this->writeFile(
$fileDetails['path'],
$this->hhh . 'BOM' . $this->hhh . PHP_EOL
. PHP_EOL . $css
);
$this->newFiles[$module->key][] = $fileDetails;
// count the file created
$this->fileCount++;
// add the field script
$field_script_bucket[] = $this->_t(2) . "//"
. $this->setLine(__LINE__) . " Custom CSS";
$field_script_bucket[] = $this->_t(2)
. "\$document->addStyleSheet('" . $target_path
. "/modules/" . $module->folder_name
. "/css/mod_admin.css', ['version' => 'auto', 'relative' => true]);";
}
}
// add any JavaScript from the fields
if (($javascript = $this->getCustomScriptBuilder(
'view_footer', $module->key
)) !== null
&& ComponentbuilderHelper::checkString($javascript))
{
// make sure this script does not have PHP
if (strpos($javascript, '<?php') === false)
{
// make sure the field is added
$module->add_scripts_field = true;
// add the JavaScript file
$this->createFolder($module->folder_path . '/js');
// add the CSS file
$fileDetails = array('path' => $module->folder_path
. '/js/mod_admin.js',
'name' => 'mod_admin.js',
'zip' => 'mod_admin.js');
$this->writeFile(
$fileDetails['path'],
$this->hhh . 'BOM' . $this->hhh . PHP_EOL
. PHP_EOL . $javascript
);
$this->newFiles[$module->key][] = $fileDetails;
// count the file created
$this->fileCount++;
// add the field script
$field_script_bucket[] = $this->_t(2) . "//"
. $this->setLine(__LINE__) . " Custom JS";
$field_script_bucket[] = $this->_t(2)
. "\$document->addScript('" . $target_path
. "/modules/" . $module->folder_name
. "/js/mod_admin.js', ['version' => 'auto', 'relative' => true]);";
}
}
// set fields folders if needed
if ($module->add_scripts_field
|| (isset($module->fields_rules_paths)
&& $module->fields_rules_paths == 2))
{
// create fields folder
$this->createFolder($module->folder_path . '/fields');
// add the custom script field
if ($module->add_scripts_field)
{
$fileDetails = array('path' => $module->folder_path
. '/fields/modadminvvvvvvvdm.php',
'name' => 'modadminvvvvvvvdm.php',
'zip' => 'modadminvvvvvvvdm.php');
$this->writeFile(
$fileDetails['path'],
$this->getModAdminVvvvvvvdm(
$field_script_bucket
)
);
$this->newFiles[$module->key][] = $fileDetails;
// count the file created
$this->fileCount++;
}
}
// set rules folders if needed
if (isset($module->fields_rules_paths)
&& $module->fields_rules_paths == 2)
{
// create fields folder
if (!JFolder::exists($module->folder_path . '/fields'))
{
JFolder::create($module->folder_path . '/fields');
// count the folder created
$this->folderCount++;
$this->indexHTML(
$module->folder_name . '/fields',
$this->compilerPath
);
}
// create rules folder
if (!JFolder::exists($module->folder_path . '/rules'))
{
JFolder::create($module->folder_path . '/rules');
// count the folder created
$this->folderCount++;
$this->indexHTML(
$module->folder_name . '/rules',
$this->compilerPath
);
}
$this->createFolder($module->folder_path . '/rules');
}
// set forms folder if needed
if (isset($module->form_files)
@ -686,16 +754,7 @@ class Structure extends Get
))
{
// create forms folder
if (!JFolder::exists($module->folder_path . '/forms'))
{
JFolder::create($module->folder_path . '/forms');
// count the folder created
$this->folderCount++;
$this->indexHTML(
$module->folder_name . '/forms',
$this->compilerPath
);
}
$this->createFolder($module->folder_path . '/forms');
// set the template files
foreach ($module->form_files as $file => $fields)
{
@ -705,7 +764,7 @@ class Structure extends Get
'name' => $file . '.xml',
'zip' => 'forms/' . $file
. '.xml');
// biuld basic XML
// build basic XML
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= PHP_EOL . '<!--' . $this->setLine(__LINE__)
. ' default paths of ' . $file
@ -848,31 +907,11 @@ class Structure extends Get
if ($module->add_sql || $module->add_sql_uninstall)
{
// create SQL folder
if (!JFolder::exists($module->folder_path . '/sql'))
{
JFolder::create($module->folder_path . '/sql');
// count the folder created
$this->folderCount++;
$this->indexHTML(
$module->folder_name . '/sql',
$this->compilerPath
);
}
$this->createFolder($module->folder_path . '/sql');
// create mysql folder
if (!JFolder::exists(
$this->createFolder(
$module->folder_path . '/sql/mysql'
))
{
JFolder::create(
$module->folder_path . '/sql/mysql'
);
// count the folder created
$this->folderCount++;
$this->indexHTML(
$module->folder_name . '/sql/mysql',
$this->compilerPath
);
}
);
// now set the install file
if ($module->add_sql)
{
@ -896,24 +935,11 @@ class Structure extends Get
}
}
// creat the language folder
if (!JFolder::exists($module->folder_path . '/language'))
{
JFolder::create($module->folder_path . '/language');
// count the folder created
$this->folderCount++;
// also the lang tag
if (!JFolder::exists(
$module->folder_path . '/language/' . $this->langTag
))
{
JFolder::create(
$module->folder_path . '/language/'
. $this->langTag
);
// count the folder created
$this->folderCount++;
}
}
$this->createFolder($module->folder_path . '/language');
// also create the lang tag folder
$this->createFolder(
$module->folder_path . '/language/' . $this->langTag
);
// check if this lib has files
if (isset($module->files)
&& ComponentbuilderHelper::checkArray($module->files))
@ -974,20 +1000,9 @@ class Structure extends Get
$path = '';
}
// create sub media path if not set
if (!JFolder::exists(
$this->createFolder(
$module->folder_path . $path
))
{
JFolder::create(
$module->folder_path . $path
);
// count the folder created
$this->folderCount++;
$this->indexHTML(
$module->folder_name . $path,
$this->compilerPath
);
}
);
// set the path to module file
$url['path'] = $module->folder_path . $path
. '/' . $fileName; // we need this for later
@ -1034,15 +1049,7 @@ class Structure extends Get
// make sure there is no old build
$this->removeFolder($plugin->folder_path);
// creat the main component folder
if (!JFolder::exists($plugin->folder_path))
{
JFolder::create($plugin->folder_path);
// count the folder created
$this->folderCount++;
$this->indexHTML(
$plugin->folder_name, $this->compilerPath
);
}
$this->createFolder($plugin->folder_path);
// set main class file
$fileDetails = array('path' => $plugin->folder_path . '/'
. $plugin->file_name . '.php',
@ -1111,27 +1118,9 @@ class Structure extends Get
&& $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
);
}
$this->createFolder($plugin->folder_path . '/fields');
// 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
);
}
$this->createFolder($plugin->folder_path . '/rules');
}
// set forms folder if needed
if (isset($plugin->form_files)
@ -1140,16 +1129,7 @@ class Structure extends Get
))
{
// 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
);
}
$this->createFolder($plugin->folder_path . '/forms');
// set the template files
foreach ($plugin->form_files as $file => $fields)
{
@ -1304,31 +1284,11 @@ class Structure extends Get
if ($plugin->add_sql || $plugin->add_sql_uninstall)
{
// create SQL folder
if (!JFolder::exists($plugin->folder_path . '/sql'))
{
JFolder::create($plugin->folder_path . '/sql');
// count the folder created
$this->folderCount++;
$this->indexHTML(
$plugin->folder_name . '/sql',
$this->compilerPath
);
}
$this->createFolder($plugin->folder_path . '/sql');
// create mysql folder
if (!JFolder::exists(
$this->createFolder(
$plugin->folder_path . '/sql/mysql'
))
{
JFolder::create(
$plugin->folder_path . '/sql/mysql'
);
// count the folder created
$this->folderCount++;
$this->indexHTML(
$plugin->folder_name . '/sql/mysql',
$this->compilerPath
);
}
);
// now set the install file
if ($plugin->add_sql)
{
@ -1351,25 +1311,12 @@ class Structure extends Get
$this->fileCount++;
}
}
// creat the language folder
if (!JFolder::exists($plugin->folder_path . '/language'))
{
JFolder::create($plugin->folder_path . '/language');
// count the folder created
$this->folderCount++;
// also the lang tag
if (!JFolder::exists(
$plugin->folder_path . '/language/' . $this->langTag
))
{
JFolder::create(
$plugin->folder_path . '/language/'
. $this->langTag
);
// count the folder created
$this->folderCount++;
}
}
// creat the language folder path
$this->createFolder($plugin->folder_path . '/language');
// also creat the lang tag folder path
$this->createFolder(
$plugin->folder_path . '/language/' . $this->langTag
);
// check if this lib has files
if (isset($plugin->files)
&& ComponentbuilderHelper::checkArray($plugin->files))
@ -1429,21 +1376,10 @@ class Structure extends Get
{
$path = '';
}
// create sub media path if not set
if (!JFolder::exists(
// create sub media media folder path if not set
$this->createFolder(
$plugin->folder_path . $path
))
{
JFolder::create(
$plugin->folder_path . $path
);
// count the folder created
$this->folderCount++;
$this->indexHTML(
$plugin->folder_name . $path,
$this->compilerPath
);
}
);
// set the path to plugin file
$url['path'] = $plugin->folder_path . $path
. '/' . $fileName; // we need this for later
@ -1459,6 +1395,31 @@ class Structure extends Get
}
}
/**
* Create Path if not exist
*
* @return void
*/
private function createFolder($path)
{
// check if the path exist
if (!JFolder::exists(
$path
))
{
// create the path
JFolder::create(
$path
);
// count the folder created
$this->folderCount++;
// add index.html (boring I know)
$this->indexHTML(
$path, ''
);
}
}
/**
* Build the Libraries files, folders, url's and config
*
@ -1483,13 +1444,7 @@ class Structure extends Get
$this->indexHTML('');
}
// create media path if not set
if (!JFolder::exists($this->componentPath . '/media'))
{
JFolder::create($this->componentPath . '/media');
// count the folder created
$this->folderCount++;
$this->indexHTML('/media');
}
$this->createFolder($this->componentPath . '/media');
foreach ($this->libraries as $id => &$library)
{
if (ComponentbuilderHelper::checkObject($library))
@ -1542,17 +1497,9 @@ class Structure extends Get
))
{
// create media/lib path if not set
if (!JFolder::exists(
$this->createFolder(
$this->componentPath . $mediaPath
))
{
JFolder::create(
$this->componentPath . $mediaPath
);
// count the folder created
$this->folderCount++;
$this->indexHTML($mediaPath);
}
);
// add local folder
$addLocalFolder = true;
// set file name
@ -1575,18 +1522,9 @@ class Structure extends Get
$path = '';
}
// create sub media path if not set
if (!JFolder::exists(
$this->createFolder(
$this->componentPath . $mediaPath . $path
))
{
JFolder::create(
$this->componentPath . $mediaPath
. $path
);
// count the folder created
$this->folderCount++;
$this->indexHTML($mediaPath . $path);
}
);
// set the path to library file
$url['path'] = $mediaPath . $path . '/'
. $fileName; // we need this for later
@ -1808,47 +1746,22 @@ class Structure extends Get
// now build all folders needed for this component
foreach ($this->joomlaVersionData->create as $main => $folders)
{
if (!JFolder::exists($this->componentPath . '/' . $main))
{
JFolder::create($this->componentPath . '/' . $main);
// count the folder created
$this->folderCount++;
$this->indexHTML($main);
}
$this->createFolder($this->componentPath . '/' . $main);
if (ComponentbuilderHelper::checkObject($folders))
{
foreach ($folders as $sub => $subFolders)
{
if (!JFolder::exists(
$this->createFolder(
$this->componentPath . '/' . $main . '/' . $sub
))
{
JFolder::create(
$this->componentPath . '/' . $main . '/' . $sub
);
// count the folder created
$this->folderCount++;
$this->indexHTML($main . '/' . $sub);
}
);
if (ComponentbuilderHelper::checkObject($subFolders))
{
foreach ($subFolders as $sub_2 => $subFolders_2)
{
if (!JFolder::exists(
$this->createFolder(
$this->componentPath . '/' . $main . '/'
. $sub . '/' . $sub_2
))
{
JFolder::create(
$this->componentPath . '/' . $main . '/'
. $sub . '/' . $sub_2
);
// count the folder created
$this->folderCount++;
$this->indexHTML(
$main . '/' . $sub . '/' . $sub_2
);
}
);
if (ComponentbuilderHelper::checkObject(
$subFolders_2
))
@ -1857,25 +1770,11 @@ class Structure extends Get
$subFolders_2 as $sub_3 => $subFolders_3
)
{
if (!JFolder::exists(
$this->createFolder(
$this->componentPath . '/' . $main
. '/' . $sub . '/' . $sub_2 . '/'
. $sub_3
))
{
JFolder::create(
$this->componentPath . '/'
. $main . '/' . $sub . '/'
. $sub_2 . '/' . $sub_3
);
// count the folder created
$this->folderCount++;
$this->indexHTML(
$main . '/' . $sub . '/'
. $sub_2 . '/' . $sub_3
);
}
);
if (ComponentbuilderHelper::checkObject(
$subFolders_3
))
@ -1885,28 +1784,12 @@ class Structure extends Get
$subFolders_4
)
{
if (!JFolder::exists(
$this->createFolder(
$this->componentPath . '/'
. $main . '/' . $sub . '/'
. $sub_2 . '/' . $sub_3
. '/' . $sub_4
))
{
JFolder::create(
$this->componentPath
. '/' . $main . '/'
. $sub . '/' . $sub_2
. '/' . $sub_3 . '/'
. $sub_4
);
// count the folder created
$this->folderCount++;
$this->indexHTML(
$main . '/' . $sub . '/'
. $sub_2 . '/' . $sub_3
. '/' . $sub_4
);
}
);
if (ComponentbuilderHelper::checkObject(
$subFolders_4
))
@ -1916,7 +1799,7 @@ class Structure extends Get
=> $subFolders_5
)
{
if (!JFolder::exists(
$this->createFolder(
$this->componentPath
. '/' . $main . '/'
. $sub . '/'
@ -1924,28 +1807,7 @@ class Structure extends Get
. $sub_3 . '/'
. $sub_4 . '/'
. $sub_5
))
{
JFolder::create(
$this->componentPath
. '/' . $main
. '/' . $sub
. '/' . $sub_2
. '/' . $sub_3
. '/' . $sub_4
. '/' . $sub_5
);
// count the folder created
$this->folderCount++;
$this->indexHTML(
$main . '/'
. $sub . '/'
. $sub_2 . '/'
. $sub_3 . '/'
. $sub_4 . '/'
. $sub_5
);
}
);
if (ComponentbuilderHelper::checkObject(
$subFolders_5
))
@ -1956,11 +1818,12 @@ class Structure extends Get
$subFolders_6
)
{
if (!JFolder::exists(
$this->createFolder(
$this->componentPath
. '/'
. $main
. '/' . $sub
. '/'
. $sub
. '/'
. $sub_2
. '/'
@ -1971,43 +1834,7 @@ class Structure extends Get
. $sub_5
. '/'
. $sub_6
))
{
JFolder::create(
$this->componentPath
. '/'
. $main
. '/'
. $sub
. '/'
. $sub_2
. '/'
. $sub_3
. '/'
. $sub_4
. '/'
. $sub_5
. '/'
. $sub_6
);
// count the folder created
$this->folderCount++;
$this->indexHTML(
$main
. '/'
. $sub
. '/'
. $sub_2
. '/'
. $sub_3
. '/'
. $sub_4
. '/'
. $sub_5
. '/'
. $sub_6
);
}
);
if (ComponentbuilderHelper::checkObject(
$subFolders_6
))
@ -2020,7 +1847,7 @@ class Structure extends Get
$subFolders_7
)
{
if (!JFolder::exists(
$this->createFolder(
$this->componentPath
. '/'
. $main
@ -2038,47 +1865,7 @@ class Structure extends Get
. $sub_6
. '/'
. $sub_7
))
{
JFolder::create(
$this->componentPath
. '/'
. $main
. '/'
. $sub
. '/'
. $sub_2
. '/'
. $sub_3
. '/'
. $sub_4
. '/'
. $sub_5
. '/'
. $sub_6
. '/'
. $sub_7
);
// count the folder created
$this->folderCount++;
$this->indexHTML(
$main
. '/'
. $sub
. '/'
. $sub_2
. '/'
. $sub_3
. '/'
. $sub_4
. '/'
. $sub_5
. '/'
. $sub_6
. '/'
. $sub_7
);
}
);
}
}
}
@ -3251,14 +3038,14 @@ class Structure extends Get
{
if ('component' === $root)
{
$root = $this->componentPath;
$root = $this->componentPath . '/';
}
// use path if exist
if (strlen($path) > 0)
{
JFile::copy(
$this->templatePath . '/index.html',
$root . '/' . $path . '/index.html'
$root . $path . '/index.html'
);
// count the file created
$this->fileCount++;

View File

@ -5038,7 +5038,7 @@ class Fields extends Structure
{
// this pains me... but to avoid collusion
$filter_type_code = ComponentbuilderHelper::safeString(
$nameListCode . 'filter' . $name
$nameListCode . 'filter' . $name
);
$filter_type_code = preg_replace('/_+/', '', $filter_type_code);
$filter_function_name = ComponentbuilderHelper::safeString(
@ -5628,7 +5628,8 @@ class Fields extends Structure
$field_filter_sets[] = $this->_t(3) . 'type="category"';
$field_filter_sets[] = $this->_t(3) . 'name="category_id"';
$field_filter_sets[] = $this->_t(3)
. 'label="' . $this->categoryBuilder[$nameListCode]['name'] . '"';
. 'label="' . $this->categoryBuilder[$nameListCode]['name']
. '"';
$field_filter_sets[] = $this->_t(3)
. 'description="JOPTION_FILTER_CATEGORY_DESC"';
$field_filter_sets[] = $this->_t(3) . 'multiple="true"';

View File

@ -4777,57 +4777,6 @@ class Interpretation extends Fields
return false;
}
/**
* get the a script from the custom script builder
*
* @param string $first The first key
* @param string $second The second key
* @param string $prefix The prefix to add in front of the script if found
* @param string $note The switch/note to add to the script
* @param bool $unset The switch to unset the value if found
* @param string $default The switch/string to use as default return if script not found
* @param string $sufix The sufix to add after the script if found
*
* @return mix The string/script if found or the default value if not found
*
*/
public function getCustomScriptBuilder($first, $second, $prefix = '',
$note = null, $unset = null, $default = null, $sufix = ''
) {
// default is to return an empty string
$script = '';
// check if there is any custom script
if (isset($this->customScriptBuilder[$first][$second])
&& ComponentbuilderHelper::checkString(
$this->customScriptBuilder[$first][$second]
))
{
// add not if set
if ($note)
{
$script .= $note;
}
// load the actual script
$script .= $prefix . str_replace(
array_keys($this->placeholders),
array_values($this->placeholders),
$this->customScriptBuilder[$first][$second]
) . $sufix;
// clear some memory
if ($unset)
{
unset($this->customScriptBuilder[$first][$second]);
}
}
// if not found return default
if (!ComponentbuilderHelper::checkString($script) && $default)
{
return $default;
}
return $script;
}
public function setCustomViewListQuery(&$get, $code, $return = true)
{
if (ComponentbuilderHelper::checkObject($get))
@ -14317,11 +14266,14 @@ class Interpretation extends Fields
$Helper = $this->fileContentStatic[$this->hhh . 'Component'
. $this->hhh] . 'Helper';
// load the access filter query code
$query .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__)
$query .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(
__LINE__
)
. " Filter by access level.";
$query .= PHP_EOL . $this->_t(2)
. "\$_access = \$this->getState('filter.access');";
$query .= PHP_EOL . $this->_t(2) . "if (\$_access && is_numeric(\$_access))";
$query .= PHP_EOL . $this->_t(2)
. "if (\$_access && is_numeric(\$_access))";
$query .= PHP_EOL . $this->_t(2) . "{";
$query .= PHP_EOL . $this->_t(3)
. "\$query->where('a.access = ' . (int) \$_access);";
@ -14330,8 +14282,10 @@ class Interpretation extends Fields
. $Helper . "::checkArray(\$_access))";
$query .= PHP_EOL . $this->_t(2) . "{";
$query .= PHP_EOL . $this->_t(3) . "//"
. $this->setLine(__LINE__) . " Secure the array for the query";
$query .= PHP_EOL . $this->_t(3) . "\$_access = ArrayHelper::toInteger(\$_access);";
. $this->setLine(__LINE__)
. " Secure the array for the query";
$query .= PHP_EOL . $this->_t(3)
. "\$_access = ArrayHelper::toInteger(\$_access);";
$query .= PHP_EOL . $this->_t(3) . "//"
. $this->setLine(__LINE__) . " Filter by the Access Array.";
$query .= PHP_EOL . $this->_t(3)
@ -14754,7 +14708,8 @@ class Interpretation extends Fields
. "\$pks = \$input->post->get('cid', array(), 'array');";
$method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " Sanitize the input";
$method[] = $this->_t(3) . "\$pks = ArrayHelper::toInteger(\$pks);";
$method[] = $this->_t(3)
. "\$pks = ArrayHelper::toInteger(\$pks);";
$method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " convert to string";
$method[] = $this->_t(3) . "\$ids = implode('_', \$pks);";
@ -15443,11 +15398,14 @@ class Interpretation extends Fields
$Helper = $this->fileContentStatic[$this->hhh . 'Component'
. $this->hhh] . 'Helper';
// load the access filter query code
$query .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__)
$query .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(
__LINE__
)
. " Filter by access level.";
$query .= PHP_EOL . $this->_t(2)
. "\$_access = \$this->getState('filter.access');";
$query .= PHP_EOL . $this->_t(2) . "if (\$_access && is_numeric(\$_access))";
$query .= PHP_EOL . $this->_t(2)
. "if (\$_access && is_numeric(\$_access))";
$query .= PHP_EOL . $this->_t(2) . "{";
$query .= PHP_EOL . $this->_t(3)
. "\$query->where('a.access = ' . (int) \$_access);";
@ -15456,8 +15414,10 @@ class Interpretation extends Fields
. $Helper . "::checkArray(\$_access))";
$query .= PHP_EOL . $this->_t(2) . "{";
$query .= PHP_EOL . $this->_t(3) . "//"
. $this->setLine(__LINE__) . " Secure the array for the query";
$query .= PHP_EOL . $this->_t(3) . "\$_access = ArrayHelper::toInteger(\$_access);";
. $this->setLine(__LINE__)
. " Secure the array for the query";
$query .= PHP_EOL . $this->_t(3)
. "\$_access = ArrayHelper::toInteger(\$_access);";
$query .= PHP_EOL . $this->_t(3) . "//"
. $this->setLine(__LINE__) . " Filter by the Access Array.";
$query .= PHP_EOL . $this->_t(3)
@ -20922,9 +20882,9 @@ class Interpretation extends Fields
/**
* Add the code of the filter in the populate state
*
* @param array $filter The field/filter array
* @param array $filter The field/filter array
* @param bool $newFilter The switch to use the new filter
* @param string $extra The defaults/extra options of the filter
* @param string $extra The defaults/extra options of the filter
*
* @return string The code for the populate state
*
@ -20978,7 +20938,7 @@ class Interpretation extends Fields
* set the default populate state code
*
* @param string $nameSingleCode The single view name
* @param bool $newFilter The switch to use the new filter
* @param bool $newFilter The switch to use the new filter
*
* @return string The state code added
*
@ -27433,7 +27393,7 @@ function vdm_dkim() {
$default = PHP_EOL . $module->default_header . PHP_EOL . '?>';
// add any css from the fields
$default .= $this->getCustomScriptBuilder(
'css_views', $key, PHP_EOL . '<style>' . PHP_EOL, '', true, null,
'css_views', $key, PHP_EOL . '<style>', '', true, null,
PHP_EOL . '</style>' . PHP_EOL
);
// now add the body
@ -27441,7 +27401,7 @@ function vdm_dkim() {
// add any JavaScript from the fields
$default .= $this->getCustomScriptBuilder(
'views_footer', $key,
PHP_EOL . '<script type="text/javascript">' . PHP_EOL, '', true,
PHP_EOL . '<script type="text/javascript">', '', true,
null, PHP_EOL . '</script>' . PHP_EOL
);
@ -27532,6 +27492,7 @@ function vdm_dkim() {
$module->config_fields
))
{
$add_scripts_field = true;
foreach ($module->config_fields as $field_name => $fieldsets)
{
foreach ($fieldsets as $fieldset => $fields)
@ -27540,6 +27501,15 @@ function vdm_dkim() {
$xmlFields = $this->getExtensionFieldsetXML(
$module, $fields, $dbkey
);
// check if the custom script field must be set
if ($add_scripts_field && $module->add_scripts_field)
{
// get the custom script field
$xmlFields .= PHP_EOL . $this->_t(2)
. "<field type=\"modadminvvvvvvvdm\" />";
// don't add it again
$add_scripts_field = false;
}
// make sure the xml is set and a string
if (isset($xmlFields)
&& ComponentbuilderHelper::checkString($xmlFields))

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>3rd December, 2020</creationDate>
<creationDate>5th December, 2020</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>