-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
40 lines (36 loc) · 1.57 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
ini_set('display_errors', 'on'); // Display all errors on screen
ini_set('short_open_tag', 'off'); // Disable short tags like this: <? but doesn`t work :(
error_reporting(E_ALL);
header("Cache-Control: public");
header("Expires: " . date("r", time() + 3600));
header('Content-Type: text/html; charset=UTF-8');
ob_start();
@session_start();
define('HOST', dirname(__FILE__)); // Root path
define('APPLICATION', ''); // Choose application - backend or frontend. If frontend - set ""
define('PROFILER', FALSE); // On/off profiler
define('START_TIME', microtime(TRUE)); // For profiler. Don't touch!
define('START_MEMORY', memory_get_usage()); // For profiler. Don't touch!
// Uncomment next row if multilang needs
// require_once 'Plugins/I18n/I18n.php';
// Autoload
function autoload($className) {
// If I18n
$arr = explode('\\', $className);
if (end($arr) == 'I18n') { return; }
// else
$className = ltrim($className, '\\');
$fileName = '';
$namespace = '';
if ($lastNsPos = strrpos($className, '\\')) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
}
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';
require $fileName;
}
spl_autoload_register('autoload');
Core\Route::factory()->execute();
Plugins\Profiler\Profiler::view();