本文整理汇总了PHP中NewsletterModule::antibot_form_check方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsletterModule::antibot_form_check方法的具体用法?PHP NewsletterModule::antibot_form_check怎么用?PHP NewsletterModule::antibot_form_check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NewsletterModule
的用法示例。
在下文中一共展示了NewsletterModule::antibot_form_check方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hook_wp_loaded
function hook_wp_loaded()
{
global $newsletter, $wpdb;
switch ($newsletter->action) {
case 's':
if (isset($this->options['antibot_disable']) || NewsletterModule::antibot_form_check()) {
$user = NewsletterSubscription::instance()->subscribe();
if ($user->status == 'E') {
NewsletterSubscription::instance()->show_message('error', $user->id);
}
if ($user->status == 'C') {
NewsletterSubscription::instance()->show_message('confirmed', $user->id);
}
if ($user->status == 'A') {
NewsletterSubscription::instance()->show_message('already_confirmed', $user->id);
}
if ($user->status == 'S') {
NewsletterSubscription::instance()->show_message('confirmation', $user->id);
}
} else {
NewsletterModule::request_to_antibot_form('Subscribe');
}
die;
case 'u':
$user = NewsletterSubscription::instance()->get_user_from_request();
if ($user == null) {
NewsletterSubscription::instance()->show_message('unsubscription_error', null);
} else {
NewsletterSubscription::instance()->show_message('unsubscription', $user);
}
die;
break;
case 'uc':
if ($this->antibot_form_check()) {
$user = NewsletterSubscription::instance()->unsubscribe();
if ($user->status == 'E') {
NewsletterSubscription::instance()->show_message('unsubscription_error', $user);
} else {
NewsletterSubscription::instance()->show_message('unsubscribed', $user);
}
return;
} else {
$this->request_to_antibot_form('Unsubscribe');
}
die;
break;
case 'p':
case 'pe':
$user = NewsletterSubscription::instance()->check_user();
if ($user == null) {
die('No subscriber found.');
}
NewsletterSubscription::instance()->show_message('profile', $user);
die;
break;
case 'c':
if ($this->antibot_form_check()) {
$user = NewsletterSubscription::instance()->confirm();
if ($user->status == 'E') {
NewsletterSubscription::instance()->show_message('error', $user->id);
} else {
setcookie('newsletter', $user->id . '-' . $user->token, time() + 60 * 60 * 24 * 365, '/');
NewsletterSubscription::instance()->show_message('confirmed', $user);
}
} else {
$this->request_to_antibot_form('Confirm');
}
die;
break;
case 'ul':
$user = NewsletterSubscription::instance()->check_user();
if ($user == null || $user->status != 'C') {
echo 'Subscriber not found, sorry.';
die;
}
$options = $this->get_options('lock');
setcookie('newsletter', $user->id . '-' . $user->token, time() + 60 * 60 * 24 * 365, '/');
header('Location: ' . $options['url']);
die;
break;
default:
return;
}
die;
}