forked from BoldGrid/boldgrid-connect
-
Notifications
You must be signed in to change notification settings - Fork 2
/
autoload.php
33 lines (32 loc) · 878 Bytes
/
autoload.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
32
33
<?php
/**
* File: autoload.php
*
* @link https://central.inmotionhosting.com
* @since 1.0.0
*
* @package Central_Connect
* @copyright InMotionHosting.com
* @version $Id$
* @author InMotion Hosting <[email protected]>
*/
/**
* Responsible for class autoloading in plugin.
*
* @param string $pClassName Classname to load.
*
* @since 1.0.0
*/
function central_connect_autoload( $pClassName ) {
if ( false === strpos( $pClassName, 'Central\\Connect' ) ) {
return;
}
$updatedClass = str_replace( 'Central\Connect\\', '', $pClassName );
$path = __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . $updatedClass . '.php';
$path = str_replace( '\\', '/', $path );
if ( file_exists( $path ) && $pClassName !== $updatedClass ) {
include( $path );
return;
}
}
spl_autoload_register( 'central_connect_autoload' );