public
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/halorgium/mephisto.git
New Site#register_spam_detection_engine.

The existing spam detection engines register themselves with Site on 
startup.
francois (author)
Mon Mar 03 04:46:21 -0800 2008
commit  09ecfabb45832dad1d237bfc1384a5dcdd379031
tree    293788e9264066b1bd00eddd7847c365d34f21f5
parent  4cadd52ca6ef9453a65399f844102b58ed07f06f
...
26
27
28
 
 
 
 
 
 
29
30
31
...
26
27
28
29
30
31
32
33
34
35
36
37
0
@@ -26,6 +26,12 @@ class Site < ActiveRecord::Base
0
     @@template_handlers.keys
0
   end
0
 
0
+ @@spam_detection_engines = []
0
+ def self.register_spam_detection_engine(name, klass)
0
+ @@spam_detection_engines<< [name, klass.name]
0
+ end
0
+ cattr_reader :spam_detection_engines
0
+
0
   has_many :sections, :order => "position", :dependent => :destroy do
0
     def home
0
       find_by_path ''
...
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 
 
 
 
 
 
 
 
 
58
59
60
...
44
45
46
 
47
 
 
 
 
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
0
@@ -44,17 +44,21 @@
0
 
0
 <div id="spam" class="setgroup">
0
   <h3>Spam prevention</h3>
0
- <p>At the moment Mephisto uses <%= link_to 'Akismet', 'http://akismet.com' %> to automatically handle spam. If you leave out the Akismet settings, you can moderate new comments from the Overview.</p>
0
   <dl class="setform">
0
- <dt><label>Akismet API Key</label></dt>
0
- <dd><%= f.text_field :akismet_key %></dd>
0
- <dt><label>Blog url</label></dt>
0
- <dd><%= f.text_field :akismet_url %></dd>
0
     <dt><label for="site_comment_age">Comments</label></dt>
0
     <dd><%= f.select :comment_age, comment_expiration_options %></dd>
0
     <dt>
0
       <label><%= f.check_box 'approve_comments' %> Approve and publish all comments automatically.</label>
0
     </dt>
0
+ <dt><label for="site_spam_detection_engine">Spam Detection Engine</label></dt>
0
+ <dd><%= f.select :spam_detection_engine, Site.spam_detection_engines %></dd>
0
+ </dl>
0
+ <p>At the moment Mephisto uses <%= link_to 'Akismet', 'http://akismet.com' %> to automatically handle spam. If you leave out the Akismet settings, you can moderate new comments from the Overview.</p>
0
+ <dl class="setform">
0
+ <dt><label>Akismet API Key</label></dt>
0
+ <dd><%#= f.text_field :akismet_key %></dd>
0
+ <dt><label>Blog url</label></dt>
0
+ <dd><%#= f.text_field :akismet_url %></dd>
0
   </dl>
0
 </div>
0
 
...
1
2
3
 
 
4
5
6
...
1
2
3
4
5
6
7
8
0
@@ -1,6 +1,8 @@
0
 module Mephisto
0
   module SpamDetectionEngines
0
     class AkismetEngine < Mephisto::SpamDetectionEngine::Base
0
+ Site.register_spam_detection_engine "Akismet", self
0
+
0
       def ham?(permalink_url, comment)
0
         check_valid!
0
         !akismet.comment_check(comment_spam_options(permalink_url, comment))
...
1
2
3
 
 
4
5
6
...
1
2
3
4
5
6
7
8
0
@@ -1,6 +1,8 @@
0
 module Mephisto
0
   module SpamDetectionEngines
0
     class DefensioEngine < Mephisto::SpamDetectionEngine::Base
0
+ Site.register_spam_detection_engine "Defensio", self
0
+
0
       def valid?
0
         [:defensio_url, :defensio_key].all? {|key| !options[key].blank?}
0
       end
...
1
2
3
 
 
4
5
6
...
1
2
3
4
5
6
7
8
0
@@ -1,6 +1,8 @@
0
 module Mephisto
0
   module SpamDetectionEngines
0
     class NullEngine < Mephisto::SpamDetectionEngine::Base
0
+ Site.register_spam_detection_engine "None", self
0
+
0
       def ham?(permalink_url, comment)
0
         true
0
       end

Comments

    No one has commented yet.