PluginProbe
Sessions / 2.11.0
Sessions v2.11.0
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 / autoload.php

autoload.php in Sessions 2.11.0, at autoload.php

47 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 Sessions.
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, 'POSessions\\' ) === 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, 'POSessions\System\\' ) === 0 ) {
20 $filepath = POSE_INCLUDES_DIR . 'system/';
21 }
22 if ( strpos( $class, 'POSessions\Plugin\Feature\\' ) === 0 ) {
23 $filepath = POSE_INCLUDES_DIR . 'features/';
24 } elseif ( strpos( $class, 'POSessions\Plugin\Integration\\' ) === 0 ) {
25 $filepath = POSE_INCLUDES_DIR . 'integrations/';
26 } elseif ( strpos( $class, 'POSessions\Plugin\\' ) === 0 ) {
27 $filepath = POSE_INCLUDES_DIR . 'plugin/';
28 } elseif ( strpos( $class, 'POSessions\API\\' ) === 0 ) {
29 $filepath = POSE_INCLUDES_DIR . 'api/';
30 }
31 if ( strpos( $class, 'POSessions\Library\\' ) === 0 ) {
32 $filepath = POSE_VENDOR_DIR;
33 }
34 if ( strpos( $filename, '-public' ) !== false ) {
35 $filepath = POSE_PUBLIC_DIR;
36 }
37 if ( strpos( $filename, '-admin' ) !== false ) {
38 $filepath = POSE_ADMIN_DIR;
39 }
40 $file = $filepath . $filename;
41 if ( file_exists( $file ) ) {
42 include_once $file;
43 }
44 }
45 }
46 );
47