mirror of
https://github.com/laravel/laravel.git
synced 2025-02-20 11:53:14 +08:00
tweaks to package handling.
This commit is contained in:
parent
dbf43877c6
commit
188b0c4f29
@ -35,6 +35,7 @@ return array(
|
|||||||
'Inflector' => 'System\\Inflector',
|
'Inflector' => 'System\\Inflector',
|
||||||
'Input' => 'System\\Input',
|
'Input' => 'System\\Input',
|
||||||
'Lang' => 'System\\Lang',
|
'Lang' => 'System\\Lang',
|
||||||
|
'Loader' => 'System\\Loader',
|
||||||
'Package' => 'System\\Package',
|
'Package' => 'System\\Package',
|
||||||
'URL' => 'System\\URL',
|
'URL' => 'System\\URL',
|
||||||
'Redirect' => 'System\\Redirect',
|
'Redirect' => 'System\\Redirect',
|
||||||
|
@ -145,7 +145,7 @@ require SYS_PATH.'routing/filter'.EXT;
|
|||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
require SYS_PATH.'package'.EXT;
|
require SYS_PATH.'package'.EXT;
|
||||||
|
|
||||||
System\Package::load(System\Config::get('packages.autoload'));
|
System\Package::load(System\Config::get('package.autoload'));
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
// Register the route filters.
|
// Register the route filters.
|
||||||
|
@ -65,7 +65,7 @@ class Loader {
|
|||||||
*/
|
*/
|
||||||
public static function register($path)
|
public static function register($path)
|
||||||
{
|
{
|
||||||
static::$paths[] = $path;
|
static::$paths[] = rtrim($path, '/').'/';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -12,30 +12,23 @@ class Package {
|
|||||||
/**
|
/**
|
||||||
* Load a package or set of packages.
|
* Load a package or set of packages.
|
||||||
*
|
*
|
||||||
* @param string|array $package
|
* @param string|array $packages
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function load($package)
|
public static function load($packages)
|
||||||
{
|
{
|
||||||
if (is_array($package))
|
foreach ((array) $packages as $package)
|
||||||
{
|
{
|
||||||
foreach ($package as $value)
|
// Packages may have a bootstrap file, which commonly is used to register auto-loaders
|
||||||
|
// and perform other initialization needed to use the package. If the package has a
|
||||||
|
// bootstrapper, we will require it here.
|
||||||
|
if ( ! array_key_exists($package, static::$loaded) and file_exists($path = PACKAGE_PATH.$package.'/bootstrap'.EXT))
|
||||||
{
|
{
|
||||||
static::load($value);
|
require $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
static::$loaded[] = $package;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Packages may have a bootstrap file, which commonly is used to register auto-loaders
|
|
||||||
// and perform other initialization needed to use the package. If the package has a
|
|
||||||
// bootstrapper, we will require it here.
|
|
||||||
if ( ! array_key_exists($package, static::$loaded) and file_exists($path = PACKAGE_PATH.$package.'/bootstrap'.EXT))
|
|
||||||
{
|
|
||||||
require $path;
|
|
||||||
}
|
|
||||||
|
|
||||||
static::$loaded[] = $package;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user