-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstart.php
More file actions
218 lines (175 loc) · 6.07 KB
/
Copy pathstart.php
File metadata and controls
218 lines (175 loc) · 6.07 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
<?php namespace Feather;
use IoC;
use Bundle;
use Request;
use Autoloader;
use Laravel\Routing\Router;
/*
|--------------------------------------------------------------------------
| Path to Feather
|--------------------------------------------------------------------------
|
| Define some paths to Feather applications and resources.
|
*/
set_path('feather', __DIR__ . DS);
set_path('applications', path('feather') . 'applications' . DS);
set_path('core', path('applications') . 'core' . DS);
set_path('admin', path('applications') . 'admin' . DS);
set_path('gears', path('feather') . 'gears' . DS);
set_path('themes', path('feather') . 'themes' . DS);
/*
|--------------------------------------------------------------------------
| Core Autoloading
|--------------------------------------------------------------------------
|
| Register the Feather namespaces and mappings with Laravel's autoloader.
|
*/
Autoloader::namespaces(array(
'Feather\\Core' => path('core') . 'models',
'Feather\\Admin' => path('admin') . 'models',
'Feather' => path('feather')
));
/*
|--------------------------------------------------------------------------
| Bootstrap Feather
|--------------------------------------------------------------------------
|
| Instantiate a new Feather application instance.
|
*/
$feather = new Components\Foundation\Application;
/*
|--------------------------------------------------------------------------
| Optional Router Placeholders
|--------------------------------------------------------------------------
|
| Register optional router placeholders with the Laravel router.
|
*/
Router::$optional['/(:page?)'] = '(?:/p([0-9]+)';
/*
|--------------------------------------------------------------------------
| Feather Configuration Repository
|--------------------------------------------------------------------------
|
| Register the configuration repository with the Feather application, this
| provides access to database configuration and file based configuration
| for both Feather and Laravel.
|
*/
$feather['config'] = $feather->share(function($feather)
{
return new Components\Config\Repository($feather);
});
define('FEATHER_DATABASE', 'feather');
$feather['config']->set('laravel: database.connections.' . FEATHER_DATABASE, $feather['config']->get('feather: feather.database'));
$feather['config']->db();
/*
|--------------------------------------------------------------------------
| Load Feather Bootstrapping
|--------------------------------------------------------------------------
|
| We can now bootstrap the remaining items.
|
*/
require path('feather') . 'bootstrap' . DS . 'views' . EXT;
require path('feather') . 'bootstrap' . DS . 'exceptions' . EXT;
require path('feather') . 'bootstrap' . DS . 'ioc' . EXT;
require path('feather') . 'bootstrap' . DS . 'validators' . EXT;
require path('feather') . 'bootstrap' . DS . 'languages' . EXT;
/*
|--------------------------------------------------------------------------
| Load Feather Components
|--------------------------------------------------------------------------
|
| Load in the Feather components.
|
*/
foreach($feather['config']->get('feather: feather.components') as $component => $resolver)
{
if(is_callable($resolver))
{
$resolver($feather);
}
}
/*
|--------------------------------------------------------------------------
| Load Feather Facades
|--------------------------------------------------------------------------
|
| Load in the Feather facades to give components a static interface through
| which methods can be accessed throughout the application.
|
*/
Components\Support\Facade::application($feather);
require path('feather') . 'facades' . EXT;
/*
|--------------------------------------------------------------------------
| Bootstrap Authentication
|--------------------------------------------------------------------------
|
| Authentication needs to be bootstrapped so that we have the correct
| auth driver set, any authenticators are registered, and the user is set.
|
*/
$feather['auth']->bootstrap();
/*
|--------------------------------------------------------------------------
| Register Feather Applications
|--------------------------------------------------------------------------
|
| Feather is split into separate applications for better separation of
| logic. Register each of the applications as defined in the configuration
| with the Laravel bundle manager.
|
*/
foreach($feather['config']->get('feather: feather.applications') as $application => $handles)
{
$handles = trim(str_replace('(:feather)', Bundle::option('feather', 'handles'), $handles), '/');
Bundle::register("feather {$application}", array(
'handles' => $handles,
'location' => "feather/applications/{$application}"
));
starts_with(Request::uri(), $handles ?: Request::uri()) and Bundle::start("feather {$application}");
}
/*
|--------------------------------------------------------------------------
| Feather CLI
|--------------------------------------------------------------------------
|
| When Feather is running via the CLI we'll automatically load in Mockery
| for testing purposes only.
|
*/
if(Request::cli())
{
require 'Mockery/Loader.php';
require 'Hamcrest/Hamcrest.php';
with(new \Mockery\Loader)->register();
}
/*
|--------------------------------------------------------------------------
| Theme Development Mode
|--------------------------------------------------------------------------
|
| When not running via the CLI and theme development mode is on we'll
| publish all the themes related assets.
|
*/
if($feather['config']->get('feather: db.forum.theme_development_mode') and !Request::cli())
{
$publisher = IoC::resolve('feather: publisher');
ob_start() and $publisher->theme((array) $feather['config']->get('feather: db.forum.theme')) and ob_clean();
}
/*
|--------------------------------------------------------------------------
| Theme Bootstrap
|--------------------------------------------------------------------------
|
| Because themes are registered as a Laravel bundle they can contain a
| start script to register any theme related assets with the container.
|
*/
Bundle::start('feather theme');