bebeboutik/tools/math-captcha/autoloadPrestashop.php
Michael RICOIS 2c870b56f4 Add captcha
2018-03-05 17:05:47 +01:00

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;
}