当前位置: 首页>>代码示例>>PHP>>正文


PHP NewsletterModule::request_to_antibot_form方法代码示例

本文整理汇总了PHP中NewsletterModule::request_to_antibot_form方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsletterModule::request_to_antibot_form方法的具体用法?PHP NewsletterModule::request_to_antibot_form怎么用?PHP NewsletterModule::request_to_antibot_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NewsletterModule的用法示例。


在下文中一共展示了NewsletterModule::request_to_antibot_form方法的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;
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:85,代码来源:subscription.php


注:本文中的NewsletterModule::request_to_antibot_form方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。