From ea3021f3dd6c22beab5aa460f0319cd7ab8d910d Mon Sep 17 00:00:00 2001 From: Loic Sharma Date: Tue, 5 Jun 2012 22:46:35 -0500 Subject: [PATCH 1/5] Fixed bug where the profiler did not correctly put quotes around bindings --- laravel/profiling/profiler.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/laravel/profiling/profiler.php b/laravel/profiling/profiler.php index 9b6edfef..ec14004f 100644 --- a/laravel/profiling/profiler.php +++ b/laravel/profiling/profiler.php @@ -54,6 +54,8 @@ class Profiler { { foreach ($bindings as $binding) { + $binding = "'{$binding}'"; + $sql = preg_replace('/\?/', $binding, $sql, 1); } From f2e915f13d930f765bc918208bbefdef7155f695 Mon Sep 17 00:00:00 2001 From: Loic Sharma Date: Tue, 5 Jun 2012 22:57:56 -0500 Subject: [PATCH 2/5] Improved the way the quotes were added to the bindings. --- laravel/profiling/profiler.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/laravel/profiling/profiler.php b/laravel/profiling/profiler.php index ec14004f..73f4d4fd 100644 --- a/laravel/profiling/profiler.php +++ b/laravel/profiling/profiler.php @@ -5,6 +5,7 @@ use Laravel\File; use Laravel\Event; use Laravel\Config; use Laravel\Request; +use Laravel\Database; class Profiler { @@ -54,7 +55,7 @@ class Profiler { { foreach ($bindings as $binding) { - $binding = "'{$binding}'"; + $binding = Database::connection()->pdo->quote($binding); $sql = preg_replace('/\?/', $binding, $sql, 1); } From 204a6a79803b17b14cf663a11471a625bb0e9eaa Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Tue, 10 Jul 2012 15:29:26 +0300 Subject: [PATCH 3/5] Add a Request::time() function. --- laravel/request.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/laravel/request.php b/laravel/request.php index 84763449..a37360a2 100644 --- a/laravel/request.php +++ b/laravel/request.php @@ -177,6 +177,25 @@ class Request { { return static::foundation()->headers->get('referer'); } + + /** + * Get the timestamp of the time when the request was started. + * + * The value is actually calculated when this function gets first called. + * + * @return int + */ + public static function time() + { + static $time; + + if (!isset($time)) + { + $time = time(); + } + + return $time; + } /** * Determine if the current request is via the command line. From 4d44df4885511e230847942b42794c2cdd6317eb Mon Sep 17 00:00:00 2001 From: Colin Viebrock Date: Thu, 12 Jul 2012 10:40:41 -0500 Subject: [PATCH 4/5] Allow second param of HTML::link* methods to be null, in which case the title of the link is the URL itself, similar to HTML::email() method. Signed-off-by: Colin Viebrock --- laravel/html.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/laravel/html.php b/laravel/html.php index 498ea28c..22025ee1 100644 --- a/laravel/html.php +++ b/laravel/html.php @@ -137,10 +137,12 @@ class HTML { * @param bool $https * @return string */ - public static function link($url, $title, $attributes = array(), $https = null) + public static function link($url, $title = null, $attributes = array(), $https = null) { $url = URL::to($url, $https); + if (is_null($title)) $title = $url; + return ''.static::entities($title).''; } @@ -152,7 +154,7 @@ class HTML { * @param array $attributes * @return string */ - public static function link_to_secure($url, $title, $attributes = array()) + public static function link_to_secure($url, $title = null, $attributes = array()) { return static::link($url, $title, $attributes, true); } @@ -168,7 +170,7 @@ class HTML { * @param bool $https * @return string */ - public static function link_to_asset($url, $title, $attributes = array(), $https = null) + public static function link_to_asset($url, $title = null, $attributes = array(), $https = null) { $url = URL::to_asset($url, $https); @@ -183,7 +185,7 @@ class HTML { * @param array $attributes * @return string */ - public static function link_to_secure_asset($url, $title, $attributes = array()) + public static function link_to_secure_asset($url, $title = null, $attributes = array()) { return static::link_to_asset($url, $title, $attributes, true); } @@ -207,7 +209,7 @@ class HTML { * @param array $attributes * @return string */ - public static function link_to_route($name, $title, $parameters = array(), $attributes = array()) + public static function link_to_route($name, $title = null, $parameters = array(), $attributes = array()) { return static::link(URL::to_route($name, $parameters), $title, $attributes); } @@ -231,7 +233,7 @@ class HTML { * @param array $attributes * @return string */ - public static function link_to_action($action, $title, $parameters = array(), $attributes = array()) + public static function link_to_action($action, $title = null, $parameters = array(), $attributes = array()) { return static::link(URL::to_action($action, $parameters), $title, $attributes); } @@ -418,7 +420,7 @@ class HTML { { return call_user_func_array(static::$macros[$method], $parameters); } - + throw new \Exception("Method [$method] does not exist."); } From 37dbeef2bb15b068ae6bb6bba463848883770a19 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Mon, 30 Jul 2012 13:48:55 +0300 Subject: [PATCH 5/5] Use LARAVEL_START constant to calculate request time. Suggested by @Kindari. --- laravel/request.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/laravel/request.php b/laravel/request.php index a37360a2..306a94c1 100644 --- a/laravel/request.php +++ b/laravel/request.php @@ -181,20 +181,11 @@ class Request { /** * Get the timestamp of the time when the request was started. * - * The value is actually calculated when this function gets first called. - * * @return int */ public static function time() { - static $time; - - if (!isset($time)) - { - $time = time(); - } - - return $time; + return (int) LARAVEL_START; } /**