added package class.
This commit is contained in:
@@ -35,6 +35,7 @@ return array(
|
|||||||
'Inflector' => 'System\\Inflector',
|
'Inflector' => 'System\\Inflector',
|
||||||
'Input' => 'System\\Input',
|
'Input' => 'System\\Input',
|
||||||
'Lang' => 'System\\Lang',
|
'Lang' => 'System\\Lang',
|
||||||
|
'Package' => 'System\\Package',
|
||||||
'URL' => 'System\\URL',
|
'URL' => 'System\\URL',
|
||||||
'Redirect' => 'System\\Redirect',
|
'Redirect' => 'System\\Redirect',
|
||||||
'Request' => 'System\\Request',
|
'Request' => 'System\\Request',
|
||||||
|
|||||||
@@ -86,13 +86,6 @@ class Input {
|
|||||||
*/
|
*/
|
||||||
public static function file($key = null, $default = null)
|
public static function file($key = null, $default = null)
|
||||||
{
|
{
|
||||||
if (strpos($key, '.') !== false)
|
|
||||||
{
|
|
||||||
list($file, $key) = explode('.', $key);
|
|
||||||
|
|
||||||
return Arr::get($_FILES[$file], $key, $default);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Arr::get($_FILES, $key, $default);
|
return Arr::get($_FILES, $key, $default);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
39
system/package.php
Normal file
39
system/package.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php namespace System;
|
||||||
|
|
||||||
|
class Package {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All of the loaded packages.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $loaded = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a package or set of packages.
|
||||||
|
*
|
||||||
|
* @param string|array $package
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function load($package)
|
||||||
|
{
|
||||||
|
if (is_array($package))
|
||||||
|
{
|
||||||
|
foreach ($package as $value)
|
||||||
|
{
|
||||||
|
static::load($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))
|
||||||
|
{
|
||||||
|
require $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
static::$loaded[] = $package;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user