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

Get plugins and themes config #6

This commit is contained in:
Awilum
2018-03-17 14:17:58 +03:00
parent 866fe37b37
commit 15221accb1
2 changed files with 61 additions and 0 deletions

View File

@@ -106,6 +106,9 @@ class Rawilum
// Init I18n
I18n::init();
// Init Themes
Themes::init();
// Init Plugins
Plugins::init();

58
rawilum/Themes.php Normal file
View File

@@ -0,0 +1,58 @@
<?php namespace Rawilum;
use Symfony\Component\Yaml\Yaml;
/**
* @package Rawilum
*
* @author Sergey Romanenko <awilum@yandex.ru>
* @link http://rawilum.org
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Themes
{
/**
* An instance of the Themes class
*
* @var object
*/
protected static $instance = null;
/**
* Init Themes
*
* @access public
* @return mixed
*/
protected function __construct()
{
// Theme Manifest
$theme_manifest = [];
// Get current theme
$theme = Config::get('site.theme');
if (Rawilum::$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);
}
}
/**
* Initialize Rawilum Themes
*
* <code>
* Themes::init();
* </code>
*
* @access public
* @return object
*/
public static function init()
{
return !isset(self::$instance) and self::$instance = new Themes();
}
}