1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-12 08:04:05 +02:00

Code cleanup and refactoring #5

This commit is contained in:
Awilum
2018-03-23 00:37:30 +03:00
parent dacbcdbe73
commit d399c72e81
5 changed files with 11 additions and 11 deletions

View File

@@ -125,7 +125,7 @@ class Cache
break;
default:
// Create doctrine cache directory if its not exists
!Flextype::$filesystem->exists($cache_directory = CACHE_PATH . '/doctrine/') and Flextype::$filesystem->mkdir($cache_directory);
!Flextype::filesystem()->exists($cache_directory = CACHE_PATH . '/doctrine/') and Flextype::filesystem()->mkdir($cache_directory);
$driver = new \Doctrine\Common\Cache\FilesystemCache($cache_directory);
break;
}
@@ -195,7 +195,7 @@ class Cache
*/
public static function clear()
{
Flextype::$filesystem->remove(CACHE_PATH . '/doctrine/');
Flextype::filesystem()->remove(CACHE_PATH . '/doctrine/');
}
/**

View File

@@ -51,7 +51,7 @@ class Config
*/
protected function __construct()
{
if (Flextype::$filesystem->exists($site_config = CONFIG_PATH . '/' . 'site.yml')) {
if (Flextype::filesystem()->exists($site_config = CONFIG_PATH . '/' . 'site.yml')) {
static::$config['site'] = Yaml::parse(file_get_contents($site_config));
} else {
throw new RuntimeException("Flextype site config file does not exist.");

View File

@@ -9,7 +9,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flextype;
use Arr;
@@ -75,7 +75,7 @@ class Pages
}
// Get 404 page if file not exists
if (Flextype::$filesystem->exists($file)) {
if (Flextype::filesystem()->exists($file)) {
$file = $file;
} else {
$file = PAGES_PATH . '/404/index.md';
@@ -95,7 +95,7 @@ class Pages
$site_theme = Config::get('site.theme');
$template_path = THEMES_PATH . '/' . $site_theme . '/' . $template_name . $template_ext;
if (Flextype::$filesystem->exists($template_path)) {
if (Flextype::filesystem()->exists($template_path)) {
include $template_path;
} else {
throw new RuntimeException("Template {$template_name} does not exist.");
@@ -171,7 +171,7 @@ class Pages
public static function getPages($url = '', $raw = false, $order_by = 'title', $order_type = 'DESC', $limit = null)
{
// Get pages list for current $url
$pages_list = Flextype::$finder->files()->name('*.md')->in(PAGES_PATH . '/' . $url);
$pages_list = Flextype::finder()->files()->name('*.md')->in(PAGES_PATH . '/' . $url);
// Go trough pages list
foreach ($pages_list as $key => $page) {

View File

@@ -9,7 +9,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flextype;
use Symfony\Component\Yaml\Yaml;
@@ -45,7 +45,7 @@ class Plugins
// Go through...
foreach ($plugins_list as $plugin) {
if (Flextype::$filesystem->exists($_plugin = PLUGINS_PATH . '/' . $plugin . '/' . $plugin . '.yml')) {
if (Flextype::filesystem()->exists($_plugin = PLUGINS_PATH . '/' . $plugin . '/' . $plugin . '.yml')) {
$plugins_cache_id .= filemtime($_plugin);
}
}
@@ -65,7 +65,7 @@ class Plugins
// Go through...
foreach ($plugins_list as $plugin) {
if (Flextype::$filesystem->exists($_plugin_manifest = PLUGINS_PATH . '/' . $plugin . '/' . $plugin . '.yml')) {
if (Flextype::filesystem()->exists($_plugin_manifest = PLUGINS_PATH . '/' . $plugin . '/' . $plugin . '.yml')) {
$plugin_manifest = Yaml::parseFile($_plugin_manifest);
}

View File

@@ -37,7 +37,7 @@ class Themes
// Get current theme
$theme = Config::get('site.theme');
if (Flextype::$filesystem->exists($theme_manifest_file = THEMES_PATH . '/' . $theme . '/' . $theme . '.yml')) {
if (Flextype::filesystem()->exists($theme_manifest_file = THEMES_PATH . '/' . $theme . '/' . $theme . '.yml')) {
$theme_manifest = Yaml::parseFile($theme_manifest_file);
Config::set('themes.'.Config::get('site.theme'), $theme_manifest);
}