From fbf726b45effff8cd3e4d9ecb829c877e674e02a Mon Sep 17 00:00:00 2001 From: Awilum Date: Fri, 1 Feb 2019 18:25:05 +0300 Subject: [PATCH] Flextype Core: Entries - code fixes according Scrutinizer Tests. --- flextype/Entries.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/flextype/Entries.php b/flextype/Entries.php index 9bc8d174..4e417e14 100755 --- a/flextype/Entries.php +++ b/flextype/Entries.php @@ -312,6 +312,8 @@ class Entries { Http::setResponseStatus(404); + $entry = []; + $entry['title'] = Registry::get('settings.entries.error404.title'); $entry['description'] = Registry::get('settings.entries.error404.description'); $entry['content'] = Registry::get('settings.entries.error404.content'); @@ -334,7 +336,11 @@ class Entries public static function processEntry(string $file_path, bool $raw = false, bool $ignore_content = false) { // Get entry from file - $entry = trim(Filesystem::read($file_path)); + if ($entry_content = Filesystem::read($file_path)) { + $entry = $entry_content; + } + + $entry = trim($entry); // Return raw entry if $raw is true if ($raw) { @@ -346,9 +352,6 @@ class Entries $entry_frontmatter = $entry['matter']; $entry_content = $entry['body']; - // Create empty $_entry - $_entry = []; - // Process $entry_frontmatter with YAML and Shortcodes parsers $_entry = YamlParser::decode(Shortcodes::process($entry_frontmatter));