';
}
return '<'.$type.static::attributes($attributes).'>'.$html.''.$type.'>';
@@ -279,6 +279,9 @@ private static function list_elements($type, $list, $attributes = array())
/**
* Build a list of HTML attributes from an array.
*
+ * Numeric-keyed attributes will be assigned the same key and value to handle
+ * attributes such as "autofocus" and "required".
+ *
* @param array $attributes
* @return string
*/
@@ -288,8 +291,6 @@ public static function attributes($attributes)
foreach ((array) $attributes as $key => $value)
{
- // Assume numeric-keyed attributes to have the same key and value.
- // Example: required="required", autofocus="autofocus", etc.
if (is_numeric($key)) $key = $value;
if ( ! is_null($value))
diff --git a/laravel/language/en/pagination.php b/laravel/language/en/pagination.php
index c4e503d6..db6f5fa4 100644
--- a/laravel/language/en/pagination.php
+++ b/laravel/language/en/pagination.php
@@ -2,6 +2,20 @@
return array(
+ /*
+ |--------------------------------------------------------------------------
+ | Pagination Language Lines
+ |--------------------------------------------------------------------------
+ |
+ | The following language lines are used by the paginator library to build
+ | the pagination links. They may be easily changed by the developer to
+ | anything they wish.
+ |
+ | The "status" line has two place-holders, :current and :last, for which
+ | the current and last page numbers are substituted, respectively.
+ |
+ */
+
'first' => 'First',
'previous' => '← Previous',
'status' => 'Page :current of :last',
diff --git a/laravel/language/en/validation.php b/laravel/language/en/validation.php
index 79de7c3f..edd77e71 100644
--- a/laravel/language/en/validation.php
+++ b/laravel/language/en/validation.php
@@ -2,6 +2,38 @@
return array(
+ /*
+ |--------------------------------------------------------------------------
+ | Validation Attribute Language Lines
+ |--------------------------------------------------------------------------
+ |
+ | The following language lines are used to swap attribute place-holders
+ | with something more reader friendly, such as "E-Mail Address" instead
+ | of "email".
+ |
+ | The Validator class will automatically search this array of lines when
+ | attempting to replace the :attribute place-holder in error messages.
+ |
+ */
+
+ 'attributes' => array(),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Validation Language Lines
+ |--------------------------------------------------------------------------
+ |
+ | The following language lines contain the default error messages used
+ | by the validator class. Some of the rules contain multiple versions,
+ | such as the size (max, min, between) rules. These versions are used
+ | for different input types such as strings and files.
+ |
+ | These language lines may be easily changed by the developer to provide
+ | custom error messages in their application. Error messages for custom
+ | validation rules may also be added to this file.
+ |
+ */
+
"accepted" => "The :attribute must be accepted.",
"active_url" => "The :attribute is not a valid URL.",
"alpha" => "The :attribute may only contain letters.",
diff --git a/laravel/laravel.php b/laravel/laravel.php
index 8aa41098..86ef75d3 100644
--- a/laravel/laravel.php
+++ b/laravel/laravel.php
@@ -37,7 +37,9 @@
* Manually load some core classes that are used on every request
* This allows to avoid using the loader for these classes.
*/
+require SYS_PATH.'input'.EXT;
require SYS_PATH.'request'.EXT;
+require SYS_PATH.'response'.EXT;
require SYS_PATH.'routing/route'.EXT;
require SYS_PATH.'routing/router'.EXT;
require SYS_PATH.'routing/loader'.EXT;
@@ -117,7 +119,7 @@
*/
if (Config::$items['session']['driver'] !== '')
{
- Session\Manager::close(array(Input::old_input => Input::get()));
+ Session\Manager::close();
}
/**
diff --git a/laravel/proxy.php b/laravel/proxy.php
deleted file mode 100644
index c81e9390..00000000
--- a/laravel/proxy.php
+++ /dev/null
@@ -1,21 +0,0 @@
-headers['Content-Type']))
- {
- $this->header('Content-Type', 'text/html; charset=utf-8');
- }
-
- if ( ! headers_sent()) $this->send_headers();
+ if ( ! headers_sent()) $this->headers();
echo $this->render();
}
/**
- * Send the response headers to the browser.
+ * Send all of the response headers to the browser.
+ *
+ * The develop may set any response headers they wish using the "header" method.
+ * All of the headers set by the developer will be automatically sent to the
+ * browser when the response is sent via the "send" method. There is no need
+ * to call this method before calling the "send" method.
+ *
+ * The protocol and status header will be set automatically, as well as the
+ * content-type and charset, unless those headers have been set explicitly.
+ * The content-type charset used will be the application encoding.
*
* @return void
*/
- public function send_headers()
+ public function headers()
{
- $protocol = (isset($_SERVER['SERVER_PROTOCOL'])) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
+ if ( ! isset($this->headers['Content-Type']))
+ {
+ $this->header('Content-Type', 'text/html; charset='.Config::$items['application']['encoding']);
+ }
- header($protocol.' '.$this->status.' '.$this->statuses[$this->status]);
+ header(Request::protocol().' '.$this->status.' '.$this->statuses[$this->status]);
foreach ($this->headers as $name => $value)
{
diff --git a/laravel/routing/loader.php b/laravel/routing/loader.php
index 47c656a6..73240727 100644
--- a/laravel/routing/loader.php
+++ b/laravel/routing/loader.php
@@ -92,6 +92,9 @@ public function everything()
$routes = array();
+ // First, we'll grab the base routes from the application directory.
+ // Once we have these, we'll merge all of the nested routes in the
+ // routes directory into this array of routes.
if (file_exists($path = $this->base.'routes'.EXT))
{
$routes = array_merge($routes, require $path);
diff --git a/laravel/security/crypter.php b/laravel/security/crypter.php
index a85fd7d8..6312f900 100644
--- a/laravel/security/crypter.php
+++ b/laravel/security/crypter.php
@@ -72,25 +72,29 @@ public static function encrypt($value)
*/
public static function decrypt($value)
{
- // Since all encrypted strings generated by this class are base64
- // encoded, we will first attempt to base64 decode the string.
- // If we can't do it, we'll bail out.
if ( ! is_string($value = base64_decode($value, true)))
{
throw new \Exception('Decryption error. Input value is not valid base64 data.');
}
- // Extract the input vector and the encrypted string from the value.
- // These will be used by Mcrypt to properly decrypt the value.
- $iv = substr($value, 0, static::iv_size());
-
- $value = substr($value, static::iv_size());
+ list($iv, $value) = static::parse($value);
$key = Config::$items['application']['key'];
return rtrim(mcrypt_decrypt(static::$cipher, $key, $value, static::$mode, $iv), "\0");
}
+ /**
+ * Parse an encrypted value into the input vector and the actual value.
+ *
+ * @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.
*
diff --git a/laravel/session/manager.php b/laravel/session/manager.php
index 5e9728da..30baf671 100644
--- a/laravel/session/manager.php
+++ b/laravel/session/manager.php
@@ -269,18 +269,12 @@ protected static function replace($search, $replace, $keys)
/**
* Close the session handling for the request.
*
- * @param array $flash
* @return void
*/
- public static function close($flash = array())
+ public static function close()
{
$config = Config::$items['session'];
- foreach ($flash as $key => $value)
- {
- static::flash($key, $value);
- }
-
static::$driver->save(static::age(), $config, static::$exists);
static::$transporter->put(static::$session['id'], $config);
diff --git a/laravel/validation/validator.php b/laravel/validation/validator.php
index 821db832..008cee30 100644
--- a/laravel/validation/validator.php
+++ b/laravel/validation/validator.php
@@ -563,7 +563,9 @@ protected function replace($message, $attribute, $rule, $parameters)
// Except for "between" every replacement should be the first parameter.
$max = ($rule == 'between') ? $parameters[1] : $parameters[0];
- $message = str_replace(array(':size', ':min', ':max'), array($parameters[0], $parameters[0], $max), $message);
+ $replace = array($parameters[0], $parameters[0], $max);
+
+ $message = str_replace(array(':size', ':min', ':max'), $replace, $message);
}
elseif (in_array($rule, $this->inclusion_rules))
{
diff --git a/laravel/view.php b/laravel/view.php
index 1a1fe429..55f15457 100644
--- a/laravel/view.php
+++ b/laravel/view.php
@@ -133,12 +133,16 @@ protected static function name($name)
{
if (is_null(static::$composers)) static::$composers = require APP_PATH.'composers'.EXT;
- // The view's name may specified in several different ways in the composers file.
- // The composer may simple have a string value, which is the name. Or, it may
- // an array value in which a "name" key exists.
+ // The view's name may specified in several different ways in the
+ // composers file. The composer may simple have a string value,
+ // which is the name. Or, it may an array value in which a
+ // "name" key exists.
foreach (static::$composers as $key => $value)
{
- if ($name === $value or (is_array($value) and $name === Arr::get($value, 'name'))) return $key;
+ if ($name === $value or (is_array($value) and $name === Arr::get($value, 'name')))
+ {
+ return $key;
+ }
}
}
@@ -170,10 +174,10 @@ public function render()
{
static::compose($this);
- // All nested views and responses are evaluated before the main view.
- // This allows the assets used by these views to be added to the asset
- // container before the
- // main view is evaluated and dumps the links to the assets.
+ // All nested views and responses are evaluated before the
+ // main view. This allows the assets used by these views to
+ // be added to the asset container before the main view is
+ // evaluated and dumps the links to the assets.
foreach ($this->data as &$data)
{
if ($data instanceof View or $data instanceof Response)
@@ -184,9 +188,9 @@ public function render()
ob_start() and extract($this->data, EXTR_SKIP);
- // If the view is a "Blade" view, we need to check the view for modifications
- // and get the path to the compiled view file. Otherwise, we'll just use the
- // regular path to the view.
+ // If the view is a "Blade" view, we need to check the view for
+ // modifications and get the path to the compiled view file.
+ // Otherwise, we'll just use the regular path to the view.
$view = (strpos($this->path, BLADE_EXT) !== false) ? $this->compile() : $this->path;
try { include $view; } catch (Exception $e) { ob_get_clean(); throw $e; }
diff --git a/public/index.php b/public/index.php
index 06006852..c39e1cd0 100644
--- a/public/index.php
+++ b/public/index.php
@@ -13,6 +13,7 @@
| Tick... Tock... Tick... Tock
|--------------------------------------------------------------------------
*/
+
define('START_TIME', microtime(true));
/*
@@ -43,6 +44,7 @@
| 3... 2... 1... Lift-off!
|--------------------------------------------------------------------------
*/
+
require $laravel.'/laravel.php';
-//echo number_format((microtime(true) - START_TIME) * 1000, 2);
\ No newline at end of file
+echo number_format((microtime(true) - START_TIME) * 1000, 2);
\ No newline at end of file