2013-09-25 03:04:44 +08:00
|
|
|
<?php
|
|
|
|
|
2014-05-30 09:42:22 +08:00
|
|
|
if (!\defined('RAINLOOP_APP_LIBRARIES_PATH'))
|
2013-09-25 03:04:44 +08:00
|
|
|
{
|
|
|
|
\define('RAINLOOP_APP_LIBRARIES_PATH', \rtrim(\realpath(__DIR__), '\\/').'/libraries/');
|
2013-12-27 09:00:40 +08:00
|
|
|
\define('RAINLOOP_MB_SUPPORTED', \function_exists('mb_strtoupper'));
|
2013-09-25 03:04:44 +08:00
|
|
|
|
2014-10-15 23:11:50 +08:00
|
|
|
/**
|
|
|
|
* @param string $sClassName
|
|
|
|
*
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
function RainLoopSplAutoloadRegisterFunction($sClassName)
|
|
|
|
{
|
2013-10-03 06:14:31 +08:00
|
|
|
if (0 === \strpos($sClassName, 'RainLoop') && false !== \strpos($sClassName, '\\'))
|
2013-09-25 03:04:44 +08:00
|
|
|
{
|
2013-10-03 06:14:31 +08:00
|
|
|
return include RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/'.\str_replace('\\', '/', \substr($sClassName, 9)).'.php';
|
2013-09-25 03:04:44 +08:00
|
|
|
}
|
2014-07-04 04:11:47 +08:00
|
|
|
else if (0 === \strpos($sClassName, 'Facebook') && false !== \strpos($sClassName, '\\'))
|
|
|
|
{
|
|
|
|
return include RAINLOOP_APP_LIBRARIES_PATH.'Facebook/'.\str_replace('\\', '/', \substr($sClassName, 9)).'.php';
|
|
|
|
}
|
|
|
|
else if (0 === \strpos($sClassName, 'GuzzleHttp') && false !== \strpos($sClassName, '\\'))
|
|
|
|
{
|
|
|
|
return include RAINLOOP_APP_LIBRARIES_PATH.'GuzzleHttp/'.\str_replace('\\', '/', \substr($sClassName, 11)).'.php';
|
|
|
|
}
|
2013-12-20 00:04:56 +08:00
|
|
|
else if (0 === \strpos($sClassName, 'Sabre') && false !== \strpos($sClassName, '\\'))
|
|
|
|
{
|
2013-12-27 09:00:40 +08:00
|
|
|
if (!RAINLOOP_MB_SUPPORTED && !defined('RL_MB_FIXED'))
|
|
|
|
{
|
|
|
|
\define('RL_MB_FIXED', true);
|
2014-04-26 05:50:17 +08:00
|
|
|
include_once RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/Common/MbStringFix.php';
|
2013-12-27 09:00:40 +08:00
|
|
|
}
|
2014-05-30 09:42:22 +08:00
|
|
|
|
2013-12-20 00:04:56 +08:00
|
|
|
return include RAINLOOP_APP_LIBRARIES_PATH.'Sabre/'.\str_replace('\\', '/', \substr($sClassName, 6)).'.php';
|
|
|
|
}
|
2013-09-25 03:04:44 +08:00
|
|
|
|
|
|
|
return false;
|
2014-10-15 23:11:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
\spl_autoload_register('RainLoopSplAutoloadRegisterFunction', false);
|
2014-05-30 09:42:22 +08:00
|
|
|
}
|
2013-09-25 03:04:44 +08:00
|
|
|
|
2014-05-30 09:42:22 +08:00
|
|
|
if (\class_exists('RainLoop\Service'))
|
|
|
|
{
|
|
|
|
if (!\class_exists('MailSo\Version'))
|
2013-09-25 03:04:44 +08:00
|
|
|
{
|
2014-10-15 23:11:50 +08:00
|
|
|
include APP_VERSION_ROOT_PATH.'app/libraries/MailSo/MailSo.php';
|
2014-05-30 09:42:22 +08:00
|
|
|
}
|
2013-09-25 03:04:44 +08:00
|
|
|
|
2014-10-15 23:11:50 +08:00
|
|
|
if (\class_exists('MailSo\Version'))
|
2014-05-30 09:42:22 +08:00
|
|
|
{
|
2014-10-15 23:11:50 +08:00
|
|
|
if (isset($_ENV['RAINLOOP_INCLUDE_AS_API']) && $_ENV['RAINLOOP_INCLUDE_AS_API'] && !\defined('APP_API_STARTED'))
|
2013-09-25 03:04:44 +08:00
|
|
|
{
|
2014-10-15 23:11:50 +08:00
|
|
|
\define('APP_API_STARTED', true);
|
2014-05-30 09:42:22 +08:00
|
|
|
\RainLoop\Api::Handle();
|
|
|
|
}
|
|
|
|
else if (!\defined('APP_STARTED'))
|
|
|
|
{
|
|
|
|
\define('APP_STARTED', true);
|
2014-10-15 23:11:50 +08:00
|
|
|
\RainLoop\Api::Handle();
|
|
|
|
\RainLoop\Service::Handle();
|
2013-09-25 03:04:44 +08:00
|
|
|
}
|
|
|
|
}
|
2014-05-30 09:42:22 +08:00
|
|
|
}
|
2014-10-15 23:11:50 +08:00
|
|
|
else if (\function_exists('RainLoopSplAutoloadRegisterFunction'))
|
|
|
|
{
|
|
|
|
\spl_autoload_unregister('RainLoopSplAutoloadRegisterFunction');
|
|
|
|
}
|
2014-05-30 09:42:22 +08:00
|
|
|
|
|
|
|
return '';
|