diff --git a/CHANGELOG.md b/CHANGELOG.md index 4feb2da40..6745ca6e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,14 @@ * Added default setting to only allow `direct-installs` from official GPM. Can be configured in `system.yaml` * Added a new `Utils::isValidUrl()` method * Added optional parameter to `|markdown(false)` filter to toggle block/line processing (default|true = `block`) + * Added new `Page::folderExists()` method 1. [](#improved) * Genericized `direct-install` so it can be called via Admin plugin 1. [](#bugfix) * Fixed a minor bug in Number validation [#1329](https://github.com/getgrav/grav/issues/1329) * Fixed exception when trying to find user account and there is no `user://accounts` folder + * Fixed issue when setting `Page::expires(0)` [Admin #1009](https://github.com/getgrav/grav-plugin-admin/issues/1009) + * Removed ID from `nonce_field()` Twig function causing validation errors [Form #115](https://github.com/getgrav/grav-plugin-form/issues/115) # v1.1.17 ## 02/17/2017 diff --git a/system/src/Grav/Common/Data/Validation.php b/system/src/Grav/Common/Data/Validation.php index fd886b017..a508312d0 100644 --- a/system/src/Grav/Common/Data/Validation.php +++ b/system/src/Grav/Common/Data/Validation.php @@ -339,7 +339,7 @@ class Validation protected static function filterNumber($value, array $params, array $field) { - return self::validateFloat($value, $params) ? (float) $value : (int) $value; + return (string)(int)$value !== (string)(float)$value ? (float) $value : (int) $value; } protected static function filterDateTime($value, array $params, array $field) diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 010c906e1..d35aff821 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -1208,7 +1208,7 @@ class Page $this->expires = $var; } - return empty($this->expires) ? Grav::instance()['config']->get('system.pages.expires') : $this->expires; + return !isset($this->expires) ? Grav::instance()['config']->get('system.pages.expires') : $this->expires; } /** @@ -2560,6 +2560,16 @@ class Page return $file && $file->exists(); } + /** + * Returns whether or not the current folder exists + * + * @return bool + */ + public function folderExists() + { + return file_exists($this->path()); + } + /** * Cleans the path. * diff --git a/system/src/Grav/Common/Twig/TwigExtension.php b/system/src/Grav/Common/Twig/TwigExtension.php index eb6b960ad..6b3f0b1dc 100644 --- a/system/src/Grav/Common/Twig/TwigExtension.php +++ b/system/src/Grav/Common/Twig/TwigExtension.php @@ -784,7 +784,7 @@ class TwigExtension extends \Twig_Extension */ public function nonceFieldFunc($action, $nonceParamName = 'nonce') { - $string = ''; + $string = ''; return $string; }