diff --git a/application/controllers/home.php b/application/controllers/home.php index 982cc513..d54746d6 100644 --- a/application/controllers/home.php +++ b/application/controllers/home.php @@ -1,6 +1,6 @@ core("database.connectors.{$config['driver']}")->connect($config); + return IoC::core("database.connectors.{$config['driver']}")->connect($config); } /** diff --git a/laravel/form.php b/laravel/form.php index af94d5f1..73ba5670 100644 --- a/laravel/form.php +++ b/laravel/form.php @@ -52,7 +52,12 @@ public static function open($action = null, $method = 'POST', $attributes = arra $attributes['accept-charset'] = Config::get('application.encoding'); } - $append = ($method == 'PUT' or $method == 'DELETE') ? static::hidden(Request::spoofer, $method) : ''; + $append = ''; + + if ($method == 'PUT' or $method == 'DELETE') + { + $append = static::hidden(Request::spoofer, $method); + } return ''.$append.PHP_EOL; } @@ -166,7 +171,11 @@ public static function label($name, $value, $attributes = array()) { static::$labels[] = $name; - return ''.PHP_EOL; + $attributes = HTML::attributes($attributes); + + $value = HTML::entities($value); + + return ''.PHP_EOL; } /** @@ -324,7 +333,9 @@ public static function file($name, $attributes = array()) */ public static function textarea($name, $value = '', $attributes = array()) { - $attributes = array_merge($attributes, array('id' => static::id($name, $attributes), 'name' => $name)); + $attributes['name'] = $name; + + $attributes['id'] = static::id($name, $attributes); if ( ! isset($attributes['rows'])) $attributes['rows'] = 10; diff --git a/laravel/laravel.php b/laravel/laravel.php index e237fb10..9583800f 100644 --- a/laravel/laravel.php +++ b/laravel/laravel.php @@ -30,7 +30,7 @@ $id = Cookie::get(Config::$items['session']['cookie']); - IoC::container()->instance('laravel.session', new Session($driver, $id)); + IoC::container()->instance('laravel.session', new Session\Manager($driver, $id)); } /** diff --git a/laravel/routing/controller.php b/laravel/routing/controller.php index ad084c33..556e8e4a 100644 --- a/laravel/routing/controller.php +++ b/laravel/routing/controller.php @@ -130,9 +130,9 @@ public function execute($method, $parameters = array()) // If the controller has specified a layout view. The response // returned by the controller method will be bound to that view // and the layout will be considered the response. - if ( ! is_null($this->layout) and $this->viewable($response)) + if (is_null($response) and ! is_null($this->layout)) { - $response = $this->layout->with('content', $response); + $response = $this->layout; } } @@ -149,34 +149,6 @@ public function execute($method, $parameters = array()) return $response; } - /** - * Deteremine if a given response is considered "viewable". - * - * This is primarily used to determine which types of responses should be - * bound to the controller's layout and which should not. We do not want - * to bind redirects and file downloads to the layout, as this obviously - * would not make any sense. - * - * @param mixed $response - * @return bool - */ - protected function viewable($response) - { - if ($response instanceof Response) - { - if ($response instanceof Redirect) - { - return false; - } - elseif ($response->headers['Content-Description'] == 'File Transfer') - { - return false; - } - } - - return true; - } - /** * Register filters on the controller's methods. * @@ -195,9 +167,9 @@ protected function viewable($response) */ protected function filter($name, $filters) { - $this->filters[] = new Filter_Collection($name, $filters); + $this->filters[$name][] = new Filter_Collection($name, $filters); - return $this->filters[count($this->filters) - 1]; + return $this->filters[$name][count($this->filters) - 1]; } /** @@ -209,11 +181,13 @@ protected function filter($name, $filters) */ protected function filters($name, $method) { + if ( ! isset($this->filters[$name])) return array(); + $filters = array(); - foreach ($this->filters as $filter) + foreach ($this->filters[$name] as $filter) { - if ($filter->name === $name and $filter->applies($method)) + if ($filter->applies($method)) { $filters = array_merge($filters, $filter->filters); } diff --git a/laravel/session.php b/laravel/session/manager.php similarity index 97% rename from laravel/session.php rename to laravel/session/manager.php index 1e0abbf8..bdafc2bd 100644 --- a/laravel/session.php +++ b/laravel/session/manager.php @@ -1,6 +1,9 @@ -session['data'] as $key => $value) { - if (strpos($key, ':old:') === 0) $this->forget($key); + if (strpos($key, ':old:') === 0) + { + $this->forget($key); + } } // Now that all of the "old" keys have been removed from the session data, diff --git a/laravel/url.php b/laravel/url.php index 815cd3ec..4a82e45e 100644 --- a/laravel/url.php +++ b/laravel/url.php @@ -10,6 +10,9 @@ class URL { * * // Create a URL to a location within the application * $url = URL::to('user/profile'); + * + * // Create a HTTPS URL to a location within the application + * $url = URL::to('user/profile', true); * * * @param string $url @@ -20,29 +23,14 @@ public static function to($url = '', $https = false) { if (filter_var($url, FILTER_VALIDATE_URL) !== false) return $url; - return rtrim(static::root($https), '/').'/'.ltrim($url, '/'); - } + $root = Config::$items['application']['url'].'/'.Config::$items['application']['index']; - /** - * Get the URL to the root of the application. - * - * @param bool $https - * @return string - */ - protected static function root($https = false) - { - $base = Config::$items['application']['url'].'/'.Config::$items['application']['index']; - - // It is possible for the developer to totally disable the generation of links - // that use HTTPS. This is primarily to create a convenient test environment - // when using SSL is not an option. We will only replace the first occurence - // of "http" with "https" since URLs are sometimes passed in query strings. if ($https and Config::$items['application']['ssl']) { - $base = preg_replace('~http://~', 'https://', $base, 1); + $root = preg_replace('~http://~', 'https://', $root, 1); } - return $base; + return rtrim($root, '/').'/'.ltrim($url, '/'); } /** diff --git a/public/index.php b/public/index.php index c1454b93..e0b938cf 100644 --- a/public/index.php +++ b/public/index.php @@ -28,4 +28,6 @@ // -------------------------------------------------------------- // Launch Laravel. // -------------------------------------------------------------- -require $laravel.'/laravel.php'; \ No newline at end of file +require $laravel.'/laravel.php'; + +echo number_format((microtime(true) - LARAVEL_START) * 1000, 2); \ No newline at end of file