diff --git a/flextype/core/Entries.php b/flextype/core/Entries.php index b124db21..baccb658 100755 --- a/flextype/core/Entries.php +++ b/flextype/core/Entries.php @@ -232,26 +232,11 @@ class Entries // Get entries list $entries_list = Filesystem::listContents($entries_path, $bind_recursive); - // Create unique entries $_entries_ids - // 1. Go through all entries - // 2. set all entries IDs and their timestamps into the $_entries_ids - $_entries_ids = ''; - foreach ($entries_list as $current_entry) { - if (strpos($current_entry['path'], $bind_id . '/entry.json') !== false) { - // ignore ... - } else { - if ($current_entry['type'] === 'dir' && Filesystem::has($current_entry['path'] . '/entry.json')) { - if ($timestamp = Filesystem::getTimestamp($current_entry['path'] . '/entry.json')) { - $_entries_ids .= 'entry:' . ltrim(rtrim(str_replace(PATH['entries'], '', $current_entry['path']), '/'), '/') . ' timestamp:' . $timestamp; - } else { - $_entries_ids .= 'entry:' . ltrim(rtrim(str_replace(PATH['entries'], '', $current_entry['path']), '/'), '/'); - } - } - } - } + // Get Entries Timestamp + $entries_timestamp = Filesystem::getDirTimestamp($entries_path); // Create unique entries $cache_id - $cache_id = md5($_entries_ids . + $cache_id = md5($entries_timestamp . $bind_id . ($bind_recursive ? 'true' : 'false') . ($bind_set_max_result ? $bind_set_max_result : 'false') . @@ -280,7 +265,7 @@ class Entries // ignore ... } else { // We are checking... - // Whether the requested entry is a director and whether the file entry.json is in this directory. + // Whether the requested entry is a director and whether the file entry is in this directory. if ($current_entry['type'] === 'dir' && ( // @todo refactoring this Filesystem::has($current_entry['path'] . '/entry.md') || @@ -512,20 +497,6 @@ class Entries return false; } - /** - * Helper method _file_location - * - * @param string $id Entry ID - * - * @return string entry file location - * - * @access private - */ - private function _file_location(string $id) : string - { - return PATH['entries'] . '/' . $id . '/entry.json'; - } - /** * Helper method _dir_location * diff --git a/flextype/core/Plugins.php b/flextype/core/Plugins.php index 0c7e853d..e60c32a5 100755 --- a/flextype/core/Plugins.php +++ b/flextype/core/Plugins.php @@ -92,20 +92,20 @@ class Plugins // Go through... foreach ($plugins_list as $plugin) { - if (Filesystem::has($_plugin_settings = PATH['plugins'] . '/' . $plugin['dirname'] . '/settings.json')) { + if (Filesystem::has($_plugin_settings = PATH['plugins'] . '/' . $plugin['dirname'] . '/settings.yaml')) { if (($content = Filesystem::read($_plugin_settings)) === false) { throw new RuntimeException('Load file: ' . $_plugin_settings . ' - failed!'); } - $plugin_settings = JsonParser::decode($content); + $plugin_settings = Parser::decode($content, 'yaml'); } - if (Filesystem::has($_plugin_config = PATH['plugins'] . '/' . $plugin['dirname'] . '/plugin.json')) { + if (Filesystem::has($_plugin_config = PATH['plugins'] . '/' . $plugin['dirname'] . '/plugin.yaml')) { if (($content = Filesystem::read($_plugin_config)) === false) { throw new RuntimeException('Load file: ' . $_plugin_config . ' - failed!'); } - $plugin_config = JsonParser::decode($content); + $plugin_config = Parser::decode($content, 'yaml'); } $_plugins_config[$plugin['dirname']] = array_merge($plugin_settings, $plugin_config); @@ -148,7 +148,7 @@ class Plugins foreach ($this->locales as $locale => $locale_title) { foreach ($plugins_list as $plugin) { - $language_file = PATH['plugins'] . '/' . $plugin['dirname'] . '/lang/' . $locale . '.json'; + $language_file = PATH['plugins'] . '/' . $plugin['dirname'] . '/lang/' . $locale . '.yaml'; if (! Filesystem::has($language_file)) { continue; } @@ -157,7 +157,7 @@ class Plugins throw new RuntimeException('Load file: ' . $language_file . ' - failed!'); } - I18n::add(JsonParser::decode($content), $locale); + I18n::add(Parser::decode($content, 'yaml'), $locale); } } } @@ -177,8 +177,8 @@ class Plugins // Go through... if (is_array($plugins_list) && count($plugins_list) > 0) { foreach ($plugins_list as $plugin) { - if (! Filesystem::has($_plugin_settings = PATH['plugins'] . '/' . $plugin['dirname'] . '/settings.json') or - ! Filesystem::has($_plugin_config = PATH['plugins'] . '/' . $plugin['dirname'] . '/plugin.json')) { + if (! Filesystem::has($_plugin_settings = PATH['plugins'] . '/' . $plugin['dirname'] . '/settings.yaml') or + ! Filesystem::has($_plugin_config = PATH['plugins'] . '/' . $plugin['dirname'] . '/plugin.yaml')) { continue; } diff --git a/flextype/core/Themes.php b/flextype/core/Themes.php index cb94c2df..fc24cebf 100644 --- a/flextype/core/Themes.php +++ b/flextype/core/Themes.php @@ -57,21 +57,21 @@ class Themes // Go through the themes list... foreach ($themes_list as $theme) { // Get theme settings - if (Filesystem::has($theme_settings_file = PATH['themes'] . '/' . $theme['dirname'] . '/settings.json')) { + if (Filesystem::has($theme_settings_file = PATH['themes'] . '/' . $theme['dirname'] . '/settings.yaml')) { if (($content = Filesystem::read($theme_settings_file)) === false) { throw new RuntimeException('Load file: ' . $theme_settings_file . ' - failed!'); } - $theme_settings = JsonParser::decode($content); + $theme_settings = Parser::decode($content, 'yaml'); } // Get theme manifest - if (Filesystem::has($theme_manifest_file = PATH['themes'] . '/' . $theme['dirname'] . '/theme.json')) { + if (Filesystem::has($theme_manifest_file = PATH['themes'] . '/' . $theme['dirname'] . '/theme.yaml')) { if (($content = Filesystem::read($theme_manifest_file)) === false) { throw new RuntimeException('Load file: ' . $theme_manifest_file . ' - failed!'); } - $theme_manifest = JsonParser::decode($content); + $theme_manifest = Parser::decode($content, 'yaml'); } $themes[$theme['dirname']] = array_merge($theme_settings, $theme_manifest); @@ -104,8 +104,8 @@ class Themes // Go through themes list... if (is_array($themes_list) && count($themes_list) > 0) { foreach ($themes_list as $theme) { - if (! Filesystem::has($_themes_settings = PATH['themes'] . '/' . $theme['dirname'] . '/settings.json') or - ! Filesystem::has($_themes_manifest = PATH['themes'] . '/' . $theme['dirname'] . '/plugin.json')) { + if (! Filesystem::has($_themes_settings = PATH['themes'] . '/' . $theme['dirname'] . '/settings.yaml') or + ! Filesystem::has($_themes_manifest = PATH['themes'] . '/' . $theme['dirname'] . '/plugin.yaml')) { continue; } @@ -137,7 +137,7 @@ class Themes // Go through founded themes foreach ($_themes_list as $theme) { - if ($theme['type'] !== 'dir' || ! Filesystem::has($theme['path'] . '/' . 'theme.json')) { + if ($theme['type'] !== 'dir' || ! Filesystem::has($theme['path'] . '/' . 'theme.yaml')) { continue; }