|
1 | | -<?php |
2 | | - |
3 | | -if (!\defined('RAINLOOP_APP_LIBRARIES_PATH')) |
4 | | -{ |
5 | | - \define('RAINLOOP_APP_PATH', \rtrim(\realpath(__DIR__), '\\/').'/'); |
6 | | - \define('RAINLOOP_APP_LIBRARIES_PATH', RAINLOOP_APP_PATH.'libraries/'); |
7 | | - \define('RAINLOOP_MB_SUPPORTED', \function_exists('mb_strtoupper')); |
8 | | - |
9 | | - \define('RAINLOOP_INCLUDE_AS_API_DEF', isset($_ENV['RAINLOOP_INCLUDE_AS_API']) && $_ENV['RAINLOOP_INCLUDE_AS_API']); |
10 | | - |
11 | | - if (!defined('RL_BACKWARD_CAPABILITY')) |
12 | | - { |
13 | | - \define('RL_BACKWARD_CAPABILITY', true); |
14 | | - include_once RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/Common/BackwardCapability/Account.php'; |
15 | | - } |
16 | | - |
17 | | - /** |
18 | | - * @param string $sClassName |
19 | | - * |
20 | | - * @return mixed |
21 | | - */ |
22 | | - function rainLoopSplAutoloadNamespaces() |
23 | | - { |
24 | | - return RAINLOOP_INCLUDE_AS_API_DEF ? array('RainLoop', 'Predis') : |
25 | | - array('RainLoop', 'Facebook', 'GuzzleHttp', 'PHPThumb', 'Predis', 'SabreForRainLoop', 'Imagine', 'Detection'); |
26 | | - } |
27 | | - |
28 | | - /** |
29 | | - * @param string $sClassName |
30 | | - * |
31 | | - * @return mixed |
32 | | - */ |
33 | | - function rainLoopSplAutoloadRegisterFunction($sClassName) |
34 | | - { |
35 | | - if ($sClassName && '\\' === $sClassName[0]) |
36 | | - { |
37 | | - $sClassName = \substr($sClassName, 1); |
38 | | - } |
39 | | - |
40 | | - foreach (rainLoopSplAutoloadNamespaces() as $sNamespaceName) |
41 | | - { |
42 | | - if (0 === \strpos($sClassName, $sNamespaceName.'\\')) |
43 | | - { |
44 | | - $sPrefix = ''; |
45 | | - if ('Detection' === $sNamespaceName) |
46 | | - { |
47 | | - $sPrefix = 'Mobile_Detect/namespaced/'; |
48 | | - } |
49 | | - |
50 | | - if ('SabreForRainLoop' === $sNamespaceName && !RAINLOOP_MB_SUPPORTED && !defined('RL_MB_FIXED')) |
51 | | - { |
52 | | - \define('RL_MB_FIXED', true); |
53 | | - include_once RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/Common/MbStringFix.php'; |
54 | | - } |
55 | | - |
56 | | - return include RAINLOOP_APP_LIBRARIES_PATH.$sPrefix.\strtr($sClassName, '\\', '/').'.php'; |
57 | | - } |
58 | | - } |
59 | | - |
60 | | - return false; |
61 | | - } |
62 | | - |
63 | | - \spl_autoload_register('rainLoopSplAutoloadRegisterFunction', false); |
64 | | -} |
65 | | - |
66 | | -if (\class_exists('RainLoop\Api')) |
67 | | -{ |
68 | | - if (!\class_exists('MailSo\Version', false)) |
69 | | - { |
70 | | - include APP_VERSION_ROOT_PATH.'app/libraries/MailSo/MailSo.php'; |
71 | | - } |
72 | | - |
73 | | - if (!\function_exists('spyc_load_file')) |
74 | | - { |
75 | | - include APP_VERSION_ROOT_PATH.'app/libraries/spyc/Spyc.php'; |
76 | | - } |
77 | | - |
78 | | - if (\class_exists('MailSo\Version')) |
79 | | - { |
80 | | - if (RAINLOOP_INCLUDE_AS_API_DEF) |
81 | | - { |
82 | | - if (!\defined('APP_API_STARTED')) |
83 | | - { |
84 | | - \define('APP_API_STARTED', true); |
85 | | - |
86 | | - \RainLoop\Api::Handle(); |
87 | | - } |
88 | | - } |
89 | | - else if (!\defined('APP_STARTED')) |
90 | | - { |
91 | | - \define('APP_STARTED', true); |
92 | | - |
93 | | - \RainLoop\Api::Handle(); |
94 | | - \RainLoop\Service::Handle(); |
95 | | - |
96 | | - \RainLoop\Api::ExitOnEnd(); |
97 | | - } |
98 | | - } |
99 | | -} |
100 | | -else if (\function_exists('rainLoopSplAutoloadRegisterFunction')) |
101 | | -{ |
102 | | - \spl_autoload_unregister('rainLoopSplAutoloadRegisterFunction'); |
103 | | -} |
| 1 | +<?php |
| 2 | + |
| 3 | +if (!\defined('RAINLOOP_APP_LIBRARIES_PATH')) |
| 4 | +{ |
| 5 | + \define('RAINLOOP_APP_PATH', \rtrim(\realpath(__DIR__), '\\/').'/'); |
| 6 | + \define('RAINLOOP_APP_LIBRARIES_PATH', RAINLOOP_APP_PATH.'libraries/'); |
| 7 | + \define('RAINLOOP_MB_SUPPORTED', \function_exists('mb_strtoupper')); |
| 8 | + |
| 9 | + \define('RAINLOOP_INCLUDE_AS_API_DEF', isset($_ENV['RAINLOOP_INCLUDE_AS_API']) && $_ENV['RAINLOOP_INCLUDE_AS_API']); |
| 10 | + |
| 11 | + if (!defined('RL_BACKWARD_CAPABILITY')) |
| 12 | + { |
| 13 | + \define('RL_BACKWARD_CAPABILITY', true); |
| 14 | + include_once RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/Common/BackwardCapability/Account.php'; |
| 15 | + } |
| 16 | + |
| 17 | + /** |
| 18 | + * @param string $sClassName |
| 19 | + * |
| 20 | + * @return mixed |
| 21 | + */ |
| 22 | + function rainLoopSplAutoloadNamespaces() |
| 23 | + { |
| 24 | + return RAINLOOP_INCLUDE_AS_API_DEF ? array('RainLoop', 'Predis') : |
| 25 | + array('RainLoop', 'Facebook', 'GuzzleHttp', 'PHPThumb', 'Predis', 'SabreForRainLoop', 'Imagine', 'Detection'); |
| 26 | + } |
| 27 | + |
| 28 | + /** |
| 29 | + * @param string $sClassName |
| 30 | + * |
| 31 | + * @return mixed |
| 32 | + */ |
| 33 | + function rainLoopSplAutoloadRegisterFunction($sClassName) |
| 34 | + { |
| 35 | + if ($sClassName && '\\' === $sClassName[0]) |
| 36 | + { |
| 37 | + $sClassName = \substr($sClassName, 1); |
| 38 | + } |
| 39 | + |
| 40 | + foreach (rainLoopSplAutoloadNamespaces() as $sNamespaceName) |
| 41 | + { |
| 42 | + if (0 === \strpos($sClassName, $sNamespaceName.'\\')) |
| 43 | + { |
| 44 | + $sPrefix = ''; |
| 45 | + if ('Detection' === $sNamespaceName) |
| 46 | + { |
| 47 | + $sPrefix = 'Mobile_Detect/namespaced/'; |
| 48 | + } |
| 49 | + |
| 50 | + if ('SabreForRainLoop' === $sNamespaceName && !RAINLOOP_MB_SUPPORTED && !defined('RL_MB_FIXED')) |
| 51 | + { |
| 52 | + \define('RL_MB_FIXED', true); |
| 53 | + include_once RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/Common/MbStringFix.php'; |
| 54 | + } |
| 55 | + |
| 56 | + return include RAINLOOP_APP_LIBRARIES_PATH.$sPrefix.\strtr($sClassName, '\\', '/').'.php'; |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + return false; |
| 61 | + } |
| 62 | + |
| 63 | + \spl_autoload_register('rainLoopSplAutoloadRegisterFunction', false); |
| 64 | +} |
| 65 | + |
| 66 | +if (\class_exists('RainLoop\Api')) |
| 67 | +{ |
| 68 | + if (!\class_exists('MailSo\Version', false)) |
| 69 | + { |
| 70 | + include APP_VERSION_ROOT_PATH.'app/libraries/MailSo/MailSo.php'; |
| 71 | + } |
| 72 | + |
| 73 | + if (!\function_exists('spyc_load_file')) |
| 74 | + { |
| 75 | + include APP_VERSION_ROOT_PATH.'app/libraries/spyc/Spyc.php'; |
| 76 | + } |
| 77 | + |
| 78 | + if (\class_exists('MailSo\Version')) |
| 79 | + { |
| 80 | + if (RAINLOOP_INCLUDE_AS_API_DEF) |
| 81 | + { |
| 82 | + if (!\defined('APP_API_STARTED')) |
| 83 | + { |
| 84 | + \define('APP_API_STARTED', true); |
| 85 | + |
| 86 | + \RainLoop\Api::Handle(); |
| 87 | + } |
| 88 | + } |
| 89 | + else if (!\defined('APP_STARTED')) |
| 90 | + { |
| 91 | + \define('APP_STARTED', true); |
| 92 | + |
| 93 | + \RainLoop\Api::Handle(); |
| 94 | + \RainLoop\Service::Handle(); |
| 95 | + |
| 96 | + \RainLoop\Api::ExitOnEnd(); |
| 97 | + } |
| 98 | + } |
| 99 | +} |
| 100 | +else if (\function_exists('rainLoopSplAutoloadRegisterFunction')) |
| 101 | +{ |
| 102 | + \spl_autoload_unregister('rainLoopSplAutoloadRegisterFunction'); |
| 103 | +} |
0 commit comments