From c1530394570b518261f9242510d23e9a93357972 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 22 Mar 2017 17:29:47 -0600 Subject: [PATCH] Fixed loading issues with improperly named themes #1373 --- system/src/Grav/Common/Themes.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/system/src/Grav/Common/Themes.php b/system/src/Grav/Common/Themes.php index b988179938..4ce6162b75 100644 --- a/system/src/Grav/Common/Themes.php +++ b/system/src/Grav/Common/Themes.php @@ -316,6 +316,15 @@ protected function autoloadTheme($class) // Remove prefix from class $class = substr($class, strlen($prefix)); + // Try Old style theme classes + $path = strtolower(ltrim(preg_replace('#\\\|_(?!.+\\\)#', '/', $class), '/')); + $file = $this->grav['locator']->findResource("themes://{$path}/{$path}.php"); + + // Load class + if (file_exists($file)) { + return include_once($file); + } + // Replace namespace tokens to directory separators $path = $this->grav['inflector']->hyphenize(ltrim($class,"\\")); $file = $this->grav['locator']->findResource("themes://{$path}/{$path}.php");