FEATURE: added extension for new comments module

This commit is contained in:
Will Rossiter 2010-12-13 00:50:08 +00:00
parent feddb2cc49
commit 237d08d5dd
2 changed files with 39 additions and 1 deletions

View File

@ -1,3 +1,18 @@
<?php
?>
/**
* Default configuration settings for the Spam Protection module.
*
* You should not put your own configuration in here rather use your
* mysite/_config.php file
*
* @package spamprotection
*/
if(class_exists('Comment')) {
/**
* If the comments module is installed then add the spam protection module
* to the comments form via this extension
*/
Object::add_extension('CommentingController', 'CommentSpamProtection');
}

View File

@ -0,0 +1,23 @@
<?php
/**
* Apply the spam protection to the comments module if it is installed
*
* @package spamprotection
*/
class CommentSpamProtection extends Extension {
/**
* Disable the AJAX commenting and update the form
* with the {@link SpamProtectorField} which is enabled
*/
function alterCommentForm(&$form) {
SpamProtectorManager::update_form($form, null, array(
'Name' => 'author_name',
'CommenterURL' => 'author_url',
'Comment' => 'post_body',
'Email' => 'author_email'
));
}
}