Detect PHP flexibly, assert wland configuration
[infodrom/musiikki-web.git] / class / autoloader.class.php
1 <?php
2
3 class AutoLoader {
4   public static $loader = false;
5   protected static $classPath = __DIR__;
6
7   public static function init()
8   {
9     if (self::$loader === false)
10       self::$loader = new self();
11   }
12
13   public function __construct()
14   {
15     spl_autoload_register(array($this, 'autoload'));
16   }
17
18   protected function autoload($class)
19   {
20     $path = self::$classPath . '/' . strtolower($class) . '.class.php';
21
22     if (is_readable($path))
23       require_once($path);
24   }
25 }
26
27 AutoLoader::init();