diff --git a/comments.php b/comments.php index e5998a0..b51ebc3 100644 --- a/comments.php +++ b/comments.php @@ -13,7 +13,7 @@ use Symfony\Component\Yaml\Yaml; class CommentsPlugin extends Plugin { - protected $route = 'comments'; + protected $route = '/admin/comments'; /** * @return array @@ -46,6 +46,10 @@ class CommentsPlugin extends Plugin } } else { + + /** @var Uri $uri */ + $uri = $this->grav['uri']; + //Admin $this->enable([ 'onTwigTemplatePaths' => ['onTwigAdminTemplatePaths', 0], @@ -53,6 +57,10 @@ class CommentsPlugin extends Plugin 'onDataTypeExcludeFromDataManagerPluginHook' => ['onDataTypeExcludeFromDataManagerPluginHook', 0], ]); + if (strpos($uri->path(), $this->route) === false) { + return; + } + $page = $this->grav['uri']->param('page'); $comments = $this->getLastComments($page); @@ -76,7 +84,6 @@ class CommentsPlugin extends Plugin $email = filter_var(urldecode($post['email']), FILTER_SANITIZE_STRING); $title = filter_var(urldecode($post['title']), FILTER_SANITIZE_STRING); - if ($this->config->get('plugins.comments.use_captcha')) { //Validate the captcha $recaptchaResponse = filter_var(urldecode($post['recaptchaResponse']), FILTER_SANITIZE_STRING);