37 lines
859 B
PHP
37 lines
859 B
PHP
![]() |
<?php
|
||
|
/**
|
||
|
* @copyright NetMonsters <team@netmonsters.ru>
|
||
|
* @link http://netmonsters.ru
|
||
|
* @package Majestic
|
||
|
* @subpackage Load
|
||
|
* @since 2010-02-24
|
||
|
* @version SVN: $Id$
|
||
|
* @filesource $URL$
|
||
|
*/
|
||
|
|
||
|
class Load
|
||
|
{
|
||
|
|
||
|
static protected $autoload;
|
||
|
|
||
|
static public function autoload($class)
|
||
|
{
|
||
|
if (! isset(self::$autoload[$class])) {
|
||
|
throw new MJException('There is no such class "' . $class . '" in autoload.');
|
||
|
}
|
||
|
require(PATH . self::$autoload[$class]);
|
||
|
}
|
||
|
|
||
|
static public function setAutoloadFrom($file)
|
||
|
{
|
||
|
if (! file_exists($file)) {
|
||
|
throw new MJException('Autoload source doesn\'t exists! Try to generate it!');
|
||
|
}
|
||
|
self::$autoload = require($file);
|
||
|
}
|
||
|
|
||
|
static public function getFilePath($class)
|
||
|
{
|
||
|
return self::$autoload[$class];
|
||
|
}
|
||
|
}
|