This repository has been archived by the owner on Nov 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
162 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,39 @@ | ||
<?php if(!defined('KIRBY')) exit ?> | ||
|
||
title: Comment | ||
|
||
pages: false | ||
|
||
files: false | ||
|
||
icon: comment | ||
|
||
fields: | ||
name: | ||
label: Name | ||
type: text | ||
required: true | ||
width: 1/2 | ||
icon: user | ||
|
||
date: | ||
label: Date | ||
type: datetime | ||
width: 1/2 | ||
validate: | ||
date | ||
|
||
email: | ||
label: Email Address | ||
type: email | ||
width: 1/2 | ||
validate: | ||
|
||
url: | ||
label: Website Address | ||
type: url | ||
width: 1/2 | ||
|
||
text: | ||
label: Text | ||
required: true | ||
type: textarea | ||
type: textarea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
<?php if(!defined('KIRBY')) exit ?> | ||
|
||
title: Comments | ||
|
||
pages: true | ||
|
||
files: false | ||
|
||
icon: comments | ||
|
||
fields: | ||
title: | ||
label: Title | ||
type: text | ||
required: true | ||
|
||
text: | ||
label: Text | ||
required: true | ||
type: textarea | ||
type: textarea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,13 @@ | |
"description": "File based comments stored as subpages for the Kirby CMS.", | ||
"author": "Florian Pircher <[email protected]>", | ||
"license": "MIT", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"type": "kirby-plugin", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Addpixel/KirbyComments" | ||
}, | ||
"bugs": { | ||
"bugs": { | ||
"url": "https://github.com/Addpixel/KirbyComments/issues" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
/* | ||
* This is the example comments form snippet. Feel free to use this code as a | ||
* reference for creating your own, custom comments snippet. | ||
* | ||
* Custom snippet markup guide: | ||
* <https://github.com/Addpixel/KirbyComments#custom-markup> | ||
* | ||
* API documentation: | ||
* <https://github.com/Addpixel/KirbyComments#api-documentation> | ||
*/ | ||
|
||
if (kirby()->get('option', 'comments.runtime.comments') == null) { | ||
// Create `Comments` object for the current page | ||
$comments = new Comments($page); | ||
$status = $comments->process(); | ||
|
||
// Store `Comments` object and status for `comments-list` snippet | ||
kirby()->set('option', 'comments.runtime.comments', $comments); | ||
kirby()->set('option', 'comments.runtime.status', $status); | ||
} else { | ||
// Load `Comments` object and status from | ||
$comments = kirby()->get('option', 'comments.runtime.comments'); | ||
$status = kirby()->get('option', 'comments.runtime.status'); | ||
} | ||
|
||
?> | ||
<?php if ($comments->userHasSubmitted()): ?> | ||
<p class="thank-you">Thank you for your comment!</p> | ||
<?php else: ?> | ||
<h2 id="comments-form-headline">Write your comment</h2> | ||
|
||
<?php if ($status->isUserError()): ?> | ||
<p id="comment-<?= $comments->nextCommentId() ?>" class="error"> | ||
<?= $status->getMessage() ?> | ||
</p> | ||
<?php endif ?> | ||
|
||
<form action="#comment-<?= $comments->nextCommentId() ?>" method="post" accept-charset="utf-8" role="form" aria-labelledby="comments-form-headline"> | ||
<label for="name">Name<abbr title="required">*</abbr></label> | ||
<input type="text" name="<?= $comments->nameName() ?>" value="<?= $comments->value($comments->nameName()) ?>" id="name" maxlength="<?= $comments->nameMaxLength() ?>" required> | ||
|
||
<label for="email">Email Address<?php if ($comments->requiresEmailAddress()): ?><abbr title="required">*</abbr><?php endif ?></label> | ||
<input type="email" name="<?= $comments->emailName() ?>" value="<?= $comments->value($comments->emailName()) ?>" id="email" maxlength="<?= $comments->emailMaxLength() ?>"<?php e($comments->requiresEmailAddress(), ' required') ?>> | ||
|
||
<label for="website">Website</label> | ||
<input type="url" name="<?= $comments->websiteName() ?>" value="<?= $comments->value($comments->websiteName()) ?>" id="website" maxlength="<?= $comments->websiteMaxLength() ?>"> | ||
|
||
<?php if ($comments->isUsingHoneypot()): ?> | ||
<div style="display: none" hidden> | ||
<input type="text" name="<?= $comments->honeypotName() ?>" value="<?= $comments->value($comments->honeypotName()) ?>"> | ||
</div> | ||
<?php endif ?> | ||
|
||
<label for="message">Message<abbr title="required">*</abbr></label> | ||
<textarea name="<?= $comments->messageName() ?>" id="message" maxlength="<?= $comments->messageMaxLength() ?>" required><?= $comments->value($comments->messageName()) ?></textarea> | ||
|
||
<input type="hidden" name="<?= $comments->sessionIdName() ?>" value="<?= $comments->sessionId() ?>"> | ||
|
||
<input type="submit" name="<?= $comments->previewName() ?>" value="Preview"> | ||
<?php if ($comments->validPreview()): ?> | ||
<input type="submit" name="<?= $comments->submitName() ?>" value="Submit" id="submit"> | ||
<?php endif ?> | ||
</form> | ||
<?php endif ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
/* | ||
* This is the example comments list snippet. Feel free to use this code as a | ||
* reference for creating your own, custom comments snippet. | ||
* | ||
* Custom snippet markup guide: | ||
* <https://github.com/Addpixel/KirbyComments#custom-markup> | ||
* | ||
* API documentation: | ||
* <https://github.com/Addpixel/KirbyComments#api-documentation> | ||
*/ | ||
|
||
if (kirby()->get('option', 'comments.runtime.comments') == null) { | ||
// Create `Comments` object for the current page | ||
$comments = new Comments($page); | ||
$status = $comments->process(); | ||
|
||
// Store `Comments` object and status for `comments-form` snippet | ||
kirby()->set('option', 'comments.runtime.comments', $comments); | ||
kirby()->set('option', 'comments.runtime.status', $status); | ||
} else { | ||
// Load `Comments` object and status from | ||
$comments = kirby()->get('option', 'comments.runtime.comments'); | ||
$status = kirby()->get('option', 'comments.runtime.status'); | ||
} | ||
|
||
?> | ||
<?php if (!$comments->isEmpty()): ?> | ||
<h2>Comments</h2> | ||
|
||
<?php foreach ($comments as $comment): ?> | ||
<article id="comment-<?= $comment->id() ?>" class="comment<?php e($comment->isPreview(), ' preview"') ?>"> | ||
<h3> | ||
<?php e($comment->isLinkable(), "<a rel='nofollow noopener' href='{$comment->website()}'>") ?> | ||
<?= $comment->name() ?> | ||
<?php e($comment->isLinkable(), "</a>") ?> | ||
</h3> | ||
|
||
<aside class="comment-info"> | ||
<?php if ($comment->isPreview()): ?> | ||
<p>This is a preview of your comment. If you’re happy with it, <a href="#submit" title="Jump to the submit button">submit</a> it to the public.</p> | ||
<?php else: ?> | ||
<p> | ||
Posted on <?= $comment->date('Y-m-d') ?>. | ||
<a href="#comment-<?= $comment->id() ?>" title="Permalink" area-label="Permalink">#</a> | ||
</p> | ||
<?php endif ?> | ||
</aside> | ||
|
||
<?= $comment->message() ?> | ||
</article> | ||
<?php endforeach ?> | ||
<?php endif ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters