From 15221accb156c4e68638ea4ec4e4a89c82d522bb Mon Sep 17 00:00:00 2001 From: Awilum Date: Sat, 17 Mar 2018 14:17:58 +0300 Subject: [PATCH] Get plugins and themes config #6 --- rawilum/Rawilum.php | 3 +++ rawilum/Themes.php | 58 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 rawilum/Themes.php diff --git a/rawilum/Rawilum.php b/rawilum/Rawilum.php index 1f280f79..a5f3e32b 100755 --- a/rawilum/Rawilum.php +++ b/rawilum/Rawilum.php @@ -106,6 +106,9 @@ class Rawilum // Init I18n I18n::init(); + // Init Themes + Themes::init(); + // Init Plugins Plugins::init(); diff --git a/rawilum/Themes.php b/rawilum/Themes.php new file mode 100644 index 00000000..9c486ba7 --- /dev/null +++ b/rawilum/Themes.php @@ -0,0 +1,58 @@ + + * @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 + * + * + * Themes::init(); + * + * + * @access public + * @return object + */ + public static function init() + { + return !isset(self::$instance) and self::$instance = new Themes(); + } +}