You are here

function cc::get_emails in Constant Contact 6.2

Same name and namespace in other branches
  1. 6.3 class.cc.php \cc::get_emails()
  2. 7.3 class.cc.php \cc::get_emails()

* Gets all account email addresses * These are used with the campaigns collection * * @access public

File

./class.cc.php, line 1311

Class

cc
@file

Code

function get_emails() {
  $xml = $this
    ->load_url("settings/emailaddresses");
  if (!$xml) {
    return false;
  }

  // parse into nicer array
  $emails = array();
  $_emails = isset($xml['feed']['entry']) ? $xml['feed']['entry'] : false;
  if (is_array($_emails)) {
    if (isset($_emails[0]['link_attr']['href'])) {
      foreach ($_emails as $k => $v) {
        $id = $this
          ->get_id_from_link($v['link_attr']['href']);
        $email = $v['content']['Email'];
        $email['id'] = $id;
        $emails[] = $email;
      }
    }
    else {
      $id = $this
        ->get_id_from_link($_emails['link_attr']['href']);
      $email = $_emails['content']['Email'];
      $email['id'] = $id;
      $emails[] = $email;
    }
  }
  return $emails;
}