PluginProbe
Assistant – Every Day Productivity Apps / trunk
Assistant – Every Day Productivity Apps vtrunk
1.5.5 trunk 0.1.0 0.2.0 0.2.1 0.2.2 0.3.0 0.3.1 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.6.0 0.7.0 0.7.0.2 0.7.0.3 0.7.0.4 0.7.0.5 0.7.0.6 0.7.0.7 0.7.0.8 0.7.0.9 0.7.1 1.0 All 71 releases
assistant / backend / autoloader.php

autoloader.php in Assistant – Every Day Productivity Apps trunk, at backend/autoloader.php

27 lines 903 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 spl_autoload_register(
4 function ( $class ) {
5 // project-specific namespace prefix
6 $prefix = 'FL\\Assistant\\';
7 // base directory for the namespace prefix
8 $base_dir = trailingslashit( sprintf( '%s/src/', __DIR__ ) );
9 // does the class use the namespace prefix?
10 $len = strlen( $prefix );
11 if ( strncmp( $prefix, $class, $len ) !== 0 ) {
12 // no, move to the next registered autoloader
13 return;
14 }
15 // get the relative class name
16 $relative_class = substr( $class, $len );
17 // replace the namespace prefix with the base directory, replace namespace
18 // separators with directory separators in the relative class name, append with .php
19 $file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php';
20 // if the file exists, require it
21 if ( file_exists( $file ) ) {
22 /** @noinspection PhpIncludeInspection */
23 require $file;
24 }
25 }
26 );
27