aboutsummaryrefslogtreecommitdiff
path: root/mod/captcha/start.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/captcha/start.php')
-rw-r--r--mod/captcha/start.php35
1 files changed, 32 insertions, 3 deletions
diff --git a/mod/captcha/start.php b/mod/captcha/start.php
index 26e8671d2..982a01c2c 100644
--- a/mod/captcha/start.php
+++ b/mod/captcha/start.php
@@ -25,9 +25,18 @@
// Default length
$CONFIG->captcha_length = 5;
- // Right, these actions require captcha validation TODO: Put this in config somehow
- register_plugin_hook("action", "register", "captcha_verify_action_hook");
- register_plugin_hook("action", "user/requestnewpassword", "captcha_verify_action_hook");
+ // Register a function that provides some default override actions
+ register_plugin_hook('actionlist', 'captcha', 'captcha_actionlist_hook');
+
+ // Register actions to intercept
+ $actions = array();
+ $actions = trigger_plugin_hook('actionlist', 'captcha', null, $actions);
+
+ if (($actions) && (is_array($actions)))
+ {
+ foreach ($actions as $action)
+ register_plugin_hook("action", $action, "captcha_verify_action_hook");
+ }
}
function captcha_page_handler($page)
@@ -108,5 +117,25 @@
return false;
}
+ /**
+ * This function returns an array of actions the captcha will expect a captcha for, other plugins may
+ * add their own to this list thereby extending the use.
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ */
+ function captcha_actionlist_hook($hook, $entity_type, $returnvalue, $params)
+ {
+ if (!is_array($returnvalue))
+ $returnvalue = array();
+
+ $returnvalue[] = 'register';
+ $returnvalue[] = 'user/requestnewpassword';
+
+ return $returnvalue;
+ }
+
register_elgg_event_handler('init','system','captcha_init');
?> \ No newline at end of file