PluginProbe
Sessions / 2.3.1
Sessions v2.3.1
2.1.0 2.10.0 2.11.0 2.12.0 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.2.0 2.3.0 2.3.1 2.4.0 2.4.1 2.5.0 2.6.0 2.6.1 2.6.2 2.7.0 2.8.0 2.9.0 2.9.1 3.0.0 3.1.0 3.1.1 All 39 releases
sessions / includes / libraries / autoload.php

autoload.php in Sessions 2.3.1, at includes/libraries/autoload.php

33 lines 788 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 Sessions.
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 ( POSessions\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 ( POSessions\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