/** * Get List from ConstantContact */ function cspv4_get_constantcontact_lists($apikey = null) { global $seed_cspv4; extract($seed_cspv4); $o = $seed_cspv4; $lists = array(); if ($o['emaillist'] == 'constantcontact' || defined('DOING_AJAX') && DOING_AJAX && isset($_GET['action']) && $_GET['action'] == 'seed_cspv4_refresh_list') { $lists = maybe_unserialize(get_transient('seed_cspv4_constantcontact_lists')); if (empty($lists)) { //var_dump('miss'); if (class_exists('cc')) { //trigger_error("Duplicate: Another Constant Contact client library is already in scope.", E_USER_WARNING); } else { require_once SEED_CSPV4_PLUGIN_PATH . 'extentions/constantcontact/seed_cspv4_class.cc.php'; } if (!isset($username) && isset($constantcontact_username)) { $username = $constantcontact_username; $password = $constantcontact_password; } if (empty($username) || empty($password)) { return array(); } $api = new cc($username, $password); $response = $api->get_all_lists(); if ($response) { foreach ($response as $k => $v) { $lists[$v['id']] = $v['Name']; } if (!empty($lists)) { set_transient('seed_cspv4_constantcontact_lists', serialize($lists), 86400); } } else { $lists['false'] = __("Unable to load Constant Contact lists", 'seedprod'); } } } return $lists; }
function snp_ml_get_cc_lists($ml_cc_username = '', $ml_cc_pass = '') { require_once SNP_DIR_PATH . '/include/constantcontact/class.cc.php'; $list = array(); if (snp_get_option('ml_cc_username') && snp_get_option('ml_cc_pass') || $ml_cc_username && $ml_cc_pass) { if ($ml_cc_username && $ml_cc_pass) { $cc = new cc($ml_cc_username, $ml_cc_pass); } else { $cc = new cc(snp_get_option('ml_cc_username'), snp_get_option('ml_cc_pass')); } $res = $cc->get_all_lists('lists'); if ($res) { foreach ((array) $res as $v) { $list[$v['id']] = array('name' => $v['Name']); } } else { // Error } } if (count($list) == 0) { $list[0] = array('name' => 'Nothing Found...'); } return $list; }