Fix Markdown %meta.*% replacement

Don't even try to use arrays here...
This commit is contained in:
Daniel Rudolf 2015-10-28 01:08:45 +01:00
parent a654b1585b
commit de6b3a7c28

View file

@ -754,10 +754,13 @@ class Pico
$content = str_replace('%theme_url%', $themeUrl, $content);
// replace %meta.*%
$metaKeys = array_map(function ($metaKey) {
return '%meta.' . $metaKey . '%';
}, array_keys($this->meta));
$metaValues = array_values($this->meta);
$metaKeys = $metaValues = array();
foreach ($this->meta as $metaKey => $metaValue) {
if (is_scalar($metaValue) || ($metaValue === null)) {
$metaKeys[] = '%meta.' . $metaKey . '%';
$metaValues[] = strval($metaValue);
}
}
$content = str_replace($metaKeys, $metaValues, $content);
return $content;