root/trunk/reCaptcha/php/init.reCaptcha.php

Revision 885, 1.7 kB (checked in by fumiakiy, 16 months ago)

reCaptcha plugin now supports default templates of 4.0x/4.1x and 4.2.

Line 
1<?php
2# Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd.
3# This program is distributed under the terms of the
4# GNU General Public License, version 2.
5#
6# $Id: init.reCaptcha.php 1174 2008-01-08 21:02:50Z bchoate $
7
8require_once("captcha_lib.php");
9
10class reCaptcha extends BaseCaptchaProvider {
11    function get_key() {
12        return 'sixapart_rc';
13    }
14    function get_name() {
15        return 'reCaptcha';
16    }
17    function get_classname() {
18        return 'reCaptcha';
19    }
20    function form_fields($blog_id) {
21        global $mt;
22        $config = $mt->db->fetch_plugin_config('reCaptcha', 'blog:' . $blog_id);
23        if ($config) {
24            $publickey = $config['recaptcha_publickey'];
25        }
26
27        $fields = "
28<div id=\"recaptcha_script\" style=\"display:block\">
29<script type=\"text/javascript\"
30   src=\"http://api.recaptcha.net/challenge?k=$publickey\">
31</script>
32
33<noscript>
34   <iframe src=\"http://api.recaptcha.net/noscript?k=$publickey\"
35       height=\"300\" width=\"500\" frameborder=\"0\"></iframe><br>
36   <textarea name=\"recaptcha_challenge_field\" rows=\"3\" cols=\"40\">
37   </textarea>
38   <input type=\"hidden\" name=\"recaptcha_response_field\" 
39       value=\"manual_challenge\">
40</noscript>
41</div>
42<script type=\"text/javascript\">
43if ( typeof(mtCaptchaVisible) != \"undefined\" )
44    mtCaptchaVisible = true;
45else if ( typeof(commenter_name) != \"undefined\" ) {
46    var div = document.getElementById(\"recaptcha_script\");
47    if (commenter_name)
48        div.style.display = \"none\";
49    else
50        div.style.display = \"block\";
51}
52</script>
53";
54        return $fields;
55    }
56}
57
58$provider = new reCaptcha();
59$_captcha_providers[$provider->get_key()] = $provider;
60
61?>
Note: See TracBrowser for help on using the browser.