Add captcha page [MAILPOET-2015]
This commit is contained in:
@ -9,10 +9,14 @@ if (!defined('ABSPATH')) exit;
|
||||
|
||||
class Subscription {
|
||||
const ENDPOINT = 'subscription';
|
||||
const ACTION_CAPTCHA = 'captcha';
|
||||
const ACTION_CAPTCHA_IMAGE = 'captchaImage';
|
||||
const ACTION_CONFIRM = 'confirm';
|
||||
const ACTION_MANAGE = 'manage';
|
||||
const ACTION_UNSUBSCRIBE = 'unsubscribe';
|
||||
public $allowed_actions = [
|
||||
self::ACTION_CAPTCHA,
|
||||
self::ACTION_CAPTCHA_IMAGE,
|
||||
self::ACTION_CONFIRM,
|
||||
self::ACTION_MANAGE,
|
||||
self::ACTION_UNSUBSCRIBE,
|
||||
@ -28,6 +32,17 @@ class Subscription {
|
||||
$this->subscription_pages = $subscription_pages;
|
||||
}
|
||||
|
||||
function captcha($data) {
|
||||
$subscription = $this->initSubscriptionPage(UserSubscription\Pages::ACTION_CAPTCHA, $data);
|
||||
}
|
||||
|
||||
function captchaImage($data) {
|
||||
$captcha = new UserSubscription\Captcha;
|
||||
$width = !empty($data['width']) ? (int)$data['width'] : null;
|
||||
$height = !empty($data['height']) ? (int)$data['height'] : null;
|
||||
return $captcha->renderImage($width, $height);
|
||||
}
|
||||
|
||||
function confirm($data) {
|
||||
$subscription = $this->initSubscriptionPage(UserSubscription\Pages::ACTION_CONFIRM, $data);
|
||||
$subscription->confirm();
|
||||
|
Reference in New Issue
Block a user