This repository has been archived by the owner on May 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
plugin.php
executable file
·47 lines (38 loc) · 1.5 KB
/
plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
// This file is part of esoTalk. Please see the included license file for usage information.
if (!defined("IN_ESOTALK")) exit;
ET::$pluginInfo["MSCaptcha"] = array(
"name" => "MSCaptcha",
"description" => "Just simple captcha.",
"version" => ESOTALK_VERSION,
"author" => "DaVchezt",
"authorEmail" => "[email protected]",
"authorURL" => "http://davchezt.tumblr.com",
"license" => "GPLv2"
);
class ETPlugin_MSCaptcha extends ETPlugin {
public function __construct($rootDirectory)
{
parent::__construct($rootDirectory);
ETFactory::registerController("mscaptcha", "MSCaptchaController", dirname(__FILE__)."/MSCaptchaController.class.php");
}
public function handler_init($sender)
{
$sender->addCSSFile($this->Resource("mscaptcha.css"));
$sender->addJSFile($this->Resource("mscaptcha.js"));
}
public function handler_userController_initJoin($controller, $form)
{
$form->addSection("mscaptcha", T("Solve this"));
$form->addField("mscaptcha", "mscaptcha", function($form)
{
return "<div class=\"mscaptcha\"><img class=\"img-mscaptcha\" src=\"".URL("mscaptcha")."\" alt=\"MSCaptcha\"><i class=\"icon-spinner mscaptcha-loader\" style=\"display:none;\"> loading...</i><br /><a id=\"mscaptcha-refresh\" href=\"#\" class=\"button\"><i class=\"icon-refresh\"></i></a>".$form->input("mscaptcha")."</div>";
},
function($form, $key, &$data)
{
if (ET::$session->get('mscaptcha') != $form->getValue($key)) {
$form->error($key, T("Invalid!, You need calculator? :D"));
}
});
}
}