wp-staging
Last commit date
Backend
1 day ago
Backup
1 day ago
Basic
1 day ago
Component
1 day ago
Core
1 day ago
Framework
1 day ago
Frontend
1 day ago
Notifications
1 day ago
Staging
1 day ago
assets
1 day ago
languages
1 day ago
resources
1 day ago
vendor_wpstg
1 day ago
views
1 day ago
CONTRIBUTING.md
2 years ago
Deactivate.php
1 day ago
README.md
5 months ago
SECURITY.md
3 weeks ago
autoloader.php
1 day ago
bootstrap.php
1 day ago
commonBootstrap.php
1 day ago
constantsFree.php
1 day ago
freeBootstrap.php
1 day ago
install.php
1 day ago
opcacheBootstrap.php
1 day ago
readme.txt
1 day ago
runtimeRequirements.php
1 day ago
uninstall.php
1 day ago
wp-staging-error-handler.php
1 day ago
wp-staging.php
1 day ago
autoloader.php
65 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | $wpstgSrcMapFile = __DIR__ . '/vendor_wpstg/autoload/src.php'; |
| 16 | $wpstgVendorMapFile = __DIR__ . '/vendor_wpstg/autoload/vendor.php'; |
| 17 | $wpstgFilesMapFile = __DIR__ . '/vendor_wpstg/autoload/files.php'; |
| 18 | |
| 19 | if ( |
| 20 | !is_readable($wpstgSrcMapFile) |
| 21 | || !is_readable($wpstgVendorMapFile) |
| 22 | || !is_readable($wpstgFilesMapFile) |
| 23 | ) { |
| 24 | return; |
| 25 | } |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | $wpstgSrcMap = include_once $wpstgSrcMapFile; |
| 34 | $wpstgVendorMap = include_once $wpstgVendorMapFile; |
| 35 | $wpstgFilesToInclude = include_once $wpstgFilesMapFile; |
| 36 | |
| 37 | if ( |
| 38 | !is_array($wpstgSrcMap) |
| 39 | || !is_array($wpstgVendorMap) |
| 40 | || !is_array($wpstgFilesToInclude) |
| 41 | ) { |
| 42 | return; |
| 43 | } |
| 44 | |
| 45 | $class_map = array_merge($wpstgSrcMap, $wpstgVendorMap); |
| 46 | |
| 47 | spl_autoload_register( |
| 48 | // @phpstan-ignore-next-line - Autoloader return value preserved for compatibility |
| 49 | function (string $class) use ($class_map) { |
| 50 | if (isset($class_map[$class]) && file_exists($class_map[$class])) { |
| 51 | include_once $class_map[$class]; |
| 52 | |
| 53 | return true; |
| 54 | } |
| 55 | }, |
| 56 | true, |
| 57 | true |
| 58 | ); |
| 59 | |
| 60 | foreach ($wpstgFilesToInclude as $file) { |
| 61 | if (is_readable($file)) { |
| 62 | require $file; |
| 63 | } |
| 64 | } |
| 65 |