i keep getting the error class cannot be found this is a php error not an exception errror.
so where did i mess up as i cannot locate my error.
class autoload
{
private $autoload_paths = array();
public function __construct($autoload_method)
{
if(strtolower($autoload_method) === true)
{
spl_autoload_register(array($this , 'defualt_engine'));
}
if(strtolower($autoload_method) === false)
{
spl_autoload_unregister(array($this , 'defualt_engine'));
}
if(function_exists($autoload_method) === TRUE)
{
spl_autoload_register($autoload_method);
}
if(is_array($autoload_method) and @method_exists($autoload_method) === TRUE)
{
spl_autoload_register($autoload_method);
}
}
protected function default_engine($classname)
{
if(FALSE === $this->autoload_classes_path($classname))
{
try
{
$this->autoload_error('Fatal Error: "Class '.strtolower($classname).' Could Not Be Located At '. PHP_EOL
.$this->autoload_get_path($classname) , TRUE);
}
catch(autoload_exception $_exception)
{
$_exception->getMessage();
}
}
else
{
$this->autoload_classes_path($classname);
}
if(FALSE === $this->autoload_core_path($classname))
{
try
{
$this->autoload_error('Fatal Error: "Class '.strtolower($classname).' Could Not Be Located At '. PHP_EOL
.$this->autoload_get_path($classname) , TRUE);
}
catch(autoload_exception $_exception)
{
$_exception->getMessage();
}
}
else
{
$this->autoload_core_path($classname);
}
return(FALSE);
}
protected function autoload_classes_path($classname)
{
if(class_exists(strtolower($classname) , FALSE) and is_object(strtolower($classname)))
{
return;
}
if($this->autoload_path_exists(strtolower($classname)) === TRUE)
{
require($this->autoload_get_path($classname));
}
if(file_exists(__CLASSES__ . strtolower($classname). EXT))
{
self::$this->autoload_set_path($classname , __CLASSES__ . strtolower($classname) . EXT);
require(self::$this->autoload_get_path($classname));
return(TRUE);
}
else
{
try
{
$this->autoload_error('Fatal Error: "Class '.strtolower($classname).' Could Not Be Located At '. PHP_EOL
.$this->autoload_get_path($classname));
}
catch(autoload_exception $_exception)
{
$_exception->getMessage();
}
}
return(FALSE);
}
protected function autoload_core_path( $classname)
{
if(class_exists(strtolower($classname) , FALSE) and is_object(strtolower($classname)))
{
return;
}
if($this->autoload_path_exists(strtolower($classname)) === TRUE)
{
require($this->autoload_get_path($classname));
}
if(file_exists(__CORE__ . strtolower($classname . EXT)))
{
$this->autoload_set_path($classname , __CORE__ . strtolower($classname . EXT));
require($this->autoload_get_path($classname));
return(TRUE);
}
else
{
try
{
$this->autoload_error('Fatal Error: "Class '.strtolower($classname).' Could Not Be Located At '. PHP_EOL
.$this->autoload_get_path($classname));
}
catch(autoload_exception $_exception)
{
$_exception->getMessage();
}
}
return(FALSE);
}
protected function autoload_path_exists($classname)
{
if(isset($this->autoload_paths[strtolower($classname)]))
{
return(TRUE);
}
return(FALSE);
}
protected function autoload_set_path($classname , $path_to_class)
{
if($this->autoload_path_exists($classname) === FALSE)
{
return $this->autoload_paths[$classname] = str_replace('\\' , '/' , strtolower($path_to_class));
}
return(FALSE);
}
protected function autoload_get_path($classname)
{
if($this->autoload_path_exists($classname) === TRUE)
{
return $this->autoload_paths[strtolower($classname)];
}
return(FALSE);
}
public function autoload_error($message)
{
require(__CLASSES__ . 'exceptions' . EXT);
throw new autoload_exception($message);
}
}