No subject


Thu Sep 13 13:30:15 BST 2007


  If you have specified the "spam_detector_module" option in your
  wiki.conf, this method will attempt to call the "looks_like_spam"
  method of that module to determine whether the edit is spam. If this
  method returns true, then the spam_detected.tt template will be used
  to display an error message.

  The looks_like_spam method will be passed a datastructure containing
  content and metadata.

Here's an example:

[in wiki.conf]

spam_detector_module = OpenGuides::Local::OGLSpamDetector

[in OGLSpamDetector.pm]

package OpenGuides::Local::OGLSpamDetector;

use strict;

sub looks_like_spam {
    my ( $class, %args ) = @_;

    if ( $args{metadata}{comment} =~ /some grammatical corrections/i ) {
        return 1;
    }

    my @cats = @{ $args{metadata}{category} };
    foreach my $cat ( @cats ) {
        if ( $cat =~ m'http://'i ) {
            return 1;
        }
    }

    my @locs = @{ $args{metadata}{locale} };
    foreach my $loc ( @locs ) {
        if ( $loc =~ m'http://'i ) {
            return 1;
        }
    }

}



More information about the OpenGuides-Dev mailing list