1. Go to this page and download the library: Download sgkirby/commentions library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
'hooks' => [
'commentions.add:before' => function ($page, $data) {
if($data['name'] == 'John Doe') {
throw new Exception("John Doe is not allowed to comment.");
}
}
],
'sgkirby.commentions.commentfields' => [
'name' => true, // include name field and mark as website field
],
'sgkirby.commentions.commentfields' => function($targetPage){
// comment forms on event pages
'email' => true,
];
}
// on all other pages, only show optional name field
return [
'name',
];
},
// empty array = no data beyond the ds' => [],
'sgkirby.commentions.webmentionfields' => [
'text', // store source HTML
'name', // store author's realname
'avatar', // store author's avatar URL
'website', // store author's homepage URL
],
'sgkirby.commentions.hideforms' => true,
'sgkirby.commentions.spamprotection' => [
'honeypot', /* filter comments where a hidden field contains data */
'timemin', /* filter comments submitted too fast */
'timemax', /* filter comments submitted after very long time */
],
'sgkirby.commentions.spamtimemin' => 5, /* valid n seconds after page load; default 5s */
'sgkirby.commentions.spamtimemax' => 86400, /* no longer valid after n seconds; default 24h */
'sgkirby.commentions.allowlinks' => true, /* Allow links in comments, if true */
'sgkirby.commentions.autolinks' => true, /* Automatically recognize URLs in comments and turn them into links. Has no effect, if allowlinks is false. */
foreach ($testpage->commentions('all') as $item) {
print_r($item->content());
}
commentions('endpoints')
commentions()
commentions('feedback')
commentions('form')
commentions('list')
commentions('grouped');
commentions('endpoints');
commentions('css');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.