@@ -6,185 +6,185 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ComposerStaticInit984ed95bef2b0e3d4eeb0208a88dc67d |
| 8 | 8 | { |
| 9 | - public static $files = array ( |
|
| 10 | - '5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php', |
|
| 11 | - '3109cb1a231dcd04bee1f9f620d46975' => __DIR__ . '/..' . '/paragonie/sodium_compat/autoload.php', |
|
| 12 | - ); |
|
| 9 | + public static $files = array ( |
|
| 10 | + '5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php', |
|
| 11 | + '3109cb1a231dcd04bee1f9f620d46975' => __DIR__ . '/..' . '/paragonie/sodium_compat/autoload.php', |
|
| 12 | + ); |
|
| 13 | 13 | |
| 14 | - public static $prefixLengthsPsr4 = array ( |
|
| 15 | - 'T' => |
|
| 16 | - array ( |
|
| 17 | - 'TrustedLogin\\' => 13, |
|
| 18 | - ), |
|
| 19 | - 'P' => |
|
| 20 | - array ( |
|
| 21 | - 'Psr\\Log\\' => 8, |
|
| 22 | - ), |
|
| 23 | - 'K' => |
|
| 24 | - array ( |
|
| 25 | - 'Katzgrau\\KLogger\\' => 17, |
|
| 26 | - 'KatzGrau\\KLogger\\' => 17, |
|
| 27 | - ), |
|
| 28 | - ); |
|
| 14 | + public static $prefixLengthsPsr4 = array ( |
|
| 15 | + 'T' => |
|
| 16 | + array ( |
|
| 17 | + 'TrustedLogin\\' => 13, |
|
| 18 | + ), |
|
| 19 | + 'P' => |
|
| 20 | + array ( |
|
| 21 | + 'Psr\\Log\\' => 8, |
|
| 22 | + ), |
|
| 23 | + 'K' => |
|
| 24 | + array ( |
|
| 25 | + 'Katzgrau\\KLogger\\' => 17, |
|
| 26 | + 'KatzGrau\\KLogger\\' => 17, |
|
| 27 | + ), |
|
| 28 | + ); |
|
| 29 | 29 | |
| 30 | - public static $prefixDirsPsr4 = array ( |
|
| 31 | - 'TrustedLogin\\' => |
|
| 32 | - array ( |
|
| 33 | - 0 => __DIR__ . '/../..' . '/src', |
|
| 34 | - 1 => __DIR__ . '/..' . '/trustedlogin/client/src', |
|
| 35 | - ), |
|
| 36 | - 'Psr\\Log\\' => |
|
| 37 | - array ( |
|
| 38 | - 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', |
|
| 39 | - ), |
|
| 40 | - 'Katzgrau\\KLogger\\' => |
|
| 41 | - array ( |
|
| 42 | - 0 => __DIR__ . '/..' . '/katzgrau/klogger/src', |
|
| 43 | - ), |
|
| 44 | - 'KatzGrau\\KLogger\\' => |
|
| 45 | - array ( |
|
| 46 | - 0 => __DIR__ . '/../..' . '/src', |
|
| 47 | - ), |
|
| 48 | - ); |
|
| 30 | + public static $prefixDirsPsr4 = array ( |
|
| 31 | + 'TrustedLogin\\' => |
|
| 32 | + array ( |
|
| 33 | + 0 => __DIR__ . '/../..' . '/src', |
|
| 34 | + 1 => __DIR__ . '/..' . '/trustedlogin/client/src', |
|
| 35 | + ), |
|
| 36 | + 'Psr\\Log\\' => |
|
| 37 | + array ( |
|
| 38 | + 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', |
|
| 39 | + ), |
|
| 40 | + 'Katzgrau\\KLogger\\' => |
|
| 41 | + array ( |
|
| 42 | + 0 => __DIR__ . '/..' . '/katzgrau/klogger/src', |
|
| 43 | + ), |
|
| 44 | + 'KatzGrau\\KLogger\\' => |
|
| 45 | + array ( |
|
| 46 | + 0 => __DIR__ . '/../..' . '/src', |
|
| 47 | + ), |
|
| 48 | + ); |
|
| 49 | 49 | |
| 50 | - public static $classMap = array ( |
|
| 51 | - 'ComposerAutoloaderInitb5638313a52df4893eb45c04efdaa356' => __DIR__ . '/..' . '/trustedlogin/client/vendor/composer/autoload_real.php', |
|
| 52 | - 'Composer\\Autoload\\ClassLoader' => __DIR__ . '/..' . '/trustedlogin/client/vendor/composer/ClassLoader.php', |
|
| 53 | - 'Composer\\Autoload\\ComposerStaticInitb5638313a52df4893eb45c04efdaa356' => __DIR__ . '/..' . '/trustedlogin/client/vendor/composer/autoload_static.php', |
|
| 54 | - 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', |
|
| 55 | - 'Error' => __DIR__ . '/..' . '/paragonie/random_compat/lib/error_polyfill.php', |
|
| 56 | - 'Katzgrau\\KLogger\\Logger' => __DIR__ . '/..' . '/katzgrau/klogger/src/Logger.php', |
|
| 57 | - 'Katzgrau\\KLogger\\TrustedLogin_Logger' => __DIR__ . '/..' . '/trustedlogin/client/vendor/TrustedLogin/katzgrau/klogger/src/Logger.php', |
|
| 58 | - 'LoggerTest' => __DIR__ . '/..' . '/katzgrau/klogger/tests/LoggerTest.php', |
|
| 59 | - 'ParagonIE\\Sodium\\Compat' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Compat.php', |
|
| 60 | - 'ParagonIE\\Sodium\\Core\\BLAKE2b' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/BLAKE2b.php', |
|
| 61 | - 'ParagonIE\\Sodium\\Core\\ChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/ChaCha20.php', |
|
| 62 | - 'ParagonIE\\Sodium\\Core\\ChaCha20\\Ctx' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/ChaCha20/Ctx.php', |
|
| 63 | - 'ParagonIE\\Sodium\\Core\\ChaCha20\\IetfCtx' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/ChaCha20/IetfCtx.php', |
|
| 64 | - 'ParagonIE\\Sodium\\Core\\Curve25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519.php', |
|
| 65 | - 'ParagonIE\\Sodium\\Core\\Curve25519\\Fe' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519/Fe.php', |
|
| 66 | - 'ParagonIE\\Sodium\\Core\\Curve25519\\Ge\\Cached' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519/Ge/Cached.php', |
|
| 67 | - 'ParagonIE\\Sodium\\Core\\Curve25519\\Ge\\P1p1' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519/Ge/P1p1.php', |
|
| 68 | - 'ParagonIE\\Sodium\\Core\\Curve25519\\Ge\\P2' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519/Ge/P2.php', |
|
| 69 | - 'ParagonIE\\Sodium\\Core\\Curve25519\\Ge\\P3' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519/Ge/P3.php', |
|
| 70 | - 'ParagonIE\\Sodium\\Core\\Curve25519\\Ge\\Precomp' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519/Ge/Precomp.php', |
|
| 71 | - 'ParagonIE\\Sodium\\Core\\Curve25519\\H' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519/H.php', |
|
| 72 | - 'ParagonIE\\Sodium\\Core\\Ed25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Ed25519.php', |
|
| 73 | - 'ParagonIE\\Sodium\\Core\\HChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/HChaCha20.php', |
|
| 74 | - 'ParagonIE\\Sodium\\Core\\HSalsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/HSalsa20.php', |
|
| 75 | - 'ParagonIE\\Sodium\\Core\\Poly1305' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Poly1305.php', |
|
| 76 | - 'ParagonIE\\Sodium\\Core\\Poly1305\\State' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Poly1305/State.php', |
|
| 77 | - 'ParagonIE\\Sodium\\Core\\Salsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Salsa20.php', |
|
| 78 | - 'ParagonIE\\Sodium\\Core\\SipHash' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/SipHash.php', |
|
| 79 | - 'ParagonIE\\Sodium\\Core\\Util' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Util.php', |
|
| 80 | - 'ParagonIE\\Sodium\\Core\\X25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/X25519.php', |
|
| 81 | - 'ParagonIE\\Sodium\\Core\\XChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/XChaCha20.php', |
|
| 82 | - 'ParagonIE\\Sodium\\Core\\Xsalsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Xsalsa20.php', |
|
| 83 | - 'ParagonIE\\Sodium\\Crypto' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Crypto.php', |
|
| 84 | - 'ParagonIE\\Sodium\\File' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/File.php', |
|
| 85 | - 'ParagonIE_Sodium_Compat' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Compat.php', |
|
| 86 | - 'ParagonIE_Sodium_Core32_BLAKE2b' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/BLAKE2b.php', |
|
| 87 | - 'ParagonIE_Sodium_Core32_ChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/ChaCha20.php', |
|
| 88 | - 'ParagonIE_Sodium_Core32_ChaCha20_Ctx' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/ChaCha20/Ctx.php', |
|
| 89 | - 'ParagonIE_Sodium_Core32_ChaCha20_IetfCtx' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/ChaCha20/IetfCtx.php', |
|
| 90 | - 'ParagonIE_Sodium_Core32_Curve25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519.php', |
|
| 91 | - 'ParagonIE_Sodium_Core32_Curve25519_Fe' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519/Fe.php', |
|
| 92 | - 'ParagonIE_Sodium_Core32_Curve25519_Ge_Cached' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519/Ge/Cached.php', |
|
| 93 | - 'ParagonIE_Sodium_Core32_Curve25519_Ge_P1p1' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519/Ge/P1p1.php', |
|
| 94 | - 'ParagonIE_Sodium_Core32_Curve25519_Ge_P2' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519/Ge/P2.php', |
|
| 95 | - 'ParagonIE_Sodium_Core32_Curve25519_Ge_P3' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519/Ge/P3.php', |
|
| 96 | - 'ParagonIE_Sodium_Core32_Curve25519_Ge_Precomp' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519/Ge/Precomp.php', |
|
| 97 | - 'ParagonIE_Sodium_Core32_Curve25519_H' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519/H.php', |
|
| 98 | - 'ParagonIE_Sodium_Core32_Ed25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Ed25519.php', |
|
| 99 | - 'ParagonIE_Sodium_Core32_HChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/HChaCha20.php', |
|
| 100 | - 'ParagonIE_Sodium_Core32_HSalsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/HSalsa20.php', |
|
| 101 | - 'ParagonIE_Sodium_Core32_Int32' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Int32.php', |
|
| 102 | - 'ParagonIE_Sodium_Core32_Int64' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Int64.php', |
|
| 103 | - 'ParagonIE_Sodium_Core32_Poly1305' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Poly1305.php', |
|
| 104 | - 'ParagonIE_Sodium_Core32_Poly1305_State' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Poly1305/State.php', |
|
| 105 | - 'ParagonIE_Sodium_Core32_Salsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Salsa20.php', |
|
| 106 | - 'ParagonIE_Sodium_Core32_SecretStream_State' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/SecretStream/State.php', |
|
| 107 | - 'ParagonIE_Sodium_Core32_SipHash' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/SipHash.php', |
|
| 108 | - 'ParagonIE_Sodium_Core32_Util' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Util.php', |
|
| 109 | - 'ParagonIE_Sodium_Core32_X25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/X25519.php', |
|
| 110 | - 'ParagonIE_Sodium_Core32_XChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/XChaCha20.php', |
|
| 111 | - 'ParagonIE_Sodium_Core32_XSalsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/XSalsa20.php', |
|
| 112 | - 'ParagonIE_Sodium_Core_BLAKE2b' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/BLAKE2b.php', |
|
| 113 | - 'ParagonIE_Sodium_Core_Base64_Common' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Base64/Common.php', |
|
| 114 | - 'ParagonIE_Sodium_Core_Base64_Original' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Base64/Original.php', |
|
| 115 | - 'ParagonIE_Sodium_Core_Base64_UrlSafe' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Base64/UrlSafe.php', |
|
| 116 | - 'ParagonIE_Sodium_Core_ChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/ChaCha20.php', |
|
| 117 | - 'ParagonIE_Sodium_Core_ChaCha20_Ctx' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/ChaCha20/Ctx.php', |
|
| 118 | - 'ParagonIE_Sodium_Core_ChaCha20_IetfCtx' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/ChaCha20/IetfCtx.php', |
|
| 119 | - 'ParagonIE_Sodium_Core_Curve25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519.php', |
|
| 120 | - 'ParagonIE_Sodium_Core_Curve25519_Fe' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519/Fe.php', |
|
| 121 | - 'ParagonIE_Sodium_Core_Curve25519_Ge_Cached' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519/Ge/Cached.php', |
|
| 122 | - 'ParagonIE_Sodium_Core_Curve25519_Ge_P1p1' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519/Ge/P1p1.php', |
|
| 123 | - 'ParagonIE_Sodium_Core_Curve25519_Ge_P2' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519/Ge/P2.php', |
|
| 124 | - 'ParagonIE_Sodium_Core_Curve25519_Ge_P3' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519/Ge/P3.php', |
|
| 125 | - 'ParagonIE_Sodium_Core_Curve25519_Ge_Precomp' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519/Ge/Precomp.php', |
|
| 126 | - 'ParagonIE_Sodium_Core_Curve25519_H' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519/H.php', |
|
| 127 | - 'ParagonIE_Sodium_Core_Ed25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Ed25519.php', |
|
| 128 | - 'ParagonIE_Sodium_Core_HChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/HChaCha20.php', |
|
| 129 | - 'ParagonIE_Sodium_Core_HSalsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/HSalsa20.php', |
|
| 130 | - 'ParagonIE_Sodium_Core_Poly1305' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Poly1305.php', |
|
| 131 | - 'ParagonIE_Sodium_Core_Poly1305_State' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Poly1305/State.php', |
|
| 132 | - 'ParagonIE_Sodium_Core_Ristretto255' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Ristretto255.php', |
|
| 133 | - 'ParagonIE_Sodium_Core_Salsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Salsa20.php', |
|
| 134 | - 'ParagonIE_Sodium_Core_SecretStream_State' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/SecretStream/State.php', |
|
| 135 | - 'ParagonIE_Sodium_Core_SipHash' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/SipHash.php', |
|
| 136 | - 'ParagonIE_Sodium_Core_Util' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Util.php', |
|
| 137 | - 'ParagonIE_Sodium_Core_X25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/X25519.php', |
|
| 138 | - 'ParagonIE_Sodium_Core_XChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/XChaCha20.php', |
|
| 139 | - 'ParagonIE_Sodium_Core_XSalsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/XSalsa20.php', |
|
| 140 | - 'ParagonIE_Sodium_Crypto' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Crypto.php', |
|
| 141 | - 'ParagonIE_Sodium_Crypto32' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Crypto32.php', |
|
| 142 | - 'ParagonIE_Sodium_File' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/File.php', |
|
| 143 | - 'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/AbstractLogger.php', |
|
| 144 | - 'Psr\\Log\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/log/Psr/Log/InvalidArgumentException.php', |
|
| 145 | - 'Psr\\Log\\LogLevel' => __DIR__ . '/..' . '/psr/log/Psr/Log/LogLevel.php', |
|
| 146 | - 'Psr\\Log\\LoggerAwareInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareInterface.php', |
|
| 147 | - 'Psr\\Log\\LoggerAwareTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareTrait.php', |
|
| 148 | - 'Psr\\Log\\LoggerInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerInterface.php', |
|
| 149 | - 'Psr\\Log\\LoggerTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerTrait.php', |
|
| 150 | - 'Psr\\Log\\NullLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/NullLogger.php', |
|
| 151 | - 'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/DummyTest.php', |
|
| 152 | - 'Psr\\Log\\Test\\LoggerInterfaceTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', |
|
| 153 | - 'Psr\\Log\\Test\\TestLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/TestLogger.php', |
|
| 154 | - 'SodiumException' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/SodiumException.php', |
|
| 155 | - 'SplFixedArray' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/PHP52/SplFixedArray.php', |
|
| 156 | - 'TrustedLoginAJAXTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-ajax.php', |
|
| 157 | - 'TrustedLoginConfigTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-config.php', |
|
| 158 | - 'TrustedLoginUsersTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-users.php', |
|
| 159 | - 'TrustedLogin\\Admin' => __DIR__ . '/..' . '/trustedlogin/client/src/Admin.php', |
|
| 160 | - 'TrustedLogin\\Ajax' => __DIR__ . '/..' . '/trustedlogin/client/src/Ajax.php', |
|
| 161 | - 'TrustedLogin\\Client' => __DIR__ . '/..' . '/trustedlogin/client/src/Client.php', |
|
| 162 | - 'TrustedLogin\\Config' => __DIR__ . '/..' . '/trustedlogin/client/src/Config.php', |
|
| 163 | - 'TrustedLogin\\Cron' => __DIR__ . '/..' . '/trustedlogin/client/src/Cron.php', |
|
| 164 | - 'TrustedLogin\\Encryption' => __DIR__ . '/..' . '/trustedlogin/client/src/Encryption.php', |
|
| 165 | - 'TrustedLogin\\Endpoint' => __DIR__ . '/..' . '/trustedlogin/client/src/Endpoint.php', |
|
| 166 | - 'TrustedLogin\\Envelope' => __DIR__ . '/..' . '/trustedlogin/client/src/Envelope.php', |
|
| 167 | - 'TrustedLogin\\Logging' => __DIR__ . '/..' . '/trustedlogin/client/src/Logging.php', |
|
| 168 | - 'TrustedLogin\\Remote' => __DIR__ . '/..' . '/trustedlogin/client/src/Remote.php', |
|
| 169 | - 'TrustedLogin\\SecurityChecks' => __DIR__ . '/..' . '/trustedlogin/client/src/SecurityChecks.php', |
|
| 170 | - 'TrustedLogin\\SiteAccess' => __DIR__ . '/..' . '/trustedlogin/client/src/SiteAccess.php', |
|
| 171 | - 'TrustedLogin\\SupportRole' => __DIR__ . '/..' . '/trustedlogin/client/src/SupportRole.php', |
|
| 172 | - 'TrustedLogin\\SupportUser' => __DIR__ . '/..' . '/trustedlogin/client/src/SupportUser.php', |
|
| 173 | - 'TrustedLogin\\TrustedLoginClientTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-client.php', |
|
| 174 | - 'TrustedLogin\\TrustedLoginEncryptionTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-encryption.php', |
|
| 175 | - 'TrustedLogin\\TrustedLoginLoggingTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-logging.php', |
|
| 176 | - 'TrustedLogin\\TrustedLoginRemoteTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-remote.php', |
|
| 177 | - 'TrustedLogin\\TrustedLoginSiteAccessTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-siteaccess.php', |
|
| 178 | - 'TypeError' => __DIR__ . '/..' . '/paragonie/random_compat/lib/error_polyfill.php', |
|
| 179 | - ); |
|
| 50 | + public static $classMap = array ( |
|
| 51 | + 'ComposerAutoloaderInitb5638313a52df4893eb45c04efdaa356' => __DIR__ . '/..' . '/trustedlogin/client/vendor/composer/autoload_real.php', |
|
| 52 | + 'Composer\\Autoload\\ClassLoader' => __DIR__ . '/..' . '/trustedlogin/client/vendor/composer/ClassLoader.php', |
|
| 53 | + 'Composer\\Autoload\\ComposerStaticInitb5638313a52df4893eb45c04efdaa356' => __DIR__ . '/..' . '/trustedlogin/client/vendor/composer/autoload_static.php', |
|
| 54 | + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', |
|
| 55 | + 'Error' => __DIR__ . '/..' . '/paragonie/random_compat/lib/error_polyfill.php', |
|
| 56 | + 'Katzgrau\\KLogger\\Logger' => __DIR__ . '/..' . '/katzgrau/klogger/src/Logger.php', |
|
| 57 | + 'Katzgrau\\KLogger\\TrustedLogin_Logger' => __DIR__ . '/..' . '/trustedlogin/client/vendor/TrustedLogin/katzgrau/klogger/src/Logger.php', |
|
| 58 | + 'LoggerTest' => __DIR__ . '/..' . '/katzgrau/klogger/tests/LoggerTest.php', |
|
| 59 | + 'ParagonIE\\Sodium\\Compat' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Compat.php', |
|
| 60 | + 'ParagonIE\\Sodium\\Core\\BLAKE2b' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/BLAKE2b.php', |
|
| 61 | + 'ParagonIE\\Sodium\\Core\\ChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/ChaCha20.php', |
|
| 62 | + 'ParagonIE\\Sodium\\Core\\ChaCha20\\Ctx' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/ChaCha20/Ctx.php', |
|
| 63 | + 'ParagonIE\\Sodium\\Core\\ChaCha20\\IetfCtx' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/ChaCha20/IetfCtx.php', |
|
| 64 | + 'ParagonIE\\Sodium\\Core\\Curve25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519.php', |
|
| 65 | + 'ParagonIE\\Sodium\\Core\\Curve25519\\Fe' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519/Fe.php', |
|
| 66 | + 'ParagonIE\\Sodium\\Core\\Curve25519\\Ge\\Cached' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519/Ge/Cached.php', |
|
| 67 | + 'ParagonIE\\Sodium\\Core\\Curve25519\\Ge\\P1p1' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519/Ge/P1p1.php', |
|
| 68 | + 'ParagonIE\\Sodium\\Core\\Curve25519\\Ge\\P2' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519/Ge/P2.php', |
|
| 69 | + 'ParagonIE\\Sodium\\Core\\Curve25519\\Ge\\P3' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519/Ge/P3.php', |
|
| 70 | + 'ParagonIE\\Sodium\\Core\\Curve25519\\Ge\\Precomp' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519/Ge/Precomp.php', |
|
| 71 | + 'ParagonIE\\Sodium\\Core\\Curve25519\\H' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Curve25519/H.php', |
|
| 72 | + 'ParagonIE\\Sodium\\Core\\Ed25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Ed25519.php', |
|
| 73 | + 'ParagonIE\\Sodium\\Core\\HChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/HChaCha20.php', |
|
| 74 | + 'ParagonIE\\Sodium\\Core\\HSalsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/HSalsa20.php', |
|
| 75 | + 'ParagonIE\\Sodium\\Core\\Poly1305' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Poly1305.php', |
|
| 76 | + 'ParagonIE\\Sodium\\Core\\Poly1305\\State' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Poly1305/State.php', |
|
| 77 | + 'ParagonIE\\Sodium\\Core\\Salsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Salsa20.php', |
|
| 78 | + 'ParagonIE\\Sodium\\Core\\SipHash' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/SipHash.php', |
|
| 79 | + 'ParagonIE\\Sodium\\Core\\Util' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Util.php', |
|
| 80 | + 'ParagonIE\\Sodium\\Core\\X25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/X25519.php', |
|
| 81 | + 'ParagonIE\\Sodium\\Core\\XChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/XChaCha20.php', |
|
| 82 | + 'ParagonIE\\Sodium\\Core\\Xsalsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Core/Xsalsa20.php', |
|
| 83 | + 'ParagonIE\\Sodium\\Crypto' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/Crypto.php', |
|
| 84 | + 'ParagonIE\\Sodium\\File' => __DIR__ . '/..' . '/paragonie/sodium_compat/namespaced/File.php', |
|
| 85 | + 'ParagonIE_Sodium_Compat' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Compat.php', |
|
| 86 | + 'ParagonIE_Sodium_Core32_BLAKE2b' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/BLAKE2b.php', |
|
| 87 | + 'ParagonIE_Sodium_Core32_ChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/ChaCha20.php', |
|
| 88 | + 'ParagonIE_Sodium_Core32_ChaCha20_Ctx' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/ChaCha20/Ctx.php', |
|
| 89 | + 'ParagonIE_Sodium_Core32_ChaCha20_IetfCtx' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/ChaCha20/IetfCtx.php', |
|
| 90 | + 'ParagonIE_Sodium_Core32_Curve25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519.php', |
|
| 91 | + 'ParagonIE_Sodium_Core32_Curve25519_Fe' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519/Fe.php', |
|
| 92 | + 'ParagonIE_Sodium_Core32_Curve25519_Ge_Cached' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519/Ge/Cached.php', |
|
| 93 | + 'ParagonIE_Sodium_Core32_Curve25519_Ge_P1p1' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519/Ge/P1p1.php', |
|
| 94 | + 'ParagonIE_Sodium_Core32_Curve25519_Ge_P2' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519/Ge/P2.php', |
|
| 95 | + 'ParagonIE_Sodium_Core32_Curve25519_Ge_P3' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519/Ge/P3.php', |
|
| 96 | + 'ParagonIE_Sodium_Core32_Curve25519_Ge_Precomp' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519/Ge/Precomp.php', |
|
| 97 | + 'ParagonIE_Sodium_Core32_Curve25519_H' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Curve25519/H.php', |
|
| 98 | + 'ParagonIE_Sodium_Core32_Ed25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Ed25519.php', |
|
| 99 | + 'ParagonIE_Sodium_Core32_HChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/HChaCha20.php', |
|
| 100 | + 'ParagonIE_Sodium_Core32_HSalsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/HSalsa20.php', |
|
| 101 | + 'ParagonIE_Sodium_Core32_Int32' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Int32.php', |
|
| 102 | + 'ParagonIE_Sodium_Core32_Int64' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Int64.php', |
|
| 103 | + 'ParagonIE_Sodium_Core32_Poly1305' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Poly1305.php', |
|
| 104 | + 'ParagonIE_Sodium_Core32_Poly1305_State' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Poly1305/State.php', |
|
| 105 | + 'ParagonIE_Sodium_Core32_Salsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Salsa20.php', |
|
| 106 | + 'ParagonIE_Sodium_Core32_SecretStream_State' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/SecretStream/State.php', |
|
| 107 | + 'ParagonIE_Sodium_Core32_SipHash' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/SipHash.php', |
|
| 108 | + 'ParagonIE_Sodium_Core32_Util' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/Util.php', |
|
| 109 | + 'ParagonIE_Sodium_Core32_X25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/X25519.php', |
|
| 110 | + 'ParagonIE_Sodium_Core32_XChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/XChaCha20.php', |
|
| 111 | + 'ParagonIE_Sodium_Core32_XSalsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core32/XSalsa20.php', |
|
| 112 | + 'ParagonIE_Sodium_Core_BLAKE2b' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/BLAKE2b.php', |
|
| 113 | + 'ParagonIE_Sodium_Core_Base64_Common' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Base64/Common.php', |
|
| 114 | + 'ParagonIE_Sodium_Core_Base64_Original' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Base64/Original.php', |
|
| 115 | + 'ParagonIE_Sodium_Core_Base64_UrlSafe' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Base64/UrlSafe.php', |
|
| 116 | + 'ParagonIE_Sodium_Core_ChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/ChaCha20.php', |
|
| 117 | + 'ParagonIE_Sodium_Core_ChaCha20_Ctx' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/ChaCha20/Ctx.php', |
|
| 118 | + 'ParagonIE_Sodium_Core_ChaCha20_IetfCtx' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/ChaCha20/IetfCtx.php', |
|
| 119 | + 'ParagonIE_Sodium_Core_Curve25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519.php', |
|
| 120 | + 'ParagonIE_Sodium_Core_Curve25519_Fe' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519/Fe.php', |
|
| 121 | + 'ParagonIE_Sodium_Core_Curve25519_Ge_Cached' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519/Ge/Cached.php', |
|
| 122 | + 'ParagonIE_Sodium_Core_Curve25519_Ge_P1p1' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519/Ge/P1p1.php', |
|
| 123 | + 'ParagonIE_Sodium_Core_Curve25519_Ge_P2' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519/Ge/P2.php', |
|
| 124 | + 'ParagonIE_Sodium_Core_Curve25519_Ge_P3' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519/Ge/P3.php', |
|
| 125 | + 'ParagonIE_Sodium_Core_Curve25519_Ge_Precomp' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519/Ge/Precomp.php', |
|
| 126 | + 'ParagonIE_Sodium_Core_Curve25519_H' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Curve25519/H.php', |
|
| 127 | + 'ParagonIE_Sodium_Core_Ed25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Ed25519.php', |
|
| 128 | + 'ParagonIE_Sodium_Core_HChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/HChaCha20.php', |
|
| 129 | + 'ParagonIE_Sodium_Core_HSalsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/HSalsa20.php', |
|
| 130 | + 'ParagonIE_Sodium_Core_Poly1305' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Poly1305.php', |
|
| 131 | + 'ParagonIE_Sodium_Core_Poly1305_State' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Poly1305/State.php', |
|
| 132 | + 'ParagonIE_Sodium_Core_Ristretto255' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Ristretto255.php', |
|
| 133 | + 'ParagonIE_Sodium_Core_Salsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Salsa20.php', |
|
| 134 | + 'ParagonIE_Sodium_Core_SecretStream_State' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/SecretStream/State.php', |
|
| 135 | + 'ParagonIE_Sodium_Core_SipHash' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/SipHash.php', |
|
| 136 | + 'ParagonIE_Sodium_Core_Util' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/Util.php', |
|
| 137 | + 'ParagonIE_Sodium_Core_X25519' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/X25519.php', |
|
| 138 | + 'ParagonIE_Sodium_Core_XChaCha20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/XChaCha20.php', |
|
| 139 | + 'ParagonIE_Sodium_Core_XSalsa20' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Core/XSalsa20.php', |
|
| 140 | + 'ParagonIE_Sodium_Crypto' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Crypto.php', |
|
| 141 | + 'ParagonIE_Sodium_Crypto32' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/Crypto32.php', |
|
| 142 | + 'ParagonIE_Sodium_File' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/File.php', |
|
| 143 | + 'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/AbstractLogger.php', |
|
| 144 | + 'Psr\\Log\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/log/Psr/Log/InvalidArgumentException.php', |
|
| 145 | + 'Psr\\Log\\LogLevel' => __DIR__ . '/..' . '/psr/log/Psr/Log/LogLevel.php', |
|
| 146 | + 'Psr\\Log\\LoggerAwareInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareInterface.php', |
|
| 147 | + 'Psr\\Log\\LoggerAwareTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareTrait.php', |
|
| 148 | + 'Psr\\Log\\LoggerInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerInterface.php', |
|
| 149 | + 'Psr\\Log\\LoggerTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerTrait.php', |
|
| 150 | + 'Psr\\Log\\NullLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/NullLogger.php', |
|
| 151 | + 'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/DummyTest.php', |
|
| 152 | + 'Psr\\Log\\Test\\LoggerInterfaceTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', |
|
| 153 | + 'Psr\\Log\\Test\\TestLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/TestLogger.php', |
|
| 154 | + 'SodiumException' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/SodiumException.php', |
|
| 155 | + 'SplFixedArray' => __DIR__ . '/..' . '/paragonie/sodium_compat/src/PHP52/SplFixedArray.php', |
|
| 156 | + 'TrustedLoginAJAXTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-ajax.php', |
|
| 157 | + 'TrustedLoginConfigTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-config.php', |
|
| 158 | + 'TrustedLoginUsersTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-users.php', |
|
| 159 | + 'TrustedLogin\\Admin' => __DIR__ . '/..' . '/trustedlogin/client/src/Admin.php', |
|
| 160 | + 'TrustedLogin\\Ajax' => __DIR__ . '/..' . '/trustedlogin/client/src/Ajax.php', |
|
| 161 | + 'TrustedLogin\\Client' => __DIR__ . '/..' . '/trustedlogin/client/src/Client.php', |
|
| 162 | + 'TrustedLogin\\Config' => __DIR__ . '/..' . '/trustedlogin/client/src/Config.php', |
|
| 163 | + 'TrustedLogin\\Cron' => __DIR__ . '/..' . '/trustedlogin/client/src/Cron.php', |
|
| 164 | + 'TrustedLogin\\Encryption' => __DIR__ . '/..' . '/trustedlogin/client/src/Encryption.php', |
|
| 165 | + 'TrustedLogin\\Endpoint' => __DIR__ . '/..' . '/trustedlogin/client/src/Endpoint.php', |
|
| 166 | + 'TrustedLogin\\Envelope' => __DIR__ . '/..' . '/trustedlogin/client/src/Envelope.php', |
|
| 167 | + 'TrustedLogin\\Logging' => __DIR__ . '/..' . '/trustedlogin/client/src/Logging.php', |
|
| 168 | + 'TrustedLogin\\Remote' => __DIR__ . '/..' . '/trustedlogin/client/src/Remote.php', |
|
| 169 | + 'TrustedLogin\\SecurityChecks' => __DIR__ . '/..' . '/trustedlogin/client/src/SecurityChecks.php', |
|
| 170 | + 'TrustedLogin\\SiteAccess' => __DIR__ . '/..' . '/trustedlogin/client/src/SiteAccess.php', |
|
| 171 | + 'TrustedLogin\\SupportRole' => __DIR__ . '/..' . '/trustedlogin/client/src/SupportRole.php', |
|
| 172 | + 'TrustedLogin\\SupportUser' => __DIR__ . '/..' . '/trustedlogin/client/src/SupportUser.php', |
|
| 173 | + 'TrustedLogin\\TrustedLoginClientTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-client.php', |
|
| 174 | + 'TrustedLogin\\TrustedLoginEncryptionTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-encryption.php', |
|
| 175 | + 'TrustedLogin\\TrustedLoginLoggingTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-logging.php', |
|
| 176 | + 'TrustedLogin\\TrustedLoginRemoteTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-remote.php', |
|
| 177 | + 'TrustedLogin\\TrustedLoginSiteAccessTest' => __DIR__ . '/..' . '/trustedlogin/client/tests/test-siteaccess.php', |
|
| 178 | + 'TypeError' => __DIR__ . '/..' . '/paragonie/random_compat/lib/error_polyfill.php', |
|
| 179 | + ); |
|
| 180 | 180 | |
| 181 | - public static function getInitializer(ClassLoader $loader) |
|
| 182 | - { |
|
| 183 | - return \Closure::bind(function () use ($loader) { |
|
| 184 | - $loader->prefixLengthsPsr4 = ComposerStaticInit984ed95bef2b0e3d4eeb0208a88dc67d::$prefixLengthsPsr4; |
|
| 185 | - $loader->prefixDirsPsr4 = ComposerStaticInit984ed95bef2b0e3d4eeb0208a88dc67d::$prefixDirsPsr4; |
|
| 186 | - $loader->classMap = ComposerStaticInit984ed95bef2b0e3d4eeb0208a88dc67d::$classMap; |
|
| 181 | + public static function getInitializer(ClassLoader $loader) |
|
| 182 | + { |
|
| 183 | + return \Closure::bind(function () use ($loader) { |
|
| 184 | + $loader->prefixLengthsPsr4 = ComposerStaticInit984ed95bef2b0e3d4eeb0208a88dc67d::$prefixLengthsPsr4; |
|
| 185 | + $loader->prefixDirsPsr4 = ComposerStaticInit984ed95bef2b0e3d4eeb0208a88dc67d::$prefixDirsPsr4; |
|
| 186 | + $loader->classMap = ComposerStaticInit984ed95bef2b0e3d4eeb0208a88dc67d::$classMap; |
|
| 187 | 187 | |
| 188 | - }, null, ClassLoader::class); |
|
| 189 | - } |
|
| 188 | + }, null, ClassLoader::class); |
|
| 189 | + } |
|
| 190 | 190 | } |
@@ -42,519 +42,519 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | class ClassLoader |
| 44 | 44 | { |
| 45 | - /** @var ?string */ |
|
| 46 | - private $vendorDir; |
|
| 47 | - |
|
| 48 | - // PSR-4 |
|
| 49 | - /** |
|
| 50 | - * @var array[] |
|
| 51 | - * @psalm-var array<string, array<string, int>> |
|
| 52 | - */ |
|
| 53 | - private $prefixLengthsPsr4 = array(); |
|
| 54 | - /** |
|
| 55 | - * @var array[] |
|
| 56 | - * @psalm-var array<string, array<int, string>> |
|
| 57 | - */ |
|
| 58 | - private $prefixDirsPsr4 = array(); |
|
| 59 | - /** |
|
| 60 | - * @var array[] |
|
| 61 | - * @psalm-var array<string, string> |
|
| 62 | - */ |
|
| 63 | - private $fallbackDirsPsr4 = array(); |
|
| 64 | - |
|
| 65 | - // PSR-0 |
|
| 66 | - /** |
|
| 67 | - * @var array[] |
|
| 68 | - * @psalm-var array<string, array<string, string[]>> |
|
| 69 | - */ |
|
| 70 | - private $prefixesPsr0 = array(); |
|
| 71 | - /** |
|
| 72 | - * @var array[] |
|
| 73 | - * @psalm-var array<string, string> |
|
| 74 | - */ |
|
| 75 | - private $fallbackDirsPsr0 = array(); |
|
| 76 | - |
|
| 77 | - /** @var bool */ |
|
| 78 | - private $useIncludePath = false; |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * @var string[] |
|
| 82 | - * @psalm-var array<string, string> |
|
| 83 | - */ |
|
| 84 | - private $classMap = array(); |
|
| 85 | - |
|
| 86 | - /** @var bool */ |
|
| 87 | - private $classMapAuthoritative = false; |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * @var bool[] |
|
| 91 | - * @psalm-var array<string, bool> |
|
| 92 | - */ |
|
| 93 | - private $missingClasses = array(); |
|
| 94 | - |
|
| 95 | - /** @var ?string */ |
|
| 96 | - private $apcuPrefix; |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * @var self[] |
|
| 100 | - */ |
|
| 101 | - private static $registeredLoaders = array(); |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * @param ?string $vendorDir |
|
| 105 | - */ |
|
| 106 | - public function __construct($vendorDir = null) |
|
| 107 | - { |
|
| 108 | - $this->vendorDir = $vendorDir; |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * @return string[] |
|
| 113 | - */ |
|
| 114 | - public function getPrefixes() |
|
| 115 | - { |
|
| 116 | - if (!empty($this->prefixesPsr0)) { |
|
| 117 | - return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - return array(); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * @return array[] |
|
| 125 | - * @psalm-return array<string, array<int, string>> |
|
| 126 | - */ |
|
| 127 | - public function getPrefixesPsr4() |
|
| 128 | - { |
|
| 129 | - return $this->prefixDirsPsr4; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * @return array[] |
|
| 134 | - * @psalm-return array<string, string> |
|
| 135 | - */ |
|
| 136 | - public function getFallbackDirs() |
|
| 137 | - { |
|
| 138 | - return $this->fallbackDirsPsr0; |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * @return array[] |
|
| 143 | - * @psalm-return array<string, string> |
|
| 144 | - */ |
|
| 145 | - public function getFallbackDirsPsr4() |
|
| 146 | - { |
|
| 147 | - return $this->fallbackDirsPsr4; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * @return string[] Array of classname => path |
|
| 152 | - * @psalm-return array<string, string> |
|
| 153 | - */ |
|
| 154 | - public function getClassMap() |
|
| 155 | - { |
|
| 156 | - return $this->classMap; |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * @param string[] $classMap Class to filename map |
|
| 161 | - * @psalm-param array<string, string> $classMap |
|
| 162 | - * |
|
| 163 | - * @return void |
|
| 164 | - */ |
|
| 165 | - public function addClassMap(array $classMap) |
|
| 166 | - { |
|
| 167 | - if ($this->classMap) { |
|
| 168 | - $this->classMap = array_merge($this->classMap, $classMap); |
|
| 169 | - } else { |
|
| 170 | - $this->classMap = $classMap; |
|
| 171 | - } |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * Registers a set of PSR-0 directories for a given prefix, either |
|
| 176 | - * appending or prepending to the ones previously set for this prefix. |
|
| 177 | - * |
|
| 178 | - * @param string $prefix The prefix |
|
| 179 | - * @param string[]|string $paths The PSR-0 root directories |
|
| 180 | - * @param bool $prepend Whether to prepend the directories |
|
| 181 | - * |
|
| 182 | - * @return void |
|
| 183 | - */ |
|
| 184 | - public function add($prefix, $paths, $prepend = false) |
|
| 185 | - { |
|
| 186 | - if (!$prefix) { |
|
| 187 | - if ($prepend) { |
|
| 188 | - $this->fallbackDirsPsr0 = array_merge( |
|
| 189 | - (array) $paths, |
|
| 190 | - $this->fallbackDirsPsr0 |
|
| 191 | - ); |
|
| 192 | - } else { |
|
| 193 | - $this->fallbackDirsPsr0 = array_merge( |
|
| 194 | - $this->fallbackDirsPsr0, |
|
| 195 | - (array) $paths |
|
| 196 | - ); |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - return; |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - $first = $prefix[0]; |
|
| 203 | - if (!isset($this->prefixesPsr0[$first][$prefix])) { |
|
| 204 | - $this->prefixesPsr0[$first][$prefix] = (array) $paths; |
|
| 205 | - |
|
| 206 | - return; |
|
| 207 | - } |
|
| 208 | - if ($prepend) { |
|
| 209 | - $this->prefixesPsr0[$first][$prefix] = array_merge( |
|
| 210 | - (array) $paths, |
|
| 211 | - $this->prefixesPsr0[$first][$prefix] |
|
| 212 | - ); |
|
| 213 | - } else { |
|
| 214 | - $this->prefixesPsr0[$first][$prefix] = array_merge( |
|
| 215 | - $this->prefixesPsr0[$first][$prefix], |
|
| 216 | - (array) $paths |
|
| 217 | - ); |
|
| 218 | - } |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - /** |
|
| 222 | - * Registers a set of PSR-4 directories for a given namespace, either |
|
| 223 | - * appending or prepending to the ones previously set for this namespace. |
|
| 224 | - * |
|
| 225 | - * @param string $prefix The prefix/namespace, with trailing '\\' |
|
| 226 | - * @param string[]|string $paths The PSR-4 base directories |
|
| 227 | - * @param bool $prepend Whether to prepend the directories |
|
| 228 | - * |
|
| 229 | - * @throws \InvalidArgumentException |
|
| 230 | - * |
|
| 231 | - * @return void |
|
| 232 | - */ |
|
| 233 | - public function addPsr4($prefix, $paths, $prepend = false) |
|
| 234 | - { |
|
| 235 | - if (!$prefix) { |
|
| 236 | - // Register directories for the root namespace. |
|
| 237 | - if ($prepend) { |
|
| 238 | - $this->fallbackDirsPsr4 = array_merge( |
|
| 239 | - (array) $paths, |
|
| 240 | - $this->fallbackDirsPsr4 |
|
| 241 | - ); |
|
| 242 | - } else { |
|
| 243 | - $this->fallbackDirsPsr4 = array_merge( |
|
| 244 | - $this->fallbackDirsPsr4, |
|
| 245 | - (array) $paths |
|
| 246 | - ); |
|
| 247 | - } |
|
| 248 | - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { |
|
| 249 | - // Register directories for a new namespace. |
|
| 250 | - $length = strlen($prefix); |
|
| 251 | - if ('\\' !== $prefix[$length - 1]) { |
|
| 252 | - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
|
| 253 | - } |
|
| 254 | - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
|
| 255 | - $this->prefixDirsPsr4[$prefix] = (array) $paths; |
|
| 256 | - } elseif ($prepend) { |
|
| 257 | - // Prepend directories for an already registered namespace. |
|
| 258 | - $this->prefixDirsPsr4[$prefix] = array_merge( |
|
| 259 | - (array) $paths, |
|
| 260 | - $this->prefixDirsPsr4[$prefix] |
|
| 261 | - ); |
|
| 262 | - } else { |
|
| 263 | - // Append directories for an already registered namespace. |
|
| 264 | - $this->prefixDirsPsr4[$prefix] = array_merge( |
|
| 265 | - $this->prefixDirsPsr4[$prefix], |
|
| 266 | - (array) $paths |
|
| 267 | - ); |
|
| 268 | - } |
|
| 269 | - } |
|
| 270 | - |
|
| 271 | - /** |
|
| 272 | - * Registers a set of PSR-0 directories for a given prefix, |
|
| 273 | - * replacing any others previously set for this prefix. |
|
| 274 | - * |
|
| 275 | - * @param string $prefix The prefix |
|
| 276 | - * @param string[]|string $paths The PSR-0 base directories |
|
| 277 | - * |
|
| 278 | - * @return void |
|
| 279 | - */ |
|
| 280 | - public function set($prefix, $paths) |
|
| 281 | - { |
|
| 282 | - if (!$prefix) { |
|
| 283 | - $this->fallbackDirsPsr0 = (array) $paths; |
|
| 284 | - } else { |
|
| 285 | - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; |
|
| 286 | - } |
|
| 287 | - } |
|
| 288 | - |
|
| 289 | - /** |
|
| 290 | - * Registers a set of PSR-4 directories for a given namespace, |
|
| 291 | - * replacing any others previously set for this namespace. |
|
| 292 | - * |
|
| 293 | - * @param string $prefix The prefix/namespace, with trailing '\\' |
|
| 294 | - * @param string[]|string $paths The PSR-4 base directories |
|
| 295 | - * |
|
| 296 | - * @throws \InvalidArgumentException |
|
| 297 | - * |
|
| 298 | - * @return void |
|
| 299 | - */ |
|
| 300 | - public function setPsr4($prefix, $paths) |
|
| 301 | - { |
|
| 302 | - if (!$prefix) { |
|
| 303 | - $this->fallbackDirsPsr4 = (array) $paths; |
|
| 304 | - } else { |
|
| 305 | - $length = strlen($prefix); |
|
| 306 | - if ('\\' !== $prefix[$length - 1]) { |
|
| 307 | - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
|
| 308 | - } |
|
| 309 | - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
|
| 310 | - $this->prefixDirsPsr4[$prefix] = (array) $paths; |
|
| 311 | - } |
|
| 312 | - } |
|
| 313 | - |
|
| 314 | - /** |
|
| 315 | - * Turns on searching the include path for class files. |
|
| 316 | - * |
|
| 317 | - * @param bool $useIncludePath |
|
| 318 | - * |
|
| 319 | - * @return void |
|
| 320 | - */ |
|
| 321 | - public function setUseIncludePath($useIncludePath) |
|
| 322 | - { |
|
| 323 | - $this->useIncludePath = $useIncludePath; |
|
| 324 | - } |
|
| 325 | - |
|
| 326 | - /** |
|
| 327 | - * Can be used to check if the autoloader uses the include path to check |
|
| 328 | - * for classes. |
|
| 329 | - * |
|
| 330 | - * @return bool |
|
| 331 | - */ |
|
| 332 | - public function getUseIncludePath() |
|
| 333 | - { |
|
| 334 | - return $this->useIncludePath; |
|
| 335 | - } |
|
| 336 | - |
|
| 337 | - /** |
|
| 338 | - * Turns off searching the prefix and fallback directories for classes |
|
| 339 | - * that have not been registered with the class map. |
|
| 340 | - * |
|
| 341 | - * @param bool $classMapAuthoritative |
|
| 342 | - * |
|
| 343 | - * @return void |
|
| 344 | - */ |
|
| 345 | - public function setClassMapAuthoritative($classMapAuthoritative) |
|
| 346 | - { |
|
| 347 | - $this->classMapAuthoritative = $classMapAuthoritative; |
|
| 348 | - } |
|
| 349 | - |
|
| 350 | - /** |
|
| 351 | - * Should class lookup fail if not found in the current class map? |
|
| 352 | - * |
|
| 353 | - * @return bool |
|
| 354 | - */ |
|
| 355 | - public function isClassMapAuthoritative() |
|
| 356 | - { |
|
| 357 | - return $this->classMapAuthoritative; |
|
| 358 | - } |
|
| 359 | - |
|
| 360 | - /** |
|
| 361 | - * APCu prefix to use to cache found/not-found classes, if the extension is enabled. |
|
| 362 | - * |
|
| 363 | - * @param string|null $apcuPrefix |
|
| 364 | - * |
|
| 365 | - * @return void |
|
| 366 | - */ |
|
| 367 | - public function setApcuPrefix($apcuPrefix) |
|
| 368 | - { |
|
| 369 | - $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; |
|
| 370 | - } |
|
| 371 | - |
|
| 372 | - /** |
|
| 373 | - * The APCu prefix in use, or null if APCu caching is not enabled. |
|
| 374 | - * |
|
| 375 | - * @return string|null |
|
| 376 | - */ |
|
| 377 | - public function getApcuPrefix() |
|
| 378 | - { |
|
| 379 | - return $this->apcuPrefix; |
|
| 380 | - } |
|
| 381 | - |
|
| 382 | - /** |
|
| 383 | - * Registers this instance as an autoloader. |
|
| 384 | - * |
|
| 385 | - * @param bool $prepend Whether to prepend the autoloader or not |
|
| 386 | - * |
|
| 387 | - * @return void |
|
| 388 | - */ |
|
| 389 | - public function register($prepend = false) |
|
| 390 | - { |
|
| 391 | - spl_autoload_register(array($this, 'loadClass'), true, $prepend); |
|
| 392 | - |
|
| 393 | - if (null === $this->vendorDir) { |
|
| 394 | - return; |
|
| 395 | - } |
|
| 396 | - |
|
| 397 | - if ($prepend) { |
|
| 398 | - self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; |
|
| 399 | - } else { |
|
| 400 | - unset(self::$registeredLoaders[$this->vendorDir]); |
|
| 401 | - self::$registeredLoaders[$this->vendorDir] = $this; |
|
| 402 | - } |
|
| 403 | - } |
|
| 404 | - |
|
| 405 | - /** |
|
| 406 | - * Unregisters this instance as an autoloader. |
|
| 407 | - * |
|
| 408 | - * @return void |
|
| 409 | - */ |
|
| 410 | - public function unregister() |
|
| 411 | - { |
|
| 412 | - spl_autoload_unregister(array($this, 'loadClass')); |
|
| 413 | - |
|
| 414 | - if (null !== $this->vendorDir) { |
|
| 415 | - unset(self::$registeredLoaders[$this->vendorDir]); |
|
| 416 | - } |
|
| 417 | - } |
|
| 418 | - |
|
| 419 | - /** |
|
| 420 | - * Loads the given class or interface. |
|
| 421 | - * |
|
| 422 | - * @param string $class The name of the class |
|
| 423 | - * @return true|null True if loaded, null otherwise |
|
| 424 | - */ |
|
| 425 | - public function loadClass($class) |
|
| 426 | - { |
|
| 427 | - if ($file = $this->findFile($class)) { |
|
| 428 | - includeFile($file); |
|
| 429 | - |
|
| 430 | - return true; |
|
| 431 | - } |
|
| 432 | - |
|
| 433 | - return null; |
|
| 434 | - } |
|
| 435 | - |
|
| 436 | - /** |
|
| 437 | - * Finds the path to the file where the class is defined. |
|
| 438 | - * |
|
| 439 | - * @param string $class The name of the class |
|
| 440 | - * |
|
| 441 | - * @return string|false The path if found, false otherwise |
|
| 442 | - */ |
|
| 443 | - public function findFile($class) |
|
| 444 | - { |
|
| 445 | - // class map lookup |
|
| 446 | - if (isset($this->classMap[$class])) { |
|
| 447 | - return $this->classMap[$class]; |
|
| 448 | - } |
|
| 449 | - if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { |
|
| 450 | - return false; |
|
| 451 | - } |
|
| 452 | - if (null !== $this->apcuPrefix) { |
|
| 453 | - $file = apcu_fetch($this->apcuPrefix.$class, $hit); |
|
| 454 | - if ($hit) { |
|
| 455 | - return $file; |
|
| 456 | - } |
|
| 457 | - } |
|
| 458 | - |
|
| 459 | - $file = $this->findFileWithExtension($class, '.php'); |
|
| 460 | - |
|
| 461 | - // Search for Hack files if we are running on HHVM |
|
| 462 | - if (false === $file && defined('HHVM_VERSION')) { |
|
| 463 | - $file = $this->findFileWithExtension($class, '.hh'); |
|
| 464 | - } |
|
| 465 | - |
|
| 466 | - if (null !== $this->apcuPrefix) { |
|
| 467 | - apcu_add($this->apcuPrefix.$class, $file); |
|
| 468 | - } |
|
| 469 | - |
|
| 470 | - if (false === $file) { |
|
| 471 | - // Remember that this class does not exist. |
|
| 472 | - $this->missingClasses[$class] = true; |
|
| 473 | - } |
|
| 474 | - |
|
| 475 | - return $file; |
|
| 476 | - } |
|
| 477 | - |
|
| 478 | - /** |
|
| 479 | - * Returns the currently registered loaders indexed by their corresponding vendor directories. |
|
| 480 | - * |
|
| 481 | - * @return self[] |
|
| 482 | - */ |
|
| 483 | - public static function getRegisteredLoaders() |
|
| 484 | - { |
|
| 485 | - return self::$registeredLoaders; |
|
| 486 | - } |
|
| 487 | - |
|
| 488 | - /** |
|
| 489 | - * @param string $class |
|
| 490 | - * @param string $ext |
|
| 491 | - * @return string|false |
|
| 492 | - */ |
|
| 493 | - private function findFileWithExtension($class, $ext) |
|
| 494 | - { |
|
| 495 | - // PSR-4 lookup |
|
| 496 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
| 497 | - |
|
| 498 | - $first = $class[0]; |
|
| 499 | - if (isset($this->prefixLengthsPsr4[$first])) { |
|
| 500 | - $subPath = $class; |
|
| 501 | - while (false !== $lastPos = strrpos($subPath, '\\')) { |
|
| 502 | - $subPath = substr($subPath, 0, $lastPos); |
|
| 503 | - $search = $subPath . '\\'; |
|
| 504 | - if (isset($this->prefixDirsPsr4[$search])) { |
|
| 505 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
| 506 | - foreach ($this->prefixDirsPsr4[$search] as $dir) { |
|
| 507 | - if (file_exists($file = $dir . $pathEnd)) { |
|
| 508 | - return $file; |
|
| 509 | - } |
|
| 510 | - } |
|
| 511 | - } |
|
| 512 | - } |
|
| 513 | - } |
|
| 514 | - |
|
| 515 | - // PSR-4 fallback dirs |
|
| 516 | - foreach ($this->fallbackDirsPsr4 as $dir) { |
|
| 517 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
| 518 | - return $file; |
|
| 519 | - } |
|
| 520 | - } |
|
| 521 | - |
|
| 522 | - // PSR-0 lookup |
|
| 523 | - if (false !== $pos = strrpos($class, '\\')) { |
|
| 524 | - // namespaced class name |
|
| 525 | - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) |
|
| 526 | - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
|
| 527 | - } else { |
|
| 528 | - // PEAR-like class name |
|
| 529 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
| 530 | - } |
|
| 531 | - |
|
| 532 | - if (isset($this->prefixesPsr0[$first])) { |
|
| 533 | - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
|
| 534 | - if (0 === strpos($class, $prefix)) { |
|
| 535 | - foreach ($dirs as $dir) { |
|
| 536 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
| 537 | - return $file; |
|
| 538 | - } |
|
| 539 | - } |
|
| 540 | - } |
|
| 541 | - } |
|
| 542 | - } |
|
| 543 | - |
|
| 544 | - // PSR-0 fallback dirs |
|
| 545 | - foreach ($this->fallbackDirsPsr0 as $dir) { |
|
| 546 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
| 547 | - return $file; |
|
| 548 | - } |
|
| 549 | - } |
|
| 550 | - |
|
| 551 | - // PSR-0 include paths. |
|
| 552 | - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { |
|
| 553 | - return $file; |
|
| 554 | - } |
|
| 555 | - |
|
| 556 | - return false; |
|
| 557 | - } |
|
| 45 | + /** @var ?string */ |
|
| 46 | + private $vendorDir; |
|
| 47 | + |
|
| 48 | + // PSR-4 |
|
| 49 | + /** |
|
| 50 | + * @var array[] |
|
| 51 | + * @psalm-var array<string, array<string, int>> |
|
| 52 | + */ |
|
| 53 | + private $prefixLengthsPsr4 = array(); |
|
| 54 | + /** |
|
| 55 | + * @var array[] |
|
| 56 | + * @psalm-var array<string, array<int, string>> |
|
| 57 | + */ |
|
| 58 | + private $prefixDirsPsr4 = array(); |
|
| 59 | + /** |
|
| 60 | + * @var array[] |
|
| 61 | + * @psalm-var array<string, string> |
|
| 62 | + */ |
|
| 63 | + private $fallbackDirsPsr4 = array(); |
|
| 64 | + |
|
| 65 | + // PSR-0 |
|
| 66 | + /** |
|
| 67 | + * @var array[] |
|
| 68 | + * @psalm-var array<string, array<string, string[]>> |
|
| 69 | + */ |
|
| 70 | + private $prefixesPsr0 = array(); |
|
| 71 | + /** |
|
| 72 | + * @var array[] |
|
| 73 | + * @psalm-var array<string, string> |
|
| 74 | + */ |
|
| 75 | + private $fallbackDirsPsr0 = array(); |
|
| 76 | + |
|
| 77 | + /** @var bool */ |
|
| 78 | + private $useIncludePath = false; |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * @var string[] |
|
| 82 | + * @psalm-var array<string, string> |
|
| 83 | + */ |
|
| 84 | + private $classMap = array(); |
|
| 85 | + |
|
| 86 | + /** @var bool */ |
|
| 87 | + private $classMapAuthoritative = false; |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * @var bool[] |
|
| 91 | + * @psalm-var array<string, bool> |
|
| 92 | + */ |
|
| 93 | + private $missingClasses = array(); |
|
| 94 | + |
|
| 95 | + /** @var ?string */ |
|
| 96 | + private $apcuPrefix; |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * @var self[] |
|
| 100 | + */ |
|
| 101 | + private static $registeredLoaders = array(); |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * @param ?string $vendorDir |
|
| 105 | + */ |
|
| 106 | + public function __construct($vendorDir = null) |
|
| 107 | + { |
|
| 108 | + $this->vendorDir = $vendorDir; |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * @return string[] |
|
| 113 | + */ |
|
| 114 | + public function getPrefixes() |
|
| 115 | + { |
|
| 116 | + if (!empty($this->prefixesPsr0)) { |
|
| 117 | + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + return array(); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * @return array[] |
|
| 125 | + * @psalm-return array<string, array<int, string>> |
|
| 126 | + */ |
|
| 127 | + public function getPrefixesPsr4() |
|
| 128 | + { |
|
| 129 | + return $this->prefixDirsPsr4; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * @return array[] |
|
| 134 | + * @psalm-return array<string, string> |
|
| 135 | + */ |
|
| 136 | + public function getFallbackDirs() |
|
| 137 | + { |
|
| 138 | + return $this->fallbackDirsPsr0; |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * @return array[] |
|
| 143 | + * @psalm-return array<string, string> |
|
| 144 | + */ |
|
| 145 | + public function getFallbackDirsPsr4() |
|
| 146 | + { |
|
| 147 | + return $this->fallbackDirsPsr4; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * @return string[] Array of classname => path |
|
| 152 | + * @psalm-return array<string, string> |
|
| 153 | + */ |
|
| 154 | + public function getClassMap() |
|
| 155 | + { |
|
| 156 | + return $this->classMap; |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * @param string[] $classMap Class to filename map |
|
| 161 | + * @psalm-param array<string, string> $classMap |
|
| 162 | + * |
|
| 163 | + * @return void |
|
| 164 | + */ |
|
| 165 | + public function addClassMap(array $classMap) |
|
| 166 | + { |
|
| 167 | + if ($this->classMap) { |
|
| 168 | + $this->classMap = array_merge($this->classMap, $classMap); |
|
| 169 | + } else { |
|
| 170 | + $this->classMap = $classMap; |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * Registers a set of PSR-0 directories for a given prefix, either |
|
| 176 | + * appending or prepending to the ones previously set for this prefix. |
|
| 177 | + * |
|
| 178 | + * @param string $prefix The prefix |
|
| 179 | + * @param string[]|string $paths The PSR-0 root directories |
|
| 180 | + * @param bool $prepend Whether to prepend the directories |
|
| 181 | + * |
|
| 182 | + * @return void |
|
| 183 | + */ |
|
| 184 | + public function add($prefix, $paths, $prepend = false) |
|
| 185 | + { |
|
| 186 | + if (!$prefix) { |
|
| 187 | + if ($prepend) { |
|
| 188 | + $this->fallbackDirsPsr0 = array_merge( |
|
| 189 | + (array) $paths, |
|
| 190 | + $this->fallbackDirsPsr0 |
|
| 191 | + ); |
|
| 192 | + } else { |
|
| 193 | + $this->fallbackDirsPsr0 = array_merge( |
|
| 194 | + $this->fallbackDirsPsr0, |
|
| 195 | + (array) $paths |
|
| 196 | + ); |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + return; |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + $first = $prefix[0]; |
|
| 203 | + if (!isset($this->prefixesPsr0[$first][$prefix])) { |
|
| 204 | + $this->prefixesPsr0[$first][$prefix] = (array) $paths; |
|
| 205 | + |
|
| 206 | + return; |
|
| 207 | + } |
|
| 208 | + if ($prepend) { |
|
| 209 | + $this->prefixesPsr0[$first][$prefix] = array_merge( |
|
| 210 | + (array) $paths, |
|
| 211 | + $this->prefixesPsr0[$first][$prefix] |
|
| 212 | + ); |
|
| 213 | + } else { |
|
| 214 | + $this->prefixesPsr0[$first][$prefix] = array_merge( |
|
| 215 | + $this->prefixesPsr0[$first][$prefix], |
|
| 216 | + (array) $paths |
|
| 217 | + ); |
|
| 218 | + } |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + /** |
|
| 222 | + * Registers a set of PSR-4 directories for a given namespace, either |
|
| 223 | + * appending or prepending to the ones previously set for this namespace. |
|
| 224 | + * |
|
| 225 | + * @param string $prefix The prefix/namespace, with trailing '\\' |
|
| 226 | + * @param string[]|string $paths The PSR-4 base directories |
|
| 227 | + * @param bool $prepend Whether to prepend the directories |
|
| 228 | + * |
|
| 229 | + * @throws \InvalidArgumentException |
|
| 230 | + * |
|
| 231 | + * @return void |
|
| 232 | + */ |
|
| 233 | + public function addPsr4($prefix, $paths, $prepend = false) |
|
| 234 | + { |
|
| 235 | + if (!$prefix) { |
|
| 236 | + // Register directories for the root namespace. |
|
| 237 | + if ($prepend) { |
|
| 238 | + $this->fallbackDirsPsr4 = array_merge( |
|
| 239 | + (array) $paths, |
|
| 240 | + $this->fallbackDirsPsr4 |
|
| 241 | + ); |
|
| 242 | + } else { |
|
| 243 | + $this->fallbackDirsPsr4 = array_merge( |
|
| 244 | + $this->fallbackDirsPsr4, |
|
| 245 | + (array) $paths |
|
| 246 | + ); |
|
| 247 | + } |
|
| 248 | + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { |
|
| 249 | + // Register directories for a new namespace. |
|
| 250 | + $length = strlen($prefix); |
|
| 251 | + if ('\\' !== $prefix[$length - 1]) { |
|
| 252 | + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
|
| 253 | + } |
|
| 254 | + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
|
| 255 | + $this->prefixDirsPsr4[$prefix] = (array) $paths; |
|
| 256 | + } elseif ($prepend) { |
|
| 257 | + // Prepend directories for an already registered namespace. |
|
| 258 | + $this->prefixDirsPsr4[$prefix] = array_merge( |
|
| 259 | + (array) $paths, |
|
| 260 | + $this->prefixDirsPsr4[$prefix] |
|
| 261 | + ); |
|
| 262 | + } else { |
|
| 263 | + // Append directories for an already registered namespace. |
|
| 264 | + $this->prefixDirsPsr4[$prefix] = array_merge( |
|
| 265 | + $this->prefixDirsPsr4[$prefix], |
|
| 266 | + (array) $paths |
|
| 267 | + ); |
|
| 268 | + } |
|
| 269 | + } |
|
| 270 | + |
|
| 271 | + /** |
|
| 272 | + * Registers a set of PSR-0 directories for a given prefix, |
|
| 273 | + * replacing any others previously set for this prefix. |
|
| 274 | + * |
|
| 275 | + * @param string $prefix The prefix |
|
| 276 | + * @param string[]|string $paths The PSR-0 base directories |
|
| 277 | + * |
|
| 278 | + * @return void |
|
| 279 | + */ |
|
| 280 | + public function set($prefix, $paths) |
|
| 281 | + { |
|
| 282 | + if (!$prefix) { |
|
| 283 | + $this->fallbackDirsPsr0 = (array) $paths; |
|
| 284 | + } else { |
|
| 285 | + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; |
|
| 286 | + } |
|
| 287 | + } |
|
| 288 | + |
|
| 289 | + /** |
|
| 290 | + * Registers a set of PSR-4 directories for a given namespace, |
|
| 291 | + * replacing any others previously set for this namespace. |
|
| 292 | + * |
|
| 293 | + * @param string $prefix The prefix/namespace, with trailing '\\' |
|
| 294 | + * @param string[]|string $paths The PSR-4 base directories |
|
| 295 | + * |
|
| 296 | + * @throws \InvalidArgumentException |
|
| 297 | + * |
|
| 298 | + * @return void |
|
| 299 | + */ |
|
| 300 | + public function setPsr4($prefix, $paths) |
|
| 301 | + { |
|
| 302 | + if (!$prefix) { |
|
| 303 | + $this->fallbackDirsPsr4 = (array) $paths; |
|
| 304 | + } else { |
|
| 305 | + $length = strlen($prefix); |
|
| 306 | + if ('\\' !== $prefix[$length - 1]) { |
|
| 307 | + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
|
| 308 | + } |
|
| 309 | + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
|
| 310 | + $this->prefixDirsPsr4[$prefix] = (array) $paths; |
|
| 311 | + } |
|
| 312 | + } |
|
| 313 | + |
|
| 314 | + /** |
|
| 315 | + * Turns on searching the include path for class files. |
|
| 316 | + * |
|
| 317 | + * @param bool $useIncludePath |
|
| 318 | + * |
|
| 319 | + * @return void |
|
| 320 | + */ |
|
| 321 | + public function setUseIncludePath($useIncludePath) |
|
| 322 | + { |
|
| 323 | + $this->useIncludePath = $useIncludePath; |
|
| 324 | + } |
|
| 325 | + |
|
| 326 | + /** |
|
| 327 | + * Can be used to check if the autoloader uses the include path to check |
|
| 328 | + * for classes. |
|
| 329 | + * |
|
| 330 | + * @return bool |
|
| 331 | + */ |
|
| 332 | + public function getUseIncludePath() |
|
| 333 | + { |
|
| 334 | + return $this->useIncludePath; |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + /** |
|
| 338 | + * Turns off searching the prefix and fallback directories for classes |
|
| 339 | + * that have not been registered with the class map. |
|
| 340 | + * |
|
| 341 | + * @param bool $classMapAuthoritative |
|
| 342 | + * |
|
| 343 | + * @return void |
|
| 344 | + */ |
|
| 345 | + public function setClassMapAuthoritative($classMapAuthoritative) |
|
| 346 | + { |
|
| 347 | + $this->classMapAuthoritative = $classMapAuthoritative; |
|
| 348 | + } |
|
| 349 | + |
|
| 350 | + /** |
|
| 351 | + * Should class lookup fail if not found in the current class map? |
|
| 352 | + * |
|
| 353 | + * @return bool |
|
| 354 | + */ |
|
| 355 | + public function isClassMapAuthoritative() |
|
| 356 | + { |
|
| 357 | + return $this->classMapAuthoritative; |
|
| 358 | + } |
|
| 359 | + |
|
| 360 | + /** |
|
| 361 | + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. |
|
| 362 | + * |
|
| 363 | + * @param string|null $apcuPrefix |
|
| 364 | + * |
|
| 365 | + * @return void |
|
| 366 | + */ |
|
| 367 | + public function setApcuPrefix($apcuPrefix) |
|
| 368 | + { |
|
| 369 | + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; |
|
| 370 | + } |
|
| 371 | + |
|
| 372 | + /** |
|
| 373 | + * The APCu prefix in use, or null if APCu caching is not enabled. |
|
| 374 | + * |
|
| 375 | + * @return string|null |
|
| 376 | + */ |
|
| 377 | + public function getApcuPrefix() |
|
| 378 | + { |
|
| 379 | + return $this->apcuPrefix; |
|
| 380 | + } |
|
| 381 | + |
|
| 382 | + /** |
|
| 383 | + * Registers this instance as an autoloader. |
|
| 384 | + * |
|
| 385 | + * @param bool $prepend Whether to prepend the autoloader or not |
|
| 386 | + * |
|
| 387 | + * @return void |
|
| 388 | + */ |
|
| 389 | + public function register($prepend = false) |
|
| 390 | + { |
|
| 391 | + spl_autoload_register(array($this, 'loadClass'), true, $prepend); |
|
| 392 | + |
|
| 393 | + if (null === $this->vendorDir) { |
|
| 394 | + return; |
|
| 395 | + } |
|
| 396 | + |
|
| 397 | + if ($prepend) { |
|
| 398 | + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; |
|
| 399 | + } else { |
|
| 400 | + unset(self::$registeredLoaders[$this->vendorDir]); |
|
| 401 | + self::$registeredLoaders[$this->vendorDir] = $this; |
|
| 402 | + } |
|
| 403 | + } |
|
| 404 | + |
|
| 405 | + /** |
|
| 406 | + * Unregisters this instance as an autoloader. |
|
| 407 | + * |
|
| 408 | + * @return void |
|
| 409 | + */ |
|
| 410 | + public function unregister() |
|
| 411 | + { |
|
| 412 | + spl_autoload_unregister(array($this, 'loadClass')); |
|
| 413 | + |
|
| 414 | + if (null !== $this->vendorDir) { |
|
| 415 | + unset(self::$registeredLoaders[$this->vendorDir]); |
|
| 416 | + } |
|
| 417 | + } |
|
| 418 | + |
|
| 419 | + /** |
|
| 420 | + * Loads the given class or interface. |
|
| 421 | + * |
|
| 422 | + * @param string $class The name of the class |
|
| 423 | + * @return true|null True if loaded, null otherwise |
|
| 424 | + */ |
|
| 425 | + public function loadClass($class) |
|
| 426 | + { |
|
| 427 | + if ($file = $this->findFile($class)) { |
|
| 428 | + includeFile($file); |
|
| 429 | + |
|
| 430 | + return true; |
|
| 431 | + } |
|
| 432 | + |
|
| 433 | + return null; |
|
| 434 | + } |
|
| 435 | + |
|
| 436 | + /** |
|
| 437 | + * Finds the path to the file where the class is defined. |
|
| 438 | + * |
|
| 439 | + * @param string $class The name of the class |
|
| 440 | + * |
|
| 441 | + * @return string|false The path if found, false otherwise |
|
| 442 | + */ |
|
| 443 | + public function findFile($class) |
|
| 444 | + { |
|
| 445 | + // class map lookup |
|
| 446 | + if (isset($this->classMap[$class])) { |
|
| 447 | + return $this->classMap[$class]; |
|
| 448 | + } |
|
| 449 | + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { |
|
| 450 | + return false; |
|
| 451 | + } |
|
| 452 | + if (null !== $this->apcuPrefix) { |
|
| 453 | + $file = apcu_fetch($this->apcuPrefix.$class, $hit); |
|
| 454 | + if ($hit) { |
|
| 455 | + return $file; |
|
| 456 | + } |
|
| 457 | + } |
|
| 458 | + |
|
| 459 | + $file = $this->findFileWithExtension($class, '.php'); |
|
| 460 | + |
|
| 461 | + // Search for Hack files if we are running on HHVM |
|
| 462 | + if (false === $file && defined('HHVM_VERSION')) { |
|
| 463 | + $file = $this->findFileWithExtension($class, '.hh'); |
|
| 464 | + } |
|
| 465 | + |
|
| 466 | + if (null !== $this->apcuPrefix) { |
|
| 467 | + apcu_add($this->apcuPrefix.$class, $file); |
|
| 468 | + } |
|
| 469 | + |
|
| 470 | + if (false === $file) { |
|
| 471 | + // Remember that this class does not exist. |
|
| 472 | + $this->missingClasses[$class] = true; |
|
| 473 | + } |
|
| 474 | + |
|
| 475 | + return $file; |
|
| 476 | + } |
|
| 477 | + |
|
| 478 | + /** |
|
| 479 | + * Returns the currently registered loaders indexed by their corresponding vendor directories. |
|
| 480 | + * |
|
| 481 | + * @return self[] |
|
| 482 | + */ |
|
| 483 | + public static function getRegisteredLoaders() |
|
| 484 | + { |
|
| 485 | + return self::$registeredLoaders; |
|
| 486 | + } |
|
| 487 | + |
|
| 488 | + /** |
|
| 489 | + * @param string $class |
|
| 490 | + * @param string $ext |
|
| 491 | + * @return string|false |
|
| 492 | + */ |
|
| 493 | + private function findFileWithExtension($class, $ext) |
|
| 494 | + { |
|
| 495 | + // PSR-4 lookup |
|
| 496 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
| 497 | + |
|
| 498 | + $first = $class[0]; |
|
| 499 | + if (isset($this->prefixLengthsPsr4[$first])) { |
|
| 500 | + $subPath = $class; |
|
| 501 | + while (false !== $lastPos = strrpos($subPath, '\\')) { |
|
| 502 | + $subPath = substr($subPath, 0, $lastPos); |
|
| 503 | + $search = $subPath . '\\'; |
|
| 504 | + if (isset($this->prefixDirsPsr4[$search])) { |
|
| 505 | + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
| 506 | + foreach ($this->prefixDirsPsr4[$search] as $dir) { |
|
| 507 | + if (file_exists($file = $dir . $pathEnd)) { |
|
| 508 | + return $file; |
|
| 509 | + } |
|
| 510 | + } |
|
| 511 | + } |
|
| 512 | + } |
|
| 513 | + } |
|
| 514 | + |
|
| 515 | + // PSR-4 fallback dirs |
|
| 516 | + foreach ($this->fallbackDirsPsr4 as $dir) { |
|
| 517 | + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
| 518 | + return $file; |
|
| 519 | + } |
|
| 520 | + } |
|
| 521 | + |
|
| 522 | + // PSR-0 lookup |
|
| 523 | + if (false !== $pos = strrpos($class, '\\')) { |
|
| 524 | + // namespaced class name |
|
| 525 | + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) |
|
| 526 | + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
|
| 527 | + } else { |
|
| 528 | + // PEAR-like class name |
|
| 529 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
| 530 | + } |
|
| 531 | + |
|
| 532 | + if (isset($this->prefixesPsr0[$first])) { |
|
| 533 | + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
|
| 534 | + if (0 === strpos($class, $prefix)) { |
|
| 535 | + foreach ($dirs as $dir) { |
|
| 536 | + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
| 537 | + return $file; |
|
| 538 | + } |
|
| 539 | + } |
|
| 540 | + } |
|
| 541 | + } |
|
| 542 | + } |
|
| 543 | + |
|
| 544 | + // PSR-0 fallback dirs |
|
| 545 | + foreach ($this->fallbackDirsPsr0 as $dir) { |
|
| 546 | + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
| 547 | + return $file; |
|
| 548 | + } |
|
| 549 | + } |
|
| 550 | + |
|
| 551 | + // PSR-0 include paths. |
|
| 552 | + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { |
|
| 553 | + return $file; |
|
| 554 | + } |
|
| 555 | + |
|
| 556 | + return false; |
|
| 557 | + } |
|
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | /** |
@@ -568,5 +568,5 @@ discard block |
||
| 568 | 568 | */ |
| 569 | 569 | function includeFile($file) |
| 570 | 570 | { |
| 571 | - include $file; |
|
| 571 | + include $file; |
|
| 572 | 572 | } |
@@ -24,327 +24,327 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | class InstalledVersions |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * @var mixed[]|null |
|
| 29 | - * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null |
|
| 30 | - */ |
|
| 31 | - private static $installed; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * @var bool|null |
|
| 35 | - */ |
|
| 36 | - private static $canGetVendors; |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * @var array[] |
|
| 40 | - * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
|
| 41 | - */ |
|
| 42 | - private static $installedByVendor = array(); |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Returns a list of all package names which are present, either by being installed, replaced or provided |
|
| 46 | - * |
|
| 47 | - * @return string[] |
|
| 48 | - * @psalm-return list<string> |
|
| 49 | - */ |
|
| 50 | - public static function getInstalledPackages() |
|
| 51 | - { |
|
| 52 | - $packages = array(); |
|
| 53 | - foreach (self::getInstalled() as $installed) { |
|
| 54 | - $packages[] = array_keys($installed['versions']); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - if (1 === \count($packages)) { |
|
| 58 | - return $packages[0]; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * Returns a list of all package names with a specific type e.g. 'library' |
|
| 66 | - * |
|
| 67 | - * @param string $type |
|
| 68 | - * @return string[] |
|
| 69 | - * @psalm-return list<string> |
|
| 70 | - */ |
|
| 71 | - public static function getInstalledPackagesByType($type) |
|
| 72 | - { |
|
| 73 | - $packagesByType = array(); |
|
| 74 | - |
|
| 75 | - foreach (self::getInstalled() as $installed) { |
|
| 76 | - foreach ($installed['versions'] as $name => $package) { |
|
| 77 | - if (isset($package['type']) && $package['type'] === $type) { |
|
| 78 | - $packagesByType[] = $name; |
|
| 79 | - } |
|
| 80 | - } |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - return $packagesByType; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * Checks whether the given package is installed |
|
| 88 | - * |
|
| 89 | - * This also returns true if the package name is provided or replaced by another package |
|
| 90 | - * |
|
| 91 | - * @param string $packageName |
|
| 92 | - * @param bool $includeDevRequirements |
|
| 93 | - * @return bool |
|
| 94 | - */ |
|
| 95 | - public static function isInstalled($packageName, $includeDevRequirements = true) |
|
| 96 | - { |
|
| 97 | - foreach (self::getInstalled() as $installed) { |
|
| 98 | - if (isset($installed['versions'][$packageName])) { |
|
| 99 | - return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - return false; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Checks whether the given package satisfies a version constraint |
|
| 108 | - * |
|
| 109 | - * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: |
|
| 110 | - * |
|
| 111 | - * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') |
|
| 112 | - * |
|
| 113 | - * @param VersionParser $parser Install composer/semver to have access to this class and functionality |
|
| 114 | - * @param string $packageName |
|
| 115 | - * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package |
|
| 116 | - * @return bool |
|
| 117 | - */ |
|
| 118 | - public static function satisfies(VersionParser $parser, $packageName, $constraint) |
|
| 119 | - { |
|
| 120 | - $constraint = $parser->parseConstraints($constraint); |
|
| 121 | - $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); |
|
| 122 | - |
|
| 123 | - return $provided->matches($constraint); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Returns a version constraint representing all the range(s) which are installed for a given package |
|
| 128 | - * |
|
| 129 | - * It is easier to use this via isInstalled() with the $constraint argument if you need to check |
|
| 130 | - * whether a given version of a package is installed, and not just whether it exists |
|
| 131 | - * |
|
| 132 | - * @param string $packageName |
|
| 133 | - * @return string Version constraint usable with composer/semver |
|
| 134 | - */ |
|
| 135 | - public static function getVersionRanges($packageName) |
|
| 136 | - { |
|
| 137 | - foreach (self::getInstalled() as $installed) { |
|
| 138 | - if (!isset($installed['versions'][$packageName])) { |
|
| 139 | - continue; |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - $ranges = array(); |
|
| 143 | - if (isset($installed['versions'][$packageName]['pretty_version'])) { |
|
| 144 | - $ranges[] = $installed['versions'][$packageName]['pretty_version']; |
|
| 145 | - } |
|
| 146 | - if (array_key_exists('aliases', $installed['versions'][$packageName])) { |
|
| 147 | - $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); |
|
| 148 | - } |
|
| 149 | - if (array_key_exists('replaced', $installed['versions'][$packageName])) { |
|
| 150 | - $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); |
|
| 151 | - } |
|
| 152 | - if (array_key_exists('provided', $installed['versions'][$packageName])) { |
|
| 153 | - $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - return implode(' || ', $ranges); |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * @param string $packageName |
|
| 164 | - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present |
|
| 165 | - */ |
|
| 166 | - public static function getVersion($packageName) |
|
| 167 | - { |
|
| 168 | - foreach (self::getInstalled() as $installed) { |
|
| 169 | - if (!isset($installed['versions'][$packageName])) { |
|
| 170 | - continue; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - if (!isset($installed['versions'][$packageName]['version'])) { |
|
| 174 | - return null; |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - return $installed['versions'][$packageName]['version']; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - /** |
|
| 184 | - * @param string $packageName |
|
| 185 | - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present |
|
| 186 | - */ |
|
| 187 | - public static function getPrettyVersion($packageName) |
|
| 188 | - { |
|
| 189 | - foreach (self::getInstalled() as $installed) { |
|
| 190 | - if (!isset($installed['versions'][$packageName])) { |
|
| 191 | - continue; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - if (!isset($installed['versions'][$packageName]['pretty_version'])) { |
|
| 195 | - return null; |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - return $installed['versions'][$packageName]['pretty_version']; |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * @param string $packageName |
|
| 206 | - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference |
|
| 207 | - */ |
|
| 208 | - public static function getReference($packageName) |
|
| 209 | - { |
|
| 210 | - foreach (self::getInstalled() as $installed) { |
|
| 211 | - if (!isset($installed['versions'][$packageName])) { |
|
| 212 | - continue; |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - if (!isset($installed['versions'][$packageName]['reference'])) { |
|
| 216 | - return null; |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - return $installed['versions'][$packageName]['reference']; |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - /** |
|
| 226 | - * @param string $packageName |
|
| 227 | - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. |
|
| 228 | - */ |
|
| 229 | - public static function getInstallPath($packageName) |
|
| 230 | - { |
|
| 231 | - foreach (self::getInstalled() as $installed) { |
|
| 232 | - if (!isset($installed['versions'][$packageName])) { |
|
| 233 | - continue; |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - /** |
|
| 243 | - * @return array |
|
| 244 | - * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} |
|
| 245 | - */ |
|
| 246 | - public static function getRootPackage() |
|
| 247 | - { |
|
| 248 | - $installed = self::getInstalled(); |
|
| 249 | - |
|
| 250 | - return $installed[0]['root']; |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - /** |
|
| 254 | - * Returns the raw installed.php data for custom implementations |
|
| 255 | - * |
|
| 256 | - * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. |
|
| 257 | - * @return array[] |
|
| 258 | - * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} |
|
| 259 | - */ |
|
| 260 | - public static function getRawData() |
|
| 261 | - { |
|
| 262 | - @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); |
|
| 263 | - |
|
| 264 | - if (null === self::$installed) { |
|
| 265 | - // only require the installed.php file if this file is loaded from its dumped location, |
|
| 266 | - // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
|
| 267 | - if (substr(__DIR__, -8, 1) !== 'C') { |
|
| 268 | - self::$installed = include __DIR__ . '/installed.php'; |
|
| 269 | - } else { |
|
| 270 | - self::$installed = array(); |
|
| 271 | - } |
|
| 272 | - } |
|
| 273 | - |
|
| 274 | - return self::$installed; |
|
| 275 | - } |
|
| 276 | - |
|
| 277 | - /** |
|
| 278 | - * Returns the raw data of all installed.php which are currently loaded for custom implementations |
|
| 279 | - * |
|
| 280 | - * @return array[] |
|
| 281 | - * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
|
| 282 | - */ |
|
| 283 | - public static function getAllRawData() |
|
| 284 | - { |
|
| 285 | - return self::getInstalled(); |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - /** |
|
| 289 | - * Lets you reload the static array from another file |
|
| 290 | - * |
|
| 291 | - * This is only useful for complex integrations in which a project needs to use |
|
| 292 | - * this class but then also needs to execute another project's autoloader in process, |
|
| 293 | - * and wants to ensure both projects have access to their version of installed.php. |
|
| 294 | - * |
|
| 295 | - * A typical case would be PHPUnit, where it would need to make sure it reads all |
|
| 296 | - * the data it needs from this class, then call reload() with |
|
| 297 | - * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure |
|
| 298 | - * the project in which it runs can then also use this class safely, without |
|
| 299 | - * interference between PHPUnit's dependencies and the project's dependencies. |
|
| 300 | - * |
|
| 301 | - * @param array[] $data A vendor/composer/installed.php data set |
|
| 302 | - * @return void |
|
| 303 | - * |
|
| 304 | - * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data |
|
| 305 | - */ |
|
| 306 | - public static function reload($data) |
|
| 307 | - { |
|
| 308 | - self::$installed = $data; |
|
| 309 | - self::$installedByVendor = array(); |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - /** |
|
| 313 | - * @return array[] |
|
| 314 | - * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
|
| 315 | - */ |
|
| 316 | - private static function getInstalled() |
|
| 317 | - { |
|
| 318 | - if (null === self::$canGetVendors) { |
|
| 319 | - self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); |
|
| 320 | - } |
|
| 321 | - |
|
| 322 | - $installed = array(); |
|
| 323 | - |
|
| 324 | - if (self::$canGetVendors) { |
|
| 325 | - foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { |
|
| 326 | - if (isset(self::$installedByVendor[$vendorDir])) { |
|
| 327 | - $installed[] = self::$installedByVendor[$vendorDir]; |
|
| 328 | - } elseif (is_file($vendorDir.'/composer/installed.php')) { |
|
| 329 | - $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; |
|
| 330 | - if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { |
|
| 331 | - self::$installed = $installed[count($installed) - 1]; |
|
| 332 | - } |
|
| 333 | - } |
|
| 334 | - } |
|
| 335 | - } |
|
| 336 | - |
|
| 337 | - if (null === self::$installed) { |
|
| 338 | - // only require the installed.php file if this file is loaded from its dumped location, |
|
| 339 | - // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
|
| 340 | - if (substr(__DIR__, -8, 1) !== 'C') { |
|
| 341 | - self::$installed = require __DIR__ . '/installed.php'; |
|
| 342 | - } else { |
|
| 343 | - self::$installed = array(); |
|
| 344 | - } |
|
| 345 | - } |
|
| 346 | - $installed[] = self::$installed; |
|
| 347 | - |
|
| 348 | - return $installed; |
|
| 349 | - } |
|
| 27 | + /** |
|
| 28 | + * @var mixed[]|null |
|
| 29 | + * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null |
|
| 30 | + */ |
|
| 31 | + private static $installed; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * @var bool|null |
|
| 35 | + */ |
|
| 36 | + private static $canGetVendors; |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * @var array[] |
|
| 40 | + * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
|
| 41 | + */ |
|
| 42 | + private static $installedByVendor = array(); |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Returns a list of all package names which are present, either by being installed, replaced or provided |
|
| 46 | + * |
|
| 47 | + * @return string[] |
|
| 48 | + * @psalm-return list<string> |
|
| 49 | + */ |
|
| 50 | + public static function getInstalledPackages() |
|
| 51 | + { |
|
| 52 | + $packages = array(); |
|
| 53 | + foreach (self::getInstalled() as $installed) { |
|
| 54 | + $packages[] = array_keys($installed['versions']); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + if (1 === \count($packages)) { |
|
| 58 | + return $packages[0]; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * Returns a list of all package names with a specific type e.g. 'library' |
|
| 66 | + * |
|
| 67 | + * @param string $type |
|
| 68 | + * @return string[] |
|
| 69 | + * @psalm-return list<string> |
|
| 70 | + */ |
|
| 71 | + public static function getInstalledPackagesByType($type) |
|
| 72 | + { |
|
| 73 | + $packagesByType = array(); |
|
| 74 | + |
|
| 75 | + foreach (self::getInstalled() as $installed) { |
|
| 76 | + foreach ($installed['versions'] as $name => $package) { |
|
| 77 | + if (isset($package['type']) && $package['type'] === $type) { |
|
| 78 | + $packagesByType[] = $name; |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + return $packagesByType; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * Checks whether the given package is installed |
|
| 88 | + * |
|
| 89 | + * This also returns true if the package name is provided or replaced by another package |
|
| 90 | + * |
|
| 91 | + * @param string $packageName |
|
| 92 | + * @param bool $includeDevRequirements |
|
| 93 | + * @return bool |
|
| 94 | + */ |
|
| 95 | + public static function isInstalled($packageName, $includeDevRequirements = true) |
|
| 96 | + { |
|
| 97 | + foreach (self::getInstalled() as $installed) { |
|
| 98 | + if (isset($installed['versions'][$packageName])) { |
|
| 99 | + return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + return false; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Checks whether the given package satisfies a version constraint |
|
| 108 | + * |
|
| 109 | + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: |
|
| 110 | + * |
|
| 111 | + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') |
|
| 112 | + * |
|
| 113 | + * @param VersionParser $parser Install composer/semver to have access to this class and functionality |
|
| 114 | + * @param string $packageName |
|
| 115 | + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package |
|
| 116 | + * @return bool |
|
| 117 | + */ |
|
| 118 | + public static function satisfies(VersionParser $parser, $packageName, $constraint) |
|
| 119 | + { |
|
| 120 | + $constraint = $parser->parseConstraints($constraint); |
|
| 121 | + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); |
|
| 122 | + |
|
| 123 | + return $provided->matches($constraint); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Returns a version constraint representing all the range(s) which are installed for a given package |
|
| 128 | + * |
|
| 129 | + * It is easier to use this via isInstalled() with the $constraint argument if you need to check |
|
| 130 | + * whether a given version of a package is installed, and not just whether it exists |
|
| 131 | + * |
|
| 132 | + * @param string $packageName |
|
| 133 | + * @return string Version constraint usable with composer/semver |
|
| 134 | + */ |
|
| 135 | + public static function getVersionRanges($packageName) |
|
| 136 | + { |
|
| 137 | + foreach (self::getInstalled() as $installed) { |
|
| 138 | + if (!isset($installed['versions'][$packageName])) { |
|
| 139 | + continue; |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + $ranges = array(); |
|
| 143 | + if (isset($installed['versions'][$packageName]['pretty_version'])) { |
|
| 144 | + $ranges[] = $installed['versions'][$packageName]['pretty_version']; |
|
| 145 | + } |
|
| 146 | + if (array_key_exists('aliases', $installed['versions'][$packageName])) { |
|
| 147 | + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); |
|
| 148 | + } |
|
| 149 | + if (array_key_exists('replaced', $installed['versions'][$packageName])) { |
|
| 150 | + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); |
|
| 151 | + } |
|
| 152 | + if (array_key_exists('provided', $installed['versions'][$packageName])) { |
|
| 153 | + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + return implode(' || ', $ranges); |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * @param string $packageName |
|
| 164 | + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present |
|
| 165 | + */ |
|
| 166 | + public static function getVersion($packageName) |
|
| 167 | + { |
|
| 168 | + foreach (self::getInstalled() as $installed) { |
|
| 169 | + if (!isset($installed['versions'][$packageName])) { |
|
| 170 | + continue; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + if (!isset($installed['versions'][$packageName]['version'])) { |
|
| 174 | + return null; |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + return $installed['versions'][$packageName]['version']; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + /** |
|
| 184 | + * @param string $packageName |
|
| 185 | + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present |
|
| 186 | + */ |
|
| 187 | + public static function getPrettyVersion($packageName) |
|
| 188 | + { |
|
| 189 | + foreach (self::getInstalled() as $installed) { |
|
| 190 | + if (!isset($installed['versions'][$packageName])) { |
|
| 191 | + continue; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + if (!isset($installed['versions'][$packageName]['pretty_version'])) { |
|
| 195 | + return null; |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + return $installed['versions'][$packageName]['pretty_version']; |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * @param string $packageName |
|
| 206 | + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference |
|
| 207 | + */ |
|
| 208 | + public static function getReference($packageName) |
|
| 209 | + { |
|
| 210 | + foreach (self::getInstalled() as $installed) { |
|
| 211 | + if (!isset($installed['versions'][$packageName])) { |
|
| 212 | + continue; |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + if (!isset($installed['versions'][$packageName]['reference'])) { |
|
| 216 | + return null; |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + return $installed['versions'][$packageName]['reference']; |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + /** |
|
| 226 | + * @param string $packageName |
|
| 227 | + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. |
|
| 228 | + */ |
|
| 229 | + public static function getInstallPath($packageName) |
|
| 230 | + { |
|
| 231 | + foreach (self::getInstalled() as $installed) { |
|
| 232 | + if (!isset($installed['versions'][$packageName])) { |
|
| 233 | + continue; |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * @return array |
|
| 244 | + * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} |
|
| 245 | + */ |
|
| 246 | + public static function getRootPackage() |
|
| 247 | + { |
|
| 248 | + $installed = self::getInstalled(); |
|
| 249 | + |
|
| 250 | + return $installed[0]['root']; |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + /** |
|
| 254 | + * Returns the raw installed.php data for custom implementations |
|
| 255 | + * |
|
| 256 | + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. |
|
| 257 | + * @return array[] |
|
| 258 | + * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} |
|
| 259 | + */ |
|
| 260 | + public static function getRawData() |
|
| 261 | + { |
|
| 262 | + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); |
|
| 263 | + |
|
| 264 | + if (null === self::$installed) { |
|
| 265 | + // only require the installed.php file if this file is loaded from its dumped location, |
|
| 266 | + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
|
| 267 | + if (substr(__DIR__, -8, 1) !== 'C') { |
|
| 268 | + self::$installed = include __DIR__ . '/installed.php'; |
|
| 269 | + } else { |
|
| 270 | + self::$installed = array(); |
|
| 271 | + } |
|
| 272 | + } |
|
| 273 | + |
|
| 274 | + return self::$installed; |
|
| 275 | + } |
|
| 276 | + |
|
| 277 | + /** |
|
| 278 | + * Returns the raw data of all installed.php which are currently loaded for custom implementations |
|
| 279 | + * |
|
| 280 | + * @return array[] |
|
| 281 | + * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
|
| 282 | + */ |
|
| 283 | + public static function getAllRawData() |
|
| 284 | + { |
|
| 285 | + return self::getInstalled(); |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + /** |
|
| 289 | + * Lets you reload the static array from another file |
|
| 290 | + * |
|
| 291 | + * This is only useful for complex integrations in which a project needs to use |
|
| 292 | + * this class but then also needs to execute another project's autoloader in process, |
|
| 293 | + * and wants to ensure both projects have access to their version of installed.php. |
|
| 294 | + * |
|
| 295 | + * A typical case would be PHPUnit, where it would need to make sure it reads all |
|
| 296 | + * the data it needs from this class, then call reload() with |
|
| 297 | + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure |
|
| 298 | + * the project in which it runs can then also use this class safely, without |
|
| 299 | + * interference between PHPUnit's dependencies and the project's dependencies. |
|
| 300 | + * |
|
| 301 | + * @param array[] $data A vendor/composer/installed.php data set |
|
| 302 | + * @return void |
|
| 303 | + * |
|
| 304 | + * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data |
|
| 305 | + */ |
|
| 306 | + public static function reload($data) |
|
| 307 | + { |
|
| 308 | + self::$installed = $data; |
|
| 309 | + self::$installedByVendor = array(); |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + /** |
|
| 313 | + * @return array[] |
|
| 314 | + * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
|
| 315 | + */ |
|
| 316 | + private static function getInstalled() |
|
| 317 | + { |
|
| 318 | + if (null === self::$canGetVendors) { |
|
| 319 | + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); |
|
| 320 | + } |
|
| 321 | + |
|
| 322 | + $installed = array(); |
|
| 323 | + |
|
| 324 | + if (self::$canGetVendors) { |
|
| 325 | + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { |
|
| 326 | + if (isset(self::$installedByVendor[$vendorDir])) { |
|
| 327 | + $installed[] = self::$installedByVendor[$vendorDir]; |
|
| 328 | + } elseif (is_file($vendorDir.'/composer/installed.php')) { |
|
| 329 | + $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; |
|
| 330 | + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { |
|
| 331 | + self::$installed = $installed[count($installed) - 1]; |
|
| 332 | + } |
|
| 333 | + } |
|
| 334 | + } |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + if (null === self::$installed) { |
|
| 338 | + // only require the installed.php file if this file is loaded from its dumped location, |
|
| 339 | + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
|
| 340 | + if (substr(__DIR__, -8, 1) !== 'C') { |
|
| 341 | + self::$installed = require __DIR__ . '/installed.php'; |
|
| 342 | + } else { |
|
| 343 | + self::$installed = array(); |
|
| 344 | + } |
|
| 345 | + } |
|
| 346 | + $installed[] = self::$installed; |
|
| 347 | + |
|
| 348 | + return $installed; |
|
| 349 | + } |
|
| 350 | 350 | } |
@@ -4,65 +4,65 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | class ComposerAutoloaderInit984ed95bef2b0e3d4eeb0208a88dc67d |
| 6 | 6 | { |
| 7 | - private static $loader; |
|
| 7 | + private static $loader; |
|
| 8 | 8 | |
| 9 | - public static function loadClassLoader($class) |
|
| 10 | - { |
|
| 11 | - if ('Composer\Autoload\ClassLoader' === $class) { |
|
| 12 | - require __DIR__ . '/ClassLoader.php'; |
|
| 13 | - } |
|
| 14 | - } |
|
| 9 | + public static function loadClassLoader($class) |
|
| 10 | + { |
|
| 11 | + if ('Composer\Autoload\ClassLoader' === $class) { |
|
| 12 | + require __DIR__ . '/ClassLoader.php'; |
|
| 13 | + } |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * @return \Composer\Autoload\ClassLoader |
|
| 18 | - */ |
|
| 19 | - public static function getLoader() |
|
| 20 | - { |
|
| 21 | - if (null !== self::$loader) { |
|
| 22 | - return self::$loader; |
|
| 23 | - } |
|
| 16 | + /** |
|
| 17 | + * @return \Composer\Autoload\ClassLoader |
|
| 18 | + */ |
|
| 19 | + public static function getLoader() |
|
| 20 | + { |
|
| 21 | + if (null !== self::$loader) { |
|
| 22 | + return self::$loader; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - require __DIR__ . '/platform_check.php'; |
|
| 25 | + require __DIR__ . '/platform_check.php'; |
|
| 26 | 26 | |
| 27 | - spl_autoload_register(array('ComposerAutoloaderInit984ed95bef2b0e3d4eeb0208a88dc67d', 'loadClassLoader'), true, true); |
|
| 28 | - self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); |
|
| 29 | - spl_autoload_unregister(array('ComposerAutoloaderInit984ed95bef2b0e3d4eeb0208a88dc67d', 'loadClassLoader')); |
|
| 27 | + spl_autoload_register(array('ComposerAutoloaderInit984ed95bef2b0e3d4eeb0208a88dc67d', 'loadClassLoader'), true, true); |
|
| 28 | + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); |
|
| 29 | + spl_autoload_unregister(array('ComposerAutoloaderInit984ed95bef2b0e3d4eeb0208a88dc67d', 'loadClassLoader')); |
|
| 30 | 30 | |
| 31 | - $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); |
|
| 32 | - if ($useStaticLoader) { |
|
| 33 | - require __DIR__ . '/autoload_static.php'; |
|
| 31 | + $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); |
|
| 32 | + if ($useStaticLoader) { |
|
| 33 | + require __DIR__ . '/autoload_static.php'; |
|
| 34 | 34 | |
| 35 | - call_user_func(\Composer\Autoload\ComposerStaticInit984ed95bef2b0e3d4eeb0208a88dc67d::getInitializer($loader)); |
|
| 36 | - } else { |
|
| 37 | - $map = require __DIR__ . '/autoload_namespaces.php'; |
|
| 38 | - foreach ($map as $namespace => $path) { |
|
| 39 | - $loader->set($namespace, $path); |
|
| 40 | - } |
|
| 35 | + call_user_func(\Composer\Autoload\ComposerStaticInit984ed95bef2b0e3d4eeb0208a88dc67d::getInitializer($loader)); |
|
| 36 | + } else { |
|
| 37 | + $map = require __DIR__ . '/autoload_namespaces.php'; |
|
| 38 | + foreach ($map as $namespace => $path) { |
|
| 39 | + $loader->set($namespace, $path); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - $map = require __DIR__ . '/autoload_psr4.php'; |
|
| 43 | - foreach ($map as $namespace => $path) { |
|
| 44 | - $loader->setPsr4($namespace, $path); |
|
| 45 | - } |
|
| 42 | + $map = require __DIR__ . '/autoload_psr4.php'; |
|
| 43 | + foreach ($map as $namespace => $path) { |
|
| 44 | + $loader->setPsr4($namespace, $path); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - $classMap = require __DIR__ . '/autoload_classmap.php'; |
|
| 48 | - if ($classMap) { |
|
| 49 | - $loader->addClassMap($classMap); |
|
| 50 | - } |
|
| 51 | - } |
|
| 47 | + $classMap = require __DIR__ . '/autoload_classmap.php'; |
|
| 48 | + if ($classMap) { |
|
| 49 | + $loader->addClassMap($classMap); |
|
| 50 | + } |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - $loader->register(true); |
|
| 53 | + $loader->register(true); |
|
| 54 | 54 | |
| 55 | - if ($useStaticLoader) { |
|
| 56 | - $includeFiles = Composer\Autoload\ComposerStaticInit984ed95bef2b0e3d4eeb0208a88dc67d::$files; |
|
| 57 | - } else { |
|
| 58 | - $includeFiles = require __DIR__ . '/autoload_files.php'; |
|
| 59 | - } |
|
| 60 | - foreach ($includeFiles as $fileIdentifier => $file) { |
|
| 61 | - composerRequire984ed95bef2b0e3d4eeb0208a88dc67d($fileIdentifier, $file); |
|
| 62 | - } |
|
| 55 | + if ($useStaticLoader) { |
|
| 56 | + $includeFiles = Composer\Autoload\ComposerStaticInit984ed95bef2b0e3d4eeb0208a88dc67d::$files; |
|
| 57 | + } else { |
|
| 58 | + $includeFiles = require __DIR__ . '/autoload_files.php'; |
|
| 59 | + } |
|
| 60 | + foreach ($includeFiles as $fileIdentifier => $file) { |
|
| 61 | + composerRequire984ed95bef2b0e3d4eeb0208a88dc67d($fileIdentifier, $file); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - return $loader; |
|
| 65 | - } |
|
| 64 | + return $loader; |
|
| 65 | + } |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | function composerRequire984ed95bef2b0e3d4eeb0208a88dc67d($fileIdentifier, $file) |
| 74 | 74 | { |
| 75 | - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { |
|
| 76 | - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; |
|
| 75 | + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { |
|
| 76 | + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; |
|
| 77 | 77 | |
| 78 | - require $file; |
|
| 79 | - } |
|
| 78 | + require $file; |
|
| 79 | + } |
|
| 80 | 80 | } |
@@ -1,70 +1,70 @@ |
||
| 1 | 1 | <?php return array( |
| 2 | - 'root' => array( |
|
| 3 | - 'pretty_version' => 'dev-develop', |
|
| 4 | - 'version' => 'dev-develop', |
|
| 5 | - 'type' => 'wordpress-plugin', |
|
| 6 | - 'install_path' => __DIR__ . '/../../', |
|
| 7 | - 'aliases' => array(), |
|
| 8 | - 'reference' => '863c13683df548e907875904b7532d599446ed18', |
|
| 9 | - 'name' => 'gravityview/gravityview', |
|
| 10 | - 'dev' => false, |
|
| 11 | - ), |
|
| 12 | - 'versions' => array( |
|
| 13 | - 'gravityview/gravityview' => array( |
|
| 14 | - 'pretty_version' => 'dev-develop', |
|
| 15 | - 'version' => 'dev-develop', |
|
| 16 | - 'type' => 'wordpress-plugin', |
|
| 17 | - 'install_path' => __DIR__ . '/../../', |
|
| 18 | - 'aliases' => array(), |
|
| 19 | - 'reference' => '863c13683df548e907875904b7532d599446ed18', |
|
| 20 | - 'dev_requirement' => false, |
|
| 21 | - ), |
|
| 22 | - 'katzgrau/klogger' => array( |
|
| 23 | - 'pretty_version' => 'dev-master', |
|
| 24 | - 'version' => 'dev-master', |
|
| 25 | - 'type' => 'library', |
|
| 26 | - 'install_path' => __DIR__ . '/../katzgrau/klogger', |
|
| 27 | - 'aliases' => array( |
|
| 28 | - 0 => '9999999-dev', |
|
| 29 | - ), |
|
| 30 | - 'reference' => 'de2d3ab6777a393a9879e0496ebb8e0644066e3f', |
|
| 31 | - 'dev_requirement' => false, |
|
| 32 | - ), |
|
| 33 | - 'paragonie/random_compat' => array( |
|
| 34 | - 'pretty_version' => 'v2.0.20', |
|
| 35 | - 'version' => '2.0.20.0', |
|
| 36 | - 'type' => 'library', |
|
| 37 | - 'install_path' => __DIR__ . '/../paragonie/random_compat', |
|
| 38 | - 'aliases' => array(), |
|
| 39 | - 'reference' => '0f1f60250fccffeaf5dda91eea1c018aed1adc2a', |
|
| 40 | - 'dev_requirement' => false, |
|
| 41 | - ), |
|
| 42 | - 'paragonie/sodium_compat' => array( |
|
| 43 | - 'pretty_version' => 'v1.17.0', |
|
| 44 | - 'version' => '1.17.0.0', |
|
| 45 | - 'type' => 'library', |
|
| 46 | - 'install_path' => __DIR__ . '/../paragonie/sodium_compat', |
|
| 47 | - 'aliases' => array(), |
|
| 48 | - 'reference' => 'c59cac21abbcc0df06a3dd18076450ea4797b321', |
|
| 49 | - 'dev_requirement' => false, |
|
| 50 | - ), |
|
| 51 | - 'psr/log' => array( |
|
| 52 | - 'pretty_version' => '1.1.4', |
|
| 53 | - 'version' => '1.1.4.0', |
|
| 54 | - 'type' => 'library', |
|
| 55 | - 'install_path' => __DIR__ . '/../psr/log', |
|
| 56 | - 'aliases' => array(), |
|
| 57 | - 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11', |
|
| 58 | - 'dev_requirement' => false, |
|
| 59 | - ), |
|
| 60 | - 'trustedlogin/client' => array( |
|
| 61 | - 'pretty_version' => 'dev-main', |
|
| 62 | - 'version' => 'dev-main', |
|
| 63 | - 'type' => 'library', |
|
| 64 | - 'install_path' => __DIR__ . '/../trustedlogin/client', |
|
| 65 | - 'aliases' => array(), |
|
| 66 | - 'reference' => '8c0be03dac771f157625ee6029e3850a199f6310', |
|
| 67 | - 'dev_requirement' => false, |
|
| 68 | - ), |
|
| 69 | - ), |
|
| 2 | + 'root' => array( |
|
| 3 | + 'pretty_version' => 'dev-develop', |
|
| 4 | + 'version' => 'dev-develop', |
|
| 5 | + 'type' => 'wordpress-plugin', |
|
| 6 | + 'install_path' => __DIR__ . '/../../', |
|
| 7 | + 'aliases' => array(), |
|
| 8 | + 'reference' => '863c13683df548e907875904b7532d599446ed18', |
|
| 9 | + 'name' => 'gravityview/gravityview', |
|
| 10 | + 'dev' => false, |
|
| 11 | + ), |
|
| 12 | + 'versions' => array( |
|
| 13 | + 'gravityview/gravityview' => array( |
|
| 14 | + 'pretty_version' => 'dev-develop', |
|
| 15 | + 'version' => 'dev-develop', |
|
| 16 | + 'type' => 'wordpress-plugin', |
|
| 17 | + 'install_path' => __DIR__ . '/../../', |
|
| 18 | + 'aliases' => array(), |
|
| 19 | + 'reference' => '863c13683df548e907875904b7532d599446ed18', |
|
| 20 | + 'dev_requirement' => false, |
|
| 21 | + ), |
|
| 22 | + 'katzgrau/klogger' => array( |
|
| 23 | + 'pretty_version' => 'dev-master', |
|
| 24 | + 'version' => 'dev-master', |
|
| 25 | + 'type' => 'library', |
|
| 26 | + 'install_path' => __DIR__ . '/../katzgrau/klogger', |
|
| 27 | + 'aliases' => array( |
|
| 28 | + 0 => '9999999-dev', |
|
| 29 | + ), |
|
| 30 | + 'reference' => 'de2d3ab6777a393a9879e0496ebb8e0644066e3f', |
|
| 31 | + 'dev_requirement' => false, |
|
| 32 | + ), |
|
| 33 | + 'paragonie/random_compat' => array( |
|
| 34 | + 'pretty_version' => 'v2.0.20', |
|
| 35 | + 'version' => '2.0.20.0', |
|
| 36 | + 'type' => 'library', |
|
| 37 | + 'install_path' => __DIR__ . '/../paragonie/random_compat', |
|
| 38 | + 'aliases' => array(), |
|
| 39 | + 'reference' => '0f1f60250fccffeaf5dda91eea1c018aed1adc2a', |
|
| 40 | + 'dev_requirement' => false, |
|
| 41 | + ), |
|
| 42 | + 'paragonie/sodium_compat' => array( |
|
| 43 | + 'pretty_version' => 'v1.17.0', |
|
| 44 | + 'version' => '1.17.0.0', |
|
| 45 | + 'type' => 'library', |
|
| 46 | + 'install_path' => __DIR__ . '/../paragonie/sodium_compat', |
|
| 47 | + 'aliases' => array(), |
|
| 48 | + 'reference' => 'c59cac21abbcc0df06a3dd18076450ea4797b321', |
|
| 49 | + 'dev_requirement' => false, |
|
| 50 | + ), |
|
| 51 | + 'psr/log' => array( |
|
| 52 | + 'pretty_version' => '1.1.4', |
|
| 53 | + 'version' => '1.1.4.0', |
|
| 54 | + 'type' => 'library', |
|
| 55 | + 'install_path' => __DIR__ . '/../psr/log', |
|
| 56 | + 'aliases' => array(), |
|
| 57 | + 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11', |
|
| 58 | + 'dev_requirement' => false, |
|
| 59 | + ), |
|
| 60 | + 'trustedlogin/client' => array( |
|
| 61 | + 'pretty_version' => 'dev-main', |
|
| 62 | + 'version' => 'dev-main', |
|
| 63 | + 'type' => 'library', |
|
| 64 | + 'install_path' => __DIR__ . '/../trustedlogin/client', |
|
| 65 | + 'aliases' => array(), |
|
| 66 | + 'reference' => '8c0be03dac771f157625ee6029e3850a199f6310', |
|
| 67 | + 'dev_requirement' => false, |
|
| 68 | + ), |
|
| 69 | + ), |
|
| 70 | 70 | ); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * @action `gravityview_search_widget_field_before` Before each search input is rendered (other than the submit button) |
| 33 | 33 | * @param GravityView_Widget_Search $this GravityView Widget instance |
| 34 | - * @param array{key:string,label:string,value:string,type:string,choices:array} $search_field |
|
| 34 | + * @param array{key:string,label:string,value:string,type:string,choices:array} $search_field |
|
| 35 | 35 | */ |
| 36 | 36 | do_action( 'gravityview_search_widget_field_before', $this, $search_field ); |
| 37 | 37 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | /** |
| 47 | 47 | * @action `gravityview_search_widget_field_after` After each search input is rendered (other than the submit button) |
| 48 | 48 | * @param GravityView_Widget_Search $this GravityView Widget instance |
| 49 | - * @param array $search_field |
|
| 49 | + * @param array $search_field |
|
| 50 | 50 | */ |
| 51 | 51 | do_action( 'gravityview_search_widget_field_after', $this, $search_field ); |
| 52 | 52 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | do_action( 'gravityview_search_widget_fields_after', $this ); |
| 59 | 59 | |
| 60 | 60 | if( $has_inputs ) { |
| 61 | - $this->render( 'search-field', 'submit', false ); |
|
| 62 | - } |
|
| 61 | + $this->render( 'search-field', 'submit', false ); |
|
| 62 | + } |
|
| 63 | 63 | ?> |
| 64 | 64 | </form> |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | 'author' => self::author, |
| 99 | 99 | 'language' => get_locale(), |
| 100 | 100 | 'url' => home_url(), |
| 101 | - 'beta' => $this->settings->get( 'beta' ), |
|
| 101 | + 'beta' => $this->settings->get( 'beta' ), |
|
| 102 | 102 | 'php_version' => phpversion(), |
| 103 | 103 | 'wp_version' => get_bloginfo( 'version' ), |
| 104 | 104 | 'gv_version' => \GV\Plugin::$version, |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | private function license_call_update_settings( $license_data, $data ) { |
| 523 | 523 | $settings = array(); |
| 524 | 524 | |
| 525 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
| 525 | + $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
| 526 | 526 | $settings['license_key_status'] = $license_data->license; |
| 527 | 527 | $settings['license_key_response'] = (array)$license_data; |
| 528 | 528 | |
@@ -663,14 +663,14 @@ discard block |
||
| 663 | 663 | // Call the custom API. |
| 664 | 664 | $response = wp_remote_post( self::url, array( |
| 665 | 665 | 'timeout' => 15, |
| 666 | - 'sslverify' => false, |
|
| 667 | - 'body' => array( |
|
| 668 | - 'edd_action' => 'check_license', |
|
| 669 | - 'license' => trim( $this->settings->get( 'license_key' ) ), |
|
| 670 | - 'item_name' => self::name, |
|
| 671 | - 'url' => home_url(), |
|
| 672 | - 'site_data' => $this->get_site_data(), |
|
| 673 | - ), |
|
| 666 | + 'sslverify' => false, |
|
| 667 | + 'body' => array( |
|
| 668 | + 'edd_action' => 'check_license', |
|
| 669 | + 'license' => trim( $this->settings->get( 'license_key' ) ), |
|
| 670 | + 'item_name' => self::name, |
|
| 671 | + 'url' => home_url(), |
|
| 672 | + 'site_data' => $this->get_site_data(), |
|
| 673 | + ), |
|
| 674 | 674 | )); |
| 675 | 675 | |
| 676 | 676 | // make sure the response came back okay |
@@ -311,17 +311,17 @@ |
||
| 311 | 311 | $this->_remote_update_url, |
| 312 | 312 | $this->_path, |
| 313 | 313 | array( |
| 314 | - 'version' => $this->_version, // current version number |
|
| 315 | - 'license' => \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ), |
|
| 316 | - 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
|
| 317 | - 'item_name' => $this->_title, // name of this plugin |
|
| 318 | - 'author' => strip_tags( $this->_author ), // author of this plugin |
|
| 319 | - 'php_version' => phpversion(), |
|
| 320 | - 'wp_version' => get_bloginfo( 'version' ), |
|
| 321 | - 'gv_version' => \GV\Plugin::$version, |
|
| 322 | - 'environment' => function_exists( 'wp_get_environment_type' ) ? wp_get_environment_type() : 'production', |
|
| 323 | - ) |
|
| 324 | - ); |
|
| 314 | + 'version' => $this->_version, // current version number |
|
| 315 | + 'license' => \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ), |
|
| 316 | + 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
|
| 317 | + 'item_name' => $this->_title, // name of this plugin |
|
| 318 | + 'author' => strip_tags( $this->_author ), // author of this plugin |
|
| 319 | + 'php_version' => phpversion(), |
|
| 320 | + 'wp_version' => get_bloginfo( 'version' ), |
|
| 321 | + 'gv_version' => \GV\Plugin::$version, |
|
| 322 | + 'environment' => function_exists( 'wp_get_environment_type' ) ? wp_get_environment_type() : 'production', |
|
| 323 | + ) |
|
| 324 | + ); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /** |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | if ( ! defined( 'WPINC' ) ) { |
| 14 | - die; |
|
| 14 | + die; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -22,109 +22,109 @@ discard block |
||
| 22 | 22 | /** |
| 23 | 23 | * @var GravityView_Edit_Entry $loader |
| 24 | 24 | */ |
| 25 | - protected $loader; |
|
| 25 | + protected $loader; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var WP_User|null Temporary storage used by restore_user_details() |
|
| 29 | - */ |
|
| 30 | - private $_user_before_update = null; |
|
| 27 | + /** |
|
| 28 | + * @var WP_User|null Temporary storage used by restore_user_details() |
|
| 29 | + */ |
|
| 30 | + private $_user_before_update = null; |
|
| 31 | 31 | |
| 32 | - function __construct( GravityView_Edit_Entry $loader ) { |
|
| 33 | - $this->loader = $loader; |
|
| 34 | - } |
|
| 32 | + function __construct( GravityView_Edit_Entry $loader ) { |
|
| 33 | + $this->loader = $loader; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @since 1.11 |
| 38 | 38 | */ |
| 39 | 39 | public function load() { |
| 40 | 40 | add_action( 'wp', array( $this, 'add_hooks' ), 10 ); |
| 41 | - } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Add hooks to trigger updating the user |
| 45 | 45 | * |
| 46 | 46 | * @since 1.18 |
| 47 | 47 | */ |
| 48 | - public function add_hooks() { |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @filter `gravityview/edit_entry/user_registration/trigger_update` Choose whether to update user information via User Registration add-on when an entry is updated? |
|
| 52 | - * @since 1.11 |
|
| 53 | - * @param boolean $boolean Whether to trigger update on user registration (default: true) |
|
| 54 | - */ |
|
| 55 | - if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) { |
|
| 56 | - |
|
| 57 | - add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 ); |
|
| 58 | - |
|
| 59 | - // last resort in case the current user display name don't match any of the defaults |
|
| 60 | - add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 ); |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * Update the WordPress user profile based on the GF User Registration create feed |
|
| 66 | - * |
|
| 67 | - * @since 1.11 |
|
| 68 | - * |
|
| 69 | - * @param array $form Gravity Forms form array |
|
| 70 | - * @param string $entry_id Gravity Forms entry ID |
|
| 71 | - * @return void |
|
| 72 | - */ |
|
| 73 | - public function update_user( $form = array(), $entry_id = 0 ) { |
|
| 74 | - |
|
| 75 | - if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) { |
|
| 76 | - gravityview()->log->error( 'GFAPI or User Registration class not found; not updating the user' ); |
|
| 77 | - return; |
|
| 78 | - } elseif( empty( $entry_id ) ) { |
|
| 79 | - gravityview()->log->error( 'Entry ID is empty [{entry_id}]; not updating the user', array( 'entry_id' => $entry_id ) ); |
|
| 80 | - return; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - $gf_user_registration = GF_User_Registration::get_instance(); |
|
| 84 | - |
|
| 85 | - $entry = GFAPI::get_entry( $entry_id ); |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * @filter `gravityview/edit_entry/user_registration/entry` Modify entry details before updating the user via User Registration add-on |
|
| 89 | - * @since 1.11 |
|
| 90 | - * @param array $entry Gravity Forms entry |
|
| 91 | - * @param array $form Gravity Forms form |
|
| 92 | - */ |
|
| 93 | - $entry = apply_filters( 'gravityview/edit_entry/user_registration/entry', $entry, $form ); |
|
| 94 | - |
|
| 95 | - $config = $this->get_feed_configuration( $entry, $form ); |
|
| 96 | - |
|
| 97 | - // Make sure the feed is active |
|
| 98 | - if ( ! \GV\Utils::get( $config, 'is_active', false ) ) { |
|
| 48 | + public function add_hooks() { |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @filter `gravityview/edit_entry/user_registration/trigger_update` Choose whether to update user information via User Registration add-on when an entry is updated? |
|
| 52 | + * @since 1.11 |
|
| 53 | + * @param boolean $boolean Whether to trigger update on user registration (default: true) |
|
| 54 | + */ |
|
| 55 | + if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) { |
|
| 56 | + |
|
| 57 | + add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 ); |
|
| 58 | + |
|
| 59 | + // last resort in case the current user display name don't match any of the defaults |
|
| 60 | + add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 ); |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * Update the WordPress user profile based on the GF User Registration create feed |
|
| 66 | + * |
|
| 67 | + * @since 1.11 |
|
| 68 | + * |
|
| 69 | + * @param array $form Gravity Forms form array |
|
| 70 | + * @param string $entry_id Gravity Forms entry ID |
|
| 71 | + * @return void |
|
| 72 | + */ |
|
| 73 | + public function update_user( $form = array(), $entry_id = 0 ) { |
|
| 74 | + |
|
| 75 | + if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) { |
|
| 76 | + gravityview()->log->error( 'GFAPI or User Registration class not found; not updating the user' ); |
|
| 99 | 77 | return; |
| 100 | - } |
|
| 78 | + } elseif( empty( $entry_id ) ) { |
|
| 79 | + gravityview()->log->error( 'Entry ID is empty [{entry_id}]; not updating the user', array( 'entry_id' => $entry_id ) ); |
|
| 80 | + return; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + $gf_user_registration = GF_User_Registration::get_instance(); |
|
| 84 | + |
|
| 85 | + $entry = GFAPI::get_entry( $entry_id ); |
|
| 101 | 86 | |
| 102 | - // If an Update feed, make sure the conditions are met. |
|
| 103 | - if ( \GV\Utils::get( $config, 'meta/feedType' ) === 'update' ) { |
|
| 104 | - if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) { |
|
| 105 | - return; |
|
| 106 | - } |
|
| 107 | - } |
|
| 87 | + /** |
|
| 88 | + * @filter `gravityview/edit_entry/user_registration/entry` Modify entry details before updating the user via User Registration add-on |
|
| 89 | + * @since 1.11 |
|
| 90 | + * @param array $entry Gravity Forms entry |
|
| 91 | + * @param array $form Gravity Forms form |
|
| 92 | + */ |
|
| 93 | + $entry = apply_filters( 'gravityview/edit_entry/user_registration/entry', $entry, $form ); |
|
| 108 | 94 | |
| 109 | - // Do not update user if the user hasn't been registered (happens when manual activation is enabled in User Registration feed) |
|
| 110 | - $username = \GV\Utils::get( $config, 'meta/username', null ); |
|
| 111 | - if ( ! isset( $entry[ $username ] ) || ! get_user_by( 'login', $entry[ $username ] ) ) { |
|
| 112 | - return; |
|
| 113 | - } |
|
| 95 | + $config = $this->get_feed_configuration( $entry, $form ); |
|
| 96 | + |
|
| 97 | + // Make sure the feed is active |
|
| 98 | + if ( ! \GV\Utils::get( $config, 'is_active', false ) ) { |
|
| 99 | + return; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + // If an Update feed, make sure the conditions are met. |
|
| 103 | + if ( \GV\Utils::get( $config, 'meta/feedType' ) === 'update' ) { |
|
| 104 | + if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) { |
|
| 105 | + return; |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + // Do not update user if the user hasn't been registered (happens when manual activation is enabled in User Registration feed) |
|
| 110 | + $username = \GV\Utils::get( $config, 'meta/username', null ); |
|
| 111 | + if ( ! isset( $entry[ $username ] ) || ! get_user_by( 'login', $entry[ $username ] ) ) { |
|
| 112 | + return; |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - // The priority is set to 3 so that default priority (10) will still override it |
|
| 116 | - add_filter( 'send_password_change_email', '__return_false', 3 ); |
|
| 117 | - add_filter( 'send_email_change_email', '__return_false', 3 ); |
|
| 115 | + // The priority is set to 3 so that default priority (10) will still override it |
|
| 116 | + add_filter( 'send_password_change_email', '__return_false', 3 ); |
|
| 117 | + add_filter( 'send_email_change_email', '__return_false', 3 ); |
|
| 118 | 118 | |
| 119 | - // Trigger the User Registration update user method |
|
| 120 | - $gf_user_registration->update_user( $entry, $form, $config ); |
|
| 119 | + // Trigger the User Registration update user method |
|
| 120 | + $gf_user_registration->update_user( $entry, $form, $config ); |
|
| 121 | 121 | |
| 122 | - remove_filter( 'send_password_change_email', '__return_false', 3 ); |
|
| 123 | - remove_filter( 'send_email_change_email', '__return_false', 3 ); |
|
| 122 | + remove_filter( 'send_password_change_email', '__return_false', 3 ); |
|
| 123 | + remove_filter( 'send_email_change_email', '__return_false', 3 ); |
|
| 124 | 124 | |
| 125 | - // Prevent double-triggering by removing the hook |
|
| 126 | - remove_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10 ); |
|
| 127 | - } |
|
| 125 | + // Prevent double-triggering by removing the hook |
|
| 126 | + remove_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10 ); |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | 130 | * Get the User Registration feed configuration for the entry & form |
@@ -139,184 +139,184 @@ discard block |
||
| 139 | 139 | * |
| 140 | 140 | * @return array |
| 141 | 141 | */ |
| 142 | - public function get_feed_configuration( $entry, $form ) { |
|
| 143 | - |
|
| 144 | - $gf_user_registration = GF_User_Registration::get_instance(); |
|
| 145 | - |
|
| 146 | - $config = $gf_user_registration->get_single_submission_feed( $entry, $form ); |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * @filter `gravityview/edit_entry/user_registration/preserve_role` Keep the current user role or override with the role defined in the Create feed |
|
| 150 | - * @since 1.15 |
|
| 151 | - * @param boolean $preserve_role Preserve current user role Default: true |
|
| 152 | - * @param array $config Gravity Forms User Registration feed configuration for the form |
|
| 153 | - * @param array $form Gravity Forms form array |
|
| 154 | - * @param array $entry Gravity Forms entry being edited |
|
| 155 | - */ |
|
| 156 | - $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry ); |
|
| 157 | - |
|
| 158 | - if( $preserve_role ) { |
|
| 159 | - $config['meta']['role'] = 'gfur_preserve_role'; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - $displayname = $this->match_current_display_name( $entry['created_by'] ); |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * Make sure the current display name is not changed with the update user method. |
|
| 166 | - * @since 1.15 |
|
| 167 | - */ |
|
| 168 | - $config['meta']['displayname'] = $displayname ? $displayname : $config['meta']['displayname']; |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration |
|
| 172 | - * @since 1.14 |
|
| 173 | - * @param array $config Gravity Forms User Registration feed configuration for the form |
|
| 174 | - * @param array $form Gravity Forms form array |
|
| 175 | - * @param array $entry Gravity Forms entry being edited |
|
| 176 | - */ |
|
| 177 | - $config = apply_filters( 'gravityview/edit_entry/user_registration/config', $config, $form, $entry ); |
|
| 178 | - |
|
| 179 | - return $config; |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - /** |
|
| 183 | - * Calculate the user display name format |
|
| 184 | - * |
|
| 185 | - * @since 1.15 |
|
| 186 | - * @since 1.20 Returns false if user not found at $user_id |
|
| 187 | - * |
|
| 188 | - * @param int $user_id WP User ID |
|
| 189 | - * @return false|string Display name format as used inside Gravity Forms User Registration. Returns false if user not found. |
|
| 190 | - */ |
|
| 191 | - public function match_current_display_name( $user_id ) { |
|
| 192 | - |
|
| 193 | - $user = get_userdata( $user_id ); |
|
| 194 | - |
|
| 195 | - if( ! $user ) { |
|
| 196 | - return false; |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - $names = $this->generate_display_names( $user ); |
|
| 200 | - |
|
| 201 | - $format = array_search( $user->display_name, $names, true ); |
|
| 202 | - |
|
| 203 | - /** |
|
| 204 | - * In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook |
|
| 205 | - * @see restore_display_name |
|
| 206 | - */ |
|
| 207 | - if( false === $format ) { |
|
| 208 | - $this->_user_before_update = $user; |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - return $format; |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - /** |
|
| 215 | - * Generate an array of all the user display names possibilities |
|
| 216 | - * |
|
| 217 | - * @since 1.15 |
|
| 218 | - * |
|
| 219 | - * @param object $profileuser WP_User object |
|
| 220 | - * @return array List all the possible display names for a certain User object |
|
| 221 | - */ |
|
| 222 | - public function generate_display_names( $profileuser ) { |
|
| 223 | - |
|
| 224 | - $public_display = array(); |
|
| 225 | - $public_display['nickname'] = $profileuser->nickname; |
|
| 226 | - $public_display['username'] = $profileuser->user_login; |
|
| 227 | - |
|
| 228 | - if ( !empty($profileuser->first_name) ) { |
|
| 229 | - $public_display['firstname'] = $profileuser->first_name; |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - if ( !empty($profileuser->last_name) ) { |
|
| 233 | - $public_display['lastname'] = $profileuser->last_name; |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) { |
|
| 237 | - $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; |
|
| 238 | - $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name; |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - $public_display = array_map( 'trim', $public_display ); |
|
| 242 | - $public_display = array_unique( $public_display ); |
|
| 243 | - |
|
| 244 | - return $public_display; |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - |
|
| 248 | - /** |
|
| 249 | - * Restore the Display Name and roles of a user after being updated by Gravity Forms User Registration Addon |
|
| 250 | - * |
|
| 251 | - * @see GFUser::update_user() |
|
| 252 | - * @param int $user_id WP User ID that was updated by Gravity Forms User Registration Addon |
|
| 253 | - * @param array $config Gravity Forms User Registration Addon form feed configuration |
|
| 254 | - * @param array $entry The Gravity Forms entry that was just updated |
|
| 255 | - * @param string $password User password |
|
| 256 | - * @return int|false|WP_Error|null True: User updated; False: $user_id not a valid User ID; WP_Error: User update error; Null: Method didn't process |
|
| 257 | - */ |
|
| 258 | - public function restore_display_name( $user_id = 0, $config = array(), $entry = array(), $password = '' ) { |
|
| 259 | - |
|
| 260 | - /** |
|
| 261 | - * @filter `gravityview/edit_entry/restore_display_name` Whether display names should be restored to before updating an entry. |
|
| 262 | - * Otherwise, display names will be reset to the format specified in Gravity Forms User Registration "Update" feed |
|
| 263 | - * @since 1.14.4 |
|
| 264 | - * @param boolean $restore_display_name Restore Display Name? Default: true |
|
| 265 | - */ |
|
| 266 | - $restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true ); |
|
| 267 | - |
|
| 268 | - $is_update_feed = ( $config && \GV\Utils::get( $config, 'meta/feed_type' ) === 'update' ); |
|
| 269 | - |
|
| 270 | - /** |
|
| 271 | - * Don't restore display name: |
|
| 272 | - * - either disabled, |
|
| 273 | - * - or it is an Update feed (we only care about Create feed) |
|
| 274 | - * - or we don't need as we found the correct format before updating user. |
|
| 275 | - * @since 1.14.4 |
|
| 276 | - */ |
|
| 277 | - if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) { |
|
| 278 | - return null; |
|
| 279 | - } |
|
| 280 | - |
|
| 281 | - $user_after_update = get_userdata( $user_id ); |
|
| 282 | - |
|
| 283 | - // User not found |
|
| 284 | - if ( ! $user_after_update ) { |
|
| 285 | - gravityview()->log->error( 'User not found at $user_id #{user_id}', array( 'user_id' => $user_id ) ); |
|
| 286 | - return false; |
|
| 287 | - } |
|
| 288 | - |
|
| 289 | - $restored_user = $user_after_update; |
|
| 290 | - |
|
| 291 | - // Restore previous display_name |
|
| 292 | - $restored_user->display_name = $this->_user_before_update->display_name; |
|
| 293 | - |
|
| 294 | - // Don't have WP update the password. |
|
| 295 | - unset( $restored_user->data->user_pass, $restored_user->user_pass ); |
|
| 296 | - |
|
| 297 | - /** |
|
| 298 | - * Modify the user data after updated by Gravity Forms User Registration but before restored by GravityView |
|
| 299 | - * @since 1.14 |
|
| 300 | - * @param WP_User $restored_user The user with restored details about to be updated by wp_update_user() |
|
| 301 | - * @param WP_User $user_before_update The user before being updated by Gravity Forms User Registration |
|
| 302 | - * @param WP_User $user_after_update The user after being updated by Gravity Forms User Registration |
|
| 303 | - * @param array $entry The Gravity Forms entry that was just updated |
|
| 304 | - */ |
|
| 305 | - $restored_user = apply_filters( 'gravityview/edit_entry/user_registration/restored_user', $restored_user, $this->_user_before_update, $user_after_update, $entry ); |
|
| 306 | - |
|
| 307 | - $updated = wp_update_user( $restored_user ); |
|
| 308 | - |
|
| 309 | - if( is_wp_error( $updated ) ) { |
|
| 310 | - gravityview()->log->error( 'There was an error updating user #{user_id} details', array( 'user_id' => $user_id, 'data' => $updated ) ); |
|
| 311 | - } else { |
|
| 312 | - gravityview()->log->debug( 'User #{user_id} details restored', array( 'user_id' => $user_id ) ); |
|
| 313 | - } |
|
| 314 | - |
|
| 315 | - $this->_user_before_update = null; |
|
| 316 | - |
|
| 317 | - unset( $restored_user, $user_after_update ); |
|
| 318 | - |
|
| 319 | - return $updated; |
|
| 320 | - } |
|
| 142 | + public function get_feed_configuration( $entry, $form ) { |
|
| 143 | + |
|
| 144 | + $gf_user_registration = GF_User_Registration::get_instance(); |
|
| 145 | + |
|
| 146 | + $config = $gf_user_registration->get_single_submission_feed( $entry, $form ); |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * @filter `gravityview/edit_entry/user_registration/preserve_role` Keep the current user role or override with the role defined in the Create feed |
|
| 150 | + * @since 1.15 |
|
| 151 | + * @param boolean $preserve_role Preserve current user role Default: true |
|
| 152 | + * @param array $config Gravity Forms User Registration feed configuration for the form |
|
| 153 | + * @param array $form Gravity Forms form array |
|
| 154 | + * @param array $entry Gravity Forms entry being edited |
|
| 155 | + */ |
|
| 156 | + $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry ); |
|
| 157 | + |
|
| 158 | + if( $preserve_role ) { |
|
| 159 | + $config['meta']['role'] = 'gfur_preserve_role'; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + $displayname = $this->match_current_display_name( $entry['created_by'] ); |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * Make sure the current display name is not changed with the update user method. |
|
| 166 | + * @since 1.15 |
|
| 167 | + */ |
|
| 168 | + $config['meta']['displayname'] = $displayname ? $displayname : $config['meta']['displayname']; |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration |
|
| 172 | + * @since 1.14 |
|
| 173 | + * @param array $config Gravity Forms User Registration feed configuration for the form |
|
| 174 | + * @param array $form Gravity Forms form array |
|
| 175 | + * @param array $entry Gravity Forms entry being edited |
|
| 176 | + */ |
|
| 177 | + $config = apply_filters( 'gravityview/edit_entry/user_registration/config', $config, $form, $entry ); |
|
| 178 | + |
|
| 179 | + return $config; |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + /** |
|
| 183 | + * Calculate the user display name format |
|
| 184 | + * |
|
| 185 | + * @since 1.15 |
|
| 186 | + * @since 1.20 Returns false if user not found at $user_id |
|
| 187 | + * |
|
| 188 | + * @param int $user_id WP User ID |
|
| 189 | + * @return false|string Display name format as used inside Gravity Forms User Registration. Returns false if user not found. |
|
| 190 | + */ |
|
| 191 | + public function match_current_display_name( $user_id ) { |
|
| 192 | + |
|
| 193 | + $user = get_userdata( $user_id ); |
|
| 194 | + |
|
| 195 | + if( ! $user ) { |
|
| 196 | + return false; |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + $names = $this->generate_display_names( $user ); |
|
| 200 | + |
|
| 201 | + $format = array_search( $user->display_name, $names, true ); |
|
| 202 | + |
|
| 203 | + /** |
|
| 204 | + * In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook |
|
| 205 | + * @see restore_display_name |
|
| 206 | + */ |
|
| 207 | + if( false === $format ) { |
|
| 208 | + $this->_user_before_update = $user; |
|
| 209 | + } |
|
| 210 | + |
|
| 211 | + return $format; |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * Generate an array of all the user display names possibilities |
|
| 216 | + * |
|
| 217 | + * @since 1.15 |
|
| 218 | + * |
|
| 219 | + * @param object $profileuser WP_User object |
|
| 220 | + * @return array List all the possible display names for a certain User object |
|
| 221 | + */ |
|
| 222 | + public function generate_display_names( $profileuser ) { |
|
| 223 | + |
|
| 224 | + $public_display = array(); |
|
| 225 | + $public_display['nickname'] = $profileuser->nickname; |
|
| 226 | + $public_display['username'] = $profileuser->user_login; |
|
| 227 | + |
|
| 228 | + if ( !empty($profileuser->first_name) ) { |
|
| 229 | + $public_display['firstname'] = $profileuser->first_name; |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + if ( !empty($profileuser->last_name) ) { |
|
| 233 | + $public_display['lastname'] = $profileuser->last_name; |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) { |
|
| 237 | + $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; |
|
| 238 | + $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name; |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + $public_display = array_map( 'trim', $public_display ); |
|
| 242 | + $public_display = array_unique( $public_display ); |
|
| 243 | + |
|
| 244 | + return $public_display; |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + |
|
| 248 | + /** |
|
| 249 | + * Restore the Display Name and roles of a user after being updated by Gravity Forms User Registration Addon |
|
| 250 | + * |
|
| 251 | + * @see GFUser::update_user() |
|
| 252 | + * @param int $user_id WP User ID that was updated by Gravity Forms User Registration Addon |
|
| 253 | + * @param array $config Gravity Forms User Registration Addon form feed configuration |
|
| 254 | + * @param array $entry The Gravity Forms entry that was just updated |
|
| 255 | + * @param string $password User password |
|
| 256 | + * @return int|false|WP_Error|null True: User updated; False: $user_id not a valid User ID; WP_Error: User update error; Null: Method didn't process |
|
| 257 | + */ |
|
| 258 | + public function restore_display_name( $user_id = 0, $config = array(), $entry = array(), $password = '' ) { |
|
| 259 | + |
|
| 260 | + /** |
|
| 261 | + * @filter `gravityview/edit_entry/restore_display_name` Whether display names should be restored to before updating an entry. |
|
| 262 | + * Otherwise, display names will be reset to the format specified in Gravity Forms User Registration "Update" feed |
|
| 263 | + * @since 1.14.4 |
|
| 264 | + * @param boolean $restore_display_name Restore Display Name? Default: true |
|
| 265 | + */ |
|
| 266 | + $restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true ); |
|
| 267 | + |
|
| 268 | + $is_update_feed = ( $config && \GV\Utils::get( $config, 'meta/feed_type' ) === 'update' ); |
|
| 269 | + |
|
| 270 | + /** |
|
| 271 | + * Don't restore display name: |
|
| 272 | + * - either disabled, |
|
| 273 | + * - or it is an Update feed (we only care about Create feed) |
|
| 274 | + * - or we don't need as we found the correct format before updating user. |
|
| 275 | + * @since 1.14.4 |
|
| 276 | + */ |
|
| 277 | + if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) { |
|
| 278 | + return null; |
|
| 279 | + } |
|
| 280 | + |
|
| 281 | + $user_after_update = get_userdata( $user_id ); |
|
| 282 | + |
|
| 283 | + // User not found |
|
| 284 | + if ( ! $user_after_update ) { |
|
| 285 | + gravityview()->log->error( 'User not found at $user_id #{user_id}', array( 'user_id' => $user_id ) ); |
|
| 286 | + return false; |
|
| 287 | + } |
|
| 288 | + |
|
| 289 | + $restored_user = $user_after_update; |
|
| 290 | + |
|
| 291 | + // Restore previous display_name |
|
| 292 | + $restored_user->display_name = $this->_user_before_update->display_name; |
|
| 293 | + |
|
| 294 | + // Don't have WP update the password. |
|
| 295 | + unset( $restored_user->data->user_pass, $restored_user->user_pass ); |
|
| 296 | + |
|
| 297 | + /** |
|
| 298 | + * Modify the user data after updated by Gravity Forms User Registration but before restored by GravityView |
|
| 299 | + * @since 1.14 |
|
| 300 | + * @param WP_User $restored_user The user with restored details about to be updated by wp_update_user() |
|
| 301 | + * @param WP_User $user_before_update The user before being updated by Gravity Forms User Registration |
|
| 302 | + * @param WP_User $user_after_update The user after being updated by Gravity Forms User Registration |
|
| 303 | + * @param array $entry The Gravity Forms entry that was just updated |
|
| 304 | + */ |
|
| 305 | + $restored_user = apply_filters( 'gravityview/edit_entry/user_registration/restored_user', $restored_user, $this->_user_before_update, $user_after_update, $entry ); |
|
| 306 | + |
|
| 307 | + $updated = wp_update_user( $restored_user ); |
|
| 308 | + |
|
| 309 | + if( is_wp_error( $updated ) ) { |
|
| 310 | + gravityview()->log->error( 'There was an error updating user #{user_id} details', array( 'user_id' => $user_id, 'data' => $updated ) ); |
|
| 311 | + } else { |
|
| 312 | + gravityview()->log->debug( 'User #{user_id} details restored', array( 'user_id' => $user_id ) ); |
|
| 313 | + } |
|
| 314 | + |
|
| 315 | + $this->_user_before_update = null; |
|
| 316 | + |
|
| 317 | + unset( $restored_user, $user_after_update ); |
|
| 318 | + |
|
| 319 | + return $updated; |
|
| 320 | + } |
|
| 321 | 321 | |
| 322 | 322 | } //end class |