PluginProbe
Import WP – CSV & XML Import Export for WordPress / trunk
Import WP – CSV & XML Import Export for WordPress vtrunk
2.14.24 2.14.23 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 2.9.1 trunk 0.1.6 All 142 releases
jc-importer / class / autoload.php

autoload.php in Import WP – CSV & XML Import Export for WordPress trunk, at class/autoload.php

31 lines 831 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(function ($class) {
4
5 // project-specific namespace prefix
6 $prefix = 'ImportWP\\';
7
8 // base directory for the namespace prefix
9 $base_dir = __DIR__ . '/';
10
11 // does the class use the namespace prefix?
12 $len = strlen($prefix);
13 if (strncmp($prefix, $class, $len) !== 0) {
14 // no, move to the next registered autoloader
15 return;
16 }
17
18 // get the relative class name
19 $relative_class = substr($class, $len);
20
21 // replace the namespace prefix with the base directory, replace namespace
22 // separators with directory separators in the relative class name, append
23 // with .php
24 $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
25
26 // if the file exists, require it
27 if (file_exists($file)) {
28 require $file;
29 }
30 });
31