MINOR: added README and INSTALL doc

This commit is contained in:
Saophalkun Ponlu 2009-02-04 04:41:14 +00:00
parent c495f07cc2
commit b8609bab2d
2 changed files with 97 additions and 0 deletions

73
INSTALL Normal file
View File

@ -0,0 +1,73 @@
SilverStripe SpamProtection Module 0.1 beta
=======================================
INSTALLATION
------------
1. Unzip this file (spamprotection-0.1.tar.gz) inside your SilverStripe installation directory.
It should be at the same level as 'jsparty', 'cms' and 'sapphire' modules.
2. Ensure the directory name for the module is 'spamprotection'.
3. Visit your SilverStripe site.
5. We now need to setup some basic features to get the module up and running. Open up _config.php
inside project directory (typically 'mysite/_config.php') with your favourite text editor.
Read the instructions below to setup the initial configuration of the module.
SETTING UP THE MODULE (in 'mysite/_config.php')
------------------------------------------------------
Before putting the following code in '_config.php', make sure you have a subclass of 'SpamProtecterField' installed or written. One example of 'SpamProtecter' subclass is 'MollomField'.
<<<< CODE STARTS >>>>
SpamProctecterManager::set_spam_protecter('MollomField');
<<<< CODE ENDS >>>>
What does this do?
------------------
This tell 'SpamProtection' module that you want to use 'MollomField' as a spam protection module across your site.
UPDATING A FORM TO INCLUDE THE SPAM PROTECTER FIELD
---------------------------------------------------
This following code should appear after the form creation.
<<<< CODE STARTS >>>>
$protectorField = SpamProctecterManager::update_form('MollomField', 'Captcha', $form, 'Message', $callbackObj);
<<<< CODE ENDS >>>>
What does this do?
------------------
This code add an instance of a 'SpamProtecterField' class specified in SETTING UP THE MODULE section. The newly created field will have "MollomField" as a name and "Captcha" as a title. The third parameter is a Form object in which the field will be added into and the fourth parameter tells SpamProtecterManager to place the new field before a field named 'Message'. The last parameter is an object that get notified when the spam verification is done and given the form object.
The purpose of having callback object is we can process the submission differently according to the spam status of the submission. For example, put any submission with 'spam' status into spam queue.
IMPLEMENTING A CALLBACK OBJECT
------------------------------
Callback object should implements Spamable interface and at least implement 2 functions - markAsHam() and markAsSpam()
<<<< CODE STARTS >>>>
class ContactSpamable implements Spamable {
function markAsSpam($form) {
// code for adding submission into spam checking queue
}
function markAsHam($form) {
// do nothing
}
}
<<<< CODE ENDS >>>>

24
README Normal file
View File

@ -0,0 +1,24 @@
###############################################
SpamProtection Module
###############################################
Maintainer Contact
-----------------------------------------------
Saophalkun Ponlu
<phalkunz (at) silverstripe (dot) com>
Requirements
-----------------------------------------------
Documentation
-----------------------------------------------
Installation Instructions
-----------------------------------------------
See INSTALL
Usage Overview
-----------------------------------------------
Known issues
-----------------------------------------------