litespeed-cache
Last commit date
assets
1 year ago
cli
1 year ago
data
1 year ago
lang
1 year ago
lib
1 year ago
src
1 year ago
thirdparty
1 year ago
tpl
1 year ago
LICENSE
1 year ago
autoload.php
1 year ago
changelog.txt
1 year ago
composer.json
1 year ago
composer.lock
1 year ago
guest.vary.php
1 year ago
litespeed-cache.php
1 year ago
package-lock.json
1 year ago
package.json
1 year ago
phpcs.xml.dist
1 year ago
qc-ping.txt
1 year ago
readme.txt
1 year ago
security.md
1 year ago
autoload.php
137 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Auto registration for LiteSpeed classes |
| 5 | * |
| 6 | * @since 1.1.0 |
| 7 | */ |
| 8 | defined('WPINC') || exit(); |
| 9 | |
| 10 | // Force define for object cache usage before plugin init |
| 11 | !defined('LSCWP_DIR') && define('LSCWP_DIR', __DIR__ . '/'); // Full absolute path '/var/www/html/***/wp-content/plugins/litespeed-cache/' or MU |
| 12 | |
| 13 | // Load all classes instead of autoload for direct conf update purpose when upgrade to new version. |
| 14 | // NOTE: These files need to load exactly in order |
| 15 | $litespeed_php_files = array( |
| 16 | // core file priority |
| 17 | 'src/root.cls.php', |
| 18 | 'src/base.cls.php', |
| 19 | |
| 20 | // main src files |
| 21 | 'src/activation.cls.php', |
| 22 | 'src/admin-display.cls.php', |
| 23 | 'src/admin-settings.cls.php', |
| 24 | 'src/admin.cls.php', |
| 25 | 'src/api.cls.php', |
| 26 | 'src/avatar.cls.php', |
| 27 | 'src/cdn.cls.php', |
| 28 | 'src/cloud.cls.php', |
| 29 | 'src/conf.cls.php', |
| 30 | 'src/control.cls.php', |
| 31 | 'src/core.cls.php', |
| 32 | 'src/crawler-map.cls.php', |
| 33 | 'src/crawler.cls.php', |
| 34 | 'src/css.cls.php', |
| 35 | 'src/data.cls.php', |
| 36 | 'src/db-optm.cls.php', |
| 37 | 'src/debug2.cls.php', |
| 38 | 'src/doc.cls.php', |
| 39 | 'src/error.cls.php', |
| 40 | 'src/esi.cls.php', |
| 41 | 'src/file.cls.php', |
| 42 | 'src/gui.cls.php', |
| 43 | 'src/health.cls.php', |
| 44 | 'src/htaccess.cls.php', |
| 45 | 'src/img-optm.cls.php', |
| 46 | 'src/import.cls.php', |
| 47 | 'src/import.preset.cls.php', |
| 48 | 'src/lang.cls.php', |
| 49 | 'src/localization.cls.php', |
| 50 | 'src/media.cls.php', |
| 51 | 'src/metabox.cls.php', |
| 52 | 'src/object-cache.cls.php', |
| 53 | 'src/optimize.cls.php', |
| 54 | 'src/optimizer.cls.php', |
| 55 | 'src/placeholder.cls.php', |
| 56 | 'src/purge.cls.php', |
| 57 | 'src/report.cls.php', |
| 58 | 'src/rest.cls.php', |
| 59 | 'src/router.cls.php', |
| 60 | 'src/str.cls.php', |
| 61 | 'src/tag.cls.php', |
| 62 | 'src/task.cls.php', |
| 63 | 'src/tool.cls.php', |
| 64 | 'src/ucss.cls.php', |
| 65 | 'src/utility.cls.php', |
| 66 | 'src/vary.cls.php', |
| 67 | 'src/vpi.cls.php', |
| 68 | |
| 69 | // Extra CDN cls files |
| 70 | 'src/cdn/cloudflare.cls.php', |
| 71 | 'src/cdn/quic.cls.php', |
| 72 | |
| 73 | // CLI classes |
| 74 | 'cli/crawler.cls.php', |
| 75 | 'cli/debug.cls.php', |
| 76 | 'cli/image.cls.php', |
| 77 | 'cli/online.cls.php', |
| 78 | 'cli/option.cls.php', |
| 79 | 'cli/presets.cls.php', |
| 80 | 'cli/purge.cls.php', |
| 81 | |
| 82 | // 3rd party libraries |
| 83 | 'lib/css_js_min/pathconverter/converter.cls.php', |
| 84 | 'lib/css_js_min/minify/exception.cls.php', |
| 85 | 'lib/css_js_min/minify/minify.cls.php', |
| 86 | 'lib/css_js_min/minify/css.cls.php', |
| 87 | 'lib/css_js_min/minify/js.cls.php', |
| 88 | 'lib/urirewriter.cls.php', |
| 89 | 'lib/guest.cls.php', |
| 90 | 'lib/html-min.cls.php', |
| 91 | // 'lib/object-cache.php', |
| 92 | // 'lib/php-compatibility.func.php', |
| 93 | |
| 94 | // upgrade purpose delay loaded funcs |
| 95 | // 'src/data.upgrade.func.php', |
| 96 | ); |
| 97 | foreach ($litespeed_php_files as $class) { |
| 98 | $file = LSCWP_DIR . $class; |
| 99 | require_once $file; |
| 100 | } |
| 101 | |
| 102 | if (!function_exists('litespeed_autoload')) { |
| 103 | function litespeed_autoload($cls) |
| 104 | { |
| 105 | if (strpos($cls, '.') !== false) { |
| 106 | return; |
| 107 | } |
| 108 | |
| 109 | if (strpos($cls, 'LiteSpeed') !== 0) { |
| 110 | return; |
| 111 | } |
| 112 | |
| 113 | $file = explode('\\', $cls); |
| 114 | array_shift($file); |
| 115 | $file = implode('/', $file); |
| 116 | $file = str_replace('_', '-', strtolower($file)); |
| 117 | |
| 118 | // if (strpos($file, 'lib/') === 0 || strpos($file, 'cli/') === 0 || strpos($file, 'thirdparty/') === 0) { |
| 119 | // $file = LSCWP_DIR . $file . '.cls.php'; |
| 120 | // } else { |
| 121 | // $file = LSCWP_DIR . 'src/' . $file . '.cls.php'; |
| 122 | // } |
| 123 | |
| 124 | if (strpos($file, 'thirdparty/') !== 0) { |
| 125 | return; |
| 126 | } |
| 127 | |
| 128 | $file = LSCWP_DIR . $file . '.cls.php'; |
| 129 | |
| 130 | if (file_exists($file)) { |
| 131 | require_once $file; |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | spl_autoload_register('litespeed_autoload'); |
| 137 |