cleaned project, repaired router

This commit is contained in:
Logsol 2013-07-08 22:52:36 +02:00
parent 2156d3f5c6
commit bffe0f1660
16 changed files with 1172 additions and 1440 deletions

View file

@ -1,51 +1,40 @@
<?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 . '"');
}
}
<?php
class Katharsis_Autoload
{
protected static $_classLocations = array(
'library',
'application/controller',
'application/model'
);
public static function init()
{
spl_autoload_register('Katharsis_Autoload::autoload');
}
public static function autoload($classname)
{
if($location = self::findClass($classname))
{
require_once $location;
return;
}
throw new exception('Autoload: could not load class "' . $classname . '"');
}
public static function findClass($classname)
{
$name = str_replace("_", DIRECTORY_SEPARATOR, $classname);
foreach(self::$_classLocations as $location)
{
if(file_exists($location . DIRECTORY_SEPARATOR . $name . ".php"))
{
return $location . DIRECTORY_SEPARATOR . $name . ".php";
}
}
return false;
}
}
?>