diff --git a/CHANGELOG.md b/CHANGELOG.md index bdea66039d..59659ec6ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +# v1.1.10 +## 12/21/2016 + +1. [](#improved) + * Improve detection of home path. Also allow `~/.grav` on Windows, drop `ConsoleTrait::isWindows()` method, used only for that [#1204](https://github.com/getgrav/grav/pull/1204) + * Reworked PHP CLI router [#1219](https://github.com/getgrav/grav/pull/1219) + * More robust theme/plugin logic in `bin/gpm direct-install` +1. [](#bugfix) + * Fixed case where extracting a package would cause an error during rename + * Fix issue with using `Yaml::parse` direcly on a filename, now deprecated + * Add pattern for frontend validation of folder slugs [#891](https://github.com/getgrav/grav-plugin-admin/issues/891) + * Fix issue with Inflector when translation is disabled [https://github.com/getgrav/grav-plugin-simplesearch/issues/87](https://github.com/getgrav/grav-plugin-simplesearch/issues/87) + * Explicitly expose `array_unique` Twig filter [https://github.com/getgrav/grav-plugin-admin/issues/897](https://github.com/getgrav/grav-plugin-admin/issues/897) + # v1.1.9 ## 12/13/2016 diff --git a/index.php b/index.php index 77725b92a2..8d8d2b62f7 100644 --- a/index.php +++ b/index.php @@ -14,6 +14,12 @@ die("Please run: bin/grav install"); } +if (PHP_SAPI == 'cli-server') { + if (!isset($_SERVER['PHP_CLI_ROUTER'])) { + die("PHP webserver requires a router to run Grav, please use:
php -S {$_SERVER["SERVER_NAME"]}:{$_SERVER["SERVER_PORT"]} system/router.php"); + } +} + use Grav\Common\Grav; use RocketTheme\Toolbox\Event\Event; diff --git a/system/blueprints/pages/default.yaml b/system/blueprints/pages/default.yaml index f38957ccff..f42971c3b2 100644 --- a/system/blueprints/pages/default.yaml +++ b/system/blueprints/pages/default.yaml @@ -133,6 +133,7 @@ form: label: PLUGIN_ADMIN.FOLDER_NAME validate: type: slug + pattern: '[a-zа-я][a-zа-я0-9_\-]+' route: type: select diff --git a/system/blueprints/pages/modular_new.yaml b/system/blueprints/pages/modular_new.yaml index 2732923637..44cf231316 100644 --- a/system/blueprints/pages/modular_new.yaml +++ b/system/blueprints/pages/modular_new.yaml @@ -24,6 +24,7 @@ form: validate: type: slug required: true + pattern: '[a-zа-я][a-zа-я0-9_\-]+' route: type: select diff --git a/system/blueprints/pages/modular_raw.yaml b/system/blueprints/pages/modular_raw.yaml index ed25992a39..730809d5cd 100644 --- a/system/blueprints/pages/modular_raw.yaml +++ b/system/blueprints/pages/modular_raw.yaml @@ -73,6 +73,7 @@ form: validate: type: slug required: true + pattern: '[a-zа-я][a-zа-я0-9_\-]+' route: type: select diff --git a/system/blueprints/pages/new.yaml b/system/blueprints/pages/new.yaml index 49b85b7290..df7b0f6932 100644 --- a/system/blueprints/pages/new.yaml +++ b/system/blueprints/pages/new.yaml @@ -26,6 +26,7 @@ form: validate: type: slug required: true + pattern: '[a-zа-я][a-zа-я0-9_\-]+' route: type: select diff --git a/system/blueprints/pages/new_folder.yaml b/system/blueprints/pages/new_folder.yaml index 16024b7493..458fa7498b 100644 --- a/system/blueprints/pages/new_folder.yaml +++ b/system/blueprints/pages/new_folder.yaml @@ -19,6 +19,7 @@ form: validate: type: slug required: true + pattern: '[a-zа-я][a-zа-я0-9_\-]+' route: type: select diff --git a/system/blueprints/pages/raw.yaml b/system/blueprints/pages/raw.yaml index 60870eaf7a..8781c2c319 100644 --- a/system/blueprints/pages/raw.yaml +++ b/system/blueprints/pages/raw.yaml @@ -73,6 +73,7 @@ form: validate: type: slug required: true + pattern: '[a-zа-я][a-zа-я0-9_\-]+' route: type: select diff --git a/system/defines.php b/system/defines.php index 956dd1b1d0..a704963de6 100644 --- a/system/defines.php +++ b/system/defines.php @@ -8,7 +8,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '1.1.9'); +define('GRAV_VERSION', '1.1.10'); define('GRAV_TESTING', false); define('DS', '/'); define('GRAV_PHP_MIN', '5.5.9'); diff --git a/system/router.php b/system/router.php new file mode 100644 index 0000000000..53e0126cf6 --- /dev/null +++ b/system/router.php @@ -0,0 +1,26 @@ + $value) { if (is_array($value)) { $value = implode(',', $value); - } - - $values[$key] = array_map('trim', explode(',', $value)); + $values[$key] = array_map('trim', explode(',', $value)); + } else { + $values[$key] = trim($value); + } } } diff --git a/system/src/Grav/Common/GPM/Installer.php b/system/src/Grav/Common/GPM/Installer.php index add625167b..0e6352147b 100644 --- a/system/src/Grav/Common/GPM/Installer.php +++ b/system/src/Grav/Common/GPM/Installer.php @@ -181,7 +181,7 @@ public static function unZip($zip_file, $destination) return false; } - $package_folder_name = $zip->getNameIndex(0); + $package_folder_name = preg_replace('#\./$#', '', $zip->getNameIndex(0)); $zip->close(); $extracted_folder = $destination . '/' . $package_folder_name; diff --git a/system/src/Grav/Common/Inflector.php b/system/src/Grav/Common/Inflector.php index 17a11e0c48..8fe5512149 100644 --- a/system/src/Grav/Common/Inflector.php +++ b/system/src/Grav/Common/Inflector.php @@ -26,11 +26,11 @@ public function init() { if (empty($this->plural)) { $language = Grav::instance()['language']; - $this->plural = $language->translate('INFLECTOR_PLURALS', null, true); - $this->singular = $language->translate('INFLECTOR_SINGULAR', null, true); - $this->uncountable = $language->translate('INFLECTOR_UNCOUNTABLE', null, true); - $this->irregular = $language->translate('INFLECTOR_IRREGULAR', null, true); - $this->ordinals = $language->translate('INFLECTOR_ORDINALS', null, true); + $this->plural = $language->translate('INFLECTOR_PLURALS', null, true) ?: []; + $this->singular = $language->translate('INFLECTOR_SINGULAR', null, true) ?: []; + $this->uncountable = $language->translate('INFLECTOR_UNCOUNTABLE', null, true) ?: []; + $this->irregular = $language->translate('INFLECTOR_IRREGULAR', null, true) ?: []; + $this->ordinals = $language->translate('INFLECTOR_ORDINALS', null, true) ?: []; } } diff --git a/system/src/Grav/Common/Twig/TwigExtension.php b/system/src/Grav/Common/Twig/TwigExtension.php index aa9f1de04a..fff032e9cf 100644 --- a/system/src/Grav/Common/Twig/TwigExtension.php +++ b/system/src/Grav/Common/Twig/TwigExtension.php @@ -87,6 +87,7 @@ public function getFilters() new \Twig_SimpleFilter('truncate', ['\Grav\Common\Utils', 'truncate']), new \Twig_SimpleFilter('truncate_html', ['\Grav\Common\Utils', 'truncateHTML']), new \Twig_SimpleFilter('json_decode', [$this, 'jsonDecodeFilter']), + new \Twig_SimpleFilter('array_unique', 'array_unique'), ]; } diff --git a/system/src/Grav/Console/Cli/InstallCommand.php b/system/src/Grav/Console/Cli/InstallCommand.php index a3768ba4ed..49b66a097b 100644 --- a/system/src/Grav/Console/Cli/InstallCommand.php +++ b/system/src/Grav/Console/Cli/InstallCommand.php @@ -65,20 +65,15 @@ protected function serve() // fix trailing slash $this->destination = rtrim($this->destination, DS) . DS; $this->user_path = $this->destination . USER_PATH; - - if (false === $this->isWindows()) { - $local_config_file = exec('eval echo ~/.grav/config'); - if (file_exists($local_config_file)) { - $this->local_config = Yaml::parse($local_config_file); - $this->output->writeln('Read local config from