From 4e00c96b71d081a4b0b9ab10dc4bd6259c94d6a9 Mon Sep 17 00:00:00 2001 From: Hung Tran Date: Wed, 21 Jan 2015 19:40:59 -0600 Subject: [PATCH] added support for PSR-4 themes --- src/Theme.php | 10 ++++++---- src/View.php | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Theme.php b/src/Theme.php index c212b59..3f75397 100644 --- a/src/Theme.php +++ b/src/Theme.php @@ -68,12 +68,14 @@ public function getExtended() */ public function getNamespace() { - $namespaces_array = $this->getConfig('autoload.psr-0', false); + if ($namespace = $this->getConfig('autoload.psr-4', false)) { + return key($namespace); + } - if ($namespaces_array === false || empty($namespaces_array)) { - return false; + if ($namespace = $this->getConfig('autoload.psr-0', false)) { + return key($namespace).'\\'; } - return key($namespaces_array); + return false; } } diff --git a/src/View.php b/src/View.php index a91edc3..e2954c1 100644 --- a/src/View.php +++ b/src/View.php @@ -53,7 +53,7 @@ public static function forge(\Foolz\Theme\Builder $builder, $type, $view) // get the View object in case it can be found $theme = $builder->getTheme(); do { - $class = $theme->getNamespace().'\\'.ucfirst($type).'\\'.Util::lowercaseToClassName($view); + $class = $theme->getNamespace().ucfirst($type).'\\'.Util::lowercaseToClassName($view); if (class_exists($class)) { $new = new $class();