Added more header options and renamed the header method in the compiler.

This commit is contained in:
Llewellyn van der Merwe 2020-12-26 22:28:36 +02:00
parent a28c5cf746
commit d36410281d
Signed by untrusted user: Llewellyn
GPG Key ID: EFC0C720A240551C
16 changed files with 132 additions and 102 deletions

View File

@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.12.3) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.12.4) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -143,14 +143,14 @@ 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*: 25th December, 2020
+ *Version*: 2.12.3
+ *Last Build*: 26th December, 2020
+ *Version*: 2.12.4
+ *Copyright*: Copyright (C) 2015 - 2021 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **290893**
+ *Field count*: **1601**
+ *File count*: **1923**
+ *Folder count*: **316**
+ *Line count*: **291286**
+ *Field count*: **1609**
+ *File count*: **1933**
+ *Folder count*: **322**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.12.3) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.12.4) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -143,14 +143,14 @@ 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*: 25th December, 2020
+ *Version*: 2.12.3
+ *Last Build*: 26th December, 2020
+ *Version*: 2.12.4
+ *Copyright*: Copyright (C) 2015 - 2021 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **290893**
+ *Field count*: **1601**
+ *File count*: **1923**
+ *Folder count*: **316**
+ *Line count*: **291286**
+ *Field count*: **1609**
+ *File count*: **1933**
+ *Folder count*: **322**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -17,10 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Language;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;###ADMIN_HELPER_CLASS_HEADER###
###ADMIN_HELPER_CLASS_HEADER###
/**
* ###Component### component helper.

View File

@ -17,10 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Language;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;###SITE_HELPER_CLASS_HEADER###
###SITE_HELPER_CLASS_HEADER###
/**
* ###Component### component helper

View File

@ -16,7 +16,8 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tabstate');
###ADMIN_COMPONENT_HEADER###
// Access check.
if (!JFactory::getUser()->authorise('core.manage', 'com_###component###'))

View File

@ -16,7 +16,8 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tabstate');
###SITE_COMPONENT_HEADER###
// Set the component css/js
$document = JFactory::getDocument();

View File

@ -11,6 +11,7 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tabstate');
// Access check.

View File

@ -6496,7 +6496,8 @@ class Get
public function setLang($string)
{
// this is there to insure we dont break already added Language strings
if (ComponentbuilderHelper::safeString($string, 'U', '_', false, false) === $string)
if (ComponentbuilderHelper::safeString($string, 'U', '_', false, false)
=== $string)
{
return false;
}

View File

@ -466,27 +466,6 @@ class Interpretation extends Fields
return implode(PHP_EOL, $bool);
}
/**
* set Helper Dynamic Headers
*
* @param string $target_client
*
* @return string
*/
public function setHelperClassHeader($target_client)
{
$header = '';
// add only to admin client
if ('admin' === $target_client && $this->addEximport)
{
$header .= PHP_EOL . 'use PhpOffice\PhpSpreadsheet\IOFactory;';
$header .= PHP_EOL . 'use PhpOffice\PhpSpreadsheet\Spreadsheet;';
$header .= PHP_EOL . 'use PhpOffice\PhpSpreadsheet\Writer\Xlsx;';
}
return $header;
}
/**
* set Helper License Lock
*
@ -8524,7 +8503,8 @@ class Interpretation extends Fields
if ($this->addAssetsTableFix == 2)
{
// get the type we will convert to
$data_type = ($this->accessWorseCase > 64000) ? "MEDIUMTEXT" : "TEXT";
$data_type = ($this->accessWorseCase > 64000) ? "MEDIUMTEXT"
: "TEXT";
// the if statement about $rule_length
$codeIF = "\$rule_length <= " . $this->accessWorseCase;
// fix column size
@ -8534,7 +8514,8 @@ class Interpretation extends Fields
$script[] = $this->_t(5)
. '$fix_rules_size = "ALTER TABLE `#__assets` CHANGE `rules` `rules` '
. $data_type
. ' NOT NULL COMMENT \'JSON encoded access control. Enlarged to ' . $data_type . ' by JCB\';";';
. ' NOT NULL COMMENT \'JSON encoded access control. Enlarged to '
. $data_type . ' by JCB\';";';
$script[] = $this->_t(5) . "\$db->setQuery(\$fix_rules_size);";
$script[] = $this->_t(5) . "\$db->execute();";
$codeA = implode(PHP_EOL, $script);
@ -22117,7 +22098,7 @@ class Interpretation extends Fields
}
/**
* Build headers for the model/view/controller headers
* Build headers for the various files
*
* @param string $context The name of the context
* @param string $viewsCodeName The view or views name
@ -22125,12 +22106,25 @@ class Interpretation extends Fields
* @return string The php to place in the header
*
*/
public function setClassHeaders($context, $viewsCodeName)
public function setFileHeader($context, $viewsCodeName)
{
// set the defaults
$headers = array();
switch ($context)
{
case 'admin.component':
case 'site.component':
$headers[] = 'JHtml::_(\'behavior.tabstate\');';
break;
case 'admin.helper':
case 'site.helper':
$headers[] = 'use Joomla\CMS\Language\Language;';
$headers[] = 'use Joomla\Registry\Registry;';
$headers[] = 'use Joomla\String\StringHelper;';
$headers[] = 'use Joomla\Utilities\ArrayHelper;';
// load the internal custom headers
$this->setHelperClassHeader($headers, $viewsCodeName);
break;
case 'admin.view.model':
case 'site.admin.view.model':
$headers[] = 'use Joomla\Registry\Registry;';
@ -22185,6 +22179,25 @@ class Interpretation extends Fields
return '';
}
/**
* set Helper Dynamic Headers
*
* @param array $headers The headers array
* @param string $target_client
*
* @return void
*/
protected function setHelperClassHeader(&$headers, $target_client)
{
// add only to admin client
if ('admin' === $target_client && $this->addEximport)
{
$headers[] = 'use PhpOffice\PhpSpreadsheet\IOFactory;';
$headers[] = 'use PhpOffice\PhpSpreadsheet\Spreadsheet;';
$headers[] = 'use PhpOffice\PhpSpreadsheet\Writer\Xlsx;';
}
}
/**
* Build chosen multi selection headers for the view
*

View File

@ -634,21 +634,21 @@ class Infusion extends Interpretation
// SITE_ADMIN_VIEW_CONTROLLER_HEADER <<<DYNAMIC>>> add the header details for the controller
$this->fileContentDynamic[$nameSingleCode][$this->hhh
. 'SITE_ADMIN_VIEW_CONTROLLER_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'site.admin.view.controller',
$nameSingleCode
);
// SITE_ADMIN_VIEW_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$nameSingleCode][$this->hhh
. 'SITE_ADMIN_VIEW_MODEL_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'site.admin.view.model',
$nameSingleCode
);
// SITE_ADMIN_VIEW_HEADER <<<DYNAMIC>>> add the header details for the view
$this->fileContentDynamic[$nameSingleCode][$this->hhh
. 'SITE_ADMIN_VIEW_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'site.admin.view',
$nameSingleCode
);
@ -664,20 +664,20 @@ class Infusion extends Interpretation
// ADMIN_VIEW_CONTROLLER_HEADER <<<DYNAMIC>>> add the header details for the controller
$this->fileContentDynamic[$nameSingleCode][$this->hhh
. 'ADMIN_VIEW_CONTROLLER_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'admin.view.controller',
$nameSingleCode
);
// ADMIN_VIEW_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$nameSingleCode][$this->hhh
. 'ADMIN_VIEW_MODEL_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'admin.view.model', $nameSingleCode
);
// ADMIN_VIEW_HEADER <<<DYNAMIC>>> add the header details for the view
$this->fileContentDynamic[$nameSingleCode][$this->hhh
. 'ADMIN_VIEW_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'admin.view', $nameSingleCode
);
@ -1036,20 +1036,20 @@ class Infusion extends Interpretation
// ADMIN_VIEWS_CONTROLLER_HEADER <<<DYNAMIC>>> add the header details for the controller
$this->fileContentDynamic[$nameListCode][$this->hhh
. 'ADMIN_VIEWS_CONTROLLER_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'admin.views.controller',
$nameListCode
);
// ADMIN_VIEWS_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$nameListCode][$this->hhh
. 'ADMIN_VIEWS_MODEL_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'admin.views.model', $nameListCode
);
// ADMIN_VIEWS_HEADER <<<DYNAMIC>>> add the header details for the views
$this->fileContentDynamic[$nameListCode][$this->hhh
. 'ADMIN_VIEWS_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'admin.views', $nameListCode
);
@ -1264,21 +1264,6 @@ class Infusion extends Interpretation
// setup the layouts
$this->setCustomViewLayouts();
// ADMIN_HELPER_CLASS_HEADER
$this->fileContentStatic[$this->hhh . 'ADMIN_HELPER_CLASS_HEADER'
. $this->hhh]
= $this->setHelperClassHeader('admin');
// SITE_HELPER_CLASS_HEADER
$this->fileContentStatic[$this->hhh . 'SITE_HELPER_CLASS_HEADER'
. $this->hhh]
= $this->setHelperClassHeader('site');
// HELPER_EXEL
$this->fileContentStatic[$this->hhh . 'HELPER_EXEL'
. $this->hhh]
= $this->setHelperExelMethods();
// setup custom_admin_views and all needed stuff for the site
if (isset($this->componentData->custom_admin_views)
&& ComponentbuilderHelper::checkArray(
@ -1512,20 +1497,20 @@ class Infusion extends Interpretation
// CUSTOM_ADMIN_VIEW_CONTROLLER_HEADER <<<DYNAMIC>>> add the header details for the controller
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'CUSTOM_ADMIN_VIEW_CONTROLLER_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'custom.admin.view.controller',
$view['settings']->code
);
// CUSTOM_ADMIN_VIEW_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'CUSTOM_ADMIN_VIEW_MODEL_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'custom.admin.view.model', $view['settings']->code
);
// CUSTOM_ADMIN_VIEW_HEADER <<<DYNAMIC>>> add the header details for the view
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'CUSTOM_ADMIN_VIEW_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'custom.admin.view', $view['settings']->code
);
}
@ -1534,20 +1519,20 @@ class Infusion extends Interpretation
// CUSTOM_ADMIN_VIEWS_CONTROLLER_HEADER <<<DYNAMIC>>> add the header details for the controller
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'CUSTOM_ADMIN_VIEWS_CONTROLLER_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'custom.admin.views.controller',
$view['settings']->code
);
// CUSTOM_ADMIN_VIEWS_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'CUSTOM_ADMIN_VIEWS_MODEL_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'custom.admin.views.model', $view['settings']->code
);
// CUSTOM_ADMIN_VIEWS_HEADER <<<DYNAMIC>>> add the header details for the view
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'CUSTOM_ADMIN_VIEWS_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'custom.admin.views', $view['settings']->code
);
}
@ -1567,6 +1552,39 @@ class Infusion extends Interpretation
$this->setCustomViewLayouts();
}
// ADMIN_HELPER_CLASS_HEADER
$this->fileContentStatic[$this->hhh . 'ADMIN_HELPER_CLASS_HEADER'
. $this->hhh]
= $this->setFileHeader(
'admin.helper', 'admin'
);
// ADMIN_COMPONENT_HEADER
$this->fileContentStatic[$this->hhh . 'ADMIN_COMPONENT_HEADER'
. $this->hhh]
= $this->setFileHeader(
'admin.component', 'admin'
);
// SITE_HELPER_CLASS_HEADER
$this->fileContentStatic[$this->hhh . 'SITE_HELPER_CLASS_HEADER'
. $this->hhh]
= $this->setFileHeader(
'site.helper', 'site'
);
// SITE_COMPONENT_HEADER
$this->fileContentStatic[$this->hhh . 'SITE_COMPONENT_HEADER'
. $this->hhh]
= $this->setFileHeader(
'site.component', 'site'
);
// HELPER_EXEL
$this->fileContentStatic[$this->hhh . 'HELPER_EXEL'
. $this->hhh]
= $this->setHelperExelMethods();
// VIEWARRAY
$this->fileContentStatic[$this->hhh . 'VIEWARRAY' . $this->hhh]
= PHP_EOL . implode("," . PHP_EOL, $viewarray);
@ -1995,20 +2013,20 @@ class Infusion extends Interpretation
// SITE_VIEW_CONTROLLER_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'SITE_VIEW_CONTROLLER_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'site.view.controller', $view['settings']->code
);
}
// SITE_VIEW_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'SITE_VIEW_MODEL_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'site.view.model', $view['settings']->code
);
// SITE_VIEW_HEADER <<<DYNAMIC>>> add the header details for the view
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'SITE_VIEW_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'site.view', $view['settings']->code
);
}
@ -2023,20 +2041,20 @@ class Infusion extends Interpretation
// SITE_VIEW_CONTROLLER_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'SITE_VIEW_CONTROLLER_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'site.views.controller', $view['settings']->code
);
}
// SITE_VIEWS_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'SITE_VIEWS_MODEL_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'site.views.model', $view['settings']->code
);
// SITE_VIEWS_HEADER <<<DYNAMIC>>> add the header details for the view
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'SITE_VIEWS_HEADER' . $this->hhh]
= $this->setClassHeaders(
= $this->setFileHeader(
'site.views', $view['settings']->code
);
}

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>25th December, 2020</creationDate>
<creationDate>26th December, 2020</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
<copyright>Copyright (C) 2015 - 2021 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>2.12.3</version>
<version>2.12.4</version>
<description><![CDATA[
<h1>Component Builder (v.2.12.3)</h1>
<h1>Component Builder (v.2.12.4)</h1>
<div style="clear: both;"></div>
<p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.

View File

@ -993,7 +993,7 @@
<version>2.12.1</version>
<infourl title="Component Builder!">http://www.joomlacomponentbuilder.com</infourl>
<downloads>
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.12.3/JCB_v2.12.3.zip</downloadurl>
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.12.4/JCB_v2.12.4.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>
@ -1007,10 +1007,10 @@
<description>Builds Complex Joomla Components</description>
<element>com_componentbuilder</element>
<type>component</type>
<version>2.12.3</version>
<version>2.12.4</version>
<infourl title="Component Builder!">http://www.joomlacomponentbuilder.com</infourl>
<downloads>
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.12.3/JCB_v2.12.3.zip</downloadurl>
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.12.4/JCB_v2.12.4.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>

View File

@ -9250,7 +9250,7 @@ class com_componentbuilderInstallerScript
echo '<a target="_blank" href="http://www.joomlacomponentbuilder.com" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 2.12.3 Was Successful! Let us know if anything is not working as expected.</h3>';
<h3>Upgrade to Version 2.12.4 Was Successful! Let us know if anything is not working as expected.</h3>';
// Set db if not set already.
if (!isset($db))

View File

@ -11,6 +11,7 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tabstate');
// Set the component css/js