diff --git a/www/composer.lock b/www/composer.lock index faecd3f1..ece22d7f 100644 --- a/www/composer.lock +++ b/www/composer.lock @@ -38,16 +38,16 @@ }, { "name": "gullevek/dotenv", - "version": "v2.0.8", + "version": "v2.1.0", "source": { "type": "git", "url": "https://github.com/gullevek/dotEnv.git", - "reference": "e29f9fcd8853a09bb89b0eb8ee555b754ecee36e" + "reference": "b9feacaded4e48effff9da7d1173752aef3dc27f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/gullevek/dotEnv/zipball/e29f9fcd8853a09bb89b0eb8ee555b754ecee36e", - "reference": "e29f9fcd8853a09bb89b0eb8ee555b754ecee36e", + "url": "https://api.github.com/repos/gullevek/dotEnv/zipball/b9feacaded4e48effff9da7d1173752aef3dc27f", + "reference": "b9feacaded4e48effff9da7d1173752aef3dc27f", "shasum": "" }, "require": { @@ -86,9 +86,9 @@ ], "support": { "issues": "https://github.com/gullevek/dotEnv/issues", - "source": "https://github.com/gullevek/dotEnv/tree/v2.0.8" + "source": "https://github.com/gullevek/dotEnv/tree/v2.1.0" }, - "time": "2023-03-03T00:32:02+00:00" + "time": "2024-08-21T02:41:15+00:00" }, { "name": "psr/log", diff --git a/www/lib/CoreLibs/Template/SmartyExtend.php b/www/lib/CoreLibs/Template/SmartyExtend.php index 94870661..e9b906d6 100644 --- a/www/lib/CoreLibs/Template/SmartyExtend.php +++ b/www/lib/CoreLibs/Template/SmartyExtend.php @@ -203,7 +203,8 @@ class SmartyExtend extends \Smarty _bind_textdomain_codeset($this->domain, $this->encoding); // register smarty variable - $this->registerPlugin('modifier', 'getvar', [&$this, 'getTemplateVars']); + // $this->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'getvar', [&$this, 'getTemplateVars']); + $this->registerPlugin(self::PLUGIN_MODIFIER, 'getvar', [&$this, 'getTemplateVars']); $this->page_name = \CoreLibs\Get\System::getPageName(); diff --git a/www/vendor/composer/installed.json b/www/vendor/composer/installed.json index fee99149..9d57f961 100644 --- a/www/vendor/composer/installed.json +++ b/www/vendor/composer/installed.json @@ -35,17 +35,17 @@ }, { "name": "gullevek/dotenv", - "version": "v2.0.8", - "version_normalized": "2.0.8.0", + "version": "v2.1.0", + "version_normalized": "2.1.0.0", "source": { "type": "git", "url": "https://github.com/gullevek/dotEnv.git", - "reference": "e29f9fcd8853a09bb89b0eb8ee555b754ecee36e" + "reference": "b9feacaded4e48effff9da7d1173752aef3dc27f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/gullevek/dotEnv/zipball/e29f9fcd8853a09bb89b0eb8ee555b754ecee36e", - "reference": "e29f9fcd8853a09bb89b0eb8ee555b754ecee36e", + "url": "https://api.github.com/repos/gullevek/dotEnv/zipball/b9feacaded4e48effff9da7d1173752aef3dc27f", + "reference": "b9feacaded4e48effff9da7d1173752aef3dc27f", "shasum": "" }, "require": { @@ -56,7 +56,7 @@ "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^9" }, - "time": "2023-03-03T00:32:02+00:00", + "time": "2024-08-21T02:41:15+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -86,7 +86,7 @@ ], "support": { "issues": "https://github.com/gullevek/dotEnv/issues", - "source": "https://github.com/gullevek/dotEnv/tree/v2.0.8" + "source": "https://github.com/gullevek/dotEnv/tree/v2.1.0" }, "install-path": "../gullevek/dotenv" }, diff --git a/www/vendor/composer/installed.php b/www/vendor/composer/installed.php index ab34286a..d29dc657 100644 --- a/www/vendor/composer/installed.php +++ b/www/vendor/composer/installed.php @@ -29,9 +29,9 @@ 'dev_requirement' => false, ), 'gullevek/dotenv' => array( - 'pretty_version' => 'v2.0.8', - 'version' => '2.0.8.0', - 'reference' => 'e29f9fcd8853a09bb89b0eb8ee555b754ecee36e', + 'pretty_version' => 'v2.1.0', + 'version' => '2.1.0.0', + 'reference' => 'b9feacaded4e48effff9da7d1173752aef3dc27f', 'type' => 'library', 'install_path' => __DIR__ . '/../gullevek/dotenv', 'aliases' => array(), diff --git a/www/vendor/gullevek/dotenv/Readme.md b/www/vendor/gullevek/dotenv/Readme.md index 56a498f6..a3ca819d 100644 --- a/www/vendor/gullevek/dotenv/Readme.md +++ b/www/vendor/gullevek/dotenv/Readme.md @@ -61,6 +61,29 @@ DOUBLE="I will be used" DOUBLE="This will be ignored" ``` +A prefix name can be set with `[PrefixName]`. Tne name rules are like for variables, but spaces +are allowed, but will be converted to "_". +The prefix is valid from the time set until the next prefix block appears or the file ends. + +Example + +```ini +FOO="bar" +FOOBAR="bar bar" +[SecitonA] +FOO="other bar" +FOOBAR="other bar bar" +``` + +Will have environmen variables as + +```php +$_ENV["FOO"]; +$_ENV["FOOBAR"]; +$_ENV["SecitonA.FOO"]; +$_ENV["SecitonA.FOOBAR"]; +``` + ## Development ### Phan diff --git a/www/vendor/gullevek/dotenv/src/DotEnv.php b/www/vendor/gullevek/dotenv/src/DotEnv.php index 6dd878ca..01868f82 100644 --- a/www/vendor/gullevek/dotenv/src/DotEnv.php +++ b/www/vendor/gullevek/dotenv/src/DotEnv.php @@ -22,6 +22,9 @@ class DotEnv * if there are two variables with the same name only the first is used * variables are case sensitive * + * [] Grouping Block Name as prefix until next or end if set, + * space replaced by _, all other var rules apply + * * @param string $path Folder to file, default is __DIR__ * @param string $env_file What file to load, default is .env * @return int -1 other error @@ -56,10 +59,14 @@ class DotEnv $status = 1; $block = false; $var = ''; + $prefix_name = ''; while ($line = fgets($fp)) { - // main match for variable = value part - if (preg_match("/^\s*([\w_.]+)\s*=\s*((\"?).*)/", $line, $matches)) { - $var = $matches[1]; + // [] block must be a single line, or it will be ignored + if (preg_match("/^\s*\[([\w_.\s]+)\]/", $line, $matches)) { + $prefix_name = preg_replace("/\s+/", "_", $matches[1]) . "."; + } elseif (preg_match("/^\s*([\w_.]+)\s*=\s*((\"?).*)/", $line, $matches)) { + // main match for variable = value part + $var = $prefix_name . $matches[1]; $value = $matches[2]; $quotes = $matches[3]; // write only if env is not set yet, and write only the first time