|
8 | 8 | * License: GNU/GPLv2
|
9 | 9 | * @see LICENSE.txt
|
10 | 10 | *
|
11 |
| - * This file: The loader (last modified: 2023.09.18). |
| 11 | + * This file: The loader (last modified: 2023.09.25). |
12 | 12 | */
|
13 | 13 |
|
14 | 14 | namespace phpMussel\Core;
|
@@ -223,7 +223,7 @@ public function __construct(
|
223 | 223 | if (!is_dir($VendorPath) || !is_readable($VendorPath)) {
|
224 | 224 | if (!isset($_SERVER['DOCUMENT_ROOT'], $_SERVER['SCRIPT_NAME'])) {
|
225 | 225 | /** Further safeguards not possible. Generate exception. */
|
226 |
| - throw new \Exception('Vendor directory is undefined or unreadable.'); |
| 226 | + throw new \Exception('Vendor directory is undefined or unreadable.'); |
227 | 227 | }
|
228 | 228 |
|
229 | 229 |
|
@@ -289,8 +289,7 @@ public function __construct(
|
289 | 289 | $this->Configuration = parse_ini_file($this->ConfigurationPath, true);
|
290 | 290 |
|
291 | 291 | /** Multiline support. */
|
292 |
| - $this->decodeConfigurations(); |
293 |
| - |
| 292 | + $this->decodeForMultilineSupport(); |
294 | 293 | } elseif (preg_match('~\.ya?ml$~i', $this->ConfigurationPath)) {
|
295 | 294 | if ($Configuration = $this->readFile($this->ConfigurationPath)) {
|
296 | 295 | $this->YAML->process($Configuration, $this->Configuration);
|
@@ -432,30 +431,6 @@ public function __construct(
|
432 | 431 | });
|
433 | 432 | }
|
434 | 433 |
|
435 |
| - /** |
436 |
| - * Method to decode the configurations |
437 |
| - * @return void |
438 |
| - */ |
439 |
| - private function decodeConfigurations() : void |
440 |
| - { |
441 |
| - if (is_array($this->Configuration)) { |
442 |
| - foreach ($this->Configuration as $CatKey => &$CatVal) { |
443 |
| - if (is_array($CatVal)) { |
444 |
| - foreach ($CatVal as $DirKey => &$DirVal) { |
445 |
| - if (!is_string($DirVal)) { |
446 |
| - continue; |
447 |
| - } |
448 |
| - $DirVal = str_replace( |
449 |
| - ["\\\\", '\0', '\a', '\b', '\t', '\n', '\v', '\f', '\r', '\e'], |
450 |
| - ["\\", "\0", "\7", "\8", "\t", "\n", "\x0B", "\x0C", "\r", "\x1B"], |
451 |
| - $DirVal |
452 |
| - ); |
453 |
| - } |
454 |
| - } |
455 |
| - } |
456 |
| - } |
457 |
| - } |
458 |
| - |
459 | 434 | /**
|
460 | 435 | * Destruct the loader.
|
461 | 436 | *
|
@@ -1266,6 +1241,33 @@ public function loadShorthandData(): bool
|
1266 | 1241 | return true;
|
1267 | 1242 | }
|
1268 | 1243 |
|
| 1244 | + /** |
| 1245 | + * Decodes for multiline support (needed when using INI configuration files). |
| 1246 | + * |
| 1247 | + * @return void |
| 1248 | + */ |
| 1249 | + private function decodeForMultilineSupport(): void |
| 1250 | + { |
| 1251 | + if (!is_array($this->Configuration)) { |
| 1252 | + return; |
| 1253 | + } |
| 1254 | + foreach ($this->Configuration as $CatKey => &$CatVal) { |
| 1255 | + if (!is_array($CatVal)) { |
| 1256 | + continue; |
| 1257 | + } |
| 1258 | + foreach ($CatVal as $DirKey => &$DirVal) { |
| 1259 | + if (!is_string($DirVal)) { |
| 1260 | + continue; |
| 1261 | + } |
| 1262 | + $DirVal = str_replace( |
| 1263 | + ["\\\\", '\0', '\a', '\b', '\t', '\n', '\v', '\f', '\r', '\e'], |
| 1264 | + ["\\", "\0", "\7", "\8", "\t", "\n", "\x0B", "\x0C", "\r", "\x1B"], |
| 1265 | + $DirVal |
| 1266 | + ); |
| 1267 | + } |
| 1268 | + } |
| 1269 | + } |
| 1270 | + |
1269 | 1271 | /**
|
1270 | 1272 | * Initialise the cache.
|
1271 | 1273 | *
|
|
0 commit comments