Make some configs optional

This commit is contained in:
Miraty 2023-05-30 22:57:39 +02:00
parent 6670711220
commit 51fbcf803e
1 changed files with 6 additions and 4 deletions

View File

@ -34,7 +34,7 @@ if (file_exists(SITE . '/config.ini'))
$config['title'] ??= '';
$config['css'] ??= 1;
$config['header'] ??= false;
$config['author'] ??= '';
$config['author'] ??= NULL;
$config['base-url'] ??= [];
$config['center-index'] ??= false;
$config['default-lang'] ??= NULL;
@ -100,7 +100,7 @@ foreach ($config['base-url'] as $url)
?>
<updated><?= date('c', $files_dates[array_key_last($files_dates)]) ?></updated>
<author>
<name><?= $config['author'] ?></name>
<name><?= $config['author'] ?? '' ?></name>
</author>
<?php
$feed = ob_get_clean();
@ -204,8 +204,10 @@ foreach ($files_dates as $src_page => $last_mod) {
?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="referrer" content="no-referrer">
<meta name="author" content="<?= $config['author'] ?>">
<?php
if (isset($config['author']))
echo '<meta name="author" content="' . $config['author'] . '">';
if ($config['announce-feed'])
echo '<link rel="alternate" type="application/atom+xml" href="' . $relativePathToRoot . 'feed.atom">' . LF;
@ -273,7 +275,7 @@ foreach ($files_dates as $src_page => $last_mod) {
global $config;
global $path_parts;
return ' href="' . $config['base-url'][0] . substr($path_parts['dirname'], strlen(SITE)) . '/' . $matches['relative_url'] . '"';
return ' href="' . ($config['base-url'][0] ?? '') . substr($path_parts['dirname'], strlen(SITE)) . '/' . $matches['relative_url'] . '"';
}, $atom_entry_content);
if (!in_array('draft', explode('.', $path_parts['basename']), true)) {