You are here

function cc::get_activities in Constant Contact 6.3

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

* Gets all activities * * @access public

File

./class.cc.php, line 1012

Class

cc
@file

Code

function get_activities($action = 'activities') {
  $xml = $this
    ->load_url($action);
  if (!$xml) {
    return false;
  }

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