summaryrefslogtreecommitdiff
path: root/modules/akismet/helpers/akismet.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-01-08 02:56:49 +0000
committerBharat Mediratta <bharat@menalto.com>2009-01-08 02:56:49 +0000
commitbc36ba609db3b030d28a8768023b35441f8b9b9e (patch)
treec08b06dc707c53313066f966d9e3179d15244ad0 /modules/akismet/helpers/akismet.php
parent8bf388a6f671faba94f46ad9e982139c211378ee (diff)
Add akismet::$test_mode, initialize it to TEST_MODE and don't contact
akismet if it's on. Force it on in the scaffolding so that we don't try to run all comments we add from there through Akismet.
Diffstat (limited to 'modules/akismet/helpers/akismet.php')
-rw-r--r--modules/akismet/helpers/akismet.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/akismet/helpers/akismet.php b/modules/akismet/helpers/akismet.php
index b34ed1ac..12d7a106 100644
--- a/modules/akismet/helpers/akismet.php
+++ b/modules/akismet/helpers/akismet.php
@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class akismet_Core {
+ public static $test_mode = TEST_MODE;
+
// Lets not send everything to Akismet
private static $white_list = array(
"HTTP_USER_AGENT",
@@ -41,6 +43,10 @@ class akismet_Core {
* @return $string "spam", "ham" or "unknown"
*/
public static function check_comment($comment) {
+ if (akismet::$test_mode) {
+ return;
+ }
+
$request = self::_build_request("comment-check", $comment);
$response = self::_http_post($request);
$answer = $response->body[0];
@@ -58,6 +64,10 @@ class akismet_Core {
* @param Comment_Model $comment A comment to check
*/
public static function submit_spam($comment) {
+ if (akismet::$test_mode) {
+ return;
+ }
+
$request = self::_build_request("submit-spam", $comment);
self::_http_post($request);
}
@@ -67,6 +77,10 @@ class akismet_Core {
* @param Comment_Model $comment A comment to check
*/
public static function submit_ham($comment) {
+ if (akismet::$test_mode) {
+ return;
+ }
+
$request = self::_build_request("submit-ham", $comment);
self::_http_post($request);
}