-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.config.php
More file actions
231 lines (176 loc) · 5.2 KB
/
Copy path.config.php
File metadata and controls
231 lines (176 loc) · 5.2 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<?php
/**
* Project Configuration
*
* Framework : Ehex (https://github.com/ehexphp/ehex-framework)
* Description : Simple, Clean and Comprehensive Framework
* Author : Samson Oyetola (samson.oyetola@xamtax.com)
*
* This file contains the following configurations:
* - Global Environment Variable
* - App Life Cycle
* - Database/MySQL cofig
* - Mail and thirdParties config
* @package Ehex
*/
class Config1{
/**
* Override Config base on the current hostName
* Retrieve with e.g env("DB_NAME") or getConfig("DB_NAME")
*/
const ENVs = [
'.env'=>['http://localhost', 'https://myapp.local'],
'.prod.env'=>['https://myapp.com']
];
/**
* Simply Application title
*/
const APP_TITLE ='Ehex (ex)';
/**
* Application title that can include html and css
*/
const APP_FANCY_TITLE = '<strong>Ehex</strong> <span>Framework</span>';
/**
* Website description
*/
const APP_DESCRIPTION = 'Powerful and Friendly Framework';
/**
* Enable CLF Access to class functions.
*/
const MODELS_CLF_CALLABLE_LIST=["*"];
/**
* Add JQUERY to every page automatically. It will add Page1::start(), Page1::end() for every page.
*/
const AUTO_PAGE_WRAPPER = true;
/**
* By default, classes are auto-loaded ahead-of-time. However, you can specify classes to ignore
*/
const EXCLUDE_AUTOLOAD_CLASS = [];
/**
* Developer company info. Optional
*/
const APP_DEVELOPER_NAME = 'Ehex';
const APP_DEVELOPER_EMAIL = 'ehex.framework@xamtax.com';
const APP_DEVELOPER_WEBSITE = 'https://ehex.xamtax.com';
/**
* Application Page Route
* @param exRoute1 $route
*/
static function onRoute($route) {
// Test Email Template
/*$route->get('/', function(){
echo view_make('pages.emails.verify', [
'url'=> Form1::callController(User::class.'@processVerifyAccount('.encode_data('hell@gmail.com').')'),
'content'=> "Hi, <br>Take control of yoe",
]);
});
return;*/
/**
* Turn a view directory to route
*/
// $route->directory('pages.common');
/**
* Home Page
*/
$route->view('/', 'pages.homepage.index');
/**
* Compile all model's route
*/
Dashboard::onRoute($route);
/**
* For Dashboard route, Error 404 and Site Under-Construction
*/
$route->fixed([
'dashboard_route'=>'dashboard',
'error404'=>'pages.common.error404',
'maintenance'=>'pages.common.maintenance_mode'
]);
}
/**
* Route Passage
*
* @param $req
* @return bool
*/
static function onMiddleware($req) {
return true;
}
/**
* Execute before page renders
* All keys will become global variable.
* @return array (of shared variables)
*/
static function onPageStart() {
return ['page_title'=>''];
}
/**
* Execute after page renders
*/
static function onPageEnd() {}
/**
* Create, Alter or Destroy Database model here.
* Execute only when DEBUG_MODE is set to TRUE
*/
static function onDebug(){
// Db1::tableCreateAll();
if(isset($_REQUEST['db_init'])) {
//Db1::tableCreateAll();
//$firstUser = User::find("user", "role");
//if($firstUser) $firstUser->update(['role'=>'admin']);
}
}
/**
* Execute when login is successful
* @param $user : i.e User::getLogin() instance
*/
static function onLogin(User $user) { }
/**
* Execute when logout
*/
static function onLogout() { }
/**
* Widget Configuration
* Common Widget Located in exWidget1.
* e.g echo exWidget1::getJivoLiveChat()
* @param $key
* @return mixed
*/
static function widget($key){
return [
'disqus'=>'ehex',
'google_analytics'=>'UA-131446983-1',
'jivo_livechat'=>'RR6Sdm1ShQ',
'tawk_livechat'=>'5c40202cab5284048d0d52cd',
'file_manager_password'=>env('DB_PASSWORD')
][$key];
}
/************************************************
* Language
* Set A list of Language in config -> language()...
* Then at the beginning of your page, use set_language(from, to) to set a default language to use
* e,g set_language('en', 'ru');
* Usage
* get_language('signup')
* Or __('signup')
* You can also translate a new word
* __('Hello world')
***********************************************
* @return array
*/
static function language(){
return [
'lost_password'=>'Lost Your Password',
'confirm'=>'Are you sure?',
'signup'=> [
'default'=>'Register',
'ru'=>'kola',
'yr'=>'dara pomo wa',
],
'login'=> [
'default'=>'Login',
'ru'=>'adLouqd',
'yr'=>'wole si wa',
],
];
}
}