From f21434bb7234adb499b7d49aed601254f6cdf4ea Mon Sep 17 00:00:00 2001 From: trendschau Date: Sat, 11 Nov 2023 21:25:58 +0100 Subject: [PATCH] fix and unify plugin load logic --- composer.lock | 12 ++++++------ system/typemill/Assets.php | 4 ++-- system/typemill/Models/Extension.php | 18 +++++++----------- system/typemill/Static/Plugins.php | 2 +- system/typemill/author/js/vue-plugins.js | 5 +++++ system/typemill/system.php | 1 - 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/composer.lock b/composer.lock index f5438a2..3eb0bf5 100644 --- a/composer.lock +++ b/composer.lock @@ -2136,16 +2136,16 @@ }, { "name": "symfony/yaml", - "version": "v5.4.30", + "version": "v5.4.31", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "c6980e82a6656f6ebfabfd82f7585794cb122554" + "reference": "f387675d7f5fc4231f7554baa70681f222f73563" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/c6980e82a6656f6ebfabfd82f7585794cb122554", - "reference": "c6980e82a6656f6ebfabfd82f7585794cb122554", + "url": "https://api.github.com/repos/symfony/yaml/zipball/f387675d7f5fc4231f7554baa70681f222f73563", + "reference": "f387675d7f5fc4231f7554baa70681f222f73563", "shasum": "" }, "require": { @@ -2191,7 +2191,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.4.30" + "source": "https://github.com/symfony/yaml/tree/v5.4.31" }, "funding": [ { @@ -2207,7 +2207,7 @@ "type": "tidelift" } ], - "time": "2023-10-27T18:36:14+00:00" + "time": "2023-11-03T14:41:28+00:00" }, { "name": "twig/twig", diff --git a/system/typemill/Assets.php b/system/typemill/Assets.php index e3d5c59..2421f44 100644 --- a/system/typemill/Assets.php +++ b/system/typemill/Assets.php @@ -91,7 +91,7 @@ class Assets public function activateVue() { - $vueUrl = ''; + $vueUrl = ''; if(!in_array($vueUrl, $this->JS)) { $this->JS[] = $vueUrl; @@ -100,7 +100,7 @@ class Assets public function activateAxios() { - $axiosUrl = ''; + $axiosUrl = ''; if(!in_array($axiosUrl, $this->JS)) { $this->JS[] = $axiosUrl; diff --git a/system/typemill/Models/Extension.php b/system/typemill/Models/Extension.php index 46232d0..2645af2 100644 --- a/system/typemill/Models/Extension.php +++ b/system/typemill/Models/Extension.php @@ -128,18 +128,14 @@ class Extension public function getPlugins() { - $pluginFolder = $this->storage->getFolderPath('pluginsFolder'); - $pluginFolderC = scandir($pluginFolder); - $plugins = []; - foreach ($pluginFolderC as $key => $plugin) + + $pluginlist = \Typemill\Static\Plugins::loadPlugins(); + + $plugins = []; + + foreach($pluginlist as $plugin) { - if (!in_array($plugin, [".",".."])) - { - if (is_dir($pluginFolder . DIRECTORY_SEPARATOR . $plugin)) - { - $plugins[] = $plugin; - } - } + $plugins[] = $plugin['name']; } return $plugins; diff --git a/system/typemill/Static/Plugins.php b/system/typemill/Static/Plugins.php index b873c99..59fc798 100644 --- a/system/typemill/Static/Plugins.php +++ b/system/typemill/Static/Plugins.php @@ -9,7 +9,7 @@ class Plugins $rootpath = getcwd(); $pluginFolder = self::scanPluginFolder($rootpath); $classNames = []; - + # iterate over plugin folders foreach($pluginFolder as $plugin) { diff --git a/system/typemill/author/js/vue-plugins.js b/system/typemill/author/js/vue-plugins.js index 429955d..7be8f2f 100644 --- a/system/typemill/author/js/vue-plugins.js +++ b/system/typemill/author/js/vue-plugins.js @@ -139,6 +139,11 @@ const app = Vue.createApp({ methods: { getActiveClass(pluginname) { + if(typeof this.formData[pluginname] == "undefined") + { + console.info(pluginname); + return; + } if(this.formData[pluginname]['active']) { return 'bg-stone-200 dark:bg-stone-900'; diff --git a/system/typemill/system.php b/system/typemill/system.php index 3e5e65f..79ad182 100644 --- a/system/typemill/system.php +++ b/system/typemill/system.php @@ -58,7 +58,6 @@ $settings = $settingsModel->loadSettings(); /**************************** * HANDLE DISPLAY ERRORS * ****************************/ - if(isset($settings['displayErrorDetails']) && $settings['displayErrorDetails']) { ini_set('display_errors', 1);