-
Notifications
You must be signed in to change notification settings - Fork 33
/
load.php
38 lines (32 loc) · 850 Bytes
/
load.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
34
35
36
37
38
<?php
/* Constants */
if ( ! defined( 'SLB_DEV' ) ) {
define( 'SLB_DEV', ( isset( $_REQUEST['slb_dev'] ) && ! ! $_REQUEST['slb_dev'] ) );
}
/* Class Management */
/**
* Class loading handler
* @param string $classname Class to load
*/
function slb_autoload( $classname ) {
$prefix = 'slb_';
$cls = strtolower( $classname );
// Remove prefix
if ( 0 !== strpos( $cls, $prefix ) ) {
return false;
}
// Format class for filename
$fn = 'class.' . substr( $cls, strlen( $prefix ) ) . '.php';
// Build path
$path = dirname( __FILE__ ) . '/includes/' . $fn;
// Load file
if ( is_readable( $path ) ) {
require $path;
}
}
spl_autoload_register( 'slb_autoload' );
/* Load Assets */
$path = dirname( __FILE__ ) . '/';
require_once $path . 'controller.php';
$GLOBALS['slb'] = new SLB_Lightbox();
require_once $path . 'functions.php';