12 namespace fpoirotte\XRL;
43 public static function load($class)
47 if (strpos($class,
':') !==
false) {
49 throw new \Exception(
'Possible remote execution attempt');
53 $class = ltrim($class,
'\\');
54 if (strncmp($class,
'fpoirotte\\XRL\\', 14)) {
58 $class = substr($class, 14);
59 if (!strncmp($class,
'tests\\', 6)) {
60 $path = dirname(__DIR__);
65 $class = str_replace(array(
'_',
'\\'), DIRECTORY_SEPARATOR, $class);
66 include($path . DIRECTORY_SEPARATOR . $class .
'.php');
67 $res = (class_exists($class,
false) || interface_exists($class,
false));
77 public static function register()
79 static $registered =
false;
82 spl_autoload_register(array(__CLASS__,
"load"));
An helper class that wraps XRL's autoloader.