當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。