Browse Source

Theme loader

Roman Shvets 12 years ago
parent
commit
5943454877
2 changed files with 6 additions and 0 deletions
  1. 1 0
      changelog.txt
  2. 5 0
      lib/pico.php

+ 1 - 0
changelog.txt

@@ -6,6 +6,7 @@
  * [New] Ignore Emacs and Nano tmp files like: "~", "#"; in content folder
  * [New] Ignore hidden files in content folder
  * [Fixed] - empty title/date headers
+ * [Fixed] - Error handling on wrong theme name
 
 2013.05.07 - version 0.6.2
  * [Changed] Replaced glob_recursive with get_files

+ 5 - 0
lib/pico.php

@@ -79,6 +79,11 @@ class Pico {
 		// Load the theme
 		$this->run_hooks('before_twig_register');
 		Twig_Autoloader::register();
+
+        if(!is_dir(THEMES_DIR . $settings['theme'])) {
+            die(sprintf("Can't open defined theme: %s in dir %s", $settings['theme'], THEMES_DIR));
+        }
+
 		$loader = new Twig_Loader_Filesystem(THEMES_DIR . $settings['theme']);
 		$twig = new Twig_Environment($loader, $settings['twig_config']);
 		$twig->addExtension(new Twig_Extension_Debug());