You are here

class MailChimp in Mailchimp 7.2

Hierarchy

Expanded class hierarchy of MailChimp

5 string references to 'MailChimp'
mailchimp_get_api_object in ./mailchimp.module
Get a Mailchimp API object for communication with the mailchimp server.
mailchimp_lists_list_form in modules/mailchimp_lists/includes/mailchimp_lists.admin.inc
Return a form for adding/editing a mailchimp list.
mailchimp_lists_overview_page in modules/mailchimp_lists/includes/mailchimp_lists.admin.inc
Administrative display showing existing lists and allowing edits/adds.
mailchimp_menu in ./mailchimp.module
Implements hook_menu().
mailchimp_requirements in ./mailchimp.install
Implements hook_requirements().

File

includes/mailchimp.inc, line 3

View source
class MailChimp extends MCAPI {

  /**
   * Override MCAPI::callServer() to leverage Drupal's core HTTP handling.
   */
  public function callServer($method, $params) {
    $dc = "us1";
    if (strstr($this->api_key, "-")) {
      list($key, $dc) = explode("-", $this->api_key, 2);
      if (!$dc) {
        $dc = "us1";
      }
    }
    $host = $dc . "." . $this->apiUrl["host"];
    $protocol = $this->secure ? 'https://' : 'http://';
    $params["apikey"] = $this->api_key;
    $this->errorMessage = "";
    $this->errorCode = "";
    $post_vars = http_build_query($params, NULL, '&');
    $response = drupal_http_request($protocol . $host . $this->apiUrl["path"] . '?method=' . $method, array(
      'method' => 'POST',
      'data' => $post_vars,
      'headers' => array(
        'Content-type' => 'application/x-www-form-urlencoded',
        'Host' => $host,
        'Accept-Language' => language_default()->language,
        'User-Agent' => 'MCAPI/' . $this->version,
      ),
      'timeout' => $this
        ->getTimeout(),
    ));
    if (!empty($response->error)) {
      $this->errorMessage = $response->error;
      $this->errorCode = $response->code;
      return FALSE;
    }
    foreach ($response->headers as $h) {
      if (substr($h, 0, 26) === "X-MailChimp-API-Error-Code") {
        $this->errorMessage = "No error message was found";
        $this->errorCode = trim(substr($h, 27));
        return FALSE;
      }
    }
    $return = drupal_json_decode($response->data);
    if ($return === FALSE) {
      $this->errorMessage = "Bad Response.  Got This: " . $response->data;
      $this->errorCode = -99;
      return FALSE;
    }
    if (isset($return['error']) && is_array($return)) {
      $this->errorMessage = $return['error'];
      $this->errorCode = $return['code'];
      return FALSE;
    }
    return $return;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MailChimp::callServer public function Override MCAPI::callServer() to leverage Drupal's core HTTP handling. Overrides MCAPI::callServer
MCAPI::$apiUrl property Cache the information on the API location on the server
MCAPI::$api_key property Cache the user api_key so we only have to log in once per client instantiation
MCAPI::$chunkSize property Default to a 8K chunk size
MCAPI::$errorCode property
MCAPI::$errorMessage property
MCAPI::$secure property Cache the user api_key so we only have to log in once per client instantiation
MCAPI::$timeout property Default to a 300 second timeout on server calls
MCAPI::$version property
MCAPI::apikeyAdd function Add an API Key to your account. We will generate a new key for you and return it.
MCAPI::apikeyExpire function Expire a Specific API Key. Note that if you expire all of your keys, a new, valid one will be created and returned next time you call login(). If you are trying to shut off access to your account for an old developer, change your MailChimp password,…
MCAPI::apikeys function Retrieve a list of all MailChimp API Keys for this User
MCAPI::callMethod function Internal function - proxy method for certain XML-RPC calls | DO NOT CALL
MCAPI::campaignAbuseReports function Get all email addresses that complained about a given campaign
MCAPI::campaignAdvice function Retrieve the text presented in our app for how a campaign performed and any advice we may have for you - best suited for display in customized reports pages. Note: some messages will contain HTML - clean tags as necessary
MCAPI::campaignAnalytics function Retrieve the Google Analytics data we've collected for this campaign. Note, requires Google Analytics Add-on to be installed and configured.
MCAPI::campaignBounceMessages function Retrieve the full bounce messages for the given campaign. Note that this can return very large amounts of data depending on how large the campaign was and how much cruft the bounce provider returned. Also, message over 30 days old are subject to being…
MCAPI::campaignClickDetailAIM function Return the list of email addresses that clicked on a given url, and how many times they clicked
MCAPI::campaignClickStats function Get an array of the urls being tracked, and their click counts for a given campaign
MCAPI::campaignContent function Get the content (both html and text) for a campaign either as it would appear in the campaign archive or as the raw, original content
MCAPI::campaignCreate function Create a new draft campaign to send
MCAPI::campaignDelete function Delete a campaign. Seriously, "poof, gone!" - be careful!
MCAPI::campaignEcommAddOrder function Attach Ecommerce Order Information to a Campaign. This will generall be used by ecommerce package plugins <a href="/plugins/ecomm360.phtml">that we provide</a> or by 3rd part system developers.
MCAPI::campaignEcommOrders function Retrieve the Ecommerce Orders tracked by campaignEcommAddOrder()
MCAPI::campaignEmailDomainPerformance function Get the top 5 performing email domains for this campaign. Users want more than 5 should use campaign campaignEmailStatsAIM() or campaignEmailStatsAIMAll() and generate any additional stats they require.
MCAPI::campaignEmailStatsAIM function Given a campaign and email address, return the entire click and open history with timestamps, ordered by time
MCAPI::campaignEmailStatsAIMAll function Given a campaign and correct paging limits, return the entire click and open history with timestamps, ordered by time, for every user a campaign was delivered to.
MCAPI::campaignFolders function List all the folders for a user account
MCAPI::campaignHardBounces function Get all email addresses with Hard Bounces for a given campaign
MCAPI::campaignNotOpenedAIM function Retrieve the list of email addresses that did not open a given campaign
MCAPI::campaignOpenedAIM function Retrieve the list of email addresses that opened a given campaign with how many times they opened - note: this AIM function is free and does not actually require the AIM module to be installed
MCAPI::campaignPause function Pause an AutoResponder orRSS campaign from sending
MCAPI::campaignReplicate function Replicate a campaign.
MCAPI::campaignResume function Resume sending an AutoResponder or RSS campaign
MCAPI::campaigns function Get the list of campaigns and their details matching the specified filters
MCAPI::campaignSchedule function Schedule a campaign to be sent in the future
MCAPI::campaignSegmentTest function Allows one to test their segmentation rules before creating a campaign using them
MCAPI::campaignSendNow function Send a given campaign immediately
MCAPI::campaignSendTest function Send a test of this campaign to the provided email address
MCAPI::campaignShareReport function Get the URL to a customized VIP Report for the specified campaign and optionally send an email to someone with links to it. Note subsequent calls will overwrite anything already set for the same campign (eg, the password)
MCAPI::campaignSoftBounces function Get all email addresses with Soft Bounces for a given campaign
MCAPI::campaignStats function Given a list and a campaign, get all the relevant campaign statistics (opens, bounces, clicks, etc.)
MCAPI::campaignTemplates function Retrieve all templates defined for your user account
MCAPI::campaignUnschedule function Unschedule a campaign that is scheduled to be sent in the future
MCAPI::campaignUnsubscribes function Get all unsubscribed email addresses for a given campaign
MCAPI::campaignUpdate function Update just about any setting for a campaign that has <em>not</em> been sent. See campaignCreate() for details
MCAPI::createFolder function Create a new folder to file campaigns in
MCAPI::generateText function Have HTML content auto-converted to a text-only format. You can send: plain HTML, an array of Template content, an existing Campaign Id, or an existing Template Id. Note that this will <b>not</b> save anything to or update any of your…
MCAPI::getAccountDetails function Retrieve lots of account information including payments made, plan info, some account stats, installed modules, contact info, and more. No private information like Credit Card numbers is available.
MCAPI::getAffiliateInfo Deprecated function <strong>DEPRECATED:</strong> Retrieve your User Unique Id and your Affiliate link to display/use for <a href="/monkeyrewards/" target="_blank">Monkey Rewards</a>. While we don't use the User Id for any…
MCAPI::getTimeout function
MCAPI::httpBuildQuery function Re-implement http_build_query for systems that do not already have it
MCAPI::inlineCss function Send your HTML content to have the CSS inlined and optionally remove the original styles.
MCAPI::listAbuseReports function Get all email addresses that complained about a given campaign
MCAPI::listBatchSubscribe function Subscribe a batch of email addresses to a list at once
MCAPI::listBatchUnsubscribe function Unsubscribe a batch of email addresses to a list
MCAPI::listGrowthHistory function Access the Growth History by Month for a given list.
MCAPI::listInterestGroupAdd function Add a single Interest Group - if interest groups for the List are not yet enabled, adding the first group will automatically turn them on.
MCAPI::listInterestGroupDel function Delete a single Interest Group - if the last group for a list is deleted, this will also turn groups for the list off.
MCAPI::listInterestGroups function Get the list of interest groups for a given list, including the label and form information
MCAPI::listInterestGroupUpdate function Change the name of an Interest Group
MCAPI::listMemberInfo function Get all the information for a particular member of a list
MCAPI::listMembers function Get all of the list members for a list that are of a particular status
MCAPI::listMergeVarAdd function Add a new merge tag to a given list
MCAPI::listMergeVarDel function Delete a merge tag from a given list and all its members. Seriously - the data is removed from all members as well! Note that on large lists this method may seem a bit slower than calls you typically make.
MCAPI::listMergeVars function Get the list of merge tags for a given list, including their name, tag, and required setting
MCAPI::listMergeVarUpdate function Update most parameters for a merge tag on a given list. You cannot currently change the merge type
MCAPI::lists function Retrieve all of the lists defined for your user account
MCAPI::listSubscribe function Subscribe the provided email to a list. By default this sends a confirmation email - you will not see new members until the link contained in it is clicked!
MCAPI::listUnsubscribe function Unsubscribe the given email address from the list
MCAPI::listUpdateMember function Edit the email address, merge fields, and interest groups for a list member
MCAPI::listWebhookAdd function Add a new Webhook URL for the given list
MCAPI::listWebhookDel function Delete an existing Webhook URL from a given list
MCAPI::listWebhooks function Return the Webhooks configured for the given list
MCAPI::MCAPI function Connect to the MailChimp API for a given list. All MCAPI calls require login before functioning
MCAPI::ping function "Ping" the MailChimp API - a simple method you can call that will return a constant value as long as everything is good. Note than unlike most all of our methods, we don't throw an Exception if we are having issues. You will simply…
MCAPI::setTimeout function
MCAPI::useSecure function