Skip to content

Commit

Permalink
Fixed loading issues with improperly named themes #1373
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Mar 22, 2017
1 parent 88ccc25 commit c153039
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions system/src/Grav/Common/Themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit c153039

Please sign in to comment.