-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbootstrap.php
123 lines (93 loc) · 2.58 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
/*
error_reporting(E_ALL);
ini_set('display_errors', 1);
*/
session_start();
define("STORE", "STORE");
define("ROOT", __DIR__);
define("REPOSITORY", ROOT."/repository");
define("CACHE", ROOT."/cache");
define("RESOURCES", ROOT."/resources");
define("ABSPATH", ROOT."/public");
define("INC", ABSPATH."/include");
define("PLUGIN", ABSPATH."/plugins");
define("PLUGIN_URL", "/plugins");
$_protocol = $_SERVER['SERVER_PROTOCOL'];
$_domain = $_SERVER['HTTP_HOST'];
$_protocol = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
//var_dump($_SERVER);
define("IS_HTTPS", $_protocol == 'https');
$url_root = "//".$_domain;
define("URL_ROOT", $url_root);
define("V2", ROOT."/public/v2");
define("V2_INC", ROOT."/public/v2/include");
define("V2_URL", URL_ROOT."/v2");
define("V2_PLUGIN", ROOT."/public/v2/plugins");
define("V2_PLUGIN_URL", V2_URL."/plugins");
require_once ROOT."/vendor/autoload.php";
$uriFactory = new \OAuth\Common\Http\Uri\UriFactory();
$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER);
$currentUri->setQuery('');
require_once ROOT."/init.php";
$type_text = array(
//'static' => 'Static',
'pr' => 'Presentation',
'page' => 'Page',
'component' => 'Module',
'theme' => 'Chart',
'style' => 'UI',
'map' => 'Map',
'data' => 'Data',
'code' => 'Code'
);
function HtmlPreprocessor($content, $type) {
if ($type == 'markdown') {
$Parsedown = new ParsedownExtra();
$content = $Parsedown->text($content);
} else if ($type == 'jade') {
$jade = new \Jade\Jade();
$content = $jade->render($content);
} else if ($type == 'haml') {
} else if ($type == 'html') {
}
return $content;
}
function JavascriptPreprocessor($content, $type) {
if ($type == 'javascript') {
} else if ($type == 'coffeescript') {
} else if ($type == 'typescript') {
}
return $content;
}
function CssPreprocessor($content, $type) {
if ($type == 'css') {
} else if ($type == 'less') {
try {
$parser = new Less_Parser();
$parser->parse($content);
$content = $parser->getCss();
} catch (Exception $e) {
var_dump($e->getMessage());
}
} else if ($type == 'sass') {
$scss = new scssc();
$content = $scss->compile($content);
} else if ($type == 'stylus') {
$stylus = new Stylus();
$content = $stylus->fromString($content)->toString();
}
return $content;
}
$detect = new Mobile_Detect;
require_once ROOT."/mime_types.php";
function get_mime_type($file) {
global $mime_types;
$ext = end(explode('.', $file));
if(array_key_exists($ext, $mime_types)){
return $mime_types[$ext][0];
}else {
return 'application/octet-stream';
}
}
?>