Added Events to Compiler, the beginning of an API. #435

Merged
Llewellyn merged 26 commits from staging into master 2019-07-06 22:38:13 +00:00
7 changed files with 47 additions and 28 deletions
Showing only changes of commit c966720f79 - Show all commits

View File

@ -146,7 +146,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 7th June, 2019 + *Last Build*: 9th June, 2019
+ *Version*: 2.9.18 + *Version*: 2.9.18
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -146,7 +146,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 7th June, 2019 + *Last Build*: 9th June, 2019
+ *Version*: 2.9.18 + *Version*: 2.9.18
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -774,7 +774,7 @@ class Structure extends Get
{ {
if (ComponentbuilderHelper::checkObject($this->joomlaVersionData->move->static)) if (ComponentbuilderHelper::checkObject($this->joomlaVersionData->move->static))
{ {
$codeName = ComponentbuilderHelper::safeString($this->componentData->name_code); $codeName = $this->componentCodeName;
// TODO needs more looking at this must be dynamic actualy // TODO needs more looking at this must be dynamic actualy
$this->notNew[] = 'PHPExcel.php'; $this->notNew[] = 'PHPExcel.php';
$this->notNew[] = 'LICENSE.txt'; $this->notNew[] = 'LICENSE.txt';

View File

@ -2702,6 +2702,11 @@ class Fields extends Structure
} }
// get the xml extension name // get the xml extension name
$_extension = $this->setPlaceholders(ComponentbuilderHelper::getBetween($field['settings']->xml, 'extension="', '"'), $this->placeholders); $_extension = $this->setPlaceholders(ComponentbuilderHelper::getBetween($field['settings']->xml, 'extension="', '"'), $this->placeholders);
// if they left out the extention for some reason
if (!ComponentbuilderHelper::checkString($_extension))
{
$_extension = 'com_' . $this->componentCodeName . '.' . $otherView;
}
// load the category builder // load the category builder
$this->categoryBuilder[$view_name_list] = array('code' => $name, 'name' => $listLangName, 'extension' => $_extension); $this->categoryBuilder[$view_name_list] = array('code' => $name, 'name' => $listLangName, 'extension' => $_extension);
// also set code name for title alias fix // also set code name for title alias fix

View File

@ -7501,11 +7501,11 @@ class Interpretation extends Fields
$header = ''; $header = '';
$mainwidth = 12; $mainwidth = 12;
$sidewidth = 0; $sidewidth = 0;
// sort the tabs based on key order
ksort($this->tabCounter[$viewName_single]); ksort($this->tabCounter[$viewName_single]);
// start tab builinging loop
foreach ($this->tabCounter[$viewName_single] as $tabNr => $tabName) foreach ($this->tabCounter[$viewName_single] as $tabNr => $tabName)
{ {
// check if we must load a custom tab
$tabWidth = 12; $tabWidth = 12;
$lrCounter = 0; $lrCounter = 0;
// set tab lang // set tab lang
@ -7530,6 +7530,7 @@ class Interpretation extends Fields
$buildLayout = false; $buildLayout = false;
} }
} }
// build layout since just fields
if ($buildLayout) if ($buildLayout)
{ {
// sort to make sure it loads left first // sort to make sure it loads left first
@ -7542,7 +7543,9 @@ class Interpretation extends Fields
// reset each time // reset each time
$items = ''; $items = '';
$itemCounter = 0; $itemCounter = 0;
// sort the names based on order of keys
ksort($names); ksort($names);
// build the items array for this alignment
foreach ($names as $nr => $name) foreach ($names as $nr => $name)
{ {
if ($itemCounter == 0) if ($itemCounter == 0)
@ -7555,6 +7558,7 @@ class Interpretation extends Fields
} }
$itemCounter++; $itemCounter++;
} }
// based on alignment build the layout
switch ($alignment) switch ($alignment)
{ {
case 1: // left case 1: // left
@ -10651,7 +10655,7 @@ class Interpretation extends Fields
{ {
$function = array(); $function = array();
// set component name // set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code); $component = $this->componentCodeName;
foreach ($this->filterBuilder[$viewName_list] as $filter) foreach ($this->filterBuilder[$viewName_list] as $filter)
{ {
if ($filter['type'] != 'category' && ComponentbuilderHelper::checkArray($filter['custom']) && $filter['custom']['extends'] === 'user') if ($filter['type'] != 'category' && ComponentbuilderHelper::checkArray($filter['custom']) && $filter['custom']['extends'] === 'user')
@ -10985,8 +10989,18 @@ class Interpretation extends Fields
{ {
if (isset($this->categoryBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$viewName_list])) if (isset($this->categoryBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$viewName_list]))
{ {
// get the actual extention
$_extension = $this->categoryBuilder[$viewName_list]['extension'];
$_extension = explode('.', $_extension);
// set component name // set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code); if (ComponentbuilderHelper::checkArray($_extension))
{
$component = str_replace('com_', '', $_extension[0]);
}
else
{
$component = $this->componentCodeName;
}
// check if category has another name // check if category has another name
if (isset($this->catOtherName[$viewName_list]) && ComponentbuilderHelper::checkArray($this->catOtherName[$viewName_list])) if (isset($this->catOtherName[$viewName_list]) && ComponentbuilderHelper::checkArray($this->catOtherName[$viewName_list]))
{ {
@ -11012,10 +11026,10 @@ class Interpretation extends Fields
// set script to global helper file // set script to global helper file
$includeHelper = array(); $includeHelper = array();
$includeHelper[] = "\n//" . $this->setLine(__LINE__) . "Insure this view category file is loaded."; $includeHelper[] = "\n//" . $this->setLine(__LINE__) . "Insure this view category file is loaded.";
$includeHelper[] = "\$classname = '" . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . ucfirst($viewName_list) . "Categories';"; $includeHelper[] = "\$classname = '" . ucfirst( $component ) . ucfirst($viewName_list) . "Categories';";
$includeHelper[] = "if (!class_exists(\$classname))"; $includeHelper[] = "if (!class_exists(\$classname))";
$includeHelper[] = "{"; $includeHelper[] = "{";
$includeHelper[] = $this->_t(1) . "\$path = JPATH_SITE . '/components/com_" . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . "/helpers/category" . $viewName_list . ".php';"; $includeHelper[] = $this->_t(1) . "\$path = JPATH_SITE . '/components/com_" . $component . "/helpers/category" . $viewName_list . ".php';";
$includeHelper[] = $this->_t(1) . "if (is_file(\$path))"; $includeHelper[] = $this->_t(1) . "if (is_file(\$path))";
$includeHelper[] = $this->_t(1) . "{"; $includeHelper[] = $this->_t(1) . "{";
$includeHelper[] = $this->_t(2) . "include_once \$path;"; $includeHelper[] = $this->_t(2) . "include_once \$path;";
@ -11026,11 +11040,11 @@ class Interpretation extends Fields
// return category view string // return category view string
if (isset($this->fileContentStatic[$this->hhh . 'ROUTER_CATEGORY_VIEWS' . $this->hhh]) && ComponentbuilderHelper::checkString($this->fileContentStatic[$this->hhh . 'ROUTER_CATEGORY_VIEWS' . $this->hhh])) if (isset($this->fileContentStatic[$this->hhh . 'ROUTER_CATEGORY_VIEWS' . $this->hhh]) && ComponentbuilderHelper::checkString($this->fileContentStatic[$this->hhh . 'ROUTER_CATEGORY_VIEWS' . $this->hhh]))
{ {
return "," . PHP_EOL . $this->_t(3) . '"com_' . $component . '.' . $otherViews . '" => "' . $otherView . '"'; return "," . PHP_EOL . $this->_t(3) . '"' . $this->categoryBuilder[$viewName_list]['extension'] . '" => "' . $otherView . '"';
} }
else else
{ {
return PHP_EOL . $this->_t(3) . '"com_' . $component . '.' . $otherViews . '" => "' . $otherView . '"'; return PHP_EOL . $this->_t(3) . '"' . $this->categoryBuilder[$viewName_list]['extension'] . '" => "' . $otherView . '"';
} }
} }
return ''; return '';
@ -11040,7 +11054,7 @@ class Interpretation extends Fields
{ {
$allow = array(); $allow = array();
// set component name // set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code); $component = $this->componentCodeName;
// prepare custom permission script // prepare custom permission script
$customAllow = $this->getCustomScriptBuilder('php_allowadd', $viewName_single, '', null, true); $customAllow = $this->getCustomScriptBuilder('php_allowadd', $viewName_single, '', null, true);
// setup correct core target // setup correct core target
@ -11142,7 +11156,7 @@ class Interpretation extends Fields
{ {
$allow = array(); $allow = array();
// set component name // set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code); $component = $this->componentCodeName;
// prepare custom permission script // prepare custom permission script
$customAllow = $this->getCustomScriptBuilder('php_allowedit', $viewName_single, '', null, true); $customAllow = $this->getCustomScriptBuilder('php_allowedit', $viewName_single, '', null, true);
// setup correct core target // setup correct core target
@ -11352,7 +11366,7 @@ class Interpretation extends Fields
public function setJmodelAdminGetForm($viewName_single, $viewName_list) public function setJmodelAdminGetForm($viewName_single, $viewName_list)
{ {
// set component name // set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code); $component = $this->componentCodeName;
// allways load these // allways load these
$allow = array(); $allow = array();
$allow[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the form."; $allow[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the form.";
@ -11655,7 +11669,7 @@ class Interpretation extends Fields
{ {
$allow = array(); $allow = array();
// set component name // set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code); $component = $this->componentCodeName;
// prepare custom permission script // prepare custom permission script
$customAllow = $this->getCustomScriptBuilder('php_allowedit', $viewName_single, $this->_t(2) . "\$recordId = (int) isset(\$data[\$key]) ? \$data[\$key] : 0;" . PHP_EOL); $customAllow = $this->getCustomScriptBuilder('php_allowedit', $viewName_single, $this->_t(2) . "\$recordId = (int) isset(\$data[\$key]) ? \$data[\$key] : 0;" . PHP_EOL);
// setup correct core target // setup correct core target
@ -11693,7 +11707,7 @@ class Interpretation extends Fields
{ {
$allow = array(); $allow = array();
// set component name // set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code); $component = $this->componentCodeName;
// setup correct core target // setup correct core target
$coreLoad = false; $coreLoad = false;
if (isset($this->permissionCore[$viewName_single])) if (isset($this->permissionCore[$viewName_single]))
@ -11777,7 +11791,7 @@ class Interpretation extends Fields
{ {
$allow = array(); $allow = array();
// set component name // set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code); $component = $this->componentCodeName;
// setup correct core target // setup correct core target
$coreLoad = false; $coreLoad = false;
if (isset($this->permissionCore[$viewName_single])) if (isset($this->permissionCore[$viewName_single]))
@ -11878,7 +11892,7 @@ class Interpretation extends Fields
{ {
$allow = array(); $allow = array();
// set component name // set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code); $component = $this->componentCodeName;
// setup correct core target // setup correct core target
$coreLoad = false; $coreLoad = false;
if (isset($this->permissionCore[$viewName_single])) if (isset($this->permissionCore[$viewName_single]))
@ -11941,7 +11955,7 @@ class Interpretation extends Fields
if ($view != 'component') if ($view != 'component')
{ {
// set component name // set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code); $component = $this->componentCodeName;
// set label // set label
$label = 'Permissions in relation to this ' . $view; $label = 'Permissions in relation to this ' . $view;
// set the access fieldset // set the access fieldset
@ -13428,7 +13442,7 @@ class Interpretation extends Fields
// main lang prefix // main lang prefix
$lang = $this->langPrefix . '_SUBMENU'; $lang = $this->langPrefix . '_SUBMENU';
// set the code name // set the code name
$codeName = ComponentbuilderHelper::safeString($this->componentData->name_code); $codeName = $this->componentCodeName;
// set default dashboard // set default dashboard
if (!ComponentbuilderHelper::checkString($this->dynamicDashboard)) if (!ComponentbuilderHelper::checkString($this->dynamicDashboard))
{ {
@ -13672,7 +13686,7 @@ class Interpretation extends Fields
// main lang prefix // main lang prefix
$lang = $this->langPrefix . '_MENU'; $lang = $this->langPrefix . '_MENU';
// set the code name // set the code name
$codeName = ComponentbuilderHelper::safeString($this->componentData->name_code); $codeName = $this->componentCodeName;
// default prefix is none // default prefix is none
$prefix = ''; $prefix = '';
// check if local is set // check if local is set
@ -13844,17 +13858,17 @@ class Interpretation extends Fields
// set the custom fields // set the custom fields
if (isset($this->componentData->config) && ComponentbuilderHelper::checkArray($this->componentData->config)) if (isset($this->componentData->config) && ComponentbuilderHelper::checkArray($this->componentData->config))
{ {
$component = ComponentbuilderHelper::safeString($this->componentData->name_code); $component = $this->componentCodeName;
$viewName = 'config'; $viewName = 'config';
$listViewName = 'configs'; $listViewName = 'configs';
// set place holders // set place holders
$placeholders = array(); $placeholders = array();
$placeholders[$this->hhh . 'component' . $this->hhh] = ComponentbuilderHelper::safeString($this->componentData->name_code); $placeholders[$this->hhh . 'component' . $this->hhh] = $this->componentCodeName;
$placeholders[$this->hhh . 'Component' . $this->hhh] = ComponentbuilderHelper::safeString($this->componentData->name_code, 'F'); $placeholders[$this->hhh . 'Component' . $this->hhh] = ComponentbuilderHelper::safeString($this->componentData->name_code, 'F');
$placeholders[$this->hhh . 'COMPONENT' . $this->hhh] = ComponentbuilderHelper::safeString($this->componentData->name_code, 'U'); $placeholders[$this->hhh . 'COMPONENT' . $this->hhh] = ComponentbuilderHelper::safeString($this->componentData->name_code, 'U');
$placeholders[$this->hhh . 'view' . $this->hhh] = $viewName; $placeholders[$this->hhh . 'view' . $this->hhh] = $viewName;
$placeholders[$this->hhh . 'views' . $this->hhh] = $listViewName; $placeholders[$this->hhh . 'views' . $this->hhh] = $listViewName;
$placeholders[$this->bbb . 'component' . $this->ddd] = $placeholders[$this->hhh . 'component' . $this->hhh]; $placeholders[$this->bbb . 'component' . $this->ddd] = $this->componentCodeName;
$placeholders[$this->bbb . 'Component' . $this->ddd] = $placeholders[$this->hhh . 'Component' . $this->hhh]; $placeholders[$this->bbb . 'Component' . $this->ddd] = $placeholders[$this->hhh . 'Component' . $this->hhh];
$placeholders[$this->bbb . 'COMPONENT' . $this->ddd] = $placeholders[$this->hhh . 'COMPONENT' . $this->hhh]; $placeholders[$this->bbb . 'COMPONENT' . $this->ddd] = $placeholders[$this->hhh . 'COMPONENT' . $this->hhh];
$placeholders[$this->bbb . 'view' . $this->ddd] = $viewName; $placeholders[$this->bbb . 'view' . $this->ddd] = $viewName;
@ -14136,7 +14150,7 @@ class Interpretation extends Fields
public function setGlobalConfigFieldsets($lang, $autorName, $autorEmail) public function setGlobalConfigFieldsets($lang, $autorName, $autorEmail)
{ {
// set component name // set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code); $component = $this->componentCodeName;
// start building field set for config // start building field set for config
$this->configFieldSets[] = '<fieldset'; $this->configFieldSets[] = '<fieldset';

View File

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

View File

@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access');
*/ */
//Insure this view category file is loaded. //Insure this view category file is loaded.
$classname = 'componentbuilderFieldsCategories'; $classname = 'ComponentbuilderFieldsCategories';
if (!class_exists($classname)) if (!class_exists($classname))
{ {
$path = JPATH_SITE . '/components/com_componentbuilder/helpers/categoryfields.php'; $path = JPATH_SITE . '/components/com_componentbuilder/helpers/categoryfields.php';
@ -27,7 +27,7 @@ if (!class_exists($classname))
} }
} }
//Insure this view category file is loaded. //Insure this view category file is loaded.
$classname = 'componentbuilderFieldtypesCategories'; $classname = 'ComponentbuilderFieldtypesCategories';
if (!class_exists($classname)) if (!class_exists($classname))
{ {
$path = JPATH_SITE . '/components/com_componentbuilder/helpers/categoryfieldtypes.php'; $path = JPATH_SITE . '/components/com_componentbuilder/helpers/categoryfieldtypes.php';