Merge branch 'release/1.2.6'

This commit is contained in:
Flavio Copes 2017-01-09 10:13:20 +01:00
commit c71e356be8
4 changed files with 12 additions and 10 deletions

View File

@ -1,3 +1,11 @@
# v1.2.6
## 01/09/2017
1. [](#improved)
Use existing `Utils::startsWith()` method
1. [](#bugfix)
* Fix [#41](https://github.com/getgrav/grav-plugin-comments/issues/41) using Comments in a Gantry-powered theme did not escape the comment form token correctly
# v1.2.5
## 09/16/2016

View File

@ -1,5 +1,5 @@
name: Comments
version: 1.2.5
version: 1.2.6
description: Adds a commenting functionality to your site
icon: comment
author:

View File

@ -9,6 +9,7 @@ use Grav\Common\Page\Pages;
use Grav\Common\Plugin;
use Grav\Common\Filesystem\RecursiveFolderFilterIterator;
use Grav\Common\User\User;
use Grav\Common\Utils;
use RocketTheme\Toolbox\File\File;
use RocketTheme\Toolbox\Event\Event;
use Symfony\Component\Yaml\Yaml;
@ -76,13 +77,6 @@ class CommentsPlugin extends Plugin
$this->grav['twig']->comments = $this->fetchComments();
}
/**
* Determine if $haystack starts with $needle. Credit: http://stackoverflow.com/a/10473026/205039
*/
private function startsWith($haystack, $needle) {
return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE;
}
/**
* Determine if the plugin should be enabled based on the enable_on_routes and disable_on_routes config options
*/
@ -99,7 +93,7 @@ class CommentsPlugin extends Plugin
$this->enable = true;
} else {
foreach($enable_on_routes as $route) {
if ($this->startsWith($path, $route)) {
if (Utils::startsWith($path, $route)) {
$this->enable = true;
break;
}

View File

@ -35,7 +35,7 @@
{% endfor %}
</div>
{{ nonce_field('form', 'form-nonce') }}
{{ nonce_field('form', 'form-nonce')|raw }}
</form>
<div class="alert">{{ form.message }}</div>