From 764d9567e4c922534cf3d314acf2c9363728edb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Dufraisse?= Date: Sun, 26 Feb 2023 02:29:25 +0100 Subject: [PATCH] feat(App): manage relative dirs --- App.php | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/App.php b/App.php index 813abe3..3c5beff 100644 --- a/App.php +++ b/App.php @@ -33,6 +33,16 @@ set_error_handler(function ( class App { + /** + * plugins path in vendor + * @var string + */ + public const PLUGINS_PATH = 'vendor/picocms/plugins/'; + /** + * themes path in vendor + * @var string + */ + public const THEMES_PATH = 'vendor/picocms/themes/'; /** * Pico instance. * @var Pico @@ -61,13 +71,22 @@ class App $this->pico = new Pico( $cwd, // root dir $contentFolderFromRoot, // config dir - 'vendor/picocms/plugins/', // plugins dir - 'vendor/picocms/themes/' // themes dir + self::PLUGINS_PATH, // plugins dir + self::THEMES_PATH // themes dir ); } public function runPico(): string { + if (!empty($GLOBALS['PicoVendorsDirectoryRelativeLevels']) && + intval($GLOBALS['PicoVendorsDirectoryRelativeLevels']) > 0){ + $previous = implode('',array_fill(0,intval($GLOBALS['PicoVendorsDirectoryRelativeLevels']),'../')); + $this->pico->setConfig([ + 'themes_url' => $previous.self::THEMES_PATH, + 'plugins_url' => $previous.self::PLUGINS_PATH + ]); + + } return $this->pico->run(); }