API: Fix inconsistent and incorrect spelling

This commit is contained in:
Andrew O'Neil 2009-06-04 22:57:33 +00:00
parent 8c17e66552
commit 928bb4bc6e
4 changed files with 23 additions and 23 deletions

12
INSTALL
View File

@ -20,12 +20,12 @@ Read the instructions below to setup the initial configuration of the module.
SETTING UP THE MODULE (in 'mysite/_config.php') 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 Before putting the following code in '_config.php', make sure you have a subclass of 'SpamProtectorField' installed or written. One
example of 'SpamProtecter' subclass is 'MollomField'. example of 'SpamProtecter' subclass is 'MollomField'.
<<<< CODE STARTS >>>> <<<< CODE STARTS >>>>
SpamProtecterManager::set_spam_protecter('MollomSpamProtector'); SpamProtectorManager::set_spam_protector('MollomSpamProtector');
<<<< CODE ENDS >>>> <<<< CODE ENDS >>>>
@ -34,20 +34,20 @@ What does this do?
This tell 'SpamProtection' module that you want to use 'MollomField' as a spam protection module across your site. 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 UPDATING A FORM TO INCLUDE THE SPAM PROTECTOR FIELD
--------------------------------------------------- ---------------------------------------------------
This following code should appear after the form creation. This following code should appear after the form creation.
<<<< CODE STARTS >>>> <<<< CODE STARTS >>>>
$protector = SpamProtecterManager::update_form($form, 'Message'); $protector = SpamProtectorManager::update_form($form, 'Message');
<<<< CODE ENDS >>>> <<<< CODE ENDS >>>>
What does this do? 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 This code add an instance of a 'SpamProtectorField' class specified in SETTING UP THE MODULE section. The newly created field will have
MollomField field. The first parameter is a Form object in which the field will be added into and the second parameter tells MollomField field. The first parameter is a Form object in which the field will be added into and the second parameter tells
SpamProtecterManager to place the new field before a field named 'Message'. SpamProtecterManagor to place the new field before a field named 'Message'.

View File

@ -26,7 +26,7 @@ class EditableSpamProtectionField extends EditableFormField {
} }
function createField() { function createField() {
if($protector = SpamProtecterManager::get_spam_protecter()) { if($protector = SpamProtectorManager::get_spam_protector()) {
if($protector) { if($protector) {
$protector = new $protector(); $protector = new $protector();
if($class = $protector->getFieldName()) { if($class = $protector->getFieldName()) {
@ -44,4 +44,4 @@ class EditableSpamProtectionField extends EditableFormField {
return 'spamprotection/images/' . strtolower($this->class) . '.png'; return 'spamprotection/images/' . strtolower($this->class) . '.png';
} }
} }

View File

@ -9,7 +9,7 @@
* been obtained. * been obtained.
* *
*/ */
class SpamProtecterField extends FormField { class SpamProtectorField extends FormField {
protected $spanControlCallbackObj = null; protected $spanControlCallbackObj = null;
@ -37,4 +37,4 @@ class SpamProtecterField extends FormField {
} }
?> ?>

View File

@ -3,27 +3,27 @@
* This class is responsible for setting an system-wide spam protecter field * This class is responsible for setting an system-wide spam protecter field
* and add the protecter field to a form * and add the protecter field to a form
*/ */
class SpamProtecterManager { class SpamProtectorManager {
static $spam_protecter = null; static $spam_protector = null;
/** /**
* Set the name of the spam protecter class * Set the name of the spam protecter class
* @param string the name of protecter field class * @param string the name of protecter field class
*/ */
static function set_spam_protecter($protecter) { static function set_spam_protector($protector) {
self::$spam_protecter = $protecter; self::$spam_protector = $protector;
} }
/** /**
* Get the name of the spam protector class * Get the name of the spam protector class
*/ */
static function get_spam_protecter() { static function get_spam_protector() {
return self::$spam_protecter; return self::$spam_protector;
} }
/** /**
* Add the spam protecter field to a form * Add the spam protector field to a form
* @param Form the form that the protecter field added into * @param Form the form that the protecter field added into
* @param string the name of the field that the protecter field will be added in front of * @param string the name of the field that the protecter field will be added in front of
* @param array an associative array * @param array an associative array
@ -36,10 +36,10 @@ class SpamProtecterManager {
*/ */
static function update_form($form, $before=null, $fieldsToSpamServiceMapping=null) { static function update_form($form, $before=null, $fieldsToSpamServiceMapping=null) {
$check = null; $check = null;
$protectorClass = self::$spam_protecter; $protectorClass = self::$spam_protector;
if(!class_exists($protectorClass)) return null; if(!class_exists($protectorClass)) return null;
$protecter = new $protectorClass(); $protector = new $protectorClass();
try { try {
$check = $protecter->updateForm($form, $before, $fieldsToSpamServiceMapping); $check = $protecter->updateForm($form, $before, $fieldsToSpamServiceMapping);
} catch (Exception $e) { } catch (Exception $e) {
@ -48,7 +48,7 @@ class SpamProtecterManager {
if(!$check) return null; if(!$check) return null;
return $protecter; return $protector;
} }
/** /**
@ -60,8 +60,8 @@ class SpamProtecterManager {
* @param String Feedback on the $object usually 'spam' or 'ham' for non spam entries * @param String Feedback on the $object usually 'spam' or 'ham' for non spam entries
*/ */
static function send_feedback($object, $feedback) { static function send_feedback($object, $feedback) {
$protecter = new self::$spam_protecter(); $protector = new self::$spam_protector();
return $protecter->sendFeedback($object, $feedback); return $protector->sendFeedback($object, $feedback);
} }
} }
?> ?>