-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.php
85 lines (79 loc) · 2.43 KB
/
config.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
<?php
define('BLUDIT', true);
define('DS', DIRECTORY_SEPARATOR);
define('PATH_ROOT', __DIR__.DS);
define('CHARSET', 'UTF-8');
define('DOMAIN', 'https://plugins.bludit.com');
define('CDN', 'https://df6m0u2ovo2fu.cloudfront.net');
define('FILES', PATH_ROOT.'files'.DS);
// TOP Bar links
$topbar = array(
'download'=>'https://www.bludit.com#download',
'demo'=>'https://www.bludit.com#demo',
'docs'=>'https://docs.bludit.com',
'themes'=>'https://themes.bludit.com',
'plugins'=>'https://plugins.bludit.com',
'donations'=>'https://www.bludit.com#donations',
'pro'=>'https://pro.bludit.com',
'website'=>DOMAIN
);
// Language
$defaultLanguage = 'en';
$acceptedLanguages = array('en', 'de', 'es');
if (isset($_GET['l'])) {
if (in_array($_GET['l'], $acceptedLanguages)) {
$defaultLanguage = $_GET['l'];
}
}
$jsonData = file_get_contents(PATH_ROOT.'languages'.DS.$defaultLanguage.'.json');
$languageArray = json_decode($jsonData, true);
function l($key, $print=true) {
global $languageArray;
$key = mb_strtolower($key, CHARSET);
$key = str_replace(' ','-',$key);
if (isset($languageArray[$key])) {
if ($print) {
echo $languageArray[$key];
} else {
return $languageArray[$key];
}
}
}
// Locale
$defaultLocale = 'en_US';
if ($defaultLanguage == "es") {
$defaultLocale = 'es_ES';
$topbar = array(
'download'=>'https://www.bludit.com/es/#download',
'demo'=>'https://www.bludit.com/es/#demo',
'docs'=>'https://docs.bludit.com/es/',
'themes'=>'https://themes.bludit.com/es/',
'plugins'=>'https://plugins.bludit.com/es/',
'donations'=>'https://www.bludit.com/es/#donations',
'pro'=>'https://pro.bludit.com/es/',
'website'=>DOMAIN.'/es/'
);
} elseif ($defaultLanguage == "de") {
$defaultLocale = 'de_DE';
$topbar = array(
'download'=>'https://www.bludit.com/de/#download',
'demo'=>'https://www.bludit.com/de/#demo',
'docs'=>'https://docs.bludit.com/de/',
'themes'=>'https://themes.bludit.com/de/',
'plugins'=>'https://plugins.bludit.com/de/',
'donations'=>'https://www.bludit.com/de/#donations',
'pro'=>'https://pro.bludit.com/de/',
'website'=>DOMAIN.'/de/'
);
}
//
function listDirectories($path, $regex='*', $sortByDate=false) {
$directories = glob($path.$regex, GLOB_ONLYDIR);
if(empty($directories)) {
return array();
}
if($sortByDate) {
usort($directories, create_function('$a,$b', 'return filemtime($b) - filemtime($a);'));
}
return $directories;
}