From: Mischa POSLAWSKY Date: Wed, 2 May 2018 12:39:52 +0000 (+0200) Subject: page: replace missing placeholders by warning X-Git-Tag: v3.0~15 X-Git-Url: http://git.shiar.nl/minimedit.git/commitdiff_plain/7b2536e0bef980a9d153522320c14dc5261b4ba4 page: replace missing placeholders by warning --- diff --git a/page.php b/page.php index c6eee87..290a596 100644 --- a/page.php +++ b/page.php @@ -26,7 +26,12 @@ function getoutput($blocks = []) '< \[\[ ([^]]*) \]\] >x', function ($sub) use ($blocks) { list ($placeholder, $name) = $sub; - $html = $blocks[$name]; + if (isset($blocks[$name])) { + $html = $blocks[$name]; + } + else { + $html = ''.$name.' ontbreekt'; + } return sprintf('%s', is_numeric($name) ? '' : $placeholder, # edit replacement preg_replace('{}', '', $html) # contents