-
Notifications
You must be signed in to change notification settings - Fork 0
/
Core.php
53 lines (44 loc) · 1.25 KB
/
Core.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
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace LegionLab\Rest;
use LegionLab\Rest\Router\Router;
use LegionLab\Rest\Collections\Settings;
/**
* Created by PhpStorm.
* User: Leonardo Vilarinho
* Date: 02/07/2016
* Time: 20:34
*/
class Core extends Router
{
public function __construct()
{
if(!defined("DOMAIN")) {
$path = dirname($_SERVER["SCRIPT_NAME"]);
$path = str_replace('/public', '', $path);
if ($path === '/')
$path = '';
define('DOMAIN', $path);
}
if(!defined("ROOT")) {
$path = $_SERVER["CONTEXT_DOCUMENT_ROOT"].DOMAIN.'/';
if ($path === '/')
$path = '';
define('ROOT', $path);
}
$this->importKernelUtil();
}
private function importKernelUtil()
{
require_once ROOT."setups.php";
if(Settings::get('deployment')) {
$directoryName = ROOT.'migration/';
if(is_dir($directoryName)):
$directory = dir($directoryName);
while (($archive = $directory->read()) !== false)
if(stripos($archive, '.php'))
require $directoryName.$archive;
$directory->close();
endif;
}
}
}