Merge branch 'develop' of github.com:laravel/laravel into develop

This commit is contained in:
Taylor Otwell
2012-04-18 20:39:18 -05:00
9 changed files with 349 additions and 164 deletions

View File

@@ -1,11 +1,11 @@
<?php namespace Laravel\Cache\Drivers; use Memcache;
<?php namespace Laravel\Cache\Drivers;
class Memcached extends Driver {
/**
* The Memcache instance.
*
* @var Memcache
* @var Memcached
*/
protected $memcache;
@@ -19,10 +19,10 @@ class Memcached extends Driver {
/**
* Create a new Memcached cache driver instance.
*
* @param Memcache $memcache
* @param Memcached $memcache
* @return void
*/
public function __construct(Memcache $memcache, $key)
public function __construct(\Memcached $memcache, $key)
{
$this->key = $key;
$this->memcache = $memcache;
@@ -68,7 +68,7 @@ class Memcached extends Driver {
*/
public function put($key, $value, $minutes)
{
$this->memcache->set($this->key.$key, $value, 0, $minutes * 60);
$this->memcache->set($this->key.$key, $value, $minutes * 60);
}
/**

View File

@@ -33,6 +33,8 @@
- [Added `unless` structure to Blade template engine](/docs/views/templating#blade-unless).
- [Added Blade comments](/docs/views/templating#blade-comments).
- [Added simpler environment management](/docs/install#environments).
- Added `View::exists` method.
- Use [Memcached](http://php.net/manual/en/book.memcached.php) API instead of older [Memcache](http://php.net/manual/en/book.memcache.php) API.
- Added support for bundles outside of the bundle directory.
- Added support for DateTime database query bindings.
- Migrated to the Symfony HttpFoundation component for core request / response handling.

View File

@@ -39,6 +39,10 @@ All views are stored within the **application/views** directory and use the PHP
return View::make('home.index');
});
#### Determining if a view exists:
$exists = View::exists('home.index');
Sometimes you will need a little more control over the response sent to the browser. For example, you may need to set a custom header on the response, or change the HTTP status code. Here's how:
#### Returning a custom response:

View File

@@ -5,7 +5,7 @@ class Memcached {
/**
* The Memcached connection instance.
*
* @var Memcache
* @var Memcached
*/
protected static $connection;
@@ -40,11 +40,11 @@ class Memcached {
*/
protected static function connect($servers)
{
$memcache = new \Memcache;
$memcache = new \Memcached;
foreach ($servers as $server)
{
$memcache->addServer($server['host'], $server['port'], true, $server['weight']);
$memcache->addServer($server['host'], $server['port'], $server['weight']);
}
if ($memcache->getVersion() === false)

View File

@@ -110,12 +110,13 @@ class View implements ArrayAccess {
}
/**
* Get the path to a given view on disk.
* Determine if the given view exists.
*
* @param string $view
* @return string
* @param string $view
* @param boolean $return_path
* @return string|bool
*/
protected function path($view)
public static function exists($view, $return_path = false)
{
list($bundle, $view) = Bundle::parse($view);
@@ -127,6 +128,22 @@ class View implements ArrayAccess {
$path = Event::first(static::loader, array($bundle, $view));
if ( ! is_null($path))
{
return $return_path ? $path : true;
}
return false;
}
/**
* Get the path to a given view on disk.
*
* @param string $view
* @return string
*/
protected function path($view)
{
if ($path = $this->exists($view,true))
{
return $path;
}