소스 검색

Fix Markdown %meta.*% replacement

Don't even try to use arrays here...
Daniel Rudolf 9 년 전
부모
커밋
de6b3a7c28
1개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 4
      lib/Pico.php

+ 7 - 4
lib/Pico.php

@@ -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;