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


PHP MCAPI::listSubscribe方法代码示例

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


在下文中一共展示了MCAPI::listSubscribe方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mailChimpSubscribe

 public function mailChimpSubscribe($data)
 {
     if (!$data['email']) {
         return "No email address provided";
     }
     if (!preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\$/i", $data['email'])) {
         return "Email address is invalid";
     }
     require_once '/home/icdigyfv/htdocs/admin/inc/klassen/mailChimpApi.inc.php';
     $api = new MCAPI($this->mailChimpApiKey);
     $merge_vars = array('FNAME' => $data['name'], 'LNAME' => $data['surname']);
     if (in_array(1, $data['group'])) {
         if ($api->listSubscribe('0eff6ba7d7', $data['email'], $merge_vars) === true) {
             $response = 'Vielen Dank für Ihre Anmeldung. Sie erhalten in kürze eine E-Mail.';
         } else {
             $response = 'Deine E-Mail Adresse ist schon im Newsletter eingetragen!';
         }
     }
     if (in_array(2, $data['group'])) {
         if ($api->listSubscribe('057fda416a', $data['email'], $merge_vars) === true) {
             $response = 'Vielen Dank für Ihre Anmeldung. Sie erhalten in kürze eine E-Mail.';
         } else {
             $response = 'Deine E-Mail Adresse ist schon im Newsletter eingetragen!';
         }
     }
     return $response;
 }
开发者ID:satson,项目名称:2gm,代码行数:27,代码来源:subscribe.inc.php

示例2: mc_subscribe

 public function mc_subscribe()
 {
     $email = $this->input->get('email');
     if (!$email) {
         $data['response_type'] = 'error';
         $data['response'] = "No email address provided";
     }
     if (!preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\$/i", $email)) {
         $data['response_type'] = 'error';
         $data['response'] = "Email address is invalid.";
     } else {
         require_once 'includes/MCAPI.class.php';
         $api = new MCAPI('c008756fe177a689e69abf3c5e44a59f-us1');
         // grab your List's Unique Id by going to http://admin.mailchimp.com/lists/
         // Click the "settings" link for the list - the Unique Id is at the bottom of that page.
         $list_id = "4249f1e3e5";
         if ($api->listSubscribe($list_id, $email, '') === true) {
             // Success
             $data['response_type'] = 'success';
             $data['response'] = 'Success! Check your email to confirm sign up.';
             $data['goal_location'] = 'Home';
             //Where did they register? Answer = home page
             // Set cookie for 7 days (to not load reg panel for 7 days)
             $c = array('name' => 'close_mc_subscribe', 'value' => 'true', 'expire' => '604800');
             $this->input->set_cookie($c);
         } else {
             $data['response_type'] = 'error';
             $data['response'] = 'Error: ' . $api->errorMessage;
         }
     }
     $this->load->view('ajax/mc_subscribe', $data);
 }
开发者ID:nyalex,项目名称:Lavish-Frugal,代码行数:32,代码来源:ajax.php

示例3: storeAddress

function storeAddress()
{
    // Validation
    if (!$_GET['email']) {
        return "No email address provided";
    }
    if (!preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\$/i", $_GET['email'])) {
        return "Email address is invalid";
    }
    require_once 'MCAPI.class.php';
    // grab an API Key from http://admin.mailchimp.com/account/api/
    $api = new MCAPI('d7229a6dbbe5df2b5bb2f6430fdbefd4-us2');
    // grab your List's Unique Id by going to http://admin.mailchimp.com/lists/
    // Click the "settings" link for the list - the Unique Id is at the bottom of that page.
    $list_id = "97aad3ac02";
    // Merge variables are the names of all of the fields your mailing list accepts
    // Ex: first name is by default FNAME
    // You can define the names of each merge variable in Lists > click the desired list > list settings > Merge tags for personalization
    // Pass merge values to the API in an array as follows
    $mergeVars = array('FNAME' => $_GET['fname'], 'LNAME' => $_GET['lname'], 'ADDRESS' => $_GET['address'], 'CITY' => $_GET['city'], 'STATE' => $_GET['state'], 'ZIP' => $_GET['zip']);
    if ($api->listSubscribe($list_id, $_GET['email'], $mergeVars) === true) {
        // It worked!
        return 'Success! Check your email to confirm sign up.';
    } else {
        // An error ocurred, return error message
        return 'Error: ' . $api->errorMessage;
    }
}
开发者ID:brybrarobry13,项目名称:cari-toon,代码行数:28,代码来源:store-address.php

示例4: storeAddress

function storeAddress($apikey, $listid)
{
    //    $your_apikey = '78a6118343c6bf1cdade80bb4162e0b3-us9';
    //    $my_list_unique_id = "e5cd1cb09f";
    $your_apikey = $apikey;
    $my_list_unique_id = $listid;
    // Validation
    if (!$_GET['email']) {
        return "No email address provided";
    }
    if (!preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\$/i", $_GET['email'])) {
        return "Email address is invalid!";
    }
    require_once 'MCAPI.class.php';
    // grab an API Key from http://admin.mailchimp.com/account/api/
    $api = new MCAPI($your_apikey);
    // grab your List's Unique Id by going to http://admin.mailchimp.com/lists/
    // Click the "settings" link for the list - the Unique Id is at the bottom of that page.
    $list_id = $my_list_unique_id;
    if ($api->listSubscribe($list_id, $_GET['email'], '') === true) {
        // It worked!
        return 'Success! Check your email to confirm.';
    } else {
        // An error ocurred, return error message
        return 'Error: ' . $api->errorMessage;
    }
}
开发者ID:q178015846,项目名称:yankee,代码行数:27,代码来源:store-address.php

示例5: onSignup

 public function onSignup()
 {
     $settings = Settings::instance();
     if (!$settings->api_key) {
         throw new ApplicationException('MailChimp API key is not configured.');
     }
     /*
      * Validate input
      */
     $data = post();
     $rules = ['email' => 'required|email|min:2|max:64'];
     $validation = Validator::make($data, $rules);
     if ($validation->fails()) {
         throw new ValidationException($validation);
     }
     /*
      * Sign up to Mailchimp via the API
      */
     require_once plugins_path() . '/rainlab/mailchimp/vendor/MCAPI.class.php';
     $api = new \MCAPI($settings->api_key);
     $this->page['error'] = null;
     $mergeVars = '';
     if (isset($data['merge']) && is_array($data['merge']) && count($data['merge'])) {
         $mergeVars = $data['merge'];
     }
     if ($api->listSubscribe($this->property('list'), post('email'), $mergeVars) !== true) {
         $this->page['error'] = $api->errorMessage;
     }
 }
开发者ID:jhenahan,项目名称:mailchimp-plugin,代码行数:29,代码来源:Signup.php

示例6: actionMailchimp

 public function actionMailchimp()
 {
     if (!isset($_POST['email']) || !$_POST['email']) {
         echo "No email provided";
         $this->redirect(array('/deal/search', 'notify' => 'no_email'));
     }
     if (!preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\$/i", $_POST['email'])) {
         echo "Email address is invalid";
         $this->redirect(array('/deal/search', 'notify' => 'invalid_email'));
     }
     Yii::import('pages.components.MailChimp.MCAPI');
     $path = Yii::getPathOfAlias('pages.components.MailChimp');
     require $path . '/MCAPI.php';
     // grab an API Key from http://admin.mailchimp.com/account/api/
     $api = new MCAPI('fa420eff49d20479854185e4432ee34f-us2');
     // grab your List's Unique Id by going to http://admin.mailchimp.com/lists/
     // Click the "settings" link for the list - the Unique Id is at the bottom of that page.
     $list_id = "d95db04d2d";
     if ($api->listSubscribe($list_id, $_POST['email'], '', 'html', false, false, true, true) === true) {
         // It worked!
         $this->redirect(array('/deal/search', 'notify' => 'success'));
     } else {
         // An error ocurred, return error message
         //echo $api->errorMessage;
         $this->redirect(array('/deal/search', 'notify' => 'api_error'));
     }
 }
开发者ID:sagittaros,项目名称:dealschrome,代码行数:27,代码来源:UtilitiesController.php

示例7: storeAddress

/**
* store address to mailchimp mailing list
* IMPORTANT : 
- Replace 'YOUR_APIKEY_HERE' by your api key from your mailchimp
    Get one here http://admin.mailchimp.com/account/api/
- Replace 'YOUR_LISTID_HERE' by your list's unique ID
   Create a list here http://admin.mailchimp.com/lists/
   Then Click the "settings" link for the list - the Unique Id is at the bottom of that page. 
*/
function storeAddress($user_email)
{
    $m_response = array();
    // Validation
    if (!$user_email) {
        $m_response['error'] = "No email address provided";
        return $m_response;
    }
    if (!preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\$/i", $user_email)) {
        $m_response['error'] = "Email address is invalid";
        return $m_response;
    }
    require_once 'MCAPI.class.php';
    // grab an API Key from http://admin.mailchimp.com/account/api/
    $api = new MCAPI('YOUR_APIKEY_HERE');
    // grab your List's Unique Id by going to http://admin.mailchimp.com/lists/
    // Click the "settings" link for the list - the Unique Id is at the bottom of that page.
    $list_id = "YOUR_LISTID_HERE";
    if ($api->listSubscribe($list_id, $user_email, '') === true) {
        // It worked!
        $m_response['success'] = 'You will be notified';
        //return 'Success! Check your email to confirm sign up.';
    } else {
        // An error ocurred, return error message
        $m_response['error'] = 'Error: Something went wrong' . $api->errorMessage;
        //return 'Error: ' . $api->errorMessage;
    }
    return $m_response;
}
开发者ID:bolvarak,项目名称:TuxNS,代码行数:38,代码来源:servermailchimp.php

示例8: iron_mailchimp_subscribe

function iron_mailchimp_subscribe()
{
    require_once IRON_PARENT_DIR . '/includes/classes/MCAPI.class.php';
    $enabled = get_iron_option('newsletter_enabled');
    $mc_api_key = get_iron_option('mailchimp_api_key');
    $mc_list_id = get_iron_option('mailchimp_list_id');
    extract($_POST);
    if (!$enabled) {
        die('disabled');
    }
    if ($mc_api_key == '' || $mc_list_id == '') {
        die('missing_api_key');
    }
    // check if email is valid
    if (isset($email) && is_email($email)) {
        $api = new MCAPI($mc_api_key);
        if ($api->listSubscribe($mc_list_id, $email, '') === true) {
            die('success');
        } else {
            die('subscribed');
        }
    } else {
        die('invalid');
    }
}
开发者ID:hathbanger,项目名称:squab,代码行数:25,代码来源:functions.php

示例9: mailChimp

function mailChimp($email, $api, $list_id, $messages)
{
    // Retrieve API key from: http://admin.mailchimp.com/account/api/
    $api = new MCAPI($api);
    if ($api->listSubscribe($list_id, $email, '') === true) {
        // Success!
        $status = 'success';
        $message = $messages[3];
    } else {
        if (empty($email)) {
            $status = "error";
            $message = $messages[0];
        } else {
            if (!preg_match('/^[^\\W][a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/', $email)) {
                $status = "error";
                $message = $messages[1];
            } else {
                // An error ocurred, return error message
                $status = 'error';
                $message = $messages[4];
            }
        }
    }
    $data = array('status' => $status, 'message' => $message);
    echo json_encode($data);
    exit;
}
开发者ID:jonathanbe,项目名称:rmc,代码行数:27,代码来源:functions.php

示例10: addAction

 public function addAction()
 {
     $api = new MCAPI($this->_apiKey);
     $email = $this->getRequest()->getParam('email');
     $retval = $api->lists();
     if ($api->errorCode) {
         Mage::getSingleton('core/session')->addError($this->__('Error: %s', $api->errorMessage));
     } else {
         /*foreach($retval['data'] as $val) {
               if ($val['name'] === "Prospects") {
                   $prospectListId = $val['id'];
               } elseif ($val['name'] === "Fashion Eyewear Customers") {
                   $customerListId = $val['id'];
               }
           }*/
         $customers = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*')->addAttributeToFilter('email', $email)->getData();
         $customerId = $customers[0]['entity_id'];
         $orders = Mage::getResourceModel('sales/order_collection')->addFieldToSelect('*')->addFieldToFilter('customer_id', $customerId)->getData();
         if (!empty($orders)) {
             //add to Customer List
             $listId = $this->customerListId;
         } else {
             //add to Prospect list
             $listId = $this->prospectListId;
         }
         $merge_vars = array('FNAME' => $this->getRequest()->getParam('firstname'));
         if ($api->listSubscribe($listId, $email, $merge_vars) === true) {
             Mage::getSingleton('core/session')->addSuccess($this->__('Success! Check your email to confirm sign up.'));
         } else {
             Mage::getSingleton('core/session')->addError($this->__('Error: %s', $api->errorMessage));
         }
     }
     $this->_redirectReferer();
 }
开发者ID:CherylMuniz,项目名称:fashion,代码行数:34,代码来源:MailchimpController.php

示例11: oxy_sign_up

function oxy_sign_up()
{
    if (isset($_POST['nonce'])) {
        if (wp_verify_nonce($_POST['nonce'], 'oxygenna-sign-me-up-nonce')) {
            header('Content-Type: application/json');
            $resp = new stdClass();
            $user_email = $_POST['email'];
            $resp->email = $user_email;
            if (filter_var($user_email, FILTER_VALIDATE_EMAIL) !== false) {
                //create the API from the stored key
                $api = new MCAPI(oxy_get_option('api_key'));
                // The list the user will subscribe to
                $list_id = oxy_get_option('list_id');
                $api->listSubscribe($list_id, $user_email);
                if ($api->errorCode) {
                    $resp->status = 'error';
                    $resp->message = __('Error registering', THEME_FRONT_TD);
                } else {
                    $resp->status = 'ok';
                    $resp->message = __('Registered', THEME_FRONT_TD);
                }
            } else {
                $resp->status = 'error';
                $resp->message = __('Invalid email', THEME_FRONT_TD);
            }
            echo json_encode($resp);
            die;
        }
    }
}
开发者ID:vanie3,项目名称:appland,代码行数:30,代码来源:mailchimp.php

示例12: subscribe

 /**
  * Subscribe an e-mail to a list.
  * 
  * @param int $listId The id of the list to subscribe to
  * @param string $email The email address to subscribe.
  * @return bool True if email was subscribed successfully.
  */
 public function subscribe($listId, $email)
 {
     // Clear the cache for members in list
     $cacheName = $this->__getCacheName('list_subscribed_members', array($listId));
     $this->__clearMailchimpCache($cacheName);
     return $this->__api->listSubscribe($listId, $email);
 }
开发者ID:JodiWarren,项目名称:hms,代码行数:14,代码来源:MailingList.php

示例13: save

 public function save()
 {
     if (!$_POST) {
         die;
     }
     $this->rsp = Response::instance();
     if (!valid::email($_POST['email'])) {
         $this->rsp->msg = 'Invalid Email!';
         $this->rsp->send();
     } elseif ($this->owner->unique_key_exists($_POST['email'])) {
         $this->rsp->msg = 'Email already exists!';
         $this->rsp->send();
     }
     $pw = text::random('alnum', 8);
     $this->owner->email = $_POST['email'];
     $this->owner->password = $pw;
     $this->owner->save();
     $replyto = 'unknown';
     $body = "Hi there, thanks for saving your progess over at http://pluspanda.com \r\n" . "Your auto-generated password is: {$pw} \r\n" . "Change your password to something more appropriate by going here:\r\n" . "http://pluspanda.com/admin/account?old={$pw} \r\n\n" . "Thank you! - Jade from pluspanda";
     # to do FIX THE HEADERS.
     $subject = 'Your Pluspanda account information =)';
     $headers = "From: welcome@pluspanda.com \r\n" . "Reply-To: Jade \r\n" . 'X-Mailer: PHP/' . phpversion();
     mail($_POST['email'], $subject, $body, $headers);
     # add to mailing list.
     include Kohana::find_file('vendor/mailchimp', 'MCAPI');
     $config = Kohana::config('mailchimp');
     $mailchimp = new MCAPI($config['apikey']);
     $mailchimp->listSubscribe($config['list_id'], $_POST['email'], '', 'text', FALSE, TRUE, TRUE, FALSE);
     $this->rsp->status = 'success';
     $this->rsp->msg = 'Thanks, Account Saved!';
     $this->rsp->send();
 }
开发者ID:plusjade,项目名称:pluspanda-php,代码行数:32,代码来源:account.php

示例14: autoresponder

 function autoresponder($plan, $user)
 {
     $plan_mc_listid = $plan->plan_mc_listid;
     $plan_mc_groupid = $plan->plan_mc_groupid;
     $name = $user->get('name');
     $email = $user->get('email');
     $explodename = explode(' ', "{$name} ");
     $fname = $explodename[0];
     $lname = $explodename[1];
     $merge_vars = array('FNAME' => $fname, 'LNAME' => $lname, 'INTERESTS' => $plan_mc_groupid);
     require_once JPATH_COMPONENT . '/helpers/MCAPI.class.php';
     // Get the component config/params object.
     $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
     $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
     $api_key = $params->get($paramsPrefix . 'MCapi');
     $api = new MCAPI($api_key);
     $api->listSubscribe($plan_mc_listid, $email, $merge_vars);
     // check for duplicates
     $db =& JFactory::getDBO();
     $sql = 'SELECT COUNT(*)' . ' FROM #__joomailermailchimpintegration' . ' WHERE email = "' . $email . '" AND listid = "' . $plan_mc_listid . '"';
     $db->setQuery($sql);
     $count = $db->loadResult();
     if ($count == 0) {
         // add to joomailermailchimpintegration DB
         $sql = 'INSERT INTO #__joomailermailchimpintegration' . ' VALUES ("",' . $user->get('id') . ',"' . $email . '","' . $plan_mc_listid . '")';
         $db->setQuery($sql);
         $db->query();
     }
     //joomailermailchimpintegration DB
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:30,代码来源:iwl_mailchimp.php

示例15: sendMailchimp

function sendMailchimp($formData)
{
    $api = new MCAPI(MAILCHIMP_API_KEY);
    if ($api->listSubscribe(MAILCHIMP_LIST_ID, $formData['newsletter-email'], '') === true) {
        return true;
    } else {
        return $api->errorMessage;
    }
}
开发者ID:KosDm,项目名称:hydraukr,代码行数:9,代码来源:newsletter.php


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