2012-05-24 00:09:54 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Bootstrapping File for phpseclib Test Suite
|
|
|
|
*
|
|
|
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Set up include path accordingly. This is especially required because some
|
|
|
|
// class files of phpseclib require() other dependencies.
|
|
|
|
set_include_path(implode(PATH_SEPARATOR, array(
|
|
|
|
dirname(__FILE__) . '/../phpseclib/',
|
2013-01-03 17:43:08 +00:00
|
|
|
dirname(__FILE__) . '/',
|
2012-05-24 00:09:54 +00:00
|
|
|
get_include_path(),
|
|
|
|
)));
|
2012-05-24 01:00:06 +00:00
|
|
|
|
2013-01-03 17:43:08 +00:00
|
|
|
function phpseclib_is_includable($suffix)
|
|
|
|
{
|
|
|
|
foreach (explode(PATH_SEPARATOR, get_include_path()) as $prefix)
|
|
|
|
{
|
|
|
|
$ds = substr($prefix, -1) == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR;
|
|
|
|
$file = $prefix . $ds . $suffix;
|
|
|
|
|
|
|
|
if (file_exists($file))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-05-24 01:00:06 +00:00
|
|
|
function phpseclib_autoload($class)
|
|
|
|
{
|
|
|
|
$file = str_replace('_', '/', $class) . '.php';
|
|
|
|
|
2013-01-03 17:43:08 +00:00
|
|
|
if (phpseclib_is_includable($file))
|
|
|
|
{
|
|
|
|
require $file;
|
|
|
|
}
|
2012-05-24 01:00:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
spl_autoload_register('phpseclib_autoload');
|