-
Notifications
You must be signed in to change notification settings - Fork 13
/
bootstrap.php
executable file
·33 lines (26 loc) · 1005 Bytes
/
bootstrap.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
namespace EDD\HelpScout;
defined( 'ABSPATH' ) or exit;
// Load autoloader (but only if not loaded already, to work with site-wide autoloaders)
if( ! function_exists( 'EDD\\HelpScout\\authorize_request' ) ) {
// Load helper functions
require_once __DIR__ . '/includes/functions.php';
// autoload classes
spl_autoload_register( function( $classname ) {
if ( strpos( $classname, 'EDD\\HelpScout\\') !== false ) {
$class = basename( str_replace( '\\', DIRECTORY_SEPARATOR, $classname ) );
$classpath = __DIR__ . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'class-'. strtolower( $class ) . '.php';
if ( file_exists( $classpath ) ) {
include_once $classpath;
}
}
} );
}
// define some default constants
require_once __DIR__ . '/includes/default-constants.php';
// Load default API actions
require_once __DIR__ . '/includes/default-actions.php';
// Check for API actions
if( ! is_admin() ) {
add_action( 'init', 'EDD\\HelpScout\\listen_for_actions' );
}