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 / includes / libraries / autoload.php

autoload.php in DecaLog 4.4.0, at includes/libraries/autoload.php

33 lines 781 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Libraries autoload for DecaLog.
4 *
5 * @package Libraries
6 * @author Pierre Lannoy <https://pierre.lannoy.fr/>.
7 * @since 1.0.0
8 */
9
10 spl_autoload_register(
11 function ( $class ) {
12 $file = '';
13 foreach ( Decalog\Library\Libraries::get_psr4() as $library ) {
14 $len = strlen( $library['prefix'] );
15 if ( strncmp( $library['prefix'], $class, $len ) === 0 ) {
16 $file = $library['base'] . str_replace( '\\', '/', substr( $class, $len ) ) . '.php';
17 }
18 }
19 if ( '' === $file ) {
20 foreach ( Decalog\Library\Libraries::get_mono() as $library ) {
21 if ( $library['detect'] === $class ) {
22 $file = $library['base'] . $library['detect'] . '.php';
23 }
24 }
25 }
26 if ( '' !== $file ) {
27 if ( file_exists( $file ) ) {
28 include_once $file;
29 }
30 }
31 }
32 );
33