function constant_contact_generate_rows(array $data) { $reg = ''; foreach ($data as $key => $val) { if (!is_string($val)) { continue; } $alt = empty($alt) ? 'class="alt"' : ''; $key = preg_replace('/(?!^)[[:upper:]]/', ' \\0', $key); $reg .= '<tr ' . $alt . '><th scope="row" id="' . sanitize_title($key) . '" class="manage-column column-name" style=""><span>' . $key . '</span></th><td>' . get_if_not_empty($val, '<span class="description">(Empty)</span>') . '</td></tr>'; } return $reg; }
foreach ($customInformation as $k) { // Contain arrays of CustomField objects foreach ($v->{$k} as $customfield) { $answer = ''; foreach ((array) $customfield->answers as $li) { // if it's a date, treat it as such if (preg_match('/^20[0-9]{2}\\-/', $li)) { $li = constant_contact_event_date($li); } $answer .= '<li>' . $li . '</li>'; } $val = "<ul class='ul-disc'>{$answer}</ul>"; $customs[$customfield->question] = $val; } } $data = array(__('Registration Information', 'ctct') => array(__('Registration Status', 'ctct') => $v->registrationStatus, __('Registration Date', 'ctct') => constant_contact_event_date($v->registrationDate), __('Guest Count', 'ctct') => get_if_not_empty($v->guestCount, 1), __('Payment Status', 'ctct') => $v->paymentStatus, __('Order Amount', 'ctct') => $v->orderAmount, __('Currency Type', 'ctct') => $v->currencyType, __('Payment Type', 'ctct') => $v->paymentType, __('Summary of Costs', 'ctct') => $costs), __('Personal Information', 'ctct') => array(__('Name', 'ctct') => $v->title, __('Email', 'ctct') => get_if_not_empty($v->email, '', "<a href='mailto:{$v->email}'>{$v->email}</a>"), __('Phone', 'ctct') => $v->personalInformation->phone, __('Cell Phone', 'ctct') => $v->personalInformation->cellPhone, __('Address', 'ctct') => constant_contact_create_location($v->personalInformation)), __('Business Information', 'ctct') => array(__('Company', 'ctct') => $v->businessInformation->company, __('Job Title', 'ctct') => $v->businessInformation->jobTitle, __('Department', 'ctct') => $v->businessInformation->department, __('Phone', 'ctct') => $v->businessInformation->phone, __('Fax', 'ctct') => $v->businessInformation->fax, __('Website', 'ctct') => $v->businessInformation->website, __('Blog', 'ctct') => $v->businessInformation->blog, __('Address', 'ctct') => constant_contact_create_location($v->businessInformation)), __('Custom Information', 'ctct') => $customs); echo constant_contact_generate_table($data); ?> <p class="submit"><a href="<?php echo remove_query_arg(array('registrant', 'refresh')); ?> " class="button-primary"><?php _e('Return to Event', 'ctct'); ?> </a> <a href="<?php echo add_query_arg('refresh', 'registrant'); ?> " class="button-secondary alignright" title="<?php _e('Registrant data is stored for 1 hour. Refresh data now.', 'ctct'); ?>
function echo_if_not_empty($check = null, $empty = '', $echo = false) { echo get_if_not_empty($check, $empty, $echo); }