/
index.php
40 lines (35 loc) · 1.19 KB
/
index.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
39
40
<?php
// Set the error log for the framework
ini_set('error_log', __DIR__ . '/error.log');
// include all the critical library stuffs
include 'core/actions-loader.php';
include 'helpers.php';
// all non-critical files to load
include 'loader.php';
// load our plugins (for registering actions)
load_plugins();
// load the currennt directory
load_directory( '.', false );
// send action for framework setup
get_action_parts( 'framework-loaded' );
// run the setup process
setup_site( get_base_path() );
// Load the current theme.
$base_path = get_base_path();
load_theme( $base_path );
// Check if this is an API request, or a user hitting the page
if( isset( $_GET['request'] ) && 0 === strpos($_GET['request'], 'api/') ) {
// Load the API files/endpoints
load_directory( './api', true);
// Load third party APIs
get_action_parts( 'load-apis' );
// proccess the API request
proccess_api_request( $_GET['request'] );
// API endpoint should die before this. If here, include the 404 page
include 'templates/404.php';
} else if ( isset( $_GET['request'] ) && 0 === strpos($_GET['request'], 'admin/') ) {
include 'admin/index.php';
} else {
// Base template includes
include 'templates/base.php';
}