function update_perch_mailchimp($last_update) { $API = new PerchAPI(1.0, 'perch_mailchimp'); include 'PerchMailchimp_Stats.class.php'; include 'PerchMailchimp_Stat.class.php'; $Settings = $API->get('Settings'); $api_key = $Settings->get('perch_mailchimp_api_key')->settingValue(); $list_id = $Settings->get('perch_mailchimp_list_id')->settingValue(); $Stats = new PerchMailchimp_Stats($API); if (!$api_key || $api_key == '' || !$list_id || $list_id == '') { return array('result' => 'FAILED', 'message' => 'API key or list ID not provided in Settings.'); } else { if ($Stats->populate($api_key, $list_id)) { return array('result' => 'OK', 'message' => 'List statistics updated.'); } else { return array('result' => 'WARNING', 'message' => 'Unable to update list statistics.'); } } }
<?php include 'MailChimp.class.php'; include 'PerchMailchimp_Stats.class.php'; include 'PerchMailchimp_Stat.class.php'; $API = new PerchAPI(1.0, 'perch_mailchimp'); $Lang = $API->get('Lang'); // check privs if ($CurrentUser->has_priv('perch_mailchimp')) { $Settings = $API->get('Settings'); $api_key = $Settings->get('perch_mailchimp_api_key')->settingValue(); $list_id = $Settings->get('perch_mailchimp_list_id')->settingValue(); $Data = new PerchMailchimp_Stats($API); $msg = false; if (!$api_key || $api_key == '' || !$list_id || $list_id == '') { //need to set these $msg = '<p class="bd helptext"><a href="' . PERCH_LOGINPATH . '/core/settings/">' . PerchLang::get('You must set your Mailchimp API Key and List ID in Settings.') . '</a></p>'; } else { $display_data = $Data->get_data(); } ?> <div class="widget"> <h2><?php echo $Lang->get('MailChimp'); ?> </h2> <div class=""> <?php if ($msg) { echo $msg;