From 27158eaea05f35227a80b2d3e4d452fadea08ee7 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Thu, 29 Oct 2015 19:21:31 +0100 Subject: [PATCH 1/9] Use onAdminMenu instead of the deprecated onAdminTemplateNavPluginHook --- comments.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/comments.php b/comments.php index 7f3389f..60b53cc 100644 --- a/comments.php +++ b/comments.php @@ -114,7 +114,8 @@ class CommentsPlugin extends Plugin //Admin $this->enable([ 'onTwigTemplatePaths' => ['onTwigAdminTemplatePaths', 0], - 'onAdminTemplateNavPluginHook' => ['onAdminTemplateNavPluginHook', 0], + 'onAdminMenu' => ['onAdminMenu', 0], + 'onAdminTemplateNavPluginHook' => ['onAdminMenu', 0], //DEPRECATED 'onDataTypeExcludeFromDataManagerPluginHook' => ['onDataTypeExcludeFromDataManagerPluginHook', 0], ]); @@ -354,7 +355,7 @@ class CommentsPlugin extends Plugin /** * Add navigation item to the admin plugin */ - public function onAdminTemplateNavPluginHook() + public function onAdminMenu() { $this->grav['twig']->plugins_hooked_nav['PLUGIN_COMMENTS.COMMENTS'] = ['route' => $this->route, 'icon' => 'fa-file-text']; } From 74bf8473c570c955075cb6c2e0a98f8da3c9db4c Mon Sep 17 00:00:00 2001 From: joomline Date: Sat, 7 Nov 2015 11:49:36 +0200 Subject: [PATCH 2/9] Update languages.yaml RU --- languages.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/languages.yaml b/languages.yaml index e4a65da..e2c18ab 100644 --- a/languages.yaml +++ b/languages.yaml @@ -22,3 +22,15 @@ it: EMAIL: Email: WRITTEN_ON: Scritto il BY: da +ru: + PLUGIN_COMMENTS: + ADD_COMMENT: Добавить комментарий + COMMENTS: Комментарии + EMAIL_NOT_CONFIGURED: Email не настроен + NEW_COMMENT_EMAIL_SUBJECT: 'Новый комментарий к %1$s' + NEW_COMMENT_EMAIL_BODY: '

Новый комментарий был сделан на %1$s by %3$s (%4$s).

Страница: %2$s

Текст: %5$s

' + EMAIL_FOOTER: '' + NAME: Имя: + EMAIL: Email: + WRITTEN_ON: Написан в + BY: от From ab3d25cc22d353cacde094e5b0a2ca623c0753b5 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Tue, 10 Nov 2015 16:25:18 +0100 Subject: [PATCH 3/9] Add nonce validation --- CHANGELOG.md | 6 ++++++ templates/partials/comments.html.twig | 2 ++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e1acc0..f8b3612 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.0.1 +## 10/21/2015 + +1. [](#improved) + * Use onAdminMenu instead of the deprecated onAdminTemplateNavPluginHook + # v1.0.0 ## 10/21/2015 diff --git a/templates/partials/comments.html.twig b/templates/partials/comments.html.twig index 3462a23..e87a146 100644 --- a/templates/partials/comments.html.twig +++ b/templates/partials/comments.html.twig @@ -21,6 +21,8 @@ {% endfor %} + + {{ nonce_field('form', 'form-nonce') }}
{{ form.message }}
From 50d3b3c3c5cf719a477b96185d4d00678c66d2d0 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Wed, 11 Nov 2015 11:00:50 +0100 Subject: [PATCH 4/9] Fix error when user/data/comments does not exist, fix #2 --- comments.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/comments.php b/comments.php index 60b53cc..88709f8 100644 --- a/comments.php +++ b/comments.php @@ -1,6 +1,7 @@ Date: Wed, 11 Nov 2015 11:01:55 +0100 Subject: [PATCH 5/9] 1.0.1 release --- CHANGELOG.md | 6 ++++++ blueprints.yaml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e1acc0..b954e48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.0.1 +## 11/11/2015 + +1. [](#bugfix) + * Fix error when user/data/comments does not exist + # v1.0.0 ## 10/21/2015 diff --git a/blueprints.yaml b/blueprints.yaml index 4c49570..ffd765e 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Comments -version: 1.0.0 +version: 1.0.1 description: Adds a commenting functionality to your site icon: comment author: From 87aff18ae99f19801e2b125618a2840a734099ac Mon Sep 17 00:00:00 2001 From: Paul Bovis Date: Fri, 13 Nov 2015 10:46:28 -0700 Subject: [PATCH 6/9] change form action to work with multilang --- templates/partials/comments.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/partials/comments.html.twig b/templates/partials/comments.html.twig index 3462a23..8cf30e2 100644 --- a/templates/partials/comments.html.twig +++ b/templates/partials/comments.html.twig @@ -3,7 +3,7 @@

{{'PLUGIN_COMMENTS.ADD_COMMENT'|t}}

{% for field in grav.config.plugins.comments.form.fields %} @@ -41,4 +41,4 @@ {% endfor %} {% endif %} -{% endif %} \ No newline at end of file +{% endif %} From 30545e79c0b8025f9738ef62f7450795288b0f44 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Fri, 13 Nov 2015 18:59:27 +0100 Subject: [PATCH 7/9] Add fr lang (https://github.com/codebee-fr/grav-plugin-comments/commit/e1d1b70e1e08c627a71fa31cc1c25975e0b5a2cb) --- languages.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/languages.yaml b/languages.yaml index e2c18ab..ae3212c 100644 --- a/languages.yaml +++ b/languages.yaml @@ -10,6 +10,18 @@ en: EMAIL: Email: WRITTEN_ON: Written on BY: by +fr: + PLUGIN_COMMENTS: + ADD_COMMENT: Ajouter un commentaire + COMMENTS: Commentaires + EMAIL_NOT_CONFIGURED: Email non configurée + NEW_COMMENT_EMAIL_SUBJECT: 'Nouveau commentaire sur %1$s' + NEW_COMMENT_EMAIL_BODY: '

Un nouveau commentaire a été posté sur %1$s par %3$s (%4$s).

Page: %2$s

Texte: %5$s

' + EMAIL_FOOTER: '' + NAME: Nom: + EMAIL: Email: + WRITTEN_ON: Ecrit le + BY: par it: PLUGIN_COMMENTS: ADD_COMMENT: Aggiungi un commento From 5800cb87bc6bb74879c914102bd81e11eb4e7dd4 Mon Sep 17 00:00:00 2001 From: Paul Bovis Date: Mon, 16 Nov 2015 08:42:17 -0700 Subject: [PATCH 8/9] change instances of gmdate to date I changed all instances of gmdate (lines 180, 190 and 320) to date. This way, the date reported in the comments will respect the server's local time as set by date.timezone in php.ini (for apache2, at least). --- comments.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/comments.php b/comments.php index 88709f8..1dda2ac 100644 --- a/comments.php +++ b/comments.php @@ -177,7 +177,7 @@ class CommentsPlugin extends Plugin $data['comments'][] = [ 'text' => $text, - 'date' => gmdate('D, d M Y H:i:s', time()), + 'date' => date('D, d M Y H:i:s', time()), 'author' => $name, 'email' => $email ]; @@ -187,7 +187,7 @@ class CommentsPlugin extends Plugin 'lang' => $lang, 'comments' => array([ 'text' => $text, - 'date' => gmdate('D, d M Y H:i:s', time()), + 'date' => date('D, d M Y H:i:s', time()), 'author' => $name, 'email' => $email ]) @@ -317,7 +317,7 @@ class CommentsPlugin extends Plugin $pages[] = [ 'title' => $file->data['title'], 'commentsCount' => count($file->data['comments']), - 'lastCommentDate' => gmdate('D, d M Y H:i:s', $file->modifiedDate) + 'lastCommentDate' => date('D, d M Y H:i:s', $file->modifiedDate) ]; } From 70aed083fed6a7f641425f56dcbce1535c81d166 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Tue, 24 Nov 2015 15:30:10 +0100 Subject: [PATCH 9/9] Prepare release 1.1.0 --- CHANGELOG.md | 12 ++++++++++++ blueprints.yaml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77faa7c..30028a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# v1.1.0 +## 11/24/2015 + +1. [](#improved) + Use date instead of gmdate to respect the server local time (thanks @bovisp) +1. [](#improved) + Now works with multilang (thanks @bovisp) +1. [](#new) + Added french (@codebee-fr) and russian (@joomline) languages +1. [](#new) + Takes advantage of the new nonce support provided by the Form plugin + # v1.0.2 ## 11/13/2015 diff --git a/blueprints.yaml b/blueprints.yaml index ffd765e..23c8197 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Comments -version: 1.0.1 +version: 1.1.0 description: Adds a commenting functionality to your site icon: comment author: