diff --git a/application/config/application.php b/application/config/application.php index 60735a60..01e9d106 100755 --- a/application/config/application.php +++ b/application/config/application.php @@ -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', diff --git a/application/language/ro/pagination.php b/application/language/ro/pagination.php new file mode 100644 index 00000000..6a668f20 --- /dev/null +++ b/application/language/ro/pagination.php @@ -0,0 +1,19 @@ + '« Inapoi', + 'next' => 'Inainte »', + +); \ No newline at end of file diff --git a/application/language/ro/validation.php b/application/language/ro/validation.php new file mode 100644 index 00000000..52134a49 --- /dev/null +++ b/application/language/ro/validation.php @@ -0,0 +1,106 @@ + "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(), + +); diff --git a/application/routes.php b/application/routes.php index 2892da90..06547e0f 100644 --- a/application/routes.php +++ b/application/routes.php @@ -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'); }); diff --git a/laravel/cache/drivers/redis.php b/laravel/cache/drivers/redis.php index 3195566c..f0a71d07 100644 --- a/laravel/cache/drivers/redis.php +++ b/laravel/cache/drivers/redis.php @@ -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 +} diff --git a/laravel/database/connection.php b/laravel/database/connection.php index 938ae97f..ec1ae884 100644 --- a/laravel/database/connection.php +++ b/laravel/database/connection.php @@ -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)); diff --git a/laravel/documentation/database/eloquent.md b/laravel/documentation/database/eloquent.md index 81a9973f..fa4916cb 100644 --- a/laravel/documentation/database/eloquent.md +++ b/laravel/documentation/database/eloquent.md @@ -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 { diff --git a/laravel/documentation/database/fluent.md b/laravel/documentation/database/fluent.md index 307488ea..adede66e 100644 --- a/laravel/documentation/database/fluent.md +++ b/laravel/documentation/database/fluent.md @@ -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') diff --git a/laravel/documentation/views/forms.md b/laravel/documentation/views/forms.md index cee6287a..538fd935 100644 --- a/laravel/documentation/views/forms.md +++ b/laravel/documentation/views/forms.md @@ -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 sure 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. diff --git a/laravel/error.php b/laravel/error.php index c4c1ac6b..7de0919a 100644 --- a/laravel/error.php +++ b/laravel/error.php @@ -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); } diff --git a/laravel/form.php b/laravel/form.php index 5a450b52..d14cad69 100644 --- a/laravel/form.php +++ b/laravel/form.php @@ -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 ''; } diff --git a/laravel/log.php b/laravel/log.php index 88477a69..40b9c12c 100644 --- a/laravel/log.php +++ b/laravel/log.php @@ -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 +} diff --git a/laravel/profiling/template.blade.php b/laravel/profiling/template.blade.php index c03b50f1..d9eab921 100755 --- a/laravel/profiling/template.blade.php +++ b/laravel/profiling/template.blade.php @@ -36,7 +36,7 @@ @foreach ($queries as $query) - {{ $query[1] }}ms + {{ number_format($query[1], 2) }}ms
{{ $query[0] }}
@@ -103,7 +103,7 @@ SQL {{ count($queries) }} @if (count($queries)) - {{ array_sum(array_map(function($q) { return $q[1]; }, $queries)) }}ms + {{ number_format(array_sum(array_pluck($queries, '1')), 2) }}ms @endif diff --git a/laravel/redis.php b/laravel/redis.php index 02267d32..516f5aac 100644 --- a/laravel/redis.php +++ b/laravel/redis.php @@ -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; diff --git a/laravel/request.php b/laravel/request.php index 0193776e..7cf85d69 100644 --- a/laravel/request.php +++ b/laravel/request.php @@ -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 +} diff --git a/laravel/routing/controller.php b/laravel/routing/controller.php index e81d6b5f..4e244948 100644 --- a/laravel/routing/controller.php +++ b/laravel/routing/controller.php @@ -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 +} diff --git a/laravel/session/drivers/cookie.php b/laravel/session/drivers/cookie.php index 63a60eec..9e75354c 100644 --- a/laravel/session/drivers/cookie.php +++ b/laravel/session/drivers/cookie.php @@ -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 +} diff --git a/laravel/tests/cases/form.test.php b/laravel/tests/cases/form.test.php index 5f6f7fa3..8791dfd1 100644 --- a/laravel/tests/cases/form.test.php +++ b/laravel/tests/cases/form.test.php @@ -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 baz', null, false); $this->assertEquals('', $form1); $this->assertEquals('', $form2); + $this->assertEquals('', $form3); } /** diff --git a/public/laravel/css/style.css b/public/laravel/css/style.css index d3333c94..f073bf19 100755 --- a/public/laravel/css/style.css +++ b/public/laravel/css/style.css @@ -1,5 +1,4 @@ -@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; }