function cc::get_campaigns in Constant Contact 6.3
Same name and namespace in other branches
- 6.2 class.cc.php \cc::get_campaigns()
- 7.3 class.cc.php \cc::get_campaigns()
* Gets all campaigns * * @access public
File
- ./
class.cc.php, line 1235
Class
- cc
- @file
Code
function get_campaigns($action = 'campaigns') {
$xml = $this
->load_url($action);
if (!$xml) {
return false;
}
// parse into nicer array
$campaigns = array();
$_campaigns = isset($xml['feed']['entry']) ? $xml['feed']['entry'] : false;
if (is_array($_campaigns)) {
if (isset($_campaigns[0]['link_attr']['href'])) {
foreach ($_campaigns as $k => $v) {
$id = $this
->get_id_from_link($v['link_attr']['href']);
$campaign = $v['content']['Campaign'];
$campaign['id'] = $id;
$campaigns[] = $campaign;
}
}
else {
$id = $this
->get_id_from_link($_campaigns['link_attr']['href']);
$campaign = $_campaigns['content']['Campaign'];
$campaign['id'] = $id;
$campaigns[] = $campaign;
}
}
return $campaigns;
}