function cc::get_contact in Constant Contact 6.2
Same name and namespace in other branches
- 6.3 class.cc.php \cc::get_contact()
- 7.3 class.cc.php \cc::get_contact()
* Gets a specific contacts details * * @access public
File
- ./
class.cc.php, line 725
Class
- cc
- @file
Code
function get_contact($id) {
$xml = $this
->load_url("contacts/{$id}");
if (!$xml) {
return false;
}
$contact = false;
$_contact = isset($xml['entry']) ? $xml['entry'] : false;
// parse into nicer array
if (is_array($_contact)) {
$id = $this
->get_id_from_link($_contact['link_attr']['href']);
$contact = $_contact['content']['Contact'];
if (isset($_contact['content']['Contact']['ContactLists']['ContactList'])) {
$_lists = $_contact['content']['Contact']['ContactLists']['ContactList'];
unset($_lists['0_attr']);
unset($_lists['ContactList_attr']);
}
else {
$_lists = false;
}
// get lists
$lists = array();
if (is_array($_lists) && count($_lists) > 0) {
unset($_lists['id']);
if (isset($_lists['link_attr']['href'])) {
$list_id = $this
->get_id_from_link($_lists['link_attr']['href']);
$lists[$list_id] = $list_id;
}
else {
foreach ($_lists as $k => $v) {
if (isset($v['link_attr']['href'])) {
$list_id = $this
->get_id_from_link($v['link_attr']['href']);
$lists[$list_id] = $list_id;
}
}
}
unset($contact['ContactLists']);
}
$contact['lists'] = $lists;
$contact['id'] = $id;
}
return $contact;
}