diff --git a/CHANGELOG.md b/CHANGELOG.md index bdea66039..59659ec6c 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 77725b92a..8d8d2b62f 100644 --- a/index.php +++ b/index.php @@ -14,6 +14,12 @@ if (!is_file($autoload)) { 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 f38957ccf..f42971c3b 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 273292363..44cf23131 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 ed25992a3..730809d5c 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 49b85b729..df7b0f693 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 16024b749..458fa7498 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 60870eaf7..8781c2c31 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 956dd1b1d..a704963de 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 000000000..53e0126cf
--- /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 add625167..0e6352147 100644
--- a/system/src/Grav/Common/GPM/Installer.php
+++ b/system/src/Grav/Common/GPM/Installer.php
@@ -181,7 +181,7 @@ class Installer
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 17a11e0c4..8fe551214 100644
--- a/system/src/Grav/Common/Inflector.php
+++ b/system/src/Grav/Common/Inflector.php
@@ -26,11 +26,11 @@ class Inflector
{
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 aa9f1de04..fff032e9c 100644
--- a/system/src/Grav/Common/Twig/TwigExtension.php
+++ b/system/src/Grav/Common/Twig/TwigExtension.php
@@ -87,6 +87,7 @@ class TwigExtension extends \Twig_Extension
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 a3768ba4e..49b66a097 100644
--- a/system/src/Grav/Console/Cli/InstallCommand.php
+++ b/system/src/Grav/Console/Cli/InstallCommand.php
@@ -65,20 +65,15 @@ class InstallCommand extends ConsoleCommand
// 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