12 namespace fpoirotte\XRL;
43 public static function load($class)
45 if (strpos($class,
':') !==
false) {
46 throw new \Exception(
'Possible remote execution attempt');
49 $class = ltrim($class,
'\\');
50 if (strncmp($class,
'fpoirotte\\XRL\\', 14)) {
54 $class = substr($class, 14);
55 $class = str_replace(array(
'_',
'\\'), DIRECTORY_SEPARATOR, $class);
56 if (!strncmp($class,
'tests\\', 6)) {
57 $path = dirname(__DIR__);
61 require($path . DIRECTORY_SEPARATOR . $class .
'.php');
62 $res = (class_exists($class,
false) || interface_exists($class,
false));
72 public static function register()
74 static $registered =
false;
77 spl_autoload_register(array(__CLASS__,
"load"));
An helper class that wraps XRL's autoloader.