28 lines
590 B
PHP
28 lines
590 B
PHP
<?php
|
|
|
|
namespace MathCaptcha;
|
|
|
|
/**
|
|
* Autoloader
|
|
*/
|
|
function mathcaptchaAutoload($className)
|
|
{
|
|
$prefix = __NAMESPACE__ . '\\';
|
|
$prefixLength = strlen($prefix);
|
|
if (0 === strpos($className, $prefix))
|
|
{
|
|
$parts = explode('\\', substr($className, $prefixLength));
|
|
$filepath = __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'MathCaptcha' . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $parts) . '.php';
|
|
|
|
if (is_file($filepath))
|
|
{
|
|
require $filepath;
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|