litespeed-cache
Last commit date
assets
5 years ago
cli
5 years ago
data
5 years ago
inc
5 years ago
lang
5 years ago
lib
5 years ago
src
5 years ago
thirdparty
5 years ago
tpl
5 years ago
wp_assets
5 years ago
LICENSE
5 years ago
autoload.php
5 years ago
litespeed-cache.php
5 years ago
readme.txt
5 years ago
autoload.php
43 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Auto registration for LiteSpeed classes |
| 4 | * |
| 5 | * @since 1.1.0 |
| 6 | * @since 3.0 Moved into / |
| 7 | * @package LiteSpeed |
| 8 | * @author LiteSpeed Technologies <info@litespeedtech.com> |
| 9 | */ |
| 10 | defined( 'WPINC' ) || exit; |
| 11 | |
| 12 | if ( ! function_exists( 'litespeed_autoload' ) ) { |
| 13 | function litespeed_autoload( $cls ) |
| 14 | { |
| 15 | if ( strpos( $cls, '.' ) !== false ) { |
| 16 | return; |
| 17 | } |
| 18 | |
| 19 | if ( strpos( $cls, 'LiteSpeed' ) !== 0 ) { |
| 20 | return; |
| 21 | } |
| 22 | |
| 23 | $file = explode( '\\', $cls ); |
| 24 | array_shift( $file ); |
| 25 | $file = implode( '/', $file ); |
| 26 | $file = str_replace( '_', '-', strtolower( $file ) ); |
| 27 | |
| 28 | if ( strpos( $file, 'lib/' ) === 0 || strpos( $file, 'cli/' ) === 0 || strpos( $file, 'thirdparty/' ) === 0 ) { |
| 29 | $file = LSCWP_DIR . $file . '.cls.php'; |
| 30 | } |
| 31 | else { |
| 32 | $file = LSCWP_DIR . 'src/' . $file . '.cls.php'; |
| 33 | } |
| 34 | |
| 35 | if ( file_exists( $file ) ) { |
| 36 | require_once $file; |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | spl_autoload_register( 'litespeed_autoload' ); |
| 42 | |
| 43 |