40 throw new \Exception(
'Cloning this class is forbidden');
49 public static function register()
51 if (self::$instance === null) {
52 self::$instance =
new static();
53 spl_autoload_register(array(self::$instance,
'load'));
72 public function load($class)
74 $class = ltrim($class,
'\\');
75 if (strncasecmp($class,
'Plop\\', 4)) {
79 if (strpos($class,
'://') !==
false) {
80 throw new \Exception(
'Possible exploitation attempt detected');
83 $class = str_replace(array(
'_',
'\\'), DIRECTORY_SEPARATOR, substr($class, 5));
84 require_once(__DIR__ . DIRECTORY_SEPARATOR . $class .
'.php');
__clone()
This class may not be cloned.
static $instance
Singleton to prevent multiple registrations.
An autoloader for Plop's classes.
__construct()
Prevent direct construction of this class.