Resolved gh-341 that adds the feature to expand the custom field option far beyond the default. Moved the menu prefix option in to the Joomla component area -> tab -> Settings to allow each component to override the global setting.
This commit is contained in:
@ -2635,46 +2635,56 @@ class Get
|
||||
{
|
||||
return $field['type_name'];
|
||||
}
|
||||
// set the type name
|
||||
$type_name = ComponentbuilderHelper::safeString($field['settings']->type_name);
|
||||
// check that we have the poperties
|
||||
if (ComponentbuilderHelper::checkArray($field['settings']->properties))
|
||||
{
|
||||
foreach ($field['settings']->properties as $property)
|
||||
// search for own custom fields
|
||||
if (strpos($field['settings']->type_name, '@') !== false)
|
||||
{
|
||||
if ($property['name'] === 'type')
|
||||
// set own custom field
|
||||
$field['own_custom'] = $field['settings']->type_name;
|
||||
$field['settings']->type_name = 'Custom';
|
||||
}
|
||||
// set the type name
|
||||
$type_name = ComponentbuilderHelper::safeString($field['settings']->type_name);
|
||||
// if custom (we must use the xml value)
|
||||
if ($type_name === 'custom' || $type_name === 'customuser')
|
||||
{
|
||||
$type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// loop over properties looking for the type value
|
||||
foreach ($field['settings']->properties as $property)
|
||||
{
|
||||
// if custom (we must use the xml value)
|
||||
if ($type_name === 'custom' || $type_name === 'customuser')
|
||||
if ($property['name'] === 'type') // type field is never ajustable (unless custom)
|
||||
{
|
||||
$type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"'));
|
||||
// force the default value
|
||||
if (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']))
|
||||
{
|
||||
$type = ComponentbuilderHelper::safeString($property['example']);
|
||||
}
|
||||
// fallback on type name set in name field
|
||||
elseif (ComponentbuilderHelper::checkString($type_name))
|
||||
{
|
||||
$type = $type_name;
|
||||
}
|
||||
// fall back on the xml settings (not ideal)
|
||||
else
|
||||
{
|
||||
$type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml, 'type="', '"'));
|
||||
}
|
||||
// exit foreach loop
|
||||
break;
|
||||
}
|
||||
// use field core type (name)
|
||||
elseif (ComponentbuilderHelper::checkString($type_name) || (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']) && $property['adjustable'] == 0))
|
||||
{
|
||||
$type = $type_name;
|
||||
}
|
||||
// make sure none adjustable fields are set (should be same as above) (TODO) hmmm we need look at this again
|
||||
elseif (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']) && $property['adjustable'] == 0)
|
||||
{
|
||||
$type = $property['example'];
|
||||
}
|
||||
// fall back on the xml settings (not ideal)
|
||||
else
|
||||
{
|
||||
$type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml, 'type="', '"'));
|
||||
}
|
||||
|
||||
// check if the value is set
|
||||
if (ComponentbuilderHelper::checkString($type))
|
||||
{
|
||||
// add the value
|
||||
return $type;
|
||||
}
|
||||
// exit foreach loop
|
||||
break;
|
||||
}
|
||||
}
|
||||
// check if the value is set
|
||||
if (ComponentbuilderHelper::checkString($type))
|
||||
{
|
||||
// add the value
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
// fall back to text
|
||||
return 'text';
|
||||
|
@ -2051,6 +2051,11 @@ class Fields extends Structure
|
||||
if (!ComponentbuilderHelper::fieldCheck($typeName))
|
||||
{
|
||||
$fieldAttributes['custom'] = array();
|
||||
// is this an own custom field
|
||||
if (isset($field['own_custom']))
|
||||
{
|
||||
$fieldAttributes['custom']['own_custom'] = $field['own_custom'];
|
||||
}
|
||||
$setCustom = true;
|
||||
}
|
||||
// setup a default field
|
||||
@ -2093,19 +2098,18 @@ class Fields extends Structure
|
||||
// replace the placeholders
|
||||
$xmlValue = $this->setPlaceholders($xmlValue, $placeholders);
|
||||
}
|
||||
elseif (strpos($property['name'], 'type_php_') !== false && $setCustom)
|
||||
// catch all PHP here
|
||||
elseif (strpos($property['name'], 'type_php') !== false && $setCustom)
|
||||
{
|
||||
// set the line number
|
||||
$phpLine = (int) str_replace('type_php_', '', $property['name']);
|
||||
$phpLine = (int) preg_replace('/[^0-9]/', '', $property['name']);
|
||||
// set the type key
|
||||
$phpKey = (string) trim( str_replace('type_', '', preg_replace('/[0-9]+/', '', $property['name'])), '_');
|
||||
// load the php for the custom field file
|
||||
$fieldAttributes['custom']['php'][$phpLine] = ComponentbuilderHelper::getBetween($field['settings']->xml, $property['name'] . '="', '"');
|
||||
}
|
||||
elseif (strpos($property['name'], 'type_phpx_') !== false && $setCustom)
|
||||
{
|
||||
// set the line number
|
||||
$phpLine = (int) str_replace('type_phpx_', '', $property['name']);
|
||||
// load the php for the custom field file
|
||||
$fieldAttributes['custom']['phpx'][$phpLine] = ComponentbuilderHelper::getBetween($field['settings']->xml, $property['name'] . '="', '"');
|
||||
$fieldAttributes['custom'][$phpKey][$phpLine] =
|
||||
$this->setDynamicValues(ComponentbuilderHelper::openValidBase64(
|
||||
ComponentbuilderHelper::getBetween($field['settings']->xml, $property['name'] . '="', '"')
|
||||
));
|
||||
}
|
||||
elseif ($property['name'] === 'prime_php' && $setCustom)
|
||||
{
|
||||
@ -2286,6 +2290,12 @@ class Fields extends Structure
|
||||
// now set the value
|
||||
$fieldAttributes[$property['name']] = $xmlValue;
|
||||
}
|
||||
// validate that the default field is set
|
||||
elseif ($property['name'] === 'default' && ($xmlValidateValue = ComponentbuilderHelper::getBetween($field['settings']->xml, 'default="', '"', 'none-set')) !== 'none-set')
|
||||
{
|
||||
// we must allow empty defaults
|
||||
$fieldAttributes['default'] = $xmlValue;
|
||||
}
|
||||
}
|
||||
// do some nice twigs beyond the default
|
||||
if (isset($fieldAttributes['name']))
|
||||
@ -2730,119 +2740,164 @@ class Fields extends Structure
|
||||
public function setCustomFieldTypeFile($data, $view_name_list, $view_name_single)
|
||||
{
|
||||
// make sure it is not already been build or if it is prime
|
||||
if ((isset($data['custom']['prime_php']) && $data['custom']['prime_php'] == 1) || !isset($this->fileContentDynamic['customfield_' . $data['type']]) || !ComponentbuilderHelper::checkArray($this->fileContentDynamic['customfield_' . $data['type']]))
|
||||
if (isset($data['custom']) && isset($data['custom']['extends']) && ((isset($data['custom']['prime_php']) && $data['custom']['prime_php'] == 1) || !isset($this->fileContentDynamic['customfield_' . $data['type']]) || !ComponentbuilderHelper::checkArray($this->fileContentDynamic['customfield_' . $data['type']])))
|
||||
{
|
||||
// first build the custom field type file
|
||||
$target = array('admin' => 'customfield');
|
||||
$this->buildDynamique($target, 'field' . $data['custom']['extends'], $data['custom']['type']);
|
||||
// set tab and break replacements
|
||||
$tabBreak = array(
|
||||
'\t' => $this->_t(1),
|
||||
'\n' => PHP_EOL
|
||||
);
|
||||
// make field dynamic
|
||||
// set the [[[PLACEHOLDER]]] options
|
||||
$replace = array(
|
||||
$this->hhh . 'TABLE' . $this->hhh => $data['custom']['table'],
|
||||
$this->hhh . 'ID' . $this->hhh => $data['custom']['id'],
|
||||
$this->hhh . 'TEXT' . $this->hhh => $data['custom']['text'],
|
||||
$this->hhh . 'CODE_TEXT' . $this->hhh => $data['code'] . '_' . $data['custom']['text'],
|
||||
$this->hhh . 'CODE' . $this->hhh => $data['code'],
|
||||
$this->hhh . 'component' . $this->hhh => $this->fileContentStatic[$this->hhh . 'component' . $this->hhh],
|
||||
$this->hhh . 'Component' . $this->hhh => $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh],
|
||||
$this->hhh . 'view_type' . $this->hhh => $view_name_single . '_' . $data['type'],
|
||||
$this->hhh . 'type' . $this->hhh => $data['type'],
|
||||
$this->hhh . 'view' . $this->hhh => $view_name_single,
|
||||
$this->hhh . 'views' . $this->hhh => $view_name_list
|
||||
$this->bbb . 'TABLE' . $this->ddd => $data['custom']['table'],
|
||||
$this->bbb . 'ID' . $this->ddd => $data['custom']['id'],
|
||||
$this->bbb . 'TEXT' . $this->ddd => $data['custom']['text'],
|
||||
$this->bbb . 'CODE_TEXT' . $this->ddd => $data['code'] . '_' . $data['custom']['text'],
|
||||
$this->bbb . 'CODE' . $this->ddd => $data['code'],
|
||||
$this->bbb . 'view_type' . $this->ddd => $view_name_single . '_' . $data['type'],
|
||||
$this->bbb . 'type' . $this->ddd => $data['type'],
|
||||
$this->bbb . 'com_component' . $this->ddd => (isset($data['custom']['component']) && ComponentbuilderHelper::checkString($data['custom']['component'])) ? ComponentbuilderHelper::safeString($data['custom']['component']) : 'com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh],
|
||||
// set the generic values
|
||||
$this->bbb . 'component' . $this->ddd => $this->fileContentStatic[$this->hhh . 'component' . $this->hhh],
|
||||
$this->bbb . 'Component' . $this->ddd => $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh],
|
||||
$this->bbb . 'view' . $this->ddd => (isset($data['custom']['view']) && ComponentbuilderHelper::checkString($data['custom']['view'])) ? ComponentbuilderHelper::safeString($data['custom']['view']) : $view_name_single,
|
||||
$this->bbb . 'views' . $this->ddd => (isset($data['custom']['views']) && ComponentbuilderHelper::checkString($data['custom']['views'])) ? ComponentbuilderHelper::safeString($data['custom']['views']) : $view_name_list
|
||||
);
|
||||
// now load the php script
|
||||
if (isset($data['custom']['php']) && ComponentbuilderHelper::checkArray($data['custom']['php']))
|
||||
// now set the ###PLACEHOLDER### options
|
||||
foreach ($replace as $replacekey => $replacevalue)
|
||||
{
|
||||
// make sure the ar is reset
|
||||
$phpCode = '';
|
||||
foreach ($data['custom']['php'] as $line => $code)
|
||||
// update the key value
|
||||
$replacekey = str_replace(array($this->bbb, $this->ddd), array($this->hhh, $this->hhh), $replacekey);
|
||||
// now set the value
|
||||
$replace[$replacekey] = $replacevalue;
|
||||
}
|
||||
// start loading the field type
|
||||
$this->fileContentDynamic['customfield_' . $data['type']] = array();
|
||||
// Type <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'Type' . $this->hhh] = ComponentbuilderHelper::safeString($data['custom']['type'], 'F');
|
||||
// type <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'type' . $this->hhh] = ComponentbuilderHelper::safeString($data['custom']['type']);
|
||||
// is this a own custom field
|
||||
if (isset($data['custom']['own_custom']))
|
||||
{
|
||||
// make sure the button option notice is set to notify the developer that the button option is not available in own custom field types
|
||||
if (isset($data['custom']['add_button']) && ($data['custom']['add_button'] === 'true' || 1 == $data['custom']['add_button']))
|
||||
{
|
||||
if (ComponentbuilderHelper::checkString($code))
|
||||
// set notice
|
||||
$this->app->enqueueMessage(JText::_('The option to add a dynamic button is not available in <b>own custom field types</b>, you will have to custom code it.'), 'error');
|
||||
}
|
||||
// load another file
|
||||
$target = array('admin' => 'customfield');
|
||||
$this->buildDynamique($target, 'fieldcustom', $data['custom']['type']);
|
||||
// JFORM_extens <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'JFORM_extends' . $this->hhh] = ComponentbuilderHelper::safeString($data['custom']['extends']);
|
||||
// JFORM_EXTENDS <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'JFORM_EXTENDS' . $this->hhh] = ComponentbuilderHelper::safeString($data['custom']['extends'], 'F');
|
||||
// JFORM_TYPE_PHP <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'JFORM_TYPE_PHP' . $this->hhh] = PHP_EOL . PHP_EOL . $this->_t(1) . "//" . $this->setLine(__LINE__) . " A " . $data['custom']['own_custom'] . " Field";
|
||||
// load the other PHP options
|
||||
foreach (ComponentbuilderHelper::$phpFieldArray as $x)
|
||||
{
|
||||
// reset the php bucket
|
||||
$phpBucket = '';
|
||||
// only set if avaliable
|
||||
if (isset($data['custom']['php' . $x]) && ComponentbuilderHelper::checkArray($data['custom']['php' . $x]))
|
||||
{
|
||||
if ($line == 1)
|
||||
foreach ($data['custom']['php' . $x] as $line => $code)
|
||||
{
|
||||
$phpCode .= $this->setPlaceholders($code, $tabBreak);
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpCode .= PHP_EOL . $this->_t(2) . $this->setPlaceholders($code, $tabBreak);
|
||||
if (ComponentbuilderHelper::checkString($code))
|
||||
{
|
||||
$phpBucket .= PHP_EOL . $this->setPlaceholders($code, $tabBreak);
|
||||
}
|
||||
}
|
||||
// JFORM_TYPE_PHP <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'JFORM_TYPE_PHP' . $this->hhh] .= PHP_EOL . $this->setPlaceholders($phpBucket, $replace);
|
||||
}
|
||||
}
|
||||
// replace the placholders
|
||||
$phpCode = $this->setPlaceholders($phpCode, $replace);
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpCode = 'return null;';
|
||||
}
|
||||
// catch empty stuff
|
||||
if (!ComponentbuilderHelper::checkString($phpCode))
|
||||
{
|
||||
$phpCode = 'return null;';
|
||||
}
|
||||
// some house cleaning for users
|
||||
if ($data['custom']['extends'] === 'user')
|
||||
{
|
||||
// now load the php xclude script
|
||||
if (ComponentbuilderHelper::checkArray($data['custom']['phpx']))
|
||||
// first build the custom field type file
|
||||
$target = array('admin' => 'customfield');
|
||||
$this->buildDynamique($target, 'field' . $data['custom']['extends'], $data['custom']['type']);
|
||||
// make sure the value is reset
|
||||
$phpCode = '';
|
||||
// now load the php script
|
||||
if (isset($data['custom']['php']) && ComponentbuilderHelper::checkArray($data['custom']['php']))
|
||||
{
|
||||
// make sure the ar is reset
|
||||
$phpxCode = '';
|
||||
foreach ($data['custom']['phpx'] as $line => $code)
|
||||
foreach ($data['custom']['php'] as $line => $code)
|
||||
{
|
||||
if (ComponentbuilderHelper::checkString($code))
|
||||
{
|
||||
if ($line == 1)
|
||||
{
|
||||
$phpxCode .= $this->setPlaceholders($code, $tabBreak);
|
||||
$phpCode .= $this->setPlaceholders($code, $tabBreak);
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpxCode .= PHP_EOL . $this->_t(2) . $this->setPlaceholders($code, $tabBreak);
|
||||
$phpCode .= PHP_EOL . $this->_t(2) . $this->setPlaceholders($code, $tabBreak);
|
||||
}
|
||||
}
|
||||
}
|
||||
// replace the placholders
|
||||
$phpxCode = $this->setPlaceholders($phpxCode, $replace);
|
||||
$phpCode = $this->setPlaceholders($phpCode, $replace);
|
||||
}
|
||||
// catch empty stuff
|
||||
if (!ComponentbuilderHelper::checkString($phpCode))
|
||||
{
|
||||
$phpCode = 'return null;';
|
||||
}
|
||||
// some house cleaning for users
|
||||
if ($data['custom']['extends'] === 'user')
|
||||
{
|
||||
// make sure the value is reset
|
||||
$phpxCode = '';
|
||||
// now load the php xclude script
|
||||
if (ComponentbuilderHelper::checkArray($data['custom']['phpx']))
|
||||
{
|
||||
foreach ($data['custom']['phpx'] as $line => $code)
|
||||
{
|
||||
if (ComponentbuilderHelper::checkString($code))
|
||||
{
|
||||
if ($line == 1)
|
||||
{
|
||||
$phpxCode .= $this->setPlaceholders($code, $tabBreak);
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpxCode .= PHP_EOL . $this->_t(2) . $this->setPlaceholders($code, $tabBreak);
|
||||
}
|
||||
}
|
||||
}
|
||||
// replace the placholders
|
||||
$phpxCode = $this->setPlaceholders($phpxCode, $replace);
|
||||
}
|
||||
// catch empty stuff
|
||||
if (!ComponentbuilderHelper::checkString($phpxCode))
|
||||
{
|
||||
$phpxCode = 'return null;';
|
||||
}
|
||||
// temp holder for name
|
||||
$tempName = $data['custom']['label'] . ' Group';
|
||||
// set lang
|
||||
$groupLangName = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($tempName, 'U');
|
||||
// add to lang array
|
||||
$this->langContent[$this->lang][$groupLangName] = ComponentbuilderHelper::safeString($tempName, 'W');
|
||||
// build the Group Control
|
||||
$this->setGroupControl[$data['type']] = $groupLangName;
|
||||
// JFORM_GETGROUPS_PHP <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'JFORM_GETGROUPS_PHP' . $this->hhh] = $phpCode;
|
||||
// JFORM_GETEXCLUDED_PHP <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'JFORM_GETEXCLUDED_PHP' . $this->hhh] = $phpxCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpxCode = 'return null;';
|
||||
// JFORM_GETOPTIONS_PHP <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'JFORM_GETOPTIONS_PHP' . $this->hhh] = $phpCode;
|
||||
}
|
||||
if (!ComponentbuilderHelper::checkString($phpxCode))
|
||||
{
|
||||
$phpxCode = 'return null;';
|
||||
}
|
||||
// temp holder for name
|
||||
$tempName = $data['custom']['label'] . ' Group';
|
||||
// set lang
|
||||
$groupLangName = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($tempName, 'U');
|
||||
// add to lang array
|
||||
$this->langContent[$this->lang][$groupLangName] = ComponentbuilderHelper::safeString($tempName, 'W');
|
||||
// build the Group Control
|
||||
$this->setGroupControl[$data['type']] = $groupLangName;
|
||||
// JFORM_GETGROUPS_PHP <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'JFORM_GETGROUPS_PHP' . $this->hhh] = $phpCode;
|
||||
|
||||
// JFORM_GETEXCLUDED_PHP <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'JFORM_GETEXCLUDED_PHP' . $this->hhh] = $phpxCode;
|
||||
// type <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'ADD_BUTTON' . $this->hhh] = $this->setAddButtonToListField($data['custom']);
|
||||
}
|
||||
else
|
||||
{
|
||||
// JFORM_GETOPTIONS_PHP <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'JFORM_GETOPTIONS_PHP' . $this->hhh] = $phpCode;
|
||||
}
|
||||
// Type <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'Type' . $this->hhh] = ComponentbuilderHelper::safeString($data['custom']['type'], 'F');
|
||||
// type <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'type' . $this->hhh] = $data['custom']['type'];
|
||||
// type <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'ADD_BUTTON' . $this->hhh] = $this->setAddButtonToListField($data['custom']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13358,17 +13358,37 @@ class Interpretation extends Fields
|
||||
$lang = $this->langPrefix . '_MENU';
|
||||
// set the code name
|
||||
$codeName = ComponentbuilderHelper::safeString($this->componentData->name_code);
|
||||
// set main menu name to lang
|
||||
$addPrefix = $this->params->get('add_menu_prefix', 1);
|
||||
// default prefix is none
|
||||
$prefix = '';
|
||||
// check if local is set
|
||||
if (isset($this->componentData->add_menu_prefix) && is_numeric($this->componentData->add_menu_prefix))
|
||||
{
|
||||
// set main menu prefix switch
|
||||
$addPrefix = $this->componentData->add_menu_prefix;
|
||||
if ($addPrefix == 1 && isset($this->componentData->menu_prefix) && ComponentbuilderHelper::checkString($this->componentData->menu_prefix))
|
||||
{
|
||||
$prefix = trim($this->componentData->menu_prefix) . ' ';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// set main menu prefix switch
|
||||
$addPrefix = $this->params->get('add_menu_prefix', 1);
|
||||
if ($addPrefix == 1)
|
||||
{
|
||||
$prefix = trim($this->params->get('menu_prefix', '»')) . ' ';
|
||||
}
|
||||
}
|
||||
// add the prefix
|
||||
if ($addPrefix == 1)
|
||||
{
|
||||
$prefix = trim($this->params->get('menu_prefix', '»'));
|
||||
$this->langContent['adminsys'][$lang] = $prefix . ' ' . $this->componentData->name;
|
||||
$this->langContent['adminsys'][$lang] = $prefix . $this->componentData->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->langContent['adminsys'][$lang] = $this->componentData->name;
|
||||
}
|
||||
// loop over the admin views
|
||||
foreach ($this->componentData->admin_views as $view)
|
||||
{
|
||||
// set custom menu
|
||||
@ -15401,7 +15421,7 @@ function vdm_dkim() {
|
||||
foreach ($field['permission'] as $permission_id)
|
||||
{
|
||||
// set the permission key word
|
||||
$permission_option = $permission_options[$permission_id];
|
||||
$permission_option = $permission_options[ (int) $permission_id];
|
||||
// reset the bucket
|
||||
$fieldView = array();
|
||||
// set the permission for this field
|
||||
|
@ -32,6 +32,11 @@ abstract class ComponentbuilderHelper
|
||||
**/
|
||||
public static $libraryNames = array(1 => 'No Library', 2 => 'Bootstrap v4', 3 => 'Uikit v3', 4 => 'Uikit v2', 5 => 'FooTable v2', 6 => 'FooTable v3');
|
||||
|
||||
/**
|
||||
* Array of php fields Allowed (16)
|
||||
**/
|
||||
public static $phpFieldArray = array('', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'x');
|
||||
|
||||
/**
|
||||
* The global params
|
||||
**/
|
||||
@ -670,7 +675,7 @@ abstract class ComponentbuilderHelper
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
$result = $db->loadObject();
|
||||
$properties = json_decode($result->properties,true);
|
||||
$properties = json_decode($result->properties, true);
|
||||
$field = array(
|
||||
'subform' => array(),
|
||||
'nameListOptions' => array(),
|
||||
@ -684,11 +689,11 @@ abstract class ComponentbuilderHelper
|
||||
// value to check since there are false and null values even 0 in the values returned
|
||||
$confirmation = '8qvZHoyuFYQqpj0YQbc6F3o5DhBlmS-_-a8pmCZfOVSfANjkmV5LG8pCdAY2JNYu6cB';
|
||||
// set the headers
|
||||
$field['values_description'] .= '<thead><tr><th class="uk-text-right">'.JText::_('COM_COMPONENTBUILDER_PROPERTY').'</th><th>'.JText::_('COM_COMPONENTBUILDER_EXAMPLE').'</th><th>'.JText::_('COM_COMPONENTBUILDER_DESCRIPTION').'</th></thead><tbody>';
|
||||
$field['values_description'] .= '<thead><tr><th class="uk-text-right">' . JText::_('COM_COMPONENTBUILDER_PROPERTY') . '</th><th>' . JText::_('COM_COMPONENTBUILDER_EXAMPLE') . '</th><th>' . JText::_('COM_COMPONENTBUILDER_DESCRIPTION') . '</th></thead><tbody>';
|
||||
foreach ($properties as $property)
|
||||
{
|
||||
$example = (isset($property['example']) && self::checkString($property['example'])) ? $property['example'] : '';
|
||||
$field['values_description'] .= '<tr><td class="uk-text-right"><code>'.$property['name'].'</code></td><td>'.$example.'</td><td>'.$property['description'].'</td></tr>';
|
||||
$field['values_description'] .= '<tr><td class="uk-text-right"><code>' . $property['name'] . '</code></td><td>' . $example . '</td><td>' . $property['description'] . '</td></tr>';
|
||||
// check if we should load the value
|
||||
$value = self::getValueFromXMLstring($xml, $property['name'], $confirmation);
|
||||
// check if this is a php field
|
||||
@ -709,7 +714,7 @@ abstract class ComponentbuilderHelper
|
||||
if(self::checkArray($settings) && isset($settings[$property['name']]))
|
||||
{
|
||||
// add the xml values
|
||||
$field['values'] .= PHP_EOL."\t".$property['name'].'="'.$settings[$property['name']].'" ';
|
||||
$field['values'] .= PHP_EOL . "\t" . $property['name'] . '="'. $settings[$property['name']] . '" ';
|
||||
// add the json values
|
||||
if ($addPHP)
|
||||
{
|
||||
@ -723,7 +728,7 @@ abstract class ComponentbuilderHelper
|
||||
elseif (!$xml || $confirmation !== $value)
|
||||
{
|
||||
// add the xml values
|
||||
$field['values'] .= PHP_EOL."\t" . $property['name'] . '="'. ($confirmation !== $value) ? $value : $example .'" ';
|
||||
$field['values'] .= PHP_EOL."\t" . $property['name'] . '="' . ($confirmation !== $value) ? $value : $example .'" ';
|
||||
// add the json values
|
||||
if ($addPHP)
|
||||
{
|
||||
@ -742,7 +747,7 @@ abstract class ComponentbuilderHelper
|
||||
// increment the number
|
||||
$nr++;
|
||||
}
|
||||
$field['values'] .= PHP_EOL."/>";
|
||||
$field['values'] .= PHP_EOL . "/>";
|
||||
$field['values_description'] .= '</tbody></table>';
|
||||
// return found field options
|
||||
return $field;
|
||||
@ -750,11 +755,16 @@ abstract class ComponentbuilderHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getValueFromXMLstring($xml, $get, $confirmation)
|
||||
public static function getValueFromXMLstring(&$xml, &$get, $confirmation = '')
|
||||
{
|
||||
if (self::checkString($xml))
|
||||
{
|
||||
return self::getBetween($xml, $get.'="', '"', $confirmation);
|
||||
// if we have a PHP value, we must base64 decode it
|
||||
if (strpos($get, 'type_php') !== false)
|
||||
{
|
||||
return self::openValidBase64(self::getBetween($xml, $get.'="', '"', $confirmation));
|
||||
}
|
||||
return self::getBetween($xml, $get . '="', '"', $confirmation);
|
||||
}
|
||||
return $confirmation;
|
||||
}
|
||||
@ -2254,6 +2264,38 @@ abstract class ComponentbuilderHelper
|
||||
return '<div>'.JText::_('COM_COMPONENTBUILDER_NO_COMPONENT_DETAILS_FOUND_SO_IT_IS_NOT_SAFE_TO_CONTINUE').'</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* open base64 string if stored as base64
|
||||
*
|
||||
* @param string $data The base64 string
|
||||
* @param string $key We store the string with that suffix :)
|
||||
*
|
||||
* @return string The opened string
|
||||
*
|
||||
*/
|
||||
public static function openValidBase64($data, $key = '__.o0=base64=Oo.__')
|
||||
{
|
||||
// check that we have a string
|
||||
if (self::checkString($data))
|
||||
{
|
||||
// check if we have a key
|
||||
if (self::checkString($key))
|
||||
{
|
||||
if (strpos($data, $key) !== false)
|
||||
{
|
||||
return base64_decode(str_replace($key, '', $data));
|
||||
}
|
||||
}
|
||||
// fallback to this, not perfect method
|
||||
elseif (base64_encode(base64_decode($data, true)) === $data)
|
||||
{
|
||||
return base64_decode($data);
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* prepare base64 string for url
|
||||
**/
|
||||
|
Reference in New Issue
Block a user