Added string manipulation back as a field building method, to insure JCB always works well accross shared server invironments. We did not remove the SimpleXMLElement method, but kept both options with a global selection option and internal error handeling. Resolved gh-197

This commit is contained in:
2018-03-18 06:28:54 +02:00
parent e715fa1614
commit 42ae72d97e
42 changed files with 15004 additions and 11887 deletions

View File

@ -428,6 +428,16 @@ class Get
*/
private $_fieldData = array();
/**
* The field builder type
*
* 1 = StringManipulation
* 2 = SimpleXMLElement
*
* @var int
*/
public $fieldBuilderType;
/**
* Set unique Names
*
@ -610,6 +620,16 @@ class Get
$this->tidy = extension_loaded('Tidy');
// Set the params
$this->params = JComponentHelper::getParams('com_componentbuilder');
// set the field type builder
$this->fieldBuilderType = $this->params->get('compiler_field_builder_type', 2);
// check the field builder type logic
if (!$this->tidy && $this->fieldBuilderType == 2)
{
// we do not have the tidy extention set fall back to StringManipulation
$this->fieldBuilderType = 1;
// load the sugestion to use string manipulation
$this->app->enqueueMessage(JText::_('Since you do not have <b>Tidy</b> extentsion setup on your system, we could not use the SimpleXMLElement class. We instead used <b>string manipulation</b> to build all your fields, this is a faster method, you must inspect the xml files in your component package to see if you are satisfied with the result.<br />You can make this method your default by opening the global options of JCB and under the <b>Global</b> tab set the <b>Field Builder Type</b> to string manipulation.<hr />'), 'Notice');
}
// load the compiler path
$this->compilerPath = $this->params->get('compiler_folder_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler');
// set the component ID

File diff suppressed because it is too large Load Diff

View File

@ -12902,13 +12902,23 @@ class Interpretation extends Fields
$dbkey = 'g';
foreach ($this->componentData->config as $field)
{
$newxmlField = $this->setDynamicField($field, $view, $viewType, $lang, $viewName, $listViewName, $placeholders, $dbkey, false);
// tmp hack untill this whole area is also done in xml (TODO)
if (isset($newxmlField->fieldXML))
// check the field builder type
if ($this->fieldBuilderType == 1)
{
$xmlField = dom_import_simplexml($newxmlField->fieldXML);
$xmlField = PHP_EOL . "\t<!-- " . $newxmlField->comment . ' -->' . PHP_EOL . "\t" . $this->xmlPrettyPrint($xmlField, 'field');
// string manipulation
$xmlField = $this->setDynamicField($field, $view, $viewType, $lang, $viewName, $listViewName, $placeholders, $dbkey, false);
}
else
{
// simpleXMLElement class
$newxmlField = $this->setDynamicField($field, $view, $viewType, $lang, $viewName, $listViewName, $placeholders, $dbkey, false);
if (isset($newxmlField->fieldXML))
{
$xmlField = dom_import_simplexml($newxmlField->fieldXML);
$xmlField = PHP_EOL . "\t<!-- " . $newxmlField->comment . ' -->' . PHP_EOL . "\t" . $this->xmlPrettyPrint($xmlField, 'field');
}
}
// make sure the xml is set and a string
if (isset($xmlField) && ComponentbuilderHelper::checkString($xmlField))
{
$this->configFieldSetsCustomField[$field['tabname']][] = $xmlField;
@ -13097,7 +13107,7 @@ class Interpretation extends Fields
}
}
// set the fields
$this->configFieldSets[] = implode("\t\t", $bucket);
$this->configFieldSets[] = implode("", $bucket);
// close field set
$this->configFieldSets[] = "\t</fieldset>";
// remove after loading
@ -13135,7 +13145,7 @@ class Interpretation extends Fields
// add custom Target Groups fields
if (isset($this->configFieldSetsCustomField['Target Groups']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['Target Groups']))
{
$this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField['Target Groups']);
$this->configFieldSets[] = implode("", $this->configFieldSetsCustomField['Target Groups']);
unset($this->configFieldSetsCustomField['Target Groups']);
}
// close that fieldse
@ -13261,7 +13271,7 @@ class Interpretation extends Fields
// add custom global fields
if (isset($this->configFieldSetsCustomField['Global']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['Global']))
{
$this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField['Global']);
$this->configFieldSets[] = implode("", $this->configFieldSetsCustomField['Global']);
unset($this->configFieldSetsCustomField['Global']);
}
// set the author details
@ -13619,7 +13629,7 @@ for developing fast and powerful web interfaces. For more info visit <a href=\"h
// add custom Uikit Settings fields
if (isset($this->configFieldSetsCustomField['Uikit Settings']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['Uikit Settings']))
{
$this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField['Uikit Settings']);
$this->configFieldSets[] = implode("", $this->configFieldSetsCustomField['Uikit Settings']);
unset($this->configFieldSetsCustomField['Uikit Settings']);
}
// close that fieldset
@ -13643,7 +13653,7 @@ for developing fast and powerful web interfaces. For more info visit <a href=\"h
// add custom Mail Configurations
if (isset($this->configFieldSetsCustomField['Mail Configuration']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['Mail Configuration']))
{
$this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField['Mail Configuration']);
$this->configFieldSets[] = implode("", $this->configFieldSetsCustomField['Mail Configuration']);
unset($this->configFieldSetsCustomField['Mail Configuration']);
}
else
@ -13905,7 +13915,7 @@ for developing fast and powerful web interfaces. For more info visit <a href=\"h
// add custom DKIM fields
if (isset($this->configFieldSetsCustomField['DKIM']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['DKIM']))
{
$this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField['DKIM']);
$this->configFieldSets[] = implode("", $this->configFieldSetsCustomField['DKIM']);
unset($this->configFieldSetsCustomField['DKIM']);
}
else
@ -14339,7 +14349,7 @@ function vdm_dkim() {
// add custom Encryption Settings fields
if (isset($this->configFieldSetsCustomField['Chart Settings']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['Chart Settings']))
{
$this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField['Chart Settings']);
$this->configFieldSets[] = implode("", $this->configFieldSetsCustomField['Chart Settings']);
unset($this->configFieldSetsCustomField['Chart Settings']);
}
@ -14540,7 +14550,7 @@ function vdm_dkim() {
// add custom Encryption Settings fields
if (isset($this->configFieldSetsCustomField[$dynamicAddField]) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField[$dynamicAddField]))
{
$this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField[$dynamicAddField]);
$this->configFieldSets[] = implode("", $this->configFieldSetsCustomField[$dynamicAddField]);
unset($this->configFieldSetsCustomField[$dynamicAddField]);
}
}