-
Notifications
You must be signed in to change notification settings - Fork 0
/
Extension.php
31 lines (27 loc) · 864 Bytes
/
Extension.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/*
* This file is part of the ws/content-type-menu-extension package.
*
* (c) Benjamin Georgeault <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* "Virtual" Extension.php file. It is use only for local extension. It add a PSR-4 autoloader for the extension.
*
* @see http://www.php-fig.org/psr/psr-4/examples/
*/
spl_autoload_register(function ($class) {
$prefix = 'Bolt\\Extension\\WS\\ContentTypeMenuExtension\\';
$base_dir = __DIR__ . '/src/';
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
return;
}
$relative_class = substr($class, $len);
$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
if (file_exists($file)) {
require $file;
}
});