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
d76cf4ba
Commit
d76cf4ba
authored
Jan 26, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bundle improvements.
parent
7052c33c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
35 deletions
+47
-35
application.php
application/config/application.php
+0
-15
bundle.php
laravel/bundle.php
+26
-6
bundler.php
laravel/cli/tasks/bundle/bundler.php
+1
-1
resolver.php
laravel/cli/tasks/migrate/resolver.php
+1
-1
core.php
laravel/core.php
+2
-4
laravel.php
laravel/laravel.php
+2
-2
router.php
laravel/routing/router.php
+15
-6
No files found.
application/config/application.php
View file @
d76cf4ba
...
...
@@ -98,21 +98,6 @@ return array(
'timezone'
=>
'UTC'
,
/*
|--------------------------------------------------------------------------
| Autoloaded Bundles
|--------------------------------------------------------------------------
|
| Bundles can provide a ton of awesome drop-in functionality for your web
| application. Everything from Twitter integration to an admin backend.
|
| Here you may specify the bundles that should be automatically started
| on every request to your application.
|
*/
'bundles'
=>
array
(),
/*
|--------------------------------------------------------------------------
| Class Aliases
...
...
laravel/bundle.php
View file @
d76cf4ba
...
...
@@ -31,11 +31,21 @@ class Bundle {
* @param string $handles
* @return void
*/
public
static
function
register
(
$bundle
,
$
location
,
$handles
=
null
)
public
static
function
register
(
$bundle
,
$
config
=
array
()
)
{
$
location
=
BUNDLE_PATH
.
rtrim
(
$location
,
DS
)
.
DS
;
$
defaults
=
array
(
'handles'
=>
null
,
'auto'
=>
false
)
;
static
::
$bundles
[
$bundle
]
=
compact
(
'location'
,
'handles'
);
if
(
!
isset
(
$config
[
'location'
]))
{
throw
new
\Exception
(
"Location not set for bundle [
$bundle
]"
);
}
// We will trim the trailing slash from the location and add it back so we don't
// have to worry about the developer adding or not adding it to the location
// path for the bundle. This makes sure it is always there.
$config
[
'location'
]
=
BUNDLE_PATH
.
rtrim
(
$config
[
'location'
],
DS
)
.
DS
;
static
::
$bundles
[
$bundle
]
=
array_merge
(
$defaults
,
$config
);
}
/**
...
...
@@ -98,7 +108,7 @@ class Bundle {
{
foreach
(
static
::
$bundles
as
$key
=>
$value
)
{
if
(
starts_with
(
$
value
[
'handles'
],
$uri
))
return
$key
;
if
(
starts_with
(
$
uri
,
$value
[
'handles'
]
))
return
$key
;
}
return
DEFAULT_BUNDLE
;
...
...
@@ -112,7 +122,7 @@ class Bundle {
*/
public
static
function
exists
(
$bundle
)
{
return
in_array
(
strtolower
(
$bundle
),
static
::
all
());
return
in_array
(
strtolower
(
$bundle
),
static
::
names
());
}
/**
...
...
@@ -296,11 +306,21 @@ class Bundle {
}
/**
* Get all of the installed bundle
names
.
* Get all of the installed bundle
s for the application
.
*
* @return array
*/
public
static
function
all
()
{
return
static
::
$bundles
;
}
/**
* Get all of the installed bundle names.
*
* @return array
*/
public
static
function
names
()
{
return
array_keys
(
static
::
$bundles
);
}
...
...
laravel/cli/tasks/bundle/bundler.php
View file @
d76cf4ba
...
...
@@ -47,7 +47,7 @@ class Bundler extends Task {
// If no bundles are passed to the command, we'll just gather all
// of the installed bundle names and publish the assets for each
// of the bundles to the public directory.
if
(
count
(
$bundles
)
==
0
)
$bundles
=
Bundle
::
all
();
if
(
count
(
$bundles
)
==
0
)
$bundles
=
Bundle
::
names
();
$publisher
=
IoC
::
resolve
(
'bundle.publisher'
);
...
...
laravel/cli/tasks/migrate/resolver.php
View file @
d76cf4ba
...
...
@@ -37,7 +37,7 @@ class Resolver {
// returned by "all" method on the Bundle class.
if
(
is_null
(
$bundle
))
{
$bundles
=
array_merge
(
Bundle
::
all
(),
array
(
'application'
));
$bundles
=
array_merge
(
Bundle
::
names
(),
array
(
'application'
));
}
else
{
...
...
laravel/core.php
View file @
d76cf4ba
...
...
@@ -147,9 +147,7 @@ Autoloader::$aliases = Config::get('application.aliases');
*/
$bundles
=
require
BUNDLE_PATH
.
'bundles'
.
EXT
;
foreach
(
$bundles
as
$
key
=>
$value
)
foreach
(
$bundles
as
$
bundle
=>
$config
)
{
$location
=
(
is_array
(
$value
))
?
$value
[
'location'
]
:
$value
;
Bundle
::
register
(
$key
,
$location
,
array_get
(
$value
,
'handles'
));
Bundle
::
register
(
$bundle
,
$config
);
}
\ No newline at end of file
laravel/laravel.php
View file @
d76cf4ba
...
...
@@ -143,9 +143,9 @@ Bundle::start(DEFAULT_BUNDLE);
* array of auto-loaded bundles. This lets the developer have an
* easy way to load bundles for every request.
*/
foreach
(
Config
::
get
(
'application.bundles'
)
as
$bundle
)
foreach
(
Bundle
::
all
()
as
$bundle
=>
$config
)
{
Bundle
::
start
(
$bundle
);
if
(
$config
[
'auto'
])
Bundle
::
start
(
$bundle
);
}
/**
...
...
laravel/routing/router.php
View file @
d76cf4ba
...
...
@@ -101,7 +101,7 @@ class Router {
// the bundle that are installed for the application.
if
(
count
(
static
::
$names
)
==
0
)
{
foreach
(
Bundle
::
all
()
as
$bundle
)
foreach
(
Bundle
::
names
()
as
$bundle
)
{
Bundle
::
routes
(
$bundle
);
}
...
...
@@ -120,7 +120,7 @@ class Router {
}
/**
* Search the routes for the route matching a
request
method and URI.
* Search the routes for the route matching a method and URI.
*
* @param string $method
* @param string $uri
...
...
@@ -206,13 +206,22 @@ class Router {
*/
protected
static
function
controller
(
$bundle
,
$method
,
$destination
,
$segments
)
{
// If there are no more segments in the URI, we will just create a route
// for the default controller of the bundle, which is "home". We'll also
// use the default method, which is "index".
if
(
count
(
$segments
)
==
0
)
{
$uri
=
(
$bundle
==
DEFAULT_BUNDLE
)
?
'/'
:
'/'
.
Bundle
::
get
(
$bundle
)
->
handles
;
$uri
=
'/'
;
// If the bundle is not the default bundle for the application, we'll
// set the root URI as the root URI registered with the bundle in the
// bundle configuration file for the application. It's registered in
// the bundle configuration using the "handles" clause.
if
(
$bundle
!==
DEFAULT_BUNDLE
)
{
$uri
=
'/'
.
Bundle
::
get
(
$bundle
)
->
handles
;
}
// We'll generate a default "uses" clause for the route action that
// points to the default controller and method for the bundle so
// that the route will execute the default controller method.
$action
=
array
(
'uses'
=>
Bundle
::
prefix
(
$bundle
)
.
'home@index'
);
return
new
Route
(
$method
.
' '
.
$uri
,
$action
);
...
...
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