From 7f0eefbde55f0fa7e6021a7b8b1c7864fff1a802 Mon Sep 17 00:00:00 2001 From: yaman-jain Date: Wed, 18 Nov 2015 02:32:44 +0530 Subject: [PATCH 1/4] updated/added PhpDoc for methods --- system/src/Grav/Common/Filesystem/Folder.php | 4 ++-- system/src/Grav/Common/GPM/Remote/Plugins.php | 2 ++ system/src/Grav/Common/GPM/Remote/Themes.php | 2 ++ system/src/Grav/Common/GPM/Response.php | 6 ++++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/system/src/Grav/Common/Filesystem/Folder.php b/system/src/Grav/Common/Filesystem/Folder.php index 6026d8f04..af1b93352 100644 --- a/system/src/Grav/Common/Filesystem/Folder.php +++ b/system/src/Grav/Common/Filesystem/Folder.php @@ -64,8 +64,8 @@ abstract class Folder /** * Get relative path between target and base path. If path isn't relative, return full path. * - * @param string $path - * @param string $base + * @param string $path + * @param mixed|string $base * @return string */ public static function getRelativePath($path, $base = GRAV_ROOT) diff --git a/system/src/Grav/Common/GPM/Remote/Plugins.php b/system/src/Grav/Common/GPM/Remote/Plugins.php index ec6d64521..e40135096 100644 --- a/system/src/Grav/Common/GPM/Remote/Plugins.php +++ b/system/src/Grav/Common/GPM/Remote/Plugins.php @@ -16,6 +16,8 @@ class Plugins extends AbstractPackageCollection /** * Local Plugins Constructor + * @param bool $refresh + * @param null $callback */ public function __construct($refresh = false, $callback = null) { diff --git a/system/src/Grav/Common/GPM/Remote/Themes.php b/system/src/Grav/Common/GPM/Remote/Themes.php index 759b7e10a..e9ffacbdc 100644 --- a/system/src/Grav/Common/GPM/Remote/Themes.php +++ b/system/src/Grav/Common/GPM/Remote/Themes.php @@ -16,6 +16,8 @@ class Themes extends AbstractPackageCollection /** * Local Themes Constructor + * @param bool $refresh + * @param null $callback */ public function __construct($refresh = false, $callback = null) { diff --git a/system/src/Grav/Common/GPM/Response.php b/system/src/Grav/Common/GPM/Response.php index 4f61e2b42..0df7e3876 100644 --- a/system/src/Grav/Common/GPM/Response.php +++ b/system/src/Grav/Common/GPM/Response.php @@ -50,6 +50,7 @@ class Response /** * Sets the preferred method to use for making HTTP calls. * @param string $method Default is `auto` + * @return Response */ public static function setMethod($method = 'auto') { @@ -64,8 +65,9 @@ class Response /** * Makes a request to the URL by using the preferred method - * @param string $uri URL to call - * @param array $options An array of parameters for both `curl` and `fopen` + * @param string $uri URL to call + * @param array $options An array of parameters for both `curl` and `fopen` + * @param null $callback * @return string The response of the request */ public static function get($uri = '', $options = [], $callback = null) From 49a5b38589968e655d9b0762585a428f23132130 Mon Sep 17 00:00:00 2001 From: yaman-jain Date: Wed, 18 Nov 2015 16:01:19 +0530 Subject: [PATCH 2/4] PhpDoc: callback definition as per #451 --- system/src/Grav/Common/GPM/Remote/Plugins.php | 2 +- system/src/Grav/Common/GPM/Remote/Themes.php | 2 +- system/src/Grav/Common/GPM/Response.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/system/src/Grav/Common/GPM/Remote/Plugins.php b/system/src/Grav/Common/GPM/Remote/Plugins.php index e40135096..df8668491 100644 --- a/system/src/Grav/Common/GPM/Remote/Plugins.php +++ b/system/src/Grav/Common/GPM/Remote/Plugins.php @@ -17,7 +17,7 @@ class Plugins extends AbstractPackageCollection /** * Local Plugins Constructor * @param bool $refresh - * @param null $callback + * @param callable $callback Either a function or callback in array notation */ public function __construct($refresh = false, $callback = null) { diff --git a/system/src/Grav/Common/GPM/Remote/Themes.php b/system/src/Grav/Common/GPM/Remote/Themes.php index e9ffacbdc..0af055b03 100644 --- a/system/src/Grav/Common/GPM/Remote/Themes.php +++ b/system/src/Grav/Common/GPM/Remote/Themes.php @@ -17,7 +17,7 @@ class Themes extends AbstractPackageCollection /** * Local Themes Constructor * @param bool $refresh - * @param null $callback + * @param callable $callback Either a function or callback in array notation */ public function __construct($refresh = false, $callback = null) { diff --git a/system/src/Grav/Common/GPM/Response.php b/system/src/Grav/Common/GPM/Response.php index 0df7e3876..d2b446b3b 100644 --- a/system/src/Grav/Common/GPM/Response.php +++ b/system/src/Grav/Common/GPM/Response.php @@ -67,7 +67,7 @@ class Response * Makes a request to the URL by using the preferred method * @param string $uri URL to call * @param array $options An array of parameters for both `curl` and `fopen` - * @param null $callback + * @param callable $callback Either a function or callback in array notation * @return string The response of the request */ public static function get($uri = '', $options = [], $callback = null) From d2660e0755209523d772065ad0a2d9a2c6e4c987 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 18 Nov 2015 18:14:35 +0200 Subject: [PATCH 3/4] Fixed gzip compression making it to work correctly with all servers and browsers --- CHANGELOG.md | 1 + system/src/Grav/Common/Grav.php | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4300bc74b..60b8c6b03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ 1. [](#bugfix) * Fixed a fatal error if you have a collection with missing or invalid `@page: /route` + * Fixed gzip compression making it to work correctly with all servers and browsers # v1.0.0-rc.3 ## 10/29/2015 diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index da1ea4217..1335c4480 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -201,7 +201,10 @@ class Grav extends Container // Use output buffering to prevent headers from being sent too early. ob_start(); if ($this['config']->get('system.cache.gzip')) { - ob_start('ob_gzhandler'); + // Enable zip/deflate with a fallback in case of if browser does not support compressing. + if(!ob_start("ob_gzhandler")) { + ob_start(); + } } // Initialize the timezone @@ -416,22 +419,25 @@ class Grav extends Container public function shutdown() { if ($this['config']->get('system.debugger.shutdown.close_connection')) { - //stop user abort + // Prevent user abort. if (function_exists('ignore_user_abort')) { @ignore_user_abort(true); } - // close the session + // Close the session. if (isset($this['session'])) { $this['session']->close(); } - // flush buffer if gzip buffer was started if ($this['config']->get('system.cache.gzip')) { - ob_end_flush(); // gzhandler buffer + // Flush gzhandler buffer if gzip was enabled. + ob_end_flush(); + } else { + // Otherwise prevent server from compressing the output. + header('Content-Encoding: none'); } - // get lengh and close the connection + // Get length and close the connection. header('Content-Length: ' . ob_get_length()); header("Connection: close"); @@ -440,7 +446,7 @@ class Grav extends Container @ob_flush(); flush(); - // fix for fastcgi close connection issue + // Fix for fastcgi close connection issue. if (function_exists('fastcgi_finish_request')) { @fastcgi_finish_request(); } From 5193551d04e7add4cfdcf3bc6c9596a1ffd84d22 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Wed, 18 Nov 2015 17:15:15 +0100 Subject: [PATCH 4/4] Fix date representation in system config Fixes https://github.com/getgrav/grav-plugin-admin/issues/278 --- system/blueprints/config/system.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/blueprints/config/system.yaml b/system/blueprints/config/system.yaml index e79da93e3..ce1169ea4 100644 --- a/system/blueprints/config/system.yaml +++ b/system/blueprints/config/system.yaml @@ -73,7 +73,7 @@ form: options: "F jS \\a\\t g:ia": Date1 "l jS \\of F g:i A": Date2 - "D, m M Y G:i:s": Date3 + "D, d M Y G:i:s": Date3 "d-m-y G:i": Date4 "jS M Y": Date5 @@ -86,7 +86,7 @@ form: options: "F jS \\a\\t g:ia": Date1 "l jS \\of F g:i A": Date2 - "D, m M Y G:i:s": Date3 + "D, d M Y G:i:s": Date3 "d-m-y G:i": Date4 "jS M Y": Date5