refactoring.
This commit is contained in:
parent
c3c0fbce96
commit
83d927c4f1
|
@ -83,7 +83,7 @@
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'packages' => array(),
|
'libraries' => array(),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
{
|
{
|
||||||
if (Config::get('session.driver') !== '')
|
if (Config::get('session.driver') !== '')
|
||||||
{
|
{
|
||||||
Session::flash(Input::old_input, Input::get());
|
Input::flash();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,20 @@ class Autoloader {
|
||||||
/**
|
/**
|
||||||
* Load the file corresponding to a given class.
|
* Load the file corresponding to a given class.
|
||||||
*
|
*
|
||||||
|
* Laravel loads classes out of three directorys: the core "laravel" directory,
|
||||||
|
* and the application "models" and "libraires" directories. All of the file
|
||||||
|
* names are lower cased and the directory structure corresponds with the
|
||||||
|
* class namespaces.
|
||||||
|
*
|
||||||
|
* The application "libraries" directory also supports the inclusion of PSR-0
|
||||||
|
* compliant libraries. These libraries will be detected automatically and
|
||||||
|
* will be loaded according to the PSR-0 naming conventions.
|
||||||
|
*
|
||||||
* @param string $class
|
* @param string $class
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function load($class)
|
public static function load($class)
|
||||||
{
|
{
|
||||||
// Most of the core classes are aliases for convenient access in spite of
|
|
||||||
// the namespace. If an alias is defined for the class, we will load the
|
|
||||||
// alias and bail out of the auto-load method.
|
|
||||||
if (array_key_exists($class, Config::$items['application']['aliases']))
|
if (array_key_exists($class, Config::$items['application']['aliases']))
|
||||||
{
|
{
|
||||||
return class_alias(Config::$items['application']['aliases'][$class], $class);
|
return class_alias(Config::$items['application']['aliases'][$class], $class);
|
||||||
|
@ -39,7 +45,7 @@ public static function load($class)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the file associated with a given class name.
|
* Determine the file path associated with a given class name.
|
||||||
*
|
*
|
||||||
* @param string $class
|
* @param string $class
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -50,13 +56,11 @@ protected static function find($class)
|
||||||
|
|
||||||
$namespace = substr($class, 0, strpos($class, '\\'));
|
$namespace = substr($class, 0, strpos($class, '\\'));
|
||||||
|
|
||||||
// If the class namespace exists in the libraries array, it means that the
|
// If the namespace has been detected as a PSR-0 compliant library,
|
||||||
// library is PSR-0 compliant, and we will load it following those standards.
|
// we will load the library according to those naming conventions.
|
||||||
// This allows us to add many third-party libraries to an application and be
|
|
||||||
// able to auto-load them automatically.
|
|
||||||
if (array_key_exists($namespace, static::$libraries))
|
if (array_key_exists($namespace, static::$libraries))
|
||||||
{
|
{
|
||||||
return LIBRARY_PATH.str_replace('_', '/', $file);
|
return str_replace('_', '/', $file).EXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (static::$paths as $path)
|
foreach (static::$paths as $path)
|
||||||
|
@ -67,10 +71,10 @@ protected static function find($class)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the file exists as-is in the libraries directory, we will assume the
|
// If the file exists according to the PSR-0 naming conventions,
|
||||||
// library is PSR-0 compliant, and will add the namespace to the array of
|
// we will add the namespace to the array of libraries and load
|
||||||
// libraries and load the class accordingly.
|
// the class according to the PSR-0 conventions.
|
||||||
if (file_exists($path = LIBRARY_PATH.str_replace('_', '/', $file)))
|
if (file_exists($path = str_replace('_', '/', $file).EXT))
|
||||||
{
|
{
|
||||||
static::$libraries[] = $namespace;
|
static::$libraries[] = $namespace;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('BLADE_EXT', '.blade.php');
|
|
||||||
define('CRLF', chr(13).chr(10));
|
|
||||||
define('EXT', '.php');
|
define('EXT', '.php');
|
||||||
|
define('BLADE_EXT', '.blade.php');
|
||||||
|
|
||||||
function constants($constants)
|
function constants($constants)
|
||||||
{
|
{
|
||||||
|
@ -12,6 +11,11 @@ function constants($constants)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the core framework paths and all of the paths that
|
||||||
|
* derive from them. If any constant has already been defined,
|
||||||
|
* we will not attempt to define it again.
|
||||||
|
*/
|
||||||
$constants = array(
|
$constants = array(
|
||||||
'APP_PATH' => realpath($application).'/',
|
'APP_PATH' => realpath($application).'/',
|
||||||
'BASE_PATH' => realpath("$laravel/..").'/',
|
'BASE_PATH' => realpath("$laravel/..").'/',
|
||||||
|
@ -42,6 +46,11 @@ function constants($constants)
|
||||||
|
|
||||||
constants($constants);
|
constants($constants);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the core framework paths and all of the paths that
|
||||||
|
* derive from them. If any constant has already been defined,
|
||||||
|
* we will not attempt to define it again.
|
||||||
|
*/
|
||||||
$environment = (isset($_SERVER['LARAVEL_ENV'])) ? CONFIG_PATH.$_SERVER['LARAVEL_ENV'].'/' : '';
|
$environment = (isset($_SERVER['LARAVEL_ENV'])) ? CONFIG_PATH.$_SERVER['LARAVEL_ENV'].'/' : '';
|
||||||
|
|
||||||
constants(array('ENV_CONFIG_PATH' => $environment));
|
constants(array('ENV_CONFIG_PATH' => $environment));
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
|
|
||||||
IoC::bootstrap();
|
IoC::bootstrap();
|
||||||
|
|
||||||
$loader = new Autoloader;
|
|
||||||
|
|
||||||
spl_autoload_register(array('Laravel\\Autoloader', 'load'));
|
spl_autoload_register(array('Laravel\\Autoloader', 'load'));
|
||||||
|
|
||||||
function e($value)
|
function e($value)
|
||||||
|
|
|
@ -59,5 +59,4 @@ public static function __callStatic($method, $parameters)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Autoloader extends Facade { public static $resolve = 'laravel.autoloader'; }
|
|
||||||
class Session extends Facade { public static $resolve = 'laravel.session'; }
|
class Session extends Facade { public static $resolve = 'laravel.session'; }
|
|
@ -74,6 +74,16 @@ public static function had($key)
|
||||||
return ( ! is_null(static::old($key)) and trim((string) static::old($key)) !== '');
|
return ( ! is_null(static::old($key)) and trim((string) static::old($key)) !== '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flash the input for the current request to the session.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function flash()
|
||||||
|
{
|
||||||
|
IoC::container()->core('session')->flash(Input::old_input, static::get());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get input data from the previous request.
|
* Get input data from the previous request.
|
||||||
*
|
*
|
||||||
|
|
|
@ -145,7 +145,7 @@ public function links()
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function status($text)
|
public function status($text)
|
||||||
{
|
{
|
||||||
return str_replace(array(':current', ':last'), array($this->page, $this->last), $text);
|
return str_replace(array(':current', ':last'), array($this->page, $this->last), $text);
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ protected function status($text)
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function first($text)
|
public function first($text)
|
||||||
{
|
{
|
||||||
return $this->backwards(__FUNCTION__, $text, 1);
|
return $this->backwards(__FUNCTION__, $text, 1);
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ protected function first($text)
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function previous($text)
|
public function previous($text)
|
||||||
{
|
{
|
||||||
return $this->backwards(__FUNCTION__, $text, $this->page - 1);
|
return $this->backwards(__FUNCTION__, $text, $this->page - 1);
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ protected function previous($text)
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function next($text)
|
public function next($text)
|
||||||
{
|
{
|
||||||
return $this->forwards(__FUNCTION__, $text, $this->page + 1);
|
return $this->forwards(__FUNCTION__, $text, $this->page + 1);
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ protected function next($text)
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function last($text)
|
public function last($text)
|
||||||
{
|
{
|
||||||
return $this->forwards(__FUNCTION__, $text, $this->last);
|
return $this->forwards(__FUNCTION__, $text, $this->last);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php namespace Laravel;
|
<?php namespace Laravel;
|
||||||
|
|
||||||
|
define('CRLF', chr(13).chr(10));
|
||||||
|
|
||||||
class Redis {
|
class Redis {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -194,8 +194,7 @@ protected function controller($method, $uri, $destination)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search the controllers for the application and determine if an applicable
|
* Search for a controller that can handle the current request.
|
||||||
* controller exists for the current request to the application.
|
|
||||||
*
|
*
|
||||||
* If a controller is found, the array key for the controller name in the URI
|
* If a controller is found, the array key for the controller name in the URI
|
||||||
* segments will be returned by the method, otherwise NULL will be returned.
|
* segments will be returned by the method, otherwise NULL will be returned.
|
||||||
|
|
|
@ -65,22 +65,13 @@ public static function decrypt($value)
|
||||||
throw new \Exception('Decryption error. Input value is not valid base64 data.');
|
throw new \Exception('Decryption error. Input value is not valid base64 data.');
|
||||||
}
|
}
|
||||||
|
|
||||||
list($iv, $value) = static::parse($value);
|
$iv = substr($value, 0, static::iv_size());
|
||||||
|
|
||||||
|
$value = substr($value, static::iv_size());
|
||||||
|
|
||||||
return rtrim(mcrypt_decrypt(static::$cipher, static::key(), $value, static::$mode, $iv), "\0");
|
return rtrim(mcrypt_decrypt(static::$cipher, static::key(), $value, static::$mode, $iv), "\0");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse an encrypted string into its input vector and value segments.
|
|
||||||
*
|
|
||||||
* @param string $value
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected static function parse($value)
|
|
||||||
{
|
|
||||||
return array(substr($value, 0, static::iv_size()), substr($value, static::iv_size()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the input vector size for the cipher and mode.
|
* Get the input vector size for the cipher and mode.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue