From 2b1e0a65faf29269fc53e659ce9810e351bd0cbe Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Tue, 10 Sep 2019 18:47:39 +0200 Subject: [PATCH] Added option to include or exclude Joomla Plugins from being compiled or exported. Added the Joomla\Utilities\ArrayHelper to helper class header. Added option to only export words if required global option fields are set. Added option to use strict field access on all exports if required global option fields are set. Fixed gh-475 by adding the option to add a github token if needed under the global options global tab, also updated the error message. --- README.md | 6 +- admin/README.txt | 6 +- admin/compiler/joomla_3/Helper.php | 2 + admin/compiler/joomla_3/Helper_site.php | 2 + admin/config.xml | 15 ++ admin/helpers/compiler/a_Get.php | 21 +- admin/helpers/compiler/e_Interpretation.php | 144 +++++++--- admin/helpers/componentbuilder.php | 248 +++++++++++++----- .../en-GB/en-GB.com_componentbuilder.ini | 14 +- admin/models/admin_views.php | 4 +- admin/models/admins_custom_tabs.php | 2 +- admin/models/admins_fields.php | 2 +- admin/models/admins_fields_conditions.php | 2 +- admin/models/admins_fields_relations.php | 2 +- admin/models/ajax.php | 9 +- admin/models/class_extendings.php | 2 +- admin/models/class_methods.php | 4 +- admin/models/class_properties.php | 4 +- admin/models/components_admin_views.php | 2 +- admin/models/components_config.php | 2 +- .../models/components_custom_admin_menus.php | 2 +- .../models/components_custom_admin_views.php | 2 +- admin/models/components_dashboard.php | 2 +- admin/models/components_files_folders.php | 2 +- admin/models/components_mysql_tweaks.php | 2 +- admin/models/components_placeholders.php | 2 +- admin/models/components_plugins.php | 2 +- admin/models/components_site_views.php | 2 +- admin/models/components_updates.php | 2 +- admin/models/custom_admin_views.php | 4 +- admin/models/custom_codes.php | 4 +- admin/models/dynamic_gets.php | 4 +- admin/models/fields.php | 4 +- admin/models/fieldtype.php | 2 +- admin/models/fieldtypes.php | 4 +- admin/models/forms/component_plugins.xml | 17 ++ admin/models/help_documents.php | 4 +- admin/models/joomla_components.php | 4 +- admin/models/joomla_plugins.php | 171 ++++++------ .../joomla_plugins_files_folders_urls.php | 2 +- admin/models/joomla_plugins_updates.php | 2 +- admin/models/language_translations.php | 4 +- admin/models/languages.php | 4 +- admin/models/layouts.php | 4 +- admin/models/libraries.php | 2 +- admin/models/libraries_config.php | 2 +- admin/models/libraries_files_folders_urls.php | 2 +- admin/models/placeholders.php | 4 +- admin/models/server.php | 2 +- admin/models/servers.php | 4 +- admin/models/site_views.php | 4 +- admin/models/snippet_types.php | 2 +- admin/models/snippets.php | 4 +- admin/models/templates.php | 4 +- admin/models/validation_rules.php | 4 +- .../import_joomla_components/tmpl/default.php | 14 +- .../import_joomla_components/view.html.php | 4 +- componentbuilder.xml | 2 +- script.php | 4 +- site/helpers/componentbuilder.php | 248 +++++++++++++----- .../en-GB/en-GB.com_componentbuilder.ini | 5 +- 61 files changed, 726 insertions(+), 330 deletions(-) diff --git a/README.md b/README.md index 463651c9d..6cfebca81 100644 --- a/README.md +++ b/README.md @@ -146,12 +146,12 @@ 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*: 5th September, 2019 ++ *Last Build*: 10th September, 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*: **251450** -+ *Field count*: **1343** ++ *Line count*: **251878** ++ *Field count*: **1345** + *File count*: **1608** + *Folder count*: **253** diff --git a/admin/README.txt b/admin/README.txt index 463651c9d..6cfebca81 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -146,12 +146,12 @@ 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*: 5th September, 2019 ++ *Last Build*: 10th September, 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*: **251450** -+ *Field count*: **1343** ++ *Line count*: **251878** ++ *Field count*: **1345** + *File count*: **1608** + *Folder count*: **253** diff --git a/admin/compiler/joomla_3/Helper.php b/admin/compiler/joomla_3/Helper.php index b8132d932..29a106670 100644 --- a/admin/compiler/joomla_3/Helper.php +++ b/admin/compiler/joomla_3/Helper.php @@ -17,6 +17,8 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\Utilities\ArrayHelper; + /** * ###Component### component helper. */ diff --git a/admin/compiler/joomla_3/Helper_site.php b/admin/compiler/joomla_3/Helper_site.php index cf98c8d43..e055e37f4 100644 --- a/admin/compiler/joomla_3/Helper_site.php +++ b/admin/compiler/joomla_3/Helper_site.php @@ -17,6 +17,8 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\Utilities\ArrayHelper; + /** * ###Component### component helper */ diff --git a/admin/config.xml b/admin/config.xml index 69db069e6..ab8e9d975 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -67,6 +67,21 @@ folder="extension" filter="cmd" /> + + diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index 9f77d8ea2..8ac86f878 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -60,6 +60,20 @@ class Get */ public $params; + /** + * Add strict field export permissions + * + * @var boolean + */ + public $strictFieldExportPermissions = false; + + /** + * Add text only export options + * + * @var boolean + */ + public $exportTextOnly = false; + /** * The global placeholders * @@ -1665,7 +1679,12 @@ class Get if (ComponentbuilderHelper::checkArray($component->addjoomla_plugins)) { $joomla_plugins = array_map(function($array) use(&$component) { - return $this->setJoomlaPlugin($array['plugin'], $component); + // only load the plugins whose target association calles for it + if (!isset($array['target']) || $array['target'] != 2) + { + return $this->setJoomlaPlugin($array['plugin'], $component); + } + return null; }, array_values($component->addjoomla_plugins)); } unset($component->addjoomla_plugins); diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index ebe3e5aeb..02afb363b 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -9135,11 +9135,13 @@ class Interpretation extends Fields */ public function setGetItemsModelMethod($viewName_single, $viewName_list, $config = array('functionName' => 'getExportData', 'docDesc' => 'Method to get list export data.', 'type' => 'export')) { + // start the query string $query = ''; - if ($this->eximportView[$viewName_list] || 'export' !== $config['type']) + // check if this is the export method + $isExport = ('export' === $config['type']); + // check if this view has export feature, and or if this is not an export method + if ((isset($this->eximportView[$viewName_list]) && $this->eximportView[$viewName_list]) || !$isExport) { - $isExport = ('export' === $config['type']); - $query = PHP_EOL . PHP_EOL . $this->_t(1) . "/**"; $query .= PHP_EOL . $this->_t(1) . " * " . $config['docDesc']; $query .= PHP_EOL . $this->_t(1) . " *"; @@ -9170,6 +9172,25 @@ class Interpretation extends Fields $query .= PHP_EOL . $this->_t(3) . "\$query->where('a.id IN (' . implode(',',\$pks) . ')');"; // add custom filtering php $query .= $this->getCustomScriptBuilder('php_getlistquery', $viewName_single, PHP_EOL . PHP_EOL . $this->_t(1)); + // first check if we export of text only is avalable + if ($this->exportTextOnly) + { + // add switch + $query .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Get global switch to activate text only export"; + $query .= PHP_EOL . $this->_t(3) . "\$export_text_only = JComponentHelper::getParams('com_" . $this->componentCodeName . "')->get('export_text_only', 0);"; + // first check if we have custom queries + $custom_query = $this->setCustomQuery($viewName_list, $viewName_single, $this->_t(2), true); + } + // if values were returned add the area + if (isset($custom_query) && ComponentbuilderHelper::checkString($custom_query)) + { + $query .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Add these queries only if text only is required"; + $query .= PHP_EOL . $this->_t(3) . "if (\$export_text_only)"; + $query .= PHP_EOL . $this->_t(3) . "{"; + // add the custom fields query + $query .= $custom_query; + $query .= PHP_EOL . $this->_t(3) . "}"; + } // add access levels if the view has access set if (isset($this->accessBuilder[$viewName_single]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName_single])) { @@ -9188,15 +9209,33 @@ class Interpretation extends Fields $query .= PHP_EOL . $this->_t(3) . "if (\$db->getNumRows())"; $query .= PHP_EOL . $this->_t(3) . "{"; $query .= PHP_EOL . $this->_t(4) . "\$items = \$db->loadObjectList();"; - $query .= $this->setGetItemsMethodStringFix($viewName_single, $viewName_list, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh], $this->_t(2), $isExport); - // add translations - if (!$isExport) + // set the string fixing code + $query .= $this->setGetItemsMethodStringFix($viewName_single, $viewName_list, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh], $this->_t(2), $isExport, true); + // first check if we export of text only is avalable + if ($this->exportTextOnly) { - $query .= $this->setSelectionTranslationFix($viewName_list, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh], $this->_t(2)); + $query_translations = $this->setSelectionTranslationFix($viewName_list, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh], $this->_t(3)); + } + // add translations + if (isset($query_translations) && ComponentbuilderHelper::checkString($query_translations)) + { + $query .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Add these translation only if text only is required"; + $query .= PHP_EOL . $this->_t(3) . "if (\$export_text_only)"; + $query .= PHP_EOL . $this->_t(3) . "{"; + $query .= $query_translations; + $query .= PHP_EOL . $this->_t(3) . "}"; } // add custom php to getItems method after all $query .= $this->getCustomScriptBuilder('php_getitems_after_all', $viewName_single, PHP_EOL . PHP_EOL . $this->_t(2)); - $query .= PHP_EOL . $this->_t(4) . "return \$items;"; + // in privacy export we must return array of arrays + if ('privacy' === $config['type']) + { + $query .= PHP_EOL . $this->_t(4) . "return json_decode(json_encode(\$items), true);"; + } + else + { + $query .= PHP_EOL . $this->_t(4) . "return \$items;"; + } $query .= PHP_EOL . $this->_t(3) . "}"; $query .= PHP_EOL . $this->_t(2) . "}"; $query .= PHP_EOL . $this->_t(2) . "return false;"; @@ -9521,7 +9560,7 @@ class Interpretation extends Fields return ''; } - public function setCustomQuery($viewName_list, $viewName_single) + public function setCustomQuery($viewName_list, $viewName_single, $tab = '', $just_text = false) { if (isset($this->customBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->customBuilder[$viewName_list])) { @@ -9529,11 +9568,20 @@ class Interpretation extends Fields foreach ($this->customBuilder[$viewName_list] as $filter) { // only load this if table is set - if (isset($this->customBuilderList[$viewName_list]) && ComponentbuilderHelper::checkArray($this->customBuilderList[$viewName_list]) && in_array($filter['code'], $this->customBuilderList[$viewName_list]) && isset($filter['custom']['table']) && ComponentbuilderHelper::checkString($filter['custom']['table']) && $filter['method'] == 0) + if ((isset($this->customBuilderList[$viewName_list]) && ComponentbuilderHelper::checkArray($this->customBuilderList[$viewName_list]) && in_array($filter['code'], $this->customBuilderList[$viewName_list]) && isset($filter['custom']['table']) && ComponentbuilderHelper::checkString($filter['custom']['table']) && $filter['method'] == 0) + || ($just_text && isset($filter['custom']['table']) && ComponentbuilderHelper::checkString($filter['custom']['table']) && $filter['method'] == 0)) { - $query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " From the " . ComponentbuilderHelper::safeString(ComponentbuilderHelper::safeString($filter['custom']['table'], 'w')) . " table."; - $query .= PHP_EOL . $this->_t(2) . "\$query->select(\$db->quoteName('" . $filter['custom']['db'] . "." . $filter['custom']['text'] . "','" . $filter['code'] . "_" . $filter['custom']['text'] . "'));"; - $query .= PHP_EOL . $this->_t(2) . "\$query->join('LEFT', \$db->quoteName('" . $filter['custom']['table'] . "', '" . $filter['custom']['db'] . "') . ' ON (' . \$db->quoteName('a." . $filter['code'] . "') . ' = ' . \$db->quoteName('" . $filter['custom']['db'] . "." . $filter['custom']['id'] . "') . ')');"; + $query .= PHP_EOL . PHP_EOL . $this->_t(2) . $tab . "//" . $this->setLine(__LINE__) . " From the " . ComponentbuilderHelper::safeString(ComponentbuilderHelper::safeString($filter['custom']['table'], 'w')) . " table."; + // we want to at times just have the words and not the ids as well + if ($just_text) + { + $query .= PHP_EOL . $this->_t(2) . $tab . "\$query->select(\$db->quoteName('" . $filter['custom']['db'] . "." . $filter['custom']['text'] . "','" . $filter['code'] . "'));"; + } + else + { + $query .= PHP_EOL . $this->_t(2) . $tab . "\$query->select(\$db->quoteName('" . $filter['custom']['db'] . "." . $filter['custom']['text'] . "','" . $filter['code'] . "_" . $filter['custom']['text'] . "'));"; + } + $query .= PHP_EOL . $this->_t(2) . $tab . "\$query->join('LEFT', \$db->quoteName('" . $filter['custom']['table'] . "', '" . $filter['custom']['db'] . "') . ' ON (' . \$db->quoteName('a." . $filter['code'] . "') . ' = ' . \$db->quoteName('" . $filter['custom']['db'] . "." . $filter['custom']['id'] . "') . ')');"; } // build the field type file $this->setCustomFieldTypeFile($filter, $viewName_list, $viewName_single); @@ -11804,7 +11852,7 @@ class Interpretation extends Fields $allow[] = $this->_t(3) . "{"; $allow[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " We have to unset then (TODO)"; $allow[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " Hiddend field can not handel array value"; - $allow[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " Even if we conver to json we get an error"; + $allow[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " Even if we convert to json we get an error"; $allow[] = $this->_t(4) . "\$form->removeField('" . $fieldName . "');"; $allow[] = $this->_t(3) . "}"; $allow[] = $this->_t(2) . "}"; @@ -12458,7 +12506,7 @@ class Interpretation extends Fields public function setPopulateState(&$view) { - // rest buket + // reset buket $state = ''; // keep track of all fields already added $donelist = array(); @@ -12665,11 +12713,12 @@ class Interpretation extends Fields return $checkin; } - public function setGetItemsMethodStringFix($viewName_single, $viewName_list, $Component, $tab = '', $export = false) + public function setGetItemsMethodStringFix($viewName_single, $viewName_list, $Component, $tab = '', $export = false, $all = false) { // add the fix if this view has the need for it $fix = ''; $forEachStart = ''; + $fix_access = ''; // encryption switches foreach ($this->cryptionTypes as $cryptionType) { @@ -12686,21 +12735,22 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.access']) && isset($this->permissionBuilder[$core['core.access']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder[$core['core.access']]) && in_array($viewName_single, $this->permissionBuilder[$core['core.access']])) { - $fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Remove items the user can't access."; - $fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "\$access = (\$user->authorise('" . $core['core.access'] . "', 'com_" . $component . "." . $viewName_single . ".' . (int) \$item->id) && \$user->authorise('" . $core['core.access'] . "', 'com_" . $component . "'));"; - $fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "if (!\$access)"; - $fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "{"; - $fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "unset(\$items[\$nr]);"; - $fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "continue;"; - $fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "}" . PHP_EOL; + $fix_access = PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Remove items the user can't access."; + $fix_access .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "\$access = (\$user->authorise('" . $core['core.access'] . "', 'com_" . $component . "." . $viewName_single . ".' . (int) \$item->id) && \$user->authorise('" . $core['core.access'] . "', 'com_" . $component . "'));"; + $fix_access .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "if (!\$access)"; + $fix_access .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "{"; + $fix_access .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "unset(\$items[\$nr]);"; + $fix_access .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "continue;"; + $fix_access .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "}" . PHP_EOL; } - if (!$export) + // get the correct array + if ($export || $all) { - $methodName = 'getItemsMethodListStringFixBuilder'; + $methodName = 'getItemsMethodEximportStringFixBuilder'; } else { - $methodName = 'getItemsMethodEximportStringFixBuilder'; + $methodName = 'getItemsMethodListStringFixBuilder'; } // load the relations before modeling if (isset($this->fieldRelations[$viewName_list]) && ComponentbuilderHelper::checkArray($this->fieldRelations[$viewName_list])) @@ -12922,10 +12972,10 @@ class Interpretation extends Fields } } // close the foreach if needed - if (ComponentbuilderHelper::checkString($fix) || $export) + if (ComponentbuilderHelper::checkString($fix) || ComponentbuilderHelper::checkString($fix_access) || $export || $all) { // start the loop - $forEachStart = PHP_EOL . PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" . $this->setLine(__LINE__) . " set values to display correctly."; + $forEachStart = PHP_EOL . PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" . $this->setLine(__LINE__) . " Set values to display correctly."; $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "if (" . $Component . "Helper::checkArray(\$items))"; $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "{"; // do not add to export since it is already done @@ -12937,19 +12987,43 @@ class Interpretation extends Fields $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "\$user = JFactory::getUser();"; $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "}"; } + // the permissional acttion switch + $hasPermissional = false; // add the permissional removal of values the user has not right to view or access - if (isset($this->permissionFields[$viewName_single]) && ComponentbuilderHelper::checkArray($this->permissionFields[$viewName_single])) + if ($this->strictFieldExportPermissions && isset($this->permissionFields[$viewName_single]) && ComponentbuilderHelper::checkArray($this->permissionFields[$viewName_single])) { - $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "//" . $this->setLine(__LINE__) . " -- get global permissional control activation. (default is inactive) ---"; - $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "//" . $this->setLine(__LINE__) . " to use this feature add a global option radio button to your"; - $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "//" . $this->setLine(__LINE__) . " component with a value of 1 as on/activate and 0 as inactive/off"; - $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "//" . $this->setLine(__LINE__) . " make sure it has the name: strict_permission_per_field"; - $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "\$strict_permission_per_field = JComponentHelper::getParams('com_" . $component . "')->get('strict_permission_per_field', 0);" . PHP_EOL; + foreach ($this->permissionFields[$viewName_single] as $fieldName => $permission_options) + { + if (!$hasPermissional) + { + foreach($permission_options as $permission_option => $fieldType) + { + if (!$hasPermissional) + { + switch ($permission_option) + { + case 'access': + case 'view': + $hasPermissional = true; + break; + } + } + } + } + } + // add the notes and get the global switch + if ($hasPermissional) + { + $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get global permissional control activation. (default is inactive)"; + $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "\$strict_permission_per_field = JComponentHelper::getParams('com_" . $component . "')->get('strict_permission_per_field', 0);" . PHP_EOL; + } } $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "foreach (\$items as \$nr => &\$item)"; $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "{"; + // add the access options + $forEachStart .= $fix_access; // add the permissional removal of values the user has not right to view or access - if (isset($this->permissionFields[$viewName_single]) && ComponentbuilderHelper::checkArray($this->permissionFields[$viewName_single])) + if ($hasPermissional) { $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "//" . $this->setLine(__LINE__) . " use permissional control if globaly set."; $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "if (\$strict_permission_per_field)"; diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index f3e76868e..ae37c1e1f 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -12,6 +12,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\Utilities\ArrayHelper; + /** * Componentbuilder component helper. */ @@ -61,14 +63,14 @@ abstract class ComponentbuilderHelper /** * The VDM packages paths **/ - public static $vdmGithubPackagesUrl = "https://api.github.com/repos/vdm-io/JCB-Packages/git/trees/master"; public static $vdmGithubPackageUrl = "https://github.com/vdm-io/JCB-Packages/raw/master/"; + public static $vdmGithubPackagesUrl = "https://api.github.com/repos/vdm-io/JCB-Packages/git/trees/master"; /** * The JCB packages paths **/ - public static $jcbGithubPackagesUrl = "https://api.github.com/repos/vdm-io/JCB-Community-Packages/git/trees/master"; public static $jcbGithubPackageUrl = "https://github.com/vdm-io/JCB-Community-Packages/raw/master/"; + public static $jcbGithubPackagesUrl = "https://api.github.com/repos/vdm-io/JCB-Community-Packages/git/trees/master"; /** * The bolerplate paths @@ -76,9 +78,6 @@ abstract class ComponentbuilderHelper public static $bolerplatePath = 'https://raw.githubusercontent.com/vdm-io/boilerplate/jcb/'; public static $bolerplateAPI = 'https://api.github.com/repos/vdm-io/boilerplate/git/trees/jcb'; - // not needed at this time (maybe latter) - public static $accessToken = ""; - /** * The array of constant paths * @@ -2413,66 +2412,163 @@ abstract class ComponentbuilderHelper /** - * get the github repo file list - * - * @return array on success - * - */ + * The github access token + **/ + protected static $gitHubAccessToken = ""; + + /** + * The github repo get data errors + **/ + public static $githubRepoDataErrors = array(); + + /** + * get the github repo file list + * + * @return array on success + * + */ public static function getGithubRepoFileList($type, $target) { - // get the current Packages (public) - if (!$repoData = self::get($type)) + // get the repo data + if (($repoData = self::getGithubRepoData($type, $target, 'tree')) !== false) { - if (self::urlExists($target)) - { - $repoData = self::getFileContents($target); - if (self::checkJson($repoData)) - { - $test = json_decode($repoData); - if (self::checkObject($test) && isset($test->tree) && self::checkArray($test->tree) ) - { - // remember to set it - self::set($type, $repoData); - } - // check if we have error message from github - elseif ($errorMessage = self::githubErrorHandeler(array('error' => null), $test)) - { - if (self::checkString($errorMessage['error'])) - { - JFactory::getApplication()->enqueueMessage($errorMessage['error'], 'Error'); - } - $repoData = false; - } - } - else - { - $repoData = false; - } - } - else - { - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_EXIST', $target), 'Error'); - } - } - // check if we could find packages - if (isset($repoData) && self::checkJson($repoData)) - { - $repoData = json_decode($repoData); - if (self::checkObject($repoData) && isset($repoData->tree) && self::checkArray($repoData->tree) ) - { - return $repoData->tree; - } + return $repoData->tree; } return false; } /** - * get the github error messages - * - * @return array of errors on success - * - */ - protected static function githubErrorHandeler($message, &$github) + * get the github repo file list + * + * @return array on success + * + */ + public static function getGithubRepoData($type, $url, $target = null, $return_type = 'object') + { + // always reset errors per/request + self::$githubRepoDataErrors = array(); + // get the current Packages (public) + if ('nomemory' === $type || !$repoData = self::get($type)) + { + // add the token if not already added + $_url = self::setGithubToken($url); + // check if the url exist + if (self::urlExists($_url)) + { + // get the data from github + if (($repoData = self::getFileContents($_url)) !== false && self::checkJson($repoData)) + { + $github_returned = json_decode($repoData); + if (self::checkString($target) && self::checkObject($github_returned) && + isset($github_returned->{$target}) && self::checkArray($github_returned->{$target}) ) + { + if ('nomemory' !== $type) + { + // remember to set it + self::set($type, $repoData); + } + } + elseif (!self::checkString($target) && self::checkObject($github_returned) && !isset($github_returned->message)) + { + if ('nomemory' !== $type) + { + // remember to set it + self::set($type, $repoData); + } + } + // check if we have error message from github + elseif (($errorMessage = self::githubErrorHandeler(array('error' => null), $github_returned, $type)) !== false) + { + if (isset($errorMessage['error']) && self::checkString($errorMessage['error'])) + { + // set the error in the application + JFactory::getApplication()->enqueueMessage($errorMessage['error'], 'Error'); + // set the error also in the class encase it is and Ajax call + self::$githubRepoDataErrors[] = $errorMessage['error']; + } + return false; + } + elseif (self::checkString($target)) + { + // setup error string + $error = JText::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_S_DATA', $url, $target); + // set the error in the application + JFactory::getApplication()->enqueueMessage($error, 'Error'); + // set the error also in the class encase it is and Ajax call + self::$githubRepoDataErrors[] = $error; + // we are done here + return false; + } + elseif ('nomemory' !== $type) + { + // setup error string + $error = JText::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_S_DATA', $url, $type); + // set the error in the application + JFactory::getApplication()->enqueueMessage($error, 'Error'); + // set the error also in the class encase it is and Ajax call + self::$githubRepoDataErrors[] = $error; + // we are done here + return false; + } + else + { + // setup error string + $error = JText::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_VALID_DATA', $url, $type); + // set the error in the application + JFactory::getApplication()->enqueueMessage($error, 'Error'); + // set the error also in the class encase it is and Ajax call + self::$githubRepoDataErrors[] = $error; + // we are done here + return false; + } + } + else + { + // setup error string + $error = JText::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_RETURN_ANY_DATA', $url); + // set the error in the application + JFactory::getApplication()->enqueueMessage($error, 'Error'); + // set the error also in the class encase it is and Ajax call + self::$githubRepoDataErrors[] = $error; + // we are done here + return false; + } + } + else + { + // setup error string + $error = JText::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_EXIST', $url); + // set the error in the application + JFactory::getApplication()->enqueueMessage($error, 'Error'); + // set the error also in the class encase it is and Ajax call + self::$githubRepoDataErrors[] = $error; + // we are done here + return false; + } + } + // check if we could find packages + if (isset($repoData) && self::checkJson($repoData)) + { + if ('object' === $return_type) + { + return json_decode($repoData); + } + elseif ('array' === $return_type) + { + return json_decode($repoData, true); + } + return $repoData; + } + return false; + } + + /** + * get the github error messages + * + * @return array of errors on success + * + */ + protected static function githubErrorHandeler($message, &$github, $type) { if (self::checkObject($github) && isset($github->message) && self::checkString($github->message)) { @@ -2481,13 +2577,17 @@ abstract class ComponentbuilderHelper // add the documentation URL if (isset($github->documentation_url) && self::checkString($github->documentation_url)) { - $errorMessage = $errorMessage.'
'.$github->documentation_url; + $errorMessage = $errorMessage . '
' . $github->documentation_url; } // check the message if (strpos($errorMessage, 'Authenticated') !== false) { + if ('nomemory' === $type) + { + $type = 'data'; + } // add little more help if it is an access token issue - $errorMessage = JText::sprintf('COM_COMPONENTBUILDER_SBR_YOU_CAN_ADD_AN_BACCESS_TOKENB_TO_GETBIBLE_GLOBAL_OPTIONS_TO_MAKE_AUTHENTICATED_REQUESTS_AN_ACCESS_TOKEN_WITH_ONLY_PUBLIC_ACCESS_WILL_DO', $errorMessage); + $errorMessage = JText::sprintf('COM_COMPONENTBUILDER_SBR_YOU_CAN_ADD_A_BGITHUB_ACCESS_TOKENB_TO_COMPONENTBUILDER_GLOBAL_OPTIONS_TO_MAKE_AUTHENTICATED_REQUESTS_TO_GITHUB_AN_ACCESS_TOKEN_WITH_ONLY_PUBLIC_ACCESS_WILL_DO_TO_RETRIEVE_S', $errorMessage, $type); } // set error notice $message['error'] = $errorMessage; @@ -2497,6 +2597,36 @@ abstract class ComponentbuilderHelper return false; } + /** + * set the github token + * + * @return array of errors on success + * + */ + protected static function setGithubToken($url) + { + // first check if token already set + if (strpos($url, 'access_token=') !== false) + { + // make sure the token is loaded + if (!self::checkString(self::$gitHubAccessToken)) + { + // get the global settings + if (!self::checkObject(self::$params)) + { + self::$params = JComponentHelper::getParams('com_componentbuilder'); + } + self::$gitHubAccessToken = self::$params->get('github_access_token', null); + } + // make sure the token is loaded at this point + if (self::checkString(self::$gitHubAccessToken)) + { + $url .= '&access_token=' . self::$gitHubAccessToken; + } + } + return $url; + } + /** * get Dynamic Scripts diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index b0d2b64a9..24bfe568d 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -3031,12 +3031,15 @@ COM_COMPONENTBUILDER_COMPONENT_PLUGINS="Component Plugins" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ADDJOOMLA_PLUGINS="Addjoomla Plugins" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ADDJOOMLA_PLUGINS_DESCRIPTION="Setup the Joomla plugins for this component." COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ADDJOOMLA_PLUGINS_LABEL="Joomla Plugins" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_COMPILE_AMP_EXPORT="Compile & Export" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_COMPILE_ONLY="Compile (only)" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_BY_DESC="The user that created this Component Plugins." COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_BY_LABEL="Created By" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_DATE_DESC="The date this Component Plugins was created." COM_COMPONENTBUILDER_COMPONENT_PLUGINS_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_EDIT="Editing the Component Plugins" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ERROR_UNIQUE_ALIAS="Another Component Plugins has the same alias." +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_EXPORT_ONLY="Export (only)" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ID="Id" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_JOOMLA_COMPONENT="Joomla Component" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_JOOMLA_COMPONENT_DESCRIPTION="Select a Joomla Component" @@ -3056,6 +3059,8 @@ COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PLUGIN_LABEL="Plugins" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_PUBLISHING="Publishing" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Component Plugins to customise the alias." COM_COMPONENTBUILDER_COMPONENT_PLUGINS_STATUS="Status" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_TARGET_DESCRIPTION="Association" +COM_COMPONENTBUILDER_COMPONENT_PLUGINS_TARGET_LABEL="Target" COM_COMPONENTBUILDER_COMPONENT_PLUGINS_VERSION_DESC="A count of the number of times this Component Plugins has been revised." COM_COMPONENTBUILDER_COMPONENT_PLUGINS_VERSION_LABEL="Revision" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS="Component Site Views" @@ -3375,6 +3380,10 @@ COM_COMPONENTBUILDER_CONFIG_FORCE_LOAD="Force" COM_COMPONENTBUILDER_CONFIG_FROMNAME_DESCRIPTION="Text displayed in the header "From:" field when sending a site email. Usually the site name." COM_COMPONENTBUILDER_CONFIG_FROMNAME_HINT="From Name Here" COM_COMPONENTBUILDER_CONFIG_FROMNAME_LABEL="From Name" +COM_COMPONENTBUILDER_CONFIG_GITHUB_ACCESS_TOKEN_DESCRIPTION="This is only needed when you are on a shared IP or/and have reached the public free limit of API queries to gitHub. So unless you have seen some kind of error that directed you here to add an access token you can just ignore this field." +COM_COMPONENTBUILDER_CONFIG_GITHUB_ACCESS_TOKEN_HINT="OAUTH-TOKEN" +COM_COMPONENTBUILDER_CONFIG_GITHUB_ACCESS_TOKEN_LABEL="gitHub Access Token
Check https://developer.github.com/v3/#authentication for more info." +COM_COMPONENTBUILDER_CONFIG_GITHUB_ACCESS_TOKEN_MESSAGE="Error! Please add token here." COM_COMPONENTBUILDER_CONFIG_GIT_FOLDER_PATH_DESCRIPTION="Here you can set the path to the git folder." COM_COMPONENTBUILDER_CONFIG_GIT_FOLDER_PATH_HINT="/home/user/git" COM_COMPONENTBUILDER_CONFIG_GIT_FOLDER_PATH_LABEL="Git Folder Path" @@ -7269,7 +7278,7 @@ COM_COMPONENTBUILDER_RIGHT_OF_TABS="Right of Tabs" COM_COMPONENTBUILDER_RUN_EXPANSION="Run Expansion" COM_COMPONENTBUILDER_SAVE_SUCCESS="Great! Item successfully saved." COM_COMPONENTBUILDER_SAVE_WARNING="The value already existed so please select another." -COM_COMPONENTBUILDER_SBR_YOU_CAN_ADD_AN_BACCESS_TOKENB_TO_GETBIBLE_GLOBAL_OPTIONS_TO_MAKE_AUTHENTICATED_REQUESTS_AN_ACCESS_TOKEN_WITH_ONLY_PUBLIC_ACCESS_WILL_DO="%s
You can add an access token to getBible global options to make authenticated requests. An access token with only public access will do." +COM_COMPONENTBUILDER_SBR_YOU_CAN_ADD_A_BGITHUB_ACCESS_TOKENB_TO_COMPONENTBUILDER_GLOBAL_OPTIONS_TO_MAKE_AUTHENTICATED_REQUESTS_TO_GITHUB_AN_ACCESS_TOKEN_WITH_ONLY_PUBLIC_ACCESS_WILL_DO_TO_RETRIEVE_S="%s
You can add a gitHub Access Token to Componentbuilder global options to make authenticated requests to gitHub. An access token with only public access will do to retrieve %s." COM_COMPONENTBUILDER_SEARCHABLE="Searchable" COM_COMPONENTBUILDER_SEE_ALL_IMPORT_INFO="See All Import Info" COM_COMPONENTBUILDER_SELECTION="selection" @@ -8313,7 +8322,10 @@ COM_COMPONENTBUILDER_THE_SEARCH_FOR_THE_SNIPPETS_ARE_CASE_SENSITIVE_SO_IF_YOU_CH COM_COMPONENTBUILDER_THE_SERVER_DETAILS_FOR_BID_SB_COULD_NOT_BE_RETRIEVED="The server details for (ID: %s) could not be retrieved!" COM_COMPONENTBUILDER_THE_SNIPPETS_WERE_SUCCESSFULLY_EXPORTED="The Snippets Were Successfully Exported!" COM_COMPONENTBUILDER_THE_SNIPPET_WAS_SUCCESSFULLY_EXPORTED="The Snippet Was Successfully Exported!" +COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_S_DATA="The url (%s) set to retrieve the packages did not return %s data!" +COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DID_NOT_RETURN_VALID_DATA="The url (%s) set to retrieve the packages did not return valid data!" COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_EXIST="The url (%s) set to retrieve the packages does not exist!" +COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_RETURN_ANY_DATA="The url (%s) set to retrieve the packages does not return any data!" COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING="The wiki is loading" COM_COMPONENTBUILDER_THIS_BSB_IS_NOT_LINKED_TO_ANY_OTHER_AREAS_OF_JCB_AT_THIS_TIME="This %s is not linked to any other areas of JCB at this time!" COM_COMPONENTBUILDER_THIS_PACKAGE_BPASSEDB_THE_CHECKSUM_VALIDATIONBR_BR_SMALLMANUALLY_ALSO_VALIDATE_THAT_THE_CORRECT_CHECKSUM_WAS_USEDSMALLBR_THIS_CHECKSUM_BSB_MUST_BE_THE_SAME_AS_THE_ONE_FOUND_A_S_SA="This package PASSED the checksum validation!

Manually also validate that the correct checksum was used.
This checksum: %s must be the same as the one found @ " diff --git a/admin/models/admin_views.php b/admin/models/admin_views.php index 3350860e5..f6c07e361 100644 --- a/admin/models/admin_views.php +++ b/admin/models/admin_views.php @@ -114,7 +114,7 @@ class ComponentbuilderModelAdmin_views extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -376,7 +376,7 @@ class ComponentbuilderModelAdmin_views extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/admins_custom_tabs.php b/admin/models/admins_custom_tabs.php index ac8d144bd..cf2f1e9d7 100644 --- a/admin/models/admins_custom_tabs.php +++ b/admin/models/admins_custom_tabs.php @@ -84,7 +84,7 @@ class ComponentbuilderModelAdmins_custom_tabs extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/admins_fields.php b/admin/models/admins_fields.php index 61352a12a..bf2813543 100644 --- a/admin/models/admins_fields.php +++ b/admin/models/admins_fields.php @@ -84,7 +84,7 @@ class ComponentbuilderModelAdmins_fields extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/admins_fields_conditions.php b/admin/models/admins_fields_conditions.php index 9da1a1aeb..58a68d2a9 100644 --- a/admin/models/admins_fields_conditions.php +++ b/admin/models/admins_fields_conditions.php @@ -84,7 +84,7 @@ class ComponentbuilderModelAdmins_fields_conditions extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/admins_fields_relations.php b/admin/models/admins_fields_relations.php index 82835f409..c8435109b 100644 --- a/admin/models/admins_fields_relations.php +++ b/admin/models/admins_fields_relations.php @@ -84,7 +84,7 @@ class ComponentbuilderModelAdmins_fields_relations extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/ajax.php b/admin/models/ajax.php index c036b4672..60c431d05 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -3212,13 +3212,14 @@ class ComponentbuilderModelAjax extends JModelList { // secure path $path = ComponentbuilderHelper::safeString(str_replace('.json','',$path), 'filename', '', false).'.json'; + // base path + $base_path = basename($path); // set url - $url = ComponentbuilderHelper::$snippetPath.rawurlencode(basename($path)); + $url = ComponentbuilderHelper::$snippetPath.rawurlencode($base_path); // get the snippets - $snippet = ComponentbuilderHelper::getFileContents($url); - if (ComponentbuilderHelper::checkJson($snippet)) + if (($snippet = ComponentbuilderHelper::getGithubRepoData('lib_snippet_' . $base_path, $url)) !== false) { - return $this->saveSnippet(json_decode($snippet, true), $status, $user); + return $this->saveSnippet($snippet, $status, $user); } return array('message' => JText::_('COM_COMPONENTBUILDER_ERROR_THE_PATH_HAS_A_MISMATCH_AND_COULD_THEREFORE_NOT_RETRIEVE_THE_SNIPPET_FROM_GITHUB'), 'status' => 'danger'); } diff --git a/admin/models/class_extendings.php b/admin/models/class_extendings.php index 7122b54db..05f4f0192 100644 --- a/admin/models/class_extendings.php +++ b/admin/models/class_extendings.php @@ -90,7 +90,7 @@ class ComponentbuilderModelClass_extendings extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/class_methods.php b/admin/models/class_methods.php index d2a0af058..8d9eab01c 100644 --- a/admin/models/class_methods.php +++ b/admin/models/class_methods.php @@ -94,7 +94,7 @@ class ComponentbuilderModelClass_methods extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -303,7 +303,7 @@ class ComponentbuilderModelClass_methods extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/class_properties.php b/admin/models/class_properties.php index 0237b58fe..0a1ed2d71 100644 --- a/admin/models/class_properties.php +++ b/admin/models/class_properties.php @@ -94,7 +94,7 @@ class ComponentbuilderModelClass_properties extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -303,7 +303,7 @@ class ComponentbuilderModelClass_properties extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/components_admin_views.php b/admin/models/components_admin_views.php index 10f3bf33a..f2300697a 100644 --- a/admin/models/components_admin_views.php +++ b/admin/models/components_admin_views.php @@ -84,7 +84,7 @@ class ComponentbuilderModelComponents_admin_views extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/components_config.php b/admin/models/components_config.php index 3e1dc7c6b..b1c209803 100644 --- a/admin/models/components_config.php +++ b/admin/models/components_config.php @@ -84,7 +84,7 @@ class ComponentbuilderModelComponents_config extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/components_custom_admin_menus.php b/admin/models/components_custom_admin_menus.php index 5437e46de..073761fa8 100644 --- a/admin/models/components_custom_admin_menus.php +++ b/admin/models/components_custom_admin_menus.php @@ -84,7 +84,7 @@ class ComponentbuilderModelComponents_custom_admin_menus extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/components_custom_admin_views.php b/admin/models/components_custom_admin_views.php index 6e4721b6b..015f4f02b 100644 --- a/admin/models/components_custom_admin_views.php +++ b/admin/models/components_custom_admin_views.php @@ -84,7 +84,7 @@ class ComponentbuilderModelComponents_custom_admin_views extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/components_dashboard.php b/admin/models/components_dashboard.php index 247cd7ee6..c411f7fd6 100644 --- a/admin/models/components_dashboard.php +++ b/admin/models/components_dashboard.php @@ -84,7 +84,7 @@ class ComponentbuilderModelComponents_dashboard extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/components_files_folders.php b/admin/models/components_files_folders.php index a8b47edad..93d944fac 100644 --- a/admin/models/components_files_folders.php +++ b/admin/models/components_files_folders.php @@ -84,7 +84,7 @@ class ComponentbuilderModelComponents_files_folders extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/components_mysql_tweaks.php b/admin/models/components_mysql_tweaks.php index 4dd13eaf4..465e6fedb 100644 --- a/admin/models/components_mysql_tweaks.php +++ b/admin/models/components_mysql_tweaks.php @@ -84,7 +84,7 @@ class ComponentbuilderModelComponents_mysql_tweaks extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/components_placeholders.php b/admin/models/components_placeholders.php index f1968bb25..854f44312 100644 --- a/admin/models/components_placeholders.php +++ b/admin/models/components_placeholders.php @@ -84,7 +84,7 @@ class ComponentbuilderModelComponents_placeholders extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/components_plugins.php b/admin/models/components_plugins.php index e7bbc86f7..a197e20e6 100644 --- a/admin/models/components_plugins.php +++ b/admin/models/components_plugins.php @@ -84,7 +84,7 @@ class ComponentbuilderModelComponents_plugins extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/components_site_views.php b/admin/models/components_site_views.php index 7e46bebb3..346a4e46f 100644 --- a/admin/models/components_site_views.php +++ b/admin/models/components_site_views.php @@ -84,7 +84,7 @@ class ComponentbuilderModelComponents_site_views extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/components_updates.php b/admin/models/components_updates.php index 51c9019cb..14b1a4b44 100644 --- a/admin/models/components_updates.php +++ b/admin/models/components_updates.php @@ -84,7 +84,7 @@ class ComponentbuilderModelComponents_updates extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/custom_admin_views.php b/admin/models/custom_admin_views.php index c2d4dfccc..258a106d7 100644 --- a/admin/models/custom_admin_views.php +++ b/admin/models/custom_admin_views.php @@ -106,7 +106,7 @@ class ComponentbuilderModelCustom_admin_views extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -317,7 +317,7 @@ class ComponentbuilderModelCustom_admin_views extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/custom_codes.php b/admin/models/custom_codes.php index ff318b1e5..e2c430100 100644 --- a/admin/models/custom_codes.php +++ b/admin/models/custom_codes.php @@ -102,7 +102,7 @@ class ComponentbuilderModelCustom_codes extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -350,7 +350,7 @@ class ComponentbuilderModelCustom_codes extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/dynamic_gets.php b/admin/models/dynamic_gets.php index 18cc8be8c..5ec969544 100644 --- a/admin/models/dynamic_gets.php +++ b/admin/models/dynamic_gets.php @@ -94,7 +94,7 @@ class ComponentbuilderModelDynamic_gets extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -300,7 +300,7 @@ class ComponentbuilderModelDynamic_gets extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/fields.php b/admin/models/fields.php index 19f1f8165..0e9e965af 100644 --- a/admin/models/fields.php +++ b/admin/models/fields.php @@ -118,7 +118,7 @@ class ComponentbuilderModelFields extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -415,7 +415,7 @@ class ComponentbuilderModelFields extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/fieldtype.php b/admin/models/fieldtype.php index ad7e135ae..463e17cdb 100644 --- a/admin/models/fieldtype.php +++ b/admin/models/fieldtype.php @@ -264,7 +264,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/fieldtypes.php b/admin/models/fieldtypes.php index 31938f718..917172840 100644 --- a/admin/models/fieldtypes.php +++ b/admin/models/fieldtypes.php @@ -102,7 +102,7 @@ class ComponentbuilderModelFieldtypes extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -269,7 +269,7 @@ class ComponentbuilderModelFieldtypes extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/forms/component_plugins.xml b/admin/models/forms/component_plugins.xml index 64feb0324..e60b7330e 100644 --- a/admin/models/forms/component_plugins.xml +++ b/admin/models/forms/component_plugins.xml @@ -120,6 +120,23 @@ default="0" button="false" /> + + + + + + +
diff --git a/admin/models/help_documents.php b/admin/models/help_documents.php index 55cc41f0b..5e7e7f476 100644 --- a/admin/models/help_documents.php +++ b/admin/models/help_documents.php @@ -102,7 +102,7 @@ class ComponentbuilderModelHelp_documents extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -306,7 +306,7 @@ class ComponentbuilderModelHelp_documents extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/joomla_components.php b/admin/models/joomla_components.php index ae86e3a73..a95baab09 100644 --- a/admin/models/joomla_components.php +++ b/admin/models/joomla_components.php @@ -2032,7 +2032,7 @@ class ComponentbuilderModelJoomla_components extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -2190,7 +2190,7 @@ class ComponentbuilderModelJoomla_components extends JModelList // Get the encryption object. $basic = new FOFEncryptAes($basickey); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/joomla_plugins.php b/admin/models/joomla_plugins.php index 8f43e81e8..7e715064a 100644 --- a/admin/models/joomla_plugins.php +++ b/admin/models/joomla_plugins.php @@ -45,28 +45,23 @@ class ComponentbuilderModelJoomla_plugins extends JModelList public function getBoilerplate() { // get boilerplate repo root details - if (($result = ComponentbuilderHelper::getFileContents(ComponentbuilderHelper::$bolerplateAPI)) !== false && ComponentbuilderHelper::checkJson($result)) + if (($repo_tree = ComponentbuilderHelper::getGithubRepoFileList('boilerplate', ComponentbuilderHelper::$bolerplateAPI)) !== false) { - $result = json_decode($result); - // check if we have a three - if (isset($result->tree) && ComponentbuilderHelper::checkArray($result->tree)) - { - $found = array_values(array_filter( - $result->tree, - function($tree) { - if (isset($tree->path) && $tree->path === 'plugins') - { - return true; - } - return false; + $found = array_values(array_filter( + $repo_tree, + function($tree) { + if (isset($tree->path) && $tree->path === 'plugins') + { + return true; } - )); - // make sure we have the correct boilerplate - if (ComponentbuilderHelper::checkArray($found) && count($found) == 1 && method_exists(__CLASS__, 'getPluginsBoilerplate')) - { - // get the plugins boilerplate - return $this->getPluginsBoilerplate($found[0]->url); + return false; } + )); + // make sure we have the correct boilerplate + if (ComponentbuilderHelper::checkArray($found) && count($found) == 1 && method_exists(__CLASS__, 'getPluginsBoilerplate')) + { + // get the plugins boilerplate + return $this->getPluginsBoilerplate($found[0]->url); } } return false; @@ -81,85 +76,80 @@ class ComponentbuilderModelJoomla_plugins extends JModelList protected function getPluginsBoilerplate($url) { // get boilerplate root for plugins - if (($result = ComponentbuilderHelper::getFileContents($url)) !== false && ComponentbuilderHelper::checkJson($result)) + if (($plugin_tree = ComponentbuilderHelper::getGithubRepoFileList('boilerplate_plugins', $url)) !== false) { - $result = json_decode($result); - // check if we have a tree - if (isset($result->tree) && ComponentbuilderHelper::checkArray($result->tree)) - { - // get the app object - $app = JFactory::getApplication(); - // set the table names - $tables = array(); - $tables['e'] = 'class_extends'; - $tables['g'] = 'joomla_plugin_group'; - $tables['m'] = 'class_method'; - $tables['p'] = 'class_property'; - // load the needed models - $models = array(); - $models['e'] = ComponentbuilderHelper::getModel($tables['e']); - $models['g'] = ComponentbuilderHelper::getModel($tables['g']); - $models['p'] = ComponentbuilderHelper::getModel($tables['p']); - $models['m'] = ComponentbuilderHelper::getModel($tables['m']); - // get the needed data of each plugin group - $groups = array_map( - function($tree) use(&$app, &$models, &$tables){ - if (($fooClass = ComponentbuilderHelper::getFileContents(ComponentbuilderHelper::$bolerplatePath . '/plugins/' . $tree->path . '/foo.php')) !== false && ComponentbuilderHelper::checkString($fooClass)) + // get the app object + $app = JFactory::getApplication(); + // set the table names + $tables = array(); + $tables['e'] = 'class_extends'; + $tables['g'] = 'joomla_plugin_group'; + $tables['m'] = 'class_method'; + $tables['p'] = 'class_property'; + // load the needed models + $models = array(); + $models['e'] = ComponentbuilderHelper::getModel($tables['e']); + $models['g'] = ComponentbuilderHelper::getModel($tables['g']); + $models['p'] = ComponentbuilderHelper::getModel($tables['p']); + $models['m'] = ComponentbuilderHelper::getModel($tables['m']); + // get the needed data of each plugin group + $groups = array_map( + function($tree) use(&$app, &$models, &$tables){ + if (($fooClass = ComponentbuilderHelper::getFileContents(ComponentbuilderHelper::$bolerplatePath . '/plugins/' . $tree->path . '/foo.php')) !== false && ComponentbuilderHelper::checkString($fooClass)) + { + // extract the boilerplate class extends and check if already set + if (($classExtends = ComponentbuilderHelper::extractBoilerplateClassExtends($fooClass, 'plugins')) !== false && + ($classExtendsID = ComponentbuilderHelper::getVar('class_extends', $classExtends, 'name', 'id')) === false) { - // extract the boilerplate class extends and check if already set - if (($classExtends = ComponentbuilderHelper::extractBoilerplateClassExtends($fooClass, 'plugins')) !== false && - ($classExtendsID = ComponentbuilderHelper::getVar('class_extends', $classExtends, 'name', 'id')) === false) + // load the extends class name + $class = array('id' => 0, 'published' => 1, 'version' => 1, 'name' => $classExtends); + // extract the boilerplate class header + $class['head'] = ComponentbuilderHelper::extractBoilerplateClassHeader($fooClass, $classExtends, 'plugins'); + // extract the boilerplate class comment + $class['comment'] = ComponentbuilderHelper::extractBoilerplateClassComment($fooClass, $classExtends, 'plugins'); + // set the extension type + $class['extension_type'] = 'plugins'; + // store the class + $this->storePluginBoilerplate($tables['e'], $models['e'], $class, $app); + // work around + $classExtendsID = ComponentbuilderHelper::getVar('class_extends', $classExtends, 'name', 'id'); + } + // set plugin group if not already set + if (($pluginGroupID = ComponentbuilderHelper::getVar('joomla_plugin_group', $tree->path, 'name', 'id')) === false) + { + // load the plugin group name + $pluginGroup = array('id' => 0, 'published' => 1, 'version' => 1, 'name' => $tree->path, 'class_extends' => $classExtendsID); + // store the group + $this->storePluginBoilerplate($tables['g'], $models['g'], $pluginGroup, $app); + // work around + $pluginGroupID = ComponentbuilderHelper::getVar('joomla_plugin_group', $tree->path, 'name', 'id'); + } + // extract the boilerplate class property and methods + if (($classProperiesMethods = ComponentbuilderHelper::extractBoilerplateClassPropertiesMethods($fooClass, $classExtends, 'plugins', $pluginGroupID)) !== false) + { + // create the properties found + if (isset($classProperiesMethods['property']) && ComponentbuilderHelper::checkArray($classProperiesMethods['property'])) { - // load the extends class name - $class = array('id' => 0, 'published' => 1, 'version' => 1, 'name' => $classExtends); - // extract the boilerplate class header - $class['head'] = ComponentbuilderHelper::extractBoilerplateClassHeader($fooClass, $classExtends, 'plugins'); - // extract the boilerplate class comment - $class['comment'] = ComponentbuilderHelper::extractBoilerplateClassComment($fooClass, $classExtends, 'plugins'); - // set the extension type - $class['extension_type'] = 'plugins'; - // store the class - $this->storePluginBoilerplate($tables['e'], $models['e'], $class, $app); - // work around - $classExtendsID = ComponentbuilderHelper::getVar('class_extends', $classExtends, 'name', 'id'); - } - // set plugin group if not already set - if (($pluginGroupID = ComponentbuilderHelper::getVar('joomla_plugin_group', $tree->path, 'name', 'id')) === false) - { - // load the plugin group name - $pluginGroup = array('id' => 0, 'published' => 1, 'version' => 1, 'name' => $tree->path, 'class_extends' => $classExtendsID); - // store the group - $this->storePluginBoilerplate($tables['g'], $models['g'], $pluginGroup, $app); - // work around - $pluginGroupID = ComponentbuilderHelper::getVar('joomla_plugin_group', $tree->path, 'name', 'id'); - } - // extract the boilerplate class property and methods - if (($classProperiesMethods = ComponentbuilderHelper::extractBoilerplateClassPropertiesMethods($fooClass, $classExtends, 'plugins', $pluginGroupID)) !== false) - { - // create the properties found - if (isset($classProperiesMethods['property']) && ComponentbuilderHelper::checkArray($classProperiesMethods['property'])) + foreach ($classProperiesMethods['property'] as $_property) { - foreach ($classProperiesMethods['property'] as $_property) - { - // force update by default - $this->storePluginBoilerplate($tables['p'], $models['p'], $_property, $app); - } + // force update by default + $this->storePluginBoilerplate($tables['p'], $models['p'], $_property, $app); } - // create the method found (TODO just create for now but we could later add a force update) - if (isset($classProperiesMethods['method']) && ComponentbuilderHelper::checkArray($classProperiesMethods['method'])) + } + // create the method found (TODO just create for now but we could later add a force update) + if (isset($classProperiesMethods['method']) && ComponentbuilderHelper::checkArray($classProperiesMethods['method'])) + { + foreach ($classProperiesMethods['method'] as $_method) { - foreach ($classProperiesMethods['method'] as $_method) - { - // force update by default - $this->storePluginBoilerplate($tables['m'], $models['m'], $_method, $app); - } + // force update by default + $this->storePluginBoilerplate($tables['m'], $models['m'], $_method, $app); } } } - }, - $result->tree - ); - } + } + }, + $plugin_tree + ); } } @@ -214,6 +204,7 @@ class ComponentbuilderModelJoomla_plugins extends JModelList } return true; } + /** * Method to auto-populate the model state. @@ -273,7 +264,7 @@ class ComponentbuilderModelJoomla_plugins extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/joomla_plugins_files_folders_urls.php b/admin/models/joomla_plugins_files_folders_urls.php index 6ae90bb80..821c4f966 100644 --- a/admin/models/joomla_plugins_files_folders_urls.php +++ b/admin/models/joomla_plugins_files_folders_urls.php @@ -84,7 +84,7 @@ class ComponentbuilderModelJoomla_plugins_files_folders_urls extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/joomla_plugins_updates.php b/admin/models/joomla_plugins_updates.php index e9dd08b62..b25ccbdc1 100644 --- a/admin/models/joomla_plugins_updates.php +++ b/admin/models/joomla_plugins_updates.php @@ -84,7 +84,7 @@ class ComponentbuilderModelJoomla_plugins_updates extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/language_translations.php b/admin/models/language_translations.php index 3cc6f7f38..4325c0ac9 100644 --- a/admin/models/language_translations.php +++ b/admin/models/language_translations.php @@ -86,7 +86,7 @@ class ComponentbuilderModelLanguage_translations extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -318,7 +318,7 @@ class ComponentbuilderModelLanguage_translations extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/languages.php b/admin/models/languages.php index 59636a80c..67dbf199e 100644 --- a/admin/models/languages.php +++ b/admin/models/languages.php @@ -213,7 +213,7 @@ class ComponentbuilderModelLanguages extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -356,7 +356,7 @@ class ComponentbuilderModelLanguages extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/layouts.php b/admin/models/layouts.php index d27f7b1cf..f4b6da54d 100644 --- a/admin/models/layouts.php +++ b/admin/models/layouts.php @@ -98,7 +98,7 @@ class ComponentbuilderModelLayouts extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -289,7 +289,7 @@ class ComponentbuilderModelLayouts extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/libraries.php b/admin/models/libraries.php index e9b5a8215..6db1d97f8 100644 --- a/admin/models/libraries.php +++ b/admin/models/libraries.php @@ -98,7 +98,7 @@ class ComponentbuilderModelLibraries extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/libraries_config.php b/admin/models/libraries_config.php index a3a66eb24..96fbb0b90 100644 --- a/admin/models/libraries_config.php +++ b/admin/models/libraries_config.php @@ -84,7 +84,7 @@ class ComponentbuilderModelLibraries_config extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/libraries_files_folders_urls.php b/admin/models/libraries_files_folders_urls.php index d75effd77..82948a145 100644 --- a/admin/models/libraries_files_folders_urls.php +++ b/admin/models/libraries_files_folders_urls.php @@ -84,7 +84,7 @@ class ComponentbuilderModelLibraries_files_folders_urls extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/placeholders.php b/admin/models/placeholders.php index 7f80e7cf0..2f982d856 100644 --- a/admin/models/placeholders.php +++ b/admin/models/placeholders.php @@ -90,7 +90,7 @@ class ComponentbuilderModelPlaceholders extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -235,7 +235,7 @@ class ComponentbuilderModelPlaceholders extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/server.php b/admin/models/server.php index b0b8b76c9..21e601b5f 100644 --- a/admin/models/server.php +++ b/admin/models/server.php @@ -244,7 +244,7 @@ class ComponentbuilderModelServer extends JModelAdmin { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/servers.php b/admin/models/servers.php index 4b7a9ae41..3a2dc9a6f 100644 --- a/admin/models/servers.php +++ b/admin/models/servers.php @@ -90,7 +90,7 @@ class ComponentbuilderModelServers extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -283,7 +283,7 @@ class ComponentbuilderModelServers extends JModelList // Get the encryption object. $basic = new FOFEncryptAes($basickey); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/site_views.php b/admin/models/site_views.php index bb52770e8..7d8cdce83 100644 --- a/admin/models/site_views.php +++ b/admin/models/site_views.php @@ -110,7 +110,7 @@ class ComponentbuilderModelSite_views extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -321,7 +321,7 @@ class ComponentbuilderModelSite_views extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/snippet_types.php b/admin/models/snippet_types.php index 6de53c1d6..4336ef3b6 100644 --- a/admin/models/snippet_types.php +++ b/admin/models/snippet_types.php @@ -90,7 +90,7 @@ class ComponentbuilderModelSnippet_types extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. diff --git a/admin/models/snippets.php b/admin/models/snippets.php index 8fb1c5c65..644b9dadb 100644 --- a/admin/models/snippets.php +++ b/admin/models/snippets.php @@ -216,7 +216,7 @@ class ComponentbuilderModelSnippets extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -377,7 +377,7 @@ class ComponentbuilderModelSnippets extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/templates.php b/admin/models/templates.php index 5740d07c8..836daf18b 100644 --- a/admin/models/templates.php +++ b/admin/models/templates.php @@ -98,7 +98,7 @@ class ComponentbuilderModelTemplates extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -289,7 +289,7 @@ class ComponentbuilderModelTemplates extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/models/validation_rules.php b/admin/models/validation_rules.php index b932d8cf5..a50299e93 100644 --- a/admin/models/validation_rules.php +++ b/admin/models/validation_rules.php @@ -90,7 +90,7 @@ class ComponentbuilderModelValidation_rules extends JModelList // load parent items $items = parent::getItems(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { // Get the user object if not set. @@ -233,7 +233,7 @@ class ComponentbuilderModelValidation_rules extends JModelList { $items = $db->loadObjectList(); - // set values to display correctly. + // Set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) { foreach ($items as $nr => &$item) diff --git a/admin/views/import_joomla_components/tmpl/default.php b/admin/views/import_joomla_components/tmpl/default.php index 1aebd5635..9cefdea0d 100644 --- a/admin/views/import_joomla_components/tmpl/default.php +++ b/admin/views/import_joomla_components/tmpl/default.php @@ -18,7 +18,7 @@ JHtml::_('script', 'system/core.js', false, true); JHtml::_('behavior.keepalive'); ?>