tweaked cache and session namespacing.

This commit is contained in:
Taylor Otwell
2011-07-29 23:17:57 -05:00
parent 5b2858824b
commit dbdd45d9fc
13 changed files with 381 additions and 28 deletions

View File

@@ -23,6 +23,13 @@ class View {
*/
public $path;
/**
* The view composers.
*
* @var array
*/
private static $composers;
/**
* Create a new view instance.
*
@@ -46,7 +53,14 @@ class View {
*/
public static function make($view, $data = array())
{
return new static($view, $data);
if (is_null(static::$composers))
{
static::$composers = require APP_PATH.'composers'.EXT;
}
$instance = new static($view, $data);
return (isset(static::$composers[$view])) ? call_user_func(static::$composers[$view], $instance) : $instance;
}
/**
@@ -75,7 +89,6 @@ class View {
*/
public function get()
{
// Get the evaluated content of all of the sub-views.
foreach ($this->data as &$data)
{
if ($data instanceof View or $data instanceof Response)