PluginProbe
DecaLog / 4.4.0
DecaLog v4.4.0
3.0.2 3.1.0 3.10.0 3.2.0 3.3.0 3.4.0 3.4.1 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.6.3 3.7.0 3.7.1 3.8.0 3.9.0 3.9.1 4.0.0 4.1.0 4.2.0 4.3.0 4.3.1 4.4.0 4.5.0 All 75 releases
decalog / autoload.php

autoload.php in DecaLog 4.4.0, at autoload.php

61 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Autoload for DecaLog.
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, 'Decalog\\' ) === 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, 'Decalog\System\\' ) === 0 ) {
20 $filepath = DECALOG_INCLUDES_DIR . 'system/';
21 } elseif ( strpos( $class, 'Decalog\Plugin\Feature\\' ) === 0 ) {
22 $filepath = DECALOG_INCLUDES_DIR . 'features/';
23 } elseif ( strpos( $class, 'Decalog\Plugin\\' ) === 0 ) {
24 $filepath = DECALOG_INCLUDES_DIR . 'plugin/';
25 } elseif ( strpos( $class, 'Decalog\Processor\\' ) === 0 ) {
26 $filepath = DECALOG_INCLUDES_DIR . 'processors/';
27 } elseif ( strpos( $class, 'Decalog\Handler\\' ) === 0 ) {
28 $filepath = DECALOG_INCLUDES_DIR . 'handlers/';
29 } elseif ( strpos( $class, 'Decalog\Storage\\' ) === 0 ) {
30 $filepath = DECALOG_INCLUDES_DIR . 'storage/';
31 } elseif ( strpos( $class, 'Decalog\Formatter\\' ) === 0 ) {
32 $filepath = DECALOG_INCLUDES_DIR . 'formatters/';
33 } elseif ( strpos( $class, 'Decalog\Listener\WP_CLI\\' ) === 0 ) {
34 $filepath = DECALOG_INCLUDES_DIR . 'listeners/wp-cli/';
35 } elseif ( strpos( $class, 'Decalog\Listener\\' ) === 0 ) {
36 $filepath = DECALOG_INCLUDES_DIR . 'listeners/';
37 } elseif ( strpos( $class, 'Decalog\Panel\\' ) === 0 ) {
38 $filepath = DECALOG_INCLUDES_DIR . 'panels/';
39 } elseif ( strpos( $class, 'Decalog\Library\\' ) === 0 ) {
40 $filepath = DECALOG_VENDOR_DIR;
41 } elseif ( strpos( $class, 'Decalog\Integration\\' ) === 0 ) {
42 $filepath = DECALOG_INCLUDES_DIR . 'integrations/';
43 } elseif ( strpos( $class, 'Decalog\API\\' ) === 0 ) {
44 $filepath = DECALOG_INCLUDES_DIR . 'api/';
45 } elseif ( strpos( $class, 'Decalog\\' ) === 0 ) {
46 $filepath = DECALOG_INCLUDES_DIR . 'api/';
47 }
48 if ( strpos( $filename, '-public' ) !== false ) {
49 $filepath = DECALOG_PUBLIC_DIR;
50 }
51 if ( strpos( $filename, '-admin' ) !== false ) {
52 $filepath = DECALOG_ADMIN_DIR;
53 }
54 $file = $filepath . $filename;
55 if ( file_exists( $file ) ) {
56 include_once $file;
57 }
58 }
59 }
60 );
61