Did some formating to the code of the compiler

This commit is contained in:
Llewellyn van der Merwe 2018-03-18 06:52:07 +02:00
parent 42ae72d97e
commit de2d957141
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
6 changed files with 249 additions and 258 deletions

View File

@ -701,4 +701,5 @@ class Compiler extends Infusion
// any help to improve this is welcome... // any help to improve this is welcome...
} }
} }

View File

@ -11,7 +11,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 2.6.0 @version 2.6.x
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder
@subpackage compiler.php @subpackage compiler.php
@ -2490,8 +2490,7 @@ class Get
foreach ($phpSripts as $script) foreach ($phpSripts as $script)
{ {
// add php script to the script builder // add php script to the script builder
if (isset($result->{'add_'.$script}) && $result->{'add_'.$script} == 1 if (isset($result->{'add_' . $script}) && $result->{'add_' . $script} == 1 && isset($result->{$script}) && ComponentbuilderHelper::checkString($result->{$script}))
&& isset($result->{$script}) && ComponentbuilderHelper::checkString($result->{$script}))
{ {
// move all main gets out to the customscript builder // move all main gets out to the customscript builder
if ($result->gettype <= 2) if ($result->gettype <= 2)
@ -4034,8 +4033,7 @@ class Get
if ($this->user->authorise('core.admin', 'com_componentbuilder')) if ($this->user->authorise('core.admin', 'com_componentbuilder'))
{ {
// check if the target is valid URL or path // check if the target is valid URL or path
if ((!filter_var($target, FILTER_VALIDATE_URL) === false && ComponentbuilderHelper::urlExists($target)) if ((!filter_var($target, FILTER_VALIDATE_URL) === false && ComponentbuilderHelper::urlExists($target)) || (JPath::clean($target) === $target && JFile::exists($target)))
|| (JPath::clean($target) === $target && JFile::exists($target)))
{ {
$this->getExternalCodeString($target, $bucket); $this->getExternalCodeString($target, $bucket);
} }

View File

@ -542,9 +542,7 @@ class Structure extends Get
private function setDynamicDashboard() private function setDynamicDashboard()
{ {
// only add the dynamic dashboard if all checks out // only add the dynamic dashboard if all checks out
if (isset($this->componentData->dashboard_type) && 2 == $this->componentData->dashboard_type if (isset($this->componentData->dashboard_type) && 2 == $this->componentData->dashboard_type && isset($this->componentData->dashboard) && ComponentbuilderHelper::checkString($this->componentData->dashboard) && strpos($this->componentData->dashboard, '_') !== false)
&& isset($this->componentData->dashboard) && ComponentbuilderHelper::checkString($this->componentData->dashboard)
&& strpos($this->componentData->dashboard, '_') !== false)
{ {
// set the default view // set the default view
$getter = explode('_', $this->componentData->dashboard); $getter = explode('_', $this->componentData->dashboard);
@ -567,7 +565,8 @@ class Structure extends Get
if (isset($this->componentData->{$targets[$t]}) && ComponentbuilderHelper::checkArray($this->componentData->{$targets[$t]})) if (isset($this->componentData->{$targets[$t]}) && ComponentbuilderHelper::checkArray($this->componentData->{$targets[$t]}))
{ {
// search the target views // search the target views
$dashboard = (array) array_filter($this->componentData->{$targets[$t]}, function($view) use($id, $t, $types){ $dashboard = (array) array_filter($this->componentData->{$targets[$t]}, function($view) use($id, $t, $types)
{
if (isset($view[$types[$t]]) && $id == $view[$types[$t]]) if (isset($view[$types[$t]]) && $id == $view[$types[$t]])
{ {
return true; return true;
@ -1460,4 +1459,5 @@ class Structure extends Get
{ {
return ComponentbuilderHelper::removeFolder($dir, $ignore); return ComponentbuilderHelper::removeFolder($dir, $ignore);
} }
} }

View File

@ -1188,6 +1188,8 @@ class Fields extends Structure
*/ */
private function setField($setType, &$fieldAttributes, &$name, &$typeName, &$langView, &$view_name_single, &$view_name_list, $placeholders, &$optionArray, $custom = null, $taber = '') private function setField($setType, &$fieldAttributes, &$name, &$typeName, &$langView, &$view_name_single, &$view_name_list, $placeholders, &$optionArray, $custom = null, $taber = '')
{ {
// count the dynamic fields created
$this->fieldCount++;
// check what type of field builder to use // check what type of field builder to use
if ($this->fieldBuilderType == 1) if ($this->fieldBuilderType == 1)
{ {
@ -1541,8 +1543,6 @@ class Fields extends Structure
$this->setCustomFieldTypeFile($data, $view_name_list, $view_name_single); $this->setCustomFieldTypeFile($data, $view_name_list, $view_name_single);
} }
} }
// count the dynamic fields created
$this->fieldCount++;
// return field // return field
return $field; return $field;
} }
@ -2868,8 +2868,6 @@ class Fields extends Structure
$xml = simplexml_import_dom($domXML); $xml = simplexml_import_dom($domXML);
break; break;
} }
// count the dynamic fields created
$this->fieldCount++;
} }
/** /**

View File

@ -2172,8 +2172,7 @@ class Interpretation extends Fields
// start the get Item // start the get Item
$getItem = ''; $getItem = '';
// set before item php // set before item php
if (isset($get->add_php_before_getitem) && $get->add_php_before_getitem == 1 if (isset($get->add_php_before_getitem) && $get->add_php_before_getitem == 1 && isset($get->php_before_getitem) && ComponentbuilderHelper::checkString($get->php_before_getitem))
&& isset($get->php_before_getitem) && ComponentbuilderHelper::checkString($get->php_before_getitem))
{ {
$getItem .= $this->setPlaceholders($get->php_before_getitem, $this->placeholders); $getItem .= $this->setPlaceholders($get->php_before_getitem, $this->placeholders);
} }
@ -2196,8 +2195,7 @@ class Interpretation extends Fields
$getItem .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Load the results as a stdClass object."; $getItem .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Load the results as a stdClass object.";
$getItem .= PHP_EOL . "\t" . $tab . "\t\$data = \$db->loadObject();"; $getItem .= PHP_EOL . "\t" . $tab . "\t\$data = \$db->loadObject();";
// set after item php // set after item php
if (isset($get->add_php_after_getitem) && $get->add_php_after_getitem == 1 if (isset($get->add_php_after_getitem) && $get->add_php_after_getitem == 1 && isset($get->php_after_getitem) && ComponentbuilderHelper::checkString($get->php_after_getitem))
&& isset($get->php_after_getitem) && ComponentbuilderHelper::checkString($get->php_after_getitem))
{ {
$getItem .= $this->setPlaceholders($get->php_after_getitem, $this->placeholders); $getItem .= $this->setPlaceholders($get->php_after_getitem, $this->placeholders);
} }
@ -2382,16 +2380,14 @@ class Interpretation extends Fields
$main .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the global params"; $main .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the global params";
$main .= PHP_EOL . "\t\t\$globalParams = JComponentHelper::getParams('com_" . $this->fileContentStatic['###component###'] . "', true);"; $main .= PHP_EOL . "\t\t\$globalParams = JComponentHelper::getParams('com_" . $this->fileContentStatic['###component###'] . "', true);";
// set php before listquery // set php before listquery
if (isset($view->add_php_getlistquery) && $view->add_php_getlistquery == 1 if (isset($view->add_php_getlistquery) && $view->add_php_getlistquery == 1 && isset($view->php_getlistquery) && ComponentbuilderHelper::checkString($view->php_getlistquery))
&& isset($view->php_getlistquery) && ComponentbuilderHelper::checkString($view->php_getlistquery))
{ {
$main .= $this->setPlaceholders($view->php_getlistquery, $this->placeholders); $main .= $this->setPlaceholders($view->php_getlistquery, $this->placeholders);
} }
// ###SITE_GET_LIST_QUERY### <<<DYNAMIC>>> // ###SITE_GET_LIST_QUERY### <<<DYNAMIC>>>
$main .= $this->setCustomViewListQuery($view, $view->code, false); $main .= $this->setCustomViewListQuery($view, $view->code, false);
// set before items php // set before items php
if (isset($view->add_php_before_getitems) && $view->add_php_before_getitems == 1 if (isset($view->add_php_before_getitems) && $view->add_php_before_getitems == 1 && isset($view->php_before_getitems) && ComponentbuilderHelper::checkString($view->php_before_getitems))
&& isset($view->php_before_getitems) && ComponentbuilderHelper::checkString($view->php_before_getitems))
{ {
$main .= $this->setPlaceholders($view->php_before_getitems, $this->placeholders); $main .= $this->setPlaceholders($view->php_before_getitems, $this->placeholders);
} }
@ -2400,8 +2396,7 @@ class Interpretation extends Fields
$main .= PHP_EOL . "\t\t\$db->setQuery(\$query);"; $main .= PHP_EOL . "\t\t\$db->setQuery(\$query);";
$main .= PHP_EOL . "\t\t\$items = \$db->loadObjectList();"; $main .= PHP_EOL . "\t\t\$items = \$db->loadObjectList();";
// set after items php // set after items php
if (isset($view->add_php_after_getitems) && $view->add_php_after_getitems == 1 if (isset($view->add_php_after_getitems) && $view->add_php_after_getitems == 1 && isset($view->php_after_getitems) && ComponentbuilderHelper::checkString($view->php_after_getitems))
&& isset($view->php_after_getitems) && ComponentbuilderHelper::checkString($view->php_after_getitems))
{ {
$main .= $this->setPlaceholders($view->php_after_getitems, $this->placeholders); $main .= $this->setPlaceholders($view->php_after_getitems, $this->placeholders);
} }
@ -4974,8 +4969,7 @@ class Interpretation extends Fields
if ($viewArray && ComponentbuilderHelper::checkArray($viewArray) && isset($viewArray['settings']) && isset($viewArray['settings']->main_get)) if ($viewArray && ComponentbuilderHelper::checkArray($viewArray) && isset($viewArray['settings']) && isset($viewArray['settings']->main_get))
{ {
// check if we have custom script for this router parse switch case // check if we have custom script for this router parse switch case
if (isset($viewArray['settings']->main_get->add_php_router_parse) && $viewArray['settings']->main_get->add_php_router_parse == 1 if (isset($viewArray['settings']->main_get->add_php_router_parse) && $viewArray['settings']->main_get->add_php_router_parse == 1 && isset($viewArray['settings']->main_get->php_router_parse) && ComponentbuilderHelper::checkString($viewArray['settings']->main_get->php_router_parse))
&& isset($viewArray['settings']->main_get->php_router_parse) && ComponentbuilderHelper::checkString($viewArray['settings']->main_get->php_router_parse))
{ {
// load the custom script for the switch based on dynamic get // load the custom script for the switch based on dynamic get
$routerSwitch[] = PHP_EOL . "\t\t\tcase '" . $view . "':"; $routerSwitch[] = PHP_EOL . "\t\t\tcase '" . $view . "':";