Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
ebc73681
Commit
ebc73681
authored
Aug 05, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor the laravel.php bootstrap.
parent
4326f959
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
31 deletions
+37
-31
laravel.php
system/laravel.php
+37
-31
No files found.
system/laravel.php
View file @
ebc73681
...
@@ -104,11 +104,6 @@ require SYS_PATH.'routing/router'.EXT;
...
@@ -104,11 +104,6 @@ require SYS_PATH.'routing/router'.EXT;
require
SYS_PATH
.
'routing/loader'
.
EXT
;
require
SYS_PATH
.
'routing/loader'
.
EXT
;
require
SYS_PATH
.
'routing/filter'
.
EXT
;
require
SYS_PATH
.
'routing/filter'
.
EXT
;
// --------------------------------------------------------------
// Register the route filters.
// --------------------------------------------------------------
Routing\Filter
::
register
(
require
APP_PATH
.
'filters'
.
EXT
);
// --------------------------------------------------------------
// --------------------------------------------------------------
// Load the packages that are in the auto-loaded packages array.
// Load the packages that are in the auto-loaded packages array.
// --------------------------------------------------------------
// --------------------------------------------------------------
...
@@ -120,46 +115,57 @@ if (count(Config::get('application.packages')) > 0)
...
@@ -120,46 +115,57 @@ if (count(Config::get('application.packages')) > 0)
}
}
// --------------------------------------------------------------
// --------------------------------------------------------------
//
Execute the global "before" filter
.
//
Register the application filters
.
// --------------------------------------------------------------
// --------------------------------------------------------------
$response
=
Routing\Filter
::
call
(
'before'
,
array
(),
true
);
Routing\Filter
::
register
(
require
APP_PATH
.
'filters'
.
EXT
);
// --------------------------------------------------------------
// --------------------------------------------------------------
//
Route the request and call the appropriate route function
.
//
Determine the module that should handle the request
.
// --------------------------------------------------------------
// --------------------------------------------------------------
if
(
is_null
(
$response
))
$segments
=
explode
(
'/'
,
Request
::
uri
());
{
if
(
in_array
(
$module
=
Request
::
segment
(
1
),
Config
::
get
(
'application.modules'
)))
{
define
(
'ACTIVE_MODULE'
,
$module
);
$path
=
MODULE_PATH
.
$module
.
'/'
;
define
(
'ACTIVE_MODULE'
,
(
in_array
(
$segments
[
0
],
Config
::
get
(
'application.modules'
)))
?
$segments
[
0
]
:
'application'
)
;
if
(
file_exists
(
$filters
=
$path
.
'filters'
.
EXT
))
// --------------------------------------------------------------
{
// Determine the path to the root of the active module.
Routing\Filter
::
register
(
require
$filters
);
// --------------------------------------------------------------
}
define
(
'ACTIVE_MODULE_PATH'
,
(
ACTIVE_MODULE
==
'application'
)
?
APP_PATH
:
MODULE_PATH
.
ACTIVE_MODULE
.
'/'
);
}
else
{
define
(
'ACTIVE_MODULE'
,
'application'
);
$path
=
APP_PATH
;
}
$route
=
Routing\Router
::
make
(
Request
::
method
(),
Request
::
uri
(),
new
Routing\Loader
(
$path
))
->
route
();
// --------------------------------------------------------------
// Register the filters for the active module.
// --------------------------------------------------------------
if
(
ACTIVE_MODULE
!==
'application'
and
file_exists
(
$filters
=
ACTIVE_MODULE_PATH
.
'filters'
.
EXT
))
{
Routing\Filter
::
register
(
require
$filters
);
}
$response
=
(
is_null
(
$route
))
?
Response
::
error
(
'404'
)
:
$route
->
call
();
// --------------------------------------------------------------
// Call the "before" filter for the application and module.
// --------------------------------------------------------------
foreach
(
array
(
'before'
,
ACTIVE_MODULE
.
'::before'
)
as
$filter
)
{
$response
=
Routing\Filter
::
call
(
$filter
,
array
(),
true
);
}
}
else
// --------------------------------------------------------------
// Route the request and get the response from the route.
// --------------------------------------------------------------
if
(
is_null
(
$response
))
{
{
$response
=
Response
::
prepare
(
$response
);
$route
=
Routing\Router
::
make
(
Request
::
method
(),
Request
::
uri
(),
new
Routing\Loader
(
ACTIVE_MODULE_PATH
))
->
route
();
$response
=
(
is_null
(
$route
))
?
Response
::
error
(
'404'
)
:
$route
->
call
();
}
}
$response
=
Response
::
prepare
(
$response
);
// --------------------------------------------------------------
// --------------------------------------------------------------
//
Execute the global "after" filter
.
//
Call the "after" filter for the application and module
.
// --------------------------------------------------------------
// --------------------------------------------------------------
Routing\Filter
::
call
(
'after'
,
array
(
$response
));
foreach
(
array
(
ACTIVE_MODULE
.
'::after'
,
'after'
)
as
$filter
)
{
Routing\Filter
::
call
(
$filter
,
array
(
$response
));
}
// --------------------------------------------------------------
// --------------------------------------------------------------
// Stringify the response.
// Stringify the response.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment