From fbf7ee0bc8b2563cae3e8570dd4269adc887e525 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 28 Sep 2016 09:39:53 -0600 Subject: [PATCH 1/3] Use existing `Utils::startsWith()` method --- comments.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/comments.php b/comments.php index 1363a8b..c6ee298 100644 --- a/comments.php +++ b/comments.php @@ -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; } From 4e88431863bbe047abcbeebcce378fdb254843cc Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Mon, 9 Jan 2017 10:12:23 +0100 Subject: [PATCH 2/3] Fix #41 using Comments in a Gantry-powered theme did not escape the comment form token correctly --- CHANGELOG.md | 8 ++++++++ templates/partials/comments.html.twig | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58f5603..a917685 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# v1.2.x +## 01/xx/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 diff --git a/templates/partials/comments.html.twig b/templates/partials/comments.html.twig index 6872180..7528223 100644 --- a/templates/partials/comments.html.twig +++ b/templates/partials/comments.html.twig @@ -35,7 +35,7 @@ {% endfor %} - {{ nonce_field('form', 'form-nonce') }} + {{ nonce_field('form', 'form-nonce')|raw }}
{{ form.message }}
From cf3284e540187f8ae450f3cc7238c9d8302883c5 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Mon, 9 Jan 2017 10:13:13 +0100 Subject: [PATCH 3/3] Prepare release --- CHANGELOG.md | 4 ++-- blueprints.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a917685..f72cf4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ -# v1.2.x -## 01/xx/2017 +# v1.2.6 +## 01/09/2017 1. [](#improved) Use existing `Utils::startsWith()` method diff --git a/blueprints.yaml b/blueprints.yaml index 08a112b..4de7704 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -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: