2,16 → 2,25 |
|
namespace PointedEars\PHPX; |
|
if (!defined('DIRECTORY_SEPARATOR')) |
{ |
define('DIRECTORY_SEPARATOR', '/'); |
} |
|
function autoload ($class) |
{ |
if (\strpos($class, '..')) |
if (\strpos($class, '..') !== false) |
{ |
throw new \InvalidArgumentException( |
'Refusing to load unsafe class ' . $class); |
"Refusing to load unsafe class '{$class}'"); |
} |
|
require_once \preg_replace('#\\\#', '/', |
\preg_replace('#^' . \preg_quote(__NAMESPACE__) .'#', __DIR__, $class) |
require_once \str_replace('\\', DIRECTORY_SEPARATOR, |
\preg_replace( |
'#^' . \preg_quote(__NAMESPACE__, '#') .'#', |
__DIR__, |
$class |
) |
) . '.php'; |
} |
|