From c976543cbb229f7a7b8dc44e418b9e13969d159b Mon Sep 17 00:00:00 2001 From: Awilum Date: Wed, 27 Feb 2019 15:01:24 +0300 Subject: [PATCH] Flextype Slim Integration - next round of integration --- flextype/Themes.php | 78 ++---------------------------------------- flextype/bootstrap.php | 2 +- 2 files changed, 4 insertions(+), 76 deletions(-) diff --git a/flextype/Themes.php b/flextype/Themes.php index f7f1aae1..fda9e722 100644 --- a/flextype/Themes.php +++ b/flextype/Themes.php @@ -18,48 +18,12 @@ use Flextype\Component\Registry\Registry; class Themes { - /** - * An instance of the Themes class - * - * @var object - */ - private static $instance = null; - - /** - * Private clone method to enforce singleton behavior. - * - * @access private - */ - private function __clone() - { - } - - /** - * Private wakeup method to enforce singleton behavior. - * - * @access private - */ - private function __wakeup() - { - } - /** * Private construct method to enforce singleton behavior. * * @access private */ - private function __construct() - { - Themes::init(); - } - - /** - * Init Themes - * - * @access private - * @return void - */ - private static function init() : void + public function __construct() { // Get current theme $theme = Registry::get('settings.theme'); @@ -86,27 +50,6 @@ class Themes } } - /** - * Get themes view - * - * @param string $template Template file - * @param string $variables Variables - * @access public - * @return object - */ - public static function view(string $template, array $variables = []) - { - // Set view file - // From current theme folder or from plugin folder - if (Filesystem::has(PATH['themes'] . '/' . Registry::get('settings.theme') . '/views/' . $template . View::$view_ext)) { - $template = PATH['themes'] . '/' . Registry::get('settings.theme') . '/views/' . $template; - } else { - $template = PATH['plugins'] . '/' . $template; - } - - // Return template - return new View($template, $variables); - } /** * Get partials for current theme @@ -114,7 +57,7 @@ class Themes * @access public * @return array */ - public static function getPartials() : array + public function getPartials() : array { $partials = []; @@ -140,7 +83,7 @@ class Themes * @access public * @return array */ - public static function getTemplates() : array + public function getTemplates() : array { $templates = []; @@ -159,19 +102,4 @@ class Themes // return templates return $templates; } - - /** - * Get the Themes instance. - * - * @access public - * @return object - */ - public static function getInstance() - { - if (is_null(Themes::$instance)) { - Themes::$instance = new self; - } - - return Themes::$instance; - } } diff --git a/flextype/bootstrap.php b/flextype/bootstrap.php index b505d026..4f851e83 100755 --- a/flextype/bootstrap.php +++ b/flextype/bootstrap.php @@ -100,7 +100,7 @@ Session::start(); Cache::getInstance(); // Get Themes Instance -Themes::getInstance(); +//Themes::getInstance(); // Configure application $config = [