private function do_opt_in() { if (get_option('ihc_register_opt-in') && $this->type == 'create') { //If Opt In it's enable, put the email address somewhere $target_opt_in = get_option('ihc_register_opt-in-type'); if ($target_opt_in && $_REQUEST['user_email']) { if (!class_exists('IhcMailServices')) { require_once IHC_PATH . 'classes/IhcMailServices.class.php'; } $indeed_mail = new IhcMailServices(); $indeed_mail->dir_path = IHC_PATH . 'classes'; switch ($target_opt_in) { case 'aweber': $awListOption = get_option('ihc_aweber_list'); if ($awListOption) { $aw_list = str_replace('awlist', '', $awListOption); $consumer_key = get_option('aweber_consumer_key'); $consumer_secret = get_option('aweber_consumer_secret'); $access_key = get_option('aweber_acces_key'); $access_secret = get_option('aweber_acces_secret'); if ($consumer_key && $consumer_secret && $access_key && $access_secret) { $indeed_mail->indeed_aWebberSubscribe($consumer_key, $consumer_secret, $access_key, $access_secret, $aw_list, $_REQUEST['user_email']); } } break; case 'email_list': $email_list = get_option('ihc_email_list'); $email_list .= $_REQUEST['user_email'] . ','; update_option('ihc_email_list', $email_list); break; case 'mailchimp': $mailchimp_api = get_option('ihc_mailchimp_api'); $mailchimp_id_list = get_option('ihc_mailchimp_id_list'); if ($mailchimp_api && $mailchimp_id_list) { $indeed_mail->indeed_mailChimp($mailchimp_api, $mailchimp_id_list, $_REQUEST['user_email']); } break; case 'get_response': $api_key = get_option('ihc_getResponse_api_key'); $token = get_option('ihc_getResponse_token'); if ($api_key && $token) { $indeed_mail->indeed_getResponse($api_key, $token, $_REQUEST['user_email']); } break; case 'campaign_monitor': $listId = get_option('ihc_cm_list_id'); $apiID = get_option('ihc_cm_api_key'); if ($listId && $apiID) { $indeed_mail->indeed_campaignMonitor($listId, $apiID, $_REQUEST['user_email']); } break; case 'icontact': $appId = get_option('ihc_icontact_appid'); $apiPass = get_option('ihc_icontact_pass'); $apiUser = get_option('ihc_icontact_user'); $listId = get_option('ihc_icontact_list_id'); if ($appId && $apiPass && $apiUser && $listId) { $indeed_mail->indeed_iContact($apiUser, $appId, $apiPass, $listId, $_REQUEST['user_email']); } break; case 'constant_contact': $apiUser = get_option('ihc_cc_user'); $apiPass = get_option('ihc_cc_pass'); $listId = get_option('ihc_cc_list'); if ($apiUser && $apiPass && $listId) { $indeed_mail->indeed_constantContact($apiUser, $apiPass, $listId, $_REQUEST['user_email']); } break; case 'wysija': $listID = get_option('ihc_wysija_list_id'); if ($listID) { $indeed_mail->indeed_wysija_subscribe($listID, $_REQUEST['user_email']); } break; case 'mymail': $listID = get_option('ihc_mymail_list_id'); if ($listID) { $indeed_mail->indeed_myMailSubscribe($listID, $_REQUEST['user_email']); } break; case 'madmimi': $username = get_option('ihc_madmimi_username'); $api_key = get_option('ihc_madmimi_apikey'); $listName = get_option('ihc_madmimi_listname'); if ($username && $api_key && $listName) { $indeed_mail->indeed_madMimi($username, $api_key, $listName, $_REQUEST['user_email']); } break; } } } }