initial commit

This commit is contained in:
logsol 2011-04-08 03:27:38 +12:00
commit f2ff442d8a
21 changed files with 1559 additions and 0 deletions

View file

@ -0,0 +1,51 @@
<?php
/**
* Autoloader
* Loads class files automatically when they are needed.
*
* @author Karl Pannek <info@katharsis.in>
* @version 0.5.2
* @package Katharsis
*/
class Katharsis_Autoload
{
/**
* @var array
*/
protected static $_classLocations = array(
'library',
'application/controller',
'application/model'
);
/**
* Registering autoload method
*
* @return void
*/
public static function init()
{
spl_autoload_register('Katharsis_Autoload::autoload');
}
/**
* Actual autoload method. Loads class files automatically when they are needed
*
* @return void
*/
public static function autoload($classname)
{
$name = str_replace("_", DIRECTORY_SEPARATOR, $classname);
foreach(self::$_classLocations as $location)
{
if(file_exists($location . DIRECTORY_SEPARATOR . $name . ".php"))
{
require_once $location . DIRECTORY_SEPARATOR . $name . ".php";
return;
}
}
die('Autoload: could not load class "' . $classname . '"');
}
}