PluginProbe
OPcache Manager / trunk
OPcache Manager vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 2.0.0 2.1.0 2.10.0 2.11.0 2.12.0 2.13.0 2.13.1 2.14.0 2.2.0 2.3.0 2.3.1 2.3.2 2.4.0 2.5.0 2.6.0 All 36 releases
opcache-manager / autoload.php

autoload.php in OPcache Manager trunk, at autoload.php

45 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Autoload for OPcache Manager.
4 *
5 * @package Bootstrap
6 * @author Pierre Lannoy <https://pierre.lannoy.fr/>.
7 * @since 1.0.0
8 */
9
10 spl_autoload_register(
11 function ( $class ) {
12 $classname = $class;
13 $filepath = __DIR__ . '/';
14 if ( strpos( $classname, 'OPcacheManager\\' ) === 0 ) {
15 while ( strpos( $classname, '\\' ) !== false ) {
16 $classname = substr( $classname, strpos( $classname, '\\' ) + 1, 1000 );
17 }
18 $filename = 'class-' . str_replace( '_', '-', strtolower( $classname ) ) . '.php';
19 if ( strpos( $class, 'OPcacheManager\System\\' ) === 0 ) {
20 $filepath = OPCM_INCLUDES_DIR . 'system/';
21 }
22 if ( strpos( $class, 'OPcacheManager\Plugin\Feature\\' ) === 0 ) {
23 $filepath = OPCM_INCLUDES_DIR . 'features/';
24 } elseif ( strpos( $class, 'OPcacheManager\Plugin\Integration\\' ) === 0 ) {
25 $filepath = OPCM_INCLUDES_DIR . 'integrations/';
26 } elseif ( strpos( $class, 'OPcacheManager\Plugin\\' ) === 0 ) {
27 $filepath = OPCM_INCLUDES_DIR . 'plugin/';
28 }
29 if ( strpos( $class, 'OPcacheManager\Library\\' ) === 0 ) {
30 $filepath = OPCM_VENDOR_DIR;
31 }
32 if ( strpos( $filename, '-public' ) !== false ) {
33 $filepath = OPCM_PUBLIC_DIR;
34 }
35 if ( strpos( $filename, '-admin' ) !== false ) {
36 $filepath = OPCM_ADMIN_DIR;
37 }
38 $file = $filepath . $filename;
39 if ( file_exists( $file ) ) {
40 include_once $file;
41 }
42 }
43 }
44 );
45