Commit 92e3ae47 authored by Taylor Otwell's avatar Taylor Otwell

Merge branch 'master' of github.com:laravel/laravel

parents 4046313e f933db7a
......@@ -159,6 +159,7 @@ return array(
'Blade' => 'Laravel\\Blade',
'Bundle' => 'Laravel\\Bundle',
'Cache' => 'Laravel\\Cache',
'Command' => 'Laravel\\CLI\\Command',
'Config' => 'Laravel\\Config',
'Controller' => 'Laravel\\Routing\\Controller',
'Cookie' => 'Laravel\\Cookie',
......
<?php
return array(
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the pagination links. You're free to change them to anything you want.
| If you come up with something more exciting, let us know.
|
*/
'previous' => '&laquo; Inapoi',
'next' => 'Inainte &raquo;',
);
\ No newline at end of file
<?php
return 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 to provide custom error
| messages in your application. Error messages for custom validation
| rules may also be added to this file.
|
*/
"accepted" => "Campul :attribute trebuie sa fie acceptat.",
"active_url" => "Campul :attribute nu este un URL valid.",
"after" => "Campul :attribute trebuie sa fie o data dupa :date.",
"alpha" => "Campul :attribute poate contine numai litere.",
"alpha_dash" => "Campul :attribute poate contine numai litere, numere si liniute.",
"alpha_num" => "Campul :attribute poate contine numai litere si numere.",
"array" => "Campul :attribute trebuie sa aiba elemente selectate.",
"before" => "Campul :attribute trebuie sa fie o data inainte de :date.",
"between" => array(
"numeric" => "Campul :attribute trebuie sa fie intre :min si :max.",
"file" => "Campul :attribute trebuie sa fie intre :min si :max kilobytes.",
"string" => "Campul :attribute trebuie sa fie intre :min si :max caractere.",
),
"confirmed" => "Confirmarea :attribute nu se potriveste.",
"count" => "Campul :attribute trebuie sa aiba exact :count elemente selectate.",
"countbetween" => "Campul :attribute trebuie sa aiba intre :min si :max elemente selectate.",
"countmax" => "Campul :attribute trebuie sa aiba mai putin de :max elemente selectate.",
"countmin" => "Campul :attribute trebuie sa aiba cel putin :min elemente selectate.",
"date_format" => "Campul :attribute trebuie sa fie intr-un format valid.",
"different" => "Campurile :attribute si :other trebuie sa fie diferite.",
"email" => "Formatul campului :attribute este invalid.",
"exists" => "Campul :attribute selectat este invalid.",
"image" => "Campul :attribute trebuie sa fie o imagine.",
"in" => "Campul :attribute selectat este invalid.",
"integer" => "Campul :attribute trebuie sa fie un numar intreg.",
"ip" => "Campul :attribute trebuie sa fie o adresa IP valida.",
"match" => "Formatul campului :attribute este invalid.",
"max" => array(
"numeric" => "Campul :attribute trebuie sa fie mai mic de :max.",
"file" => "Campul :attribute trebuie sa fie mai mic de :max kilobytes.",
"string" => "Campul :attribute trebuie sa fie mai mic de :max caractere.",
),
"mimes" => "Campul :attribute trebuie sa fie un fisier de tipul: :values.",
"min" => array(
"numeric" => "Campul :attribute trebuie sa fie cel putin :min.",
"file" => "Campul :attribute trebuie sa aiba cel putin :min kilobytes.",
"string" => "Campul :attribute trebuie sa aiba cel putin :min caractere.",
),
"not_in" => "Campul :attribute selectat este invalid.",
"numeric" => "Campul :attribute trebuie sa fie un numar.",
"required" => "Campul :attribute este obligatoriu.",
"required_with" => "Campul :attribute este obligatoriu cu :field",
"same" => "Campul :attribute si :other trebuie sa fie identice.",
"size" => array(
"numeric" => "Campul :attribute trebuie sa fie :size.",
"file" => "Campul :attribute trebuie sa aiba :size kilobyte.",
"string" => "Campul :attribute trebuie sa aiba :size caractere.",
),
"unique" => "Campul :attribute a fost deja folosit.",
"url" => "Campul :attribute nu este intr-un format valid.",
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute_rule" to name the lines. This helps keep your
| custom validation clean and tidy.
|
| So, say you want to use a custom validation message when validating that
| the "email" attribute is unique. Just add "email_unique" to this array
| with your custom message. The Validator will handle the rest!
|
*/
'custom' => array(),
/*
|--------------------------------------------------------------------------
| Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as "E-Mail Address" instead
| of "email". Your users will thank you.
|
| The Validator class will automatically search this array of lines it
| is attempting to replace the :attribute place-holder in messages.
| It's pretty slick. We think you'll like it.
|
*/
'attributes' => array(),
);
......@@ -48,7 +48,8 @@ Route::get('/', function()
|
| Similarly, we use an event to handle the display of 500 level errors
| within the application. These errors are fired when there is an
| uncaught exception thrown in the application.
| uncaught exception thrown in the application. The exception object
| that is captured during execution is then passed to the 500 listener.
|
*/
......@@ -57,7 +58,7 @@ Event::listen('404', function()
return Response::error('404');
});
Event::listen('500', function()
Event::listen('500', function($exception)
{
return Response::error('500');
});
......
......@@ -87,5 +87,15 @@ class Redis extends Driver {
{
$this->redis->del($key);
}
/**
* Flush the entire cache.
*
* @return void
*/
public function flush()
{
$this->redis->flushdb();
}
}
\ No newline at end of file
}
......@@ -75,7 +75,8 @@ class Connection {
if (isset(\Laravel\Database::$registrar[$this->driver()]))
{
return $this->grammar = \Laravel\Database::$registrar[$this->driver()]['query']();
$resolver = \Laravel\Database::$registrar[$this->driver()]['query'];
return $this->grammar = $resolver($this);
}
switch ($this->driver())
......@@ -308,7 +309,7 @@ class Connection {
*/
protected function log($sql, $bindings, $start)
{
$time = number_format((microtime(true) - $start) * 1000, 2);
$time = (microtime(true) - $start) * 1000;
Event::fire('laravel.query', array($sql, $bindings, $time));
......
......@@ -284,7 +284,7 @@ Or, as usual, you may retrieve the relationship through the dynamic roles proper
$roles = User::find(1)->roles;
If your table names don't follow conventions, simply pass the table name in the second parameter to the **has\_and\_belongs\_to\_many** method:
If your table names don't follow conventions, simply pass the table name in the second parameter to the **has\_many\_and\_belongs\_to** method:
class User extends Eloquent {
......
......@@ -76,6 +76,13 @@ There are a variety of methods to assist you in building where clauses. The most
->or_where('email', '=', 'example@gmail.com')
->first();
To do the equivalent of an AND where, simply chain the query with another where:
return DB::table('users')
->where('id', '=', 1)
->where('activated', '=', 1)
->first();
Of course, you are not limited to simply checking equality. You may also use **greater-than**, **less-than**, **not-equal**, and **like**:
return DB::table('users')
......
......@@ -83,6 +83,14 @@ Laravel provides an easy method of protecting your application from cross-site r
echo Form::label('email', 'E-Mail Address', array('class' => 'awesome'));
#### Turning off HTML escaping of label contents:
echo Form::label('confirm', 'Are you <strong>sure</strong> you want to proceed?', null, false);
You can pass ```false``` as the optional fourth argument to disable automatic HTML escaping of the label content.
> **Note:** After creating a label, any form element you create with a name matching the label name will automatically receive an ID matching the label name as well.
<a name="text"></a>
......
......@@ -54,7 +54,7 @@ class Error {
// Using events gives the developer more freedom.
else
{
$response = Event::first('500');
$response = Event::first('500', $exception);
$response = Response::prepare($response);
}
......
......@@ -182,13 +182,15 @@ class Form {
* @param array $attributes
* @return string
*/
public static function label($name, $value, $attributes = array())
public static function label($name, $value, $attributes = array(), $escape_html = true)
{
static::$labels[] = $name;
$attributes = HTML::attributes($attributes);
$value = HTML::entities($value);
if ($escape_html) {
$value = HTML::entities($value);
}
return '<label for="'.$name.'"'.$attributes.'>'.$value.'</label>';
}
......
......@@ -56,7 +56,31 @@ class Log {
Event::fire('laravel.log', array($type, $message));
}
$message = static::format($type, $message);
$trace=debug_backtrace();
foreach($trace as $item)
{
if (isset($item['class']) AND $item['class'] == __CLASS__)
{
continue;
}
$caller = $item;
break;
}
$function = $caller['function'];
if (isset($caller['class']))
{
$class = $caller['class'] . '::';
}
else
{
$class = '';
}
$message = static::format($type, $class . $function . ' - ' . $message);
File::append(path('storage').'logs/'.date('Y-m-d').'.log', $message);
}
......@@ -96,4 +120,4 @@ class Log {
static::write($method, $parameters[0], $parameters[1]);
}
}
\ No newline at end of file
}
......@@ -36,7 +36,7 @@
@foreach ($queries as $query)
<tr>
<td class="anbu-table-first">
{{ $query[1] }}ms
{{ number_format($query[1], 2) }}ms
</td>
<td>
<pre>{{ $query[0] }}</pre>
......@@ -103,7 +103,7 @@
<a data-anbu-tab="anbu-sql" class="anbu-tab" href="#">SQL
<span class="anbu-count">{{ count($queries) }}</span>
@if (count($queries))
<span class="anbu-count">{{ array_sum(array_map(function($q) { return $q[1]; }, $queries)) }}ms</span>
<span class="anbu-count">{{ number_format(array_sum(array_pluck($queries, '1')), 2) }}ms</span>
@endif
</a>
</li>
......
......@@ -16,6 +16,13 @@ class Redis {
*/
protected $port;
/**
* The database password, if present.
*
* @var string
*/
protected $password;
/**
* The database number the connection selects on load.
*
......@@ -45,10 +52,11 @@ class Redis {
* @param int $database
* @return void
*/
public function __construct($host, $port, $database = 0)
public function __construct($host, $port, $password = null, $database = 0)
{
$this->host = $host;
$this->port = $port;
$this->password = $password;
$this->database = $database;
}
......@@ -79,7 +87,12 @@ class Redis {
extract($config);
static::$databases[$name] = new static($host, $port, $database);
if ( ! isset($password))
{
$password = null;
}
static::$databases[$name] = new static($host, $port, $password, $database);
}
return static::$databases[$name];
......@@ -153,6 +166,11 @@ class Redis {
throw new \Exception("Error making Redis connection: {$error} - {$message}");
}
if ( $this->password )
{
$this->auth($this->password);
}
$this->select($this->database);
return $this->connection;
......
......@@ -196,7 +196,7 @@ class Request {
*/
public static function cli()
{
return defined('STDIN') || (substr(PHP_SAPI, 0, 3) == 'cgi' && getenv('TERM'));
return defined('STDIN') || (PHP_SAPI != "cgi-fcgi" && substr(PHP_SAPI, 0, 3) == 'cgi' && getenv('TERM'));
}
/**
......@@ -287,4 +287,4 @@ class Request {
return call_user_func_array(array(static::foundation(), $method), $parameters);
}
}
\ No newline at end of file
}
......@@ -276,7 +276,7 @@ abstract class Controller {
// Again, as was the case with route closures, if the controller "before"
// filters return a response, it will be considered the response to the
// request and the controller method will not be used.
$response = Filter::run($filters, array(), true);
$response = Filter::run($filters, $parameters, true);
if (is_null($response))
{
......@@ -439,4 +439,4 @@ abstract class Controller {
}
}
}
\ No newline at end of file
}
......@@ -39,7 +39,7 @@ class Cookie extends Driver {
$payload = Crypter::encrypt(serialize($session));
C::put(Cookie::payload, $payload, $lifetime, $path, $domain);
C::put(Cookie::payload, $payload, $lifetime, $path, $domain, $secure);
}
/**
......@@ -53,4 +53,4 @@ class Cookie extends Driver {
C::forget(Cookie::payload);
}
}
\ No newline at end of file
}
......@@ -111,9 +111,11 @@ class FormTest extends PHPUnit_Framework_TestCase {
{
$form1 = Form::label('foo', 'Foobar');
$form2 = Form::label('foo', 'Foobar', array('class' => 'control-label'));
$form3 = Form::label('foo', 'Foobar <i>baz</i>', null, false);
$this->assertEquals('<label for="foo">Foobar</label>', $form1);
$this->assertEquals('<label for="foo" class="control-label">Foobar</label>', $form2);
$this->assertEquals('<label for="foo">Foobar <i>baz</i></label>', $form3);
}
/**
......
@import url(http://fonts.googleapis.com/css?family=Ubuntu);
@import url(http://fonts.googleapis.com/css?family=Droid+Sans);
@import url(http://fonts.googleapis.com/css?family=Ubuntu|Droid+Sans);
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; }
audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment