/**
* Displays a MailChimp Signup Form
**/
function mailchimpSF_signup_form($args = array()) {
extract($args);

$mv = get_option('mc_merge_vars');
$ig = get_option('mc_interest_groups');

// See if we have valid Merge Vars
if (!is_array($mv)){
echo $before_widget;
?>

MailChimp Setup’, ‘mailchimp_i18n’); ?>

echo $after_widget;
return;
}

// Get some options
$uid = get_option('mc_user_id');
$list_name = get_option('mc_list_name');

echo $before_widget;

$header = get_option('mc_header_content');
// See if we have custom header content
if (!empty($header)) {
// See if we need to wrap the header content in our own div
if (strlen($header) == strlen(strip_tags($header))){
echo $before_title ? $before_title : '

‘;
echo $header; // don’t escape $header b/c it may have HTML allowed
echo $after_title ? $after_title : ‘

‘;
}
else {
echo $header; // don’t escape $header b/c it may have HTML allowed
}
}

$sub_heading = trim(get_option(‘mc_subheader_content’));
?>

if ($sub_heading) {
?>


}
?>

//don't show the "required" stuff if there's only 1 field to display.
$num_fields = 0;
foreach((array)$mv as $var) {
$opt = 'mc_mv_'.$var['tag'];
if ($var['req'] || get_option($opt) == 'on') {
$num_fields++;
}
}

if (is_array($mv)) {
// head on back to the beginning of the array
reset($mv);
}

// Loop over our vars, and output the ones that are set to display
foreach($mv as $var) {
$opt = 'mc_mv_'.$var['tag'];
// See if that var is set as required, or turned on (for display)
if ($var['req'] || get_option($opt) == 'on') {
?>

* =


}

// Show our Interest groups fields if we have them, and they're set to on
if ($ig && get_option('mc_show_interest_groups') == 'on') {
?>

$i=0; // Set our counter
switch ($ig['form_field']) {
case 'checkbox':
case 'checkboxes':
foreach($ig['groups'] as $interest){
$interest = $interest['name'];
?>

” class=”mc_interest_label”>


$i++;
}
break;
case 'radio':
foreach($ig['groups'] as $interest){
$interest = $interest['name'];
?>

” class=”mc_interest_label”>


$i++;
}
break;
case 'select':
case 'dropdown':
?>

if (!$dc) $dc = "us1";
$host = 'http://'.$dc.'.list-manage.com';
?>