Merge branch 'release/1.2.2'
This commit is contained in:
commit
1ccc720d4c
|
@ -1,3 +1,11 @@
|
|||
# v1.2.2
|
||||
## 08/12/2016
|
||||
|
||||
1. [](#improved)
|
||||
* Added Romanian translation
|
||||
1. [](#bugfix)
|
||||
* Fix issue in storing comments cache when cache is enabled [#33](https://github.com/getgrav/grav-plugin-comments/issues/33)
|
||||
|
||||
# v1.2.1
|
||||
## 07/19/2016
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: Comments
|
||||
version: 1.2.1
|
||||
version: 1.2.2
|
||||
description: Adds a commenting functionality to your site
|
||||
icon: comment
|
||||
author:
|
||||
|
|
26
comments.php
26
comments.php
|
@ -18,7 +18,7 @@ class CommentsPlugin extends Plugin
|
|||
protected $route = 'comments';
|
||||
protected $enable = false;
|
||||
protected $comments_cache_id;
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
@ -92,7 +92,7 @@ class CommentsPlugin extends Plugin
|
|||
public function initializeFrontend()
|
||||
{
|
||||
$this->calculateEnable();
|
||||
|
||||
|
||||
if ($this->enable) {
|
||||
$this->enable([
|
||||
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
|
||||
|
@ -101,12 +101,14 @@ class CommentsPlugin extends Plugin
|
|||
'onTwigSiteVariables' => ['onTwigSiteVariables', 0]
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$cache = $this->grav['cache'];
|
||||
$uri = $this->grav['uri'];
|
||||
|
||||
//init cache id
|
||||
$this->comments_cache_id = md5('comments-data' . $cache->getKey());
|
||||
$this->comments_cache_id = md5('comments-data' . $cache->getKey() . '-' . $uri->url());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Admin side initialization
|
||||
*/
|
||||
|
@ -136,7 +138,7 @@ class CommentsPlugin extends Plugin
|
|||
$this->grav['twig']->comments = $comments;
|
||||
$this->grav['twig']->pages = $this->fetchPages();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public function onPluginsInitialized()
|
||||
|
@ -174,10 +176,12 @@ class CommentsPlugin extends Plugin
|
|||
$email = filter_var(urldecode($post['email']), FILTER_SANITIZE_STRING);
|
||||
$title = filter_var(urldecode($post['title']), FILTER_SANITIZE_STRING);
|
||||
|
||||
$user = $this->grav['user'];
|
||||
if ($user->authenticated) {
|
||||
$name = $user->fullname;
|
||||
$email = $user->email;
|
||||
if (isset($this->grav['user'])) {
|
||||
$user = $this->grav['user'];
|
||||
if ($user->authenticated) {
|
||||
$name = $user->fullname;
|
||||
$email = $user->email;
|
||||
}
|
||||
}
|
||||
|
||||
/** @var Language $language */
|
||||
|
@ -323,7 +327,7 @@ class CommentsPlugin extends Plugin
|
|||
if ($comments = $cache->fetch($this->comments_cache_id)) {
|
||||
return $comments;
|
||||
}
|
||||
|
||||
|
||||
$lang = $this->grav['language']->getLanguage();
|
||||
$filename = $lang ? '/' . $lang : '';
|
||||
$filename .= $this->grav['uri']->path() . '.yaml';
|
||||
|
|
|
@ -154,3 +154,24 @@ pt-br:
|
|||
SUBMIT_COMMENT_BUTTON_TEXT: "Enviar"
|
||||
EMAIL_NEW_COMMENT_SUBJECT: "[Novo comentário] de {{ form.value.name|e }}"
|
||||
THANK_YOU_MESSAGE: "Obrigada por enviar seu comentário!"
|
||||
ro:
|
||||
PLUGIN_COMMENTS:
|
||||
ADD_COMMENT: 'Adăugați un comentariu'
|
||||
COMMENTS: 'Comentarii'
|
||||
EMAIL_NOT_CONFIGURED: 'Adresa de email nu este configurată'
|
||||
NEW_COMMENT_EMAIL_SUBJECT: 'Comentariu nou pentru %1$s'
|
||||
NEW_COMMENT_EMAIL_BODY: '<p>Un nou comentariu a fost adăugat la %1$s de către %3$s (%4$s).</p><p>Pagină: %2$s</p><p>Text: %5$s</p>'
|
||||
EMAIL_FOOTER: ''
|
||||
NAME: 'Nume:'
|
||||
EMAIL: 'Adresă de email:'
|
||||
WRITTEN_ON: 'Scris în data de'
|
||||
BY: 'de către'
|
||||
NAME_LABEL: "Numele"
|
||||
NAME_PLACEHOLDER: "Introduceți numele Dvs."
|
||||
EMAIL_LABEL: "Email"
|
||||
EMAIL_PLACEHOLDER: "Introduceți adresa Dvs. de email"
|
||||
MESSAGE_LABEL: "Comentariu"
|
||||
MESSAGE_PLACEHOLDER: "Scrieți comentariul Dvs."
|
||||
SUBMIT_COMMENT_BUTTON_TEXT: "Trimiteți"
|
||||
EMAIL_NEW_COMMENT_SUBJECT: "[Comentariu nou] from {{ form.value.name|e }}"
|
||||
THANK_YOU_MESSAGE: "Vă mulțumim pentru comentariu!"
|
||||
|
|
Loading…
Reference in New Issue