From d78e3bb2157d116e550d0d7f362a089e8ac5ce0e Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Mon, 14 Oct 2019 17:30:35 +0200 Subject: [PATCH] Tweaked the category naming. Improved the autoloader for composer. --- README.md | 4 +- admin/README.txt | 4 +- admin/helpers/compiler/c_Fields.php | 2 +- admin/helpers/compiler/e_Interpretation.php | 2 +- admin/helpers/componentbuilder.php | 38 ++++++++++++++----- .../en-GB/en-GB.com_componentbuilder.ini | 8 ++-- admin/layouts/fieldtype/fields_fullwidth.php | 2 +- admin/views/fields/tmpl/default_head.php | 2 +- admin/views/fields/view.html.php | 2 +- admin/views/fieldtypes/tmpl/default_head.php | 2 +- admin/views/fieldtypes/view.html.php | 2 +- componentbuilder.xml | 2 +- site/helpers/componentbuilder.php | 34 +++++++++++++---- 13 files changed, 70 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 386c6d17f..6095311bf 100644 --- a/README.md +++ b/README.md @@ -146,11 +146,11 @@ 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*: 11th October, 2019 ++ *Last Build*: 14th October, 2019 + *Version*: 2.10.1 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **253755** ++ *Line count*: **253791** + *Field count*: **1347** + *File count*: **1618** + *Folder count*: **261** diff --git a/admin/README.txt b/admin/README.txt index 386c6d17f..6095311bf 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -146,11 +146,11 @@ 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*: 11th October, 2019 ++ *Last Build*: 14th October, 2019 + *Version*: 2.10.1 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **253755** ++ *Line count*: **253791** + *Field count*: **1347** + *File count*: **1618** + *Folder count*: **261** diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index dca23d201..f6652de75 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -2800,7 +2800,7 @@ class Fields extends Structure } else { - $tempName = $view_name_single . ' category'; + $tempName = $view_name_list . ' categories'; } // set lang $listLangName = $langView . '_' . ComponentbuilderHelper::safeFieldName($tempName, true); diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 4801935b5..0be8e1976 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -13394,7 +13394,7 @@ class Interpretation extends Fields { $otherViews = $name_list; // build lang - $langName = 'Category  For
' . ComponentbuilderHelper::safeString($otherViews, 'W'); + $langName = 'Categories For
' . ComponentbuilderHelper::safeString($otherViews, 'W'); } if (!in_array($otherViews, $catArray)) { diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index b4ee4d435..2bd5be2dd 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -3787,22 +3787,40 @@ abstract class ComponentbuilderHelper /** * Composer Switch **/ - protected static $composer = false; + protected static $composer = array(); /** * Load the Composer Vendors **/ - public static function composerAutoload() + public static function composerAutoload($target = 'vdm_io') { - // insure we load the composer vendors only once - if (!self::$composer) + // insure we load the composer vendor only once + if (!isset(self::$composer[$target])) { - // load the autoloader - require_once JPATH_SITE.'/libraries/vdm_io/vendor/autoload.php'; - // do not load again - self::$composer = true; + // get the function name + $functionName = self::safeString('compose' . $target); + // check if method exist + if (method_exists(__CLASS__, $functionName)) + { + return self::{$functionName}(); + } + return false; } + return self::$composer[$target]; } + + + /** + * Load the Composer Vendor vdm_io + **/ + protected static function composevdm_io() + { + // load the autoloader for vdm_io + require_once JPATH_SITE . '/libraries/vdm_io/vendor/autoload.php'; + // do not load again + self::$composer['vdm_io'] = true; + } + /** * bc math wrapper (very basic not for accounting) @@ -5614,12 +5632,12 @@ abstract class ComponentbuilderHelper if ($user->authorise('field.access', 'com_componentbuilder') && $user->authorise('field.submenu', 'com_componentbuilder')) { JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_FIELDS'), 'index.php?option=com_componentbuilder&view=fields', $submenu === 'fields'); - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_FIELD_FIELD_CATEGORY'), 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.fields', $submenu === 'categories.fields'); + JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_FIELD_FIELDS_CATEGORIES'), 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.fields', $submenu === 'categories.fields'); } if ($user->authorise('fieldtype.access', 'com_componentbuilder') && $user->authorise('fieldtype.submenu', 'com_componentbuilder')) { JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_FIELDTYPES'), 'index.php?option=com_componentbuilder&view=fieldtypes', $submenu === 'fieldtypes'); - JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_FIELDTYPE_FIELDTYPE_CATEGORY'), 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.fieldtypes', $submenu === 'categories.fieldtypes'); + JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_FIELDTYPE_FIELDTYPES_CATEGORIES'), 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.fieldtypes', $submenu === 'categories.fieldtypes'); } if ($user->authorise('language_translation.access', 'com_componentbuilder') && $user->authorise('language_translation.submenu', 'com_componentbuilder')) { diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 1eea73738..44f7e2603 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -4258,9 +4258,9 @@ COM_COMPONENTBUILDER_DASHBOARD_CUSTOM_CODES="Custom Codes

" COM_COMPONENTBUILDER_DASHBOARD_DYNAMIC_GETS="Dynamic Gets

" COM_COMPONENTBUILDER_DASHBOARD_DYNAMIC_GET_ADD="Add Dynamic Get

" COM_COMPONENTBUILDER_DASHBOARD_FIELDS="Fields

" -COM_COMPONENTBUILDER_DASHBOARD_FIELDS_CATID="Category  For
Fields" +COM_COMPONENTBUILDER_DASHBOARD_FIELDS_CATID="Categories For
Fields" COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPES="Fieldtypes

" -COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPES_CATID="Category  For
Fieldtypes" +COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPES_CATID="Categories For
Fieldtypes" COM_COMPONENTBUILDER_DASHBOARD_FIELD_ADD="Add Field

" COM_COMPONENTBUILDER_DASHBOARD_GET_SNIPPETS="Get Snippets

" COM_COMPONENTBUILDER_DASHBOARD_HELP_DOCUMENTS="Help Documents

" @@ -4801,7 +4801,7 @@ COM_COMPONENTBUILDER_FIELDTYPE_EXAMPLE_HINT="Value/Example Here" COM_COMPONENTBUILDER_FIELDTYPE_EXAMPLE_LABEL="Value/Example" COM_COMPONENTBUILDER_FIELDTYPE_EXAMPLE_MESSAGE="Error! Please add value/example here." COM_COMPONENTBUILDER_FIELDTYPE_FIELDS="Fields" -COM_COMPONENTBUILDER_FIELDTYPE_FIELDTYPE_CATEGORY="Fieldtype Category" +COM_COMPONENTBUILDER_FIELDTYPE_FIELDTYPES_CATEGORIES="Fieldtypes Categories" COM_COMPONENTBUILDER_FIELDTYPE_FIFTY="50" COM_COMPONENTBUILDER_FIELDTYPE_FLOAT="FLOAT" COM_COMPONENTBUILDER_FIELDTYPE_HAS_DEFAULTS="Has Defaults" @@ -4938,10 +4938,10 @@ COM_COMPONENTBUILDER_FIELD_DOUBLE="DOUBLE" COM_COMPONENTBUILDER_FIELD_EDIT="Editing the Field" COM_COMPONENTBUILDER_FIELD_ELEVEN="11" COM_COMPONENTBUILDER_FIELD_ERROR_UNIQUE_ALIAS="Another Field has the same alias." +COM_COMPONENTBUILDER_FIELD_FIELDS_CATEGORIES="Fields Categories" COM_COMPONENTBUILDER_FIELD_FIELDTYPE="Fieldtype" COM_COMPONENTBUILDER_FIELD_FIELDTYPE_DESCRIPTION="Set the field type" COM_COMPONENTBUILDER_FIELD_FIELDTYPE_LABEL="Type" -COM_COMPONENTBUILDER_FIELD_FIELD_CATEGORY="Field Category" COM_COMPONENTBUILDER_FIELD_FIFTY="50" COM_COMPONENTBUILDER_FIELD_FLOAT="FLOAT" COM_COMPONENTBUILDER_FIELD_HELPNOTE_LABEL="Field Information" diff --git a/admin/layouts/fieldtype/fields_fullwidth.php b/admin/layouts/fieldtype/fields_fullwidth.php index 6c42cd144..c7430d98b 100644 --- a/admin/layouts/fieldtype/fields_fullwidth.php +++ b/admin/layouts/fieldtype/fields_fullwidth.php @@ -74,7 +74,7 @@ $can = ComponentbuilderHelper::getActions('field'); - + diff --git a/admin/views/fields/tmpl/default_head.php b/admin/views/fields/tmpl/default_head.php index 407073858..44924291e 100644 --- a/admin/views/fields/tmpl/default_head.php +++ b/admin/views/fields/tmpl/default_head.php @@ -48,7 +48,7 @@ defined('_JEXEC') or die('Restricted access'); listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> diff --git a/admin/views/fields/view.html.php b/admin/views/fields/view.html.php index e630e565c..de1374bf7 100644 --- a/admin/views/fields/view.html.php +++ b/admin/views/fields/view.html.php @@ -408,7 +408,7 @@ class ComponentbuilderViewFields extends JViewLegacy 'a.indexes' => JText::_('COM_COMPONENTBUILDER_FIELD_INDEXES_LABEL'), 'a.null_switch' => JText::_('COM_COMPONENTBUILDER_FIELD_NULL_SWITCH_LABEL'), 'a.store' => JText::_('COM_COMPONENTBUILDER_FIELD_STORE_LABEL'), - 'c.category_title' => JText::_('COM_COMPONENTBUILDER_FIELD_FIELD_CATEGORY'), + 'c.category_title' => JText::_('COM_COMPONENTBUILDER_FIELD_FIELDS_CATEGORIES'), 'a.id' => JText::_('JGRID_HEADING_ID') ); } diff --git a/admin/views/fieldtypes/tmpl/default_head.php b/admin/views/fieldtypes/tmpl/default_head.php index 0bfac3324..521ffdbfb 100644 --- a/admin/views/fieldtypes/tmpl/default_head.php +++ b/admin/views/fieldtypes/tmpl/default_head.php @@ -36,7 +36,7 @@ defined('_JEXEC') or die('Restricted access'); listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> diff --git a/admin/views/fieldtypes/view.html.php b/admin/views/fieldtypes/view.html.php index 683e0e33f..dc06cda8c 100644 --- a/admin/views/fieldtypes/view.html.php +++ b/admin/views/fieldtypes/view.html.php @@ -249,7 +249,7 @@ class ComponentbuilderViewFieldtypes extends JViewLegacy 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_FIELDTYPE_NAME_LABEL'), 'a.short_description' => JText::_('COM_COMPONENTBUILDER_FIELDTYPE_SHORT_DESCRIPTION_LABEL'), - 'c.category_title' => JText::_('COM_COMPONENTBUILDER_FIELDTYPE_FIELDTYPE_CATEGORY'), + 'c.category_title' => JText::_('COM_COMPONENTBUILDER_FIELDTYPE_FIELDTYPES_CATEGORIES'), 'a.id' => JText::_('JGRID_HEADING_ID') ); } diff --git a/componentbuilder.xml b/componentbuilder.xml index 7dd3287a9..a5122103c 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 11th October, 2019 + 14th October, 2019 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index b5239c5b7..33e869329 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -3787,22 +3787,40 @@ abstract class ComponentbuilderHelper /** * Composer Switch **/ - protected static $composer = false; + protected static $composer = array(); /** * Load the Composer Vendors **/ - public static function composerAutoload() + public static function composerAutoload($target = 'vdm_io') { - // insure we load the composer vendors only once - if (!self::$composer) + // insure we load the composer vendor only once + if (!isset(self::$composer[$target])) { - // load the autoloader - require_once JPATH_SITE.'/libraries/vdm_io/vendor/autoload.php'; - // do not load again - self::$composer = true; + // get the function name + $functionName = self::safeString('compose' . $target); + // check if method exist + if (method_exists(__CLASS__, $functionName)) + { + return self::{$functionName}(); + } + return false; } + return self::$composer[$target]; } + + + /** + * Load the Composer Vendor vdm_io + **/ + protected static function composevdm_io() + { + // load the autoloader for vdm_io + require_once JPATH_SITE . '/libraries/vdm_io/vendor/autoload.php'; + // do not load again + self::$composer['vdm_io'] = true; + } + /** * bc math wrapper (very basic not for accounting)