function dgx_donate_get_country_selector($select_name, $select_initial_value) { $output = "<select class='dgx_donate_country_select' id='" . esc_attr($select_name) . "' name='" . esc_attr($select_name) . "'>"; $countries = dgx_donate_get_countries(); foreach ($countries as $country_code => $country_name) { $selected = ""; if (strcasecmp($select_initial_value, $country_code) == 0) { $selected = " selected "; } $output .= "<option value='" . esc_attr($country_code) . "'" . esc_attr($selected) . ">" . esc_html($country_name) . "</option>"; } $output .= "</select>"; return $output; }
public function setUp() { // get display meta data $post_id = $_GET['post']; $first = get_post_meta($post_id, '_dgx_donate_donor_first_name', true); $last = get_post_meta($post_id, '_dgx_donate_donor_last_name', true); $email = get_post_meta($post_id, '_dgx_donate_donor_email', true); $phone = get_post_meta($post_id, '_dgx_donate_donor_phone', true); $address = get_post_meta($post_id, '_dgx_donate_donor_address', true); $address2 = get_post_meta($post_id, '_dgx_donate_donor_address2', true); $city = get_post_meta($post_id, '_dgx_donate_donor_city', true); $state = get_post_meta($post_id, '_dgx_donate_donor_state', true); $province = get_post_meta($post_id, '_dgx_donate_donor_province', true); $country = get_post_meta($post_id, '_dgx_donate_donor_country', true); $zip = get_post_meta($post_id, '_dgx_donate_donor_zip', true); if (empty($country)) { /* older versions only did US */ $country = 'US'; update_post_meta($post_id, '_dgx_donate_donor_country', 'US'); } // construct basic address info block $html = ""; $html .= $first . ' ' . $last . '<br>'; $html .= $address != '' ? $address . '<br>' : ''; $html .= $address2 != '' ? $address2 . '<br>' : ''; $html .= $city != '' ? $city . ', ' : ''; if ('US' == $country) { $html .= $state != '' ? $state . ' ' : ''; } else { if ('CA' == $country) { $html .= $province != '' ? $province . ' ' : ''; } } if (dgx_donate_country_requires_postal_code($country)) { $html .= $zip != '' ? $zip . '<br>' : ''; } $countries = dgx_donate_get_countries(); $country_name = $countries[$country]; $html .= $country_name != '' ? $country_name . '<br>' : ''; $html .= '<br>'; $html .= $phone != '' ? $phone . '<br>' : ''; $html .= $email != '' ? $email : ''; $this->addSettingFields(array('field_id' => 'donor_info', 'type' => 'donor_info', 'before_field' => $html)); }
header("Content-Type: text/html"); echo "<html>\n"; echo "<head>\n"; echo "<title>Unauthorized</title>\n"; echo "</head>\n"; echo "<body>\n"; echo "<h1>Unauthorized</h1>\n"; echo "<p>You do not have permission to access this page. Did you forget to log in?</p>"; echo "</body>\n"; echo "</html>\n"; } else { $startDate = $_POST['startdate']; $endDate = $_POST['enddate']; $startTimeStamp = strtotime($startDate); $endTimeStamp = strtotime($endDate); $countries = dgx_donate_get_countries(); $firstOne = true; $args = array('numberposts' => '-1', 'post_type' => 'dgx-donation', 'orderby' => 'post_date', 'order' => 'DESC'); $myDonations = get_posts($args); foreach ((array) $myDonations as $myDonation) { $donationID = $myDonation->ID; // Make sure this donation's date falls in the range $okToAdd = true; $year = get_post_meta($donationID, '_dgx_donate_year', true); $month = get_post_meta($donationID, '_dgx_donate_month', true); $day = get_post_meta($donationID, '_dgx_donate_day', true); $donationDate = $month . "/" . $day . "/" . $year; $donationTimeStamp = strtotime($donationDate); if ($donationTimeStamp < $startTimeStamp) { $okToAdd = false; }
function seamless_donations_admin_forms_section_defaults($_setup_object) { $section_desc = 'Select the currency you would like to receive donations in and the default country for the donation form.'; $defaults_section = array('section_id' => 'seamless_donations_admin_forms_section_defaults', 'page_slug' => 'seamless_donations_admin_forms', 'title' => __('Defaults', 'seamless-donations'), 'description' => __($section_desc, 'seamless-donations')); $defaults_section = apply_filters('seamless_donations_admin_forms_section_defaults', $defaults_section); $defaults_options = array(array('field_id' => 'dgx_donate_currency', 'title' => __('Default Currency', 'seamless-donations'), 'type' => 'select', 'default' => 'USD', 'label' => dgx_donate_get_currency_list()), array('field_id' => 'dgx_donate_default_country', 'title' => __('Default Country', 'seamless-donations'), 'type' => 'select', 'default' => 'US', 'label' => dgx_donate_get_countries()), array('field_id' => 'submit', 'type' => 'submit', 'label' => __('Save Defaults', 'seamless-donations'))); $defaults_options = apply_filters('seamless_donations_admin_forms_section_defaults_options', $defaults_options); seamless_donations_process_add_settings_fields_with_options($defaults_options, $_setup_object, $defaults_section); }
public function show_donation_detail($donation_id) { $html = ""; $html .= "<table class='widefat'><tbody>\n"; $year = get_post_meta($donation_id, '_dgx_donate_year', true); $month = get_post_meta($donation_id, '_dgx_donate_month', true); $day = get_post_meta($donation_id, '_dgx_donate_day', true); $time = get_post_meta($donation_id, '_dgx_donate_time', true); $html .= "<tr>"; $html .= "<th>" . esc_html__('Date', 'seamless-donations') . "</th>"; $html .= "<td>" . esc_html($month . "/" . $day . "/" . $year . " " . $time) . "</td></tr>\n"; $amount = get_post_meta($donation_id, '_dgx_donate_amount', true); $currency_code = dgx_donate_get_donation_currency_code($donation_id); $formatted_amount = dgx_donate_get_escaped_formatted_amount($amount, 2, $currency_code); $html .= "<tr>"; $html .= "<th>" . esc_html__('Amount', 'seamless-donations') . "</th>"; $html .= "<td>" . $formatted_amount . "</td></tr>\n"; $add_to_mailing_list = get_post_meta($donation_id, '_dgx_donate_add_to_mailing_list', true); if (!empty($add_to_mailing_list)) { $add_to_mailing_list = __('Yes', 'seamless-donations'); } else { $add_to_mailing_list = __('No', 'seamless-donations'); } $html .= "<tr><th>" . esc_html__('Add to Mailing List?', 'seamless-donations') . "</th>"; $html .= "<td>" . esc_html($add_to_mailing_list) . "</td></tr>\n"; $anonymous = get_post_meta($donation_id, '_dgx_donate_anonymous', true); if (empty($anonymous)) { $anonymous = __('No', 'seamless-donations'); } else { $anonymous = __('Yes', 'seamless-donations'); } $html .= "<tr><th>" . esc_html__('Would like to remain anonymous?', 'seamless-donations') . "</th>"; $html .= "<td>" . esc_html($anonymous) . "</td></tr>\n"; $fund_name = __('Undesignated', 'seamless-donations'); $designated = get_post_meta($donation_id, '_dgx_donate_designated', true); if (!empty($designated)) { $fund_name = get_post_meta($donation_id, '_dgx_donate_designated_fund', true); } $html .= "<tr><th>" . esc_html__('Designated Fund', 'seamless-donations') . "</th>"; $html .= "<td>" . esc_html($fund_name) . "</td></tr>\n"; $employer_match = get_post_meta($donation_id, '_dgx_donate_employer_match', true); if (empty($employer_match)) { $employer_match_message = __('No', 'seamless-donations'); } else { $employer_match_message = __('Yes', 'seamless-donations'); } $html .= "<tr><th>" . esc_html__('Employer Match', 'seamless-donations') . "</th>"; $html .= "<td>" . esc_html($employer_match_message) . "</td></tr>\n"; $employer_name = get_post_meta($donation_id, '_dgx_donate_employer_name', true); if (empty($employer_name)) { $employer_name_message = '-'; } else { $employer_name_message = $employer_name; } $html .= "<tr><th>" . esc_html__('Employer', 'seamless-donations') . "</th>"; $html .= "<td>" . esc_html($employer_name_message) . "</td></tr>\n"; $occupation = get_post_meta($donation_id, '_dgx_donate_occupation', true); if (empty($occupation)) { $occupation_message = '-'; } else { $occupation_message = $occupation; } $html .= "<tr><th>" . esc_html__('Occupation', 'seamless-donations') . "</th>"; $html .= "<td>" . esc_html($occupation_message) . "</td></tr>\n"; $donor_country = get_post_meta($donation_id, '_dgx_donate_donor_country', true); if ('GB' == $donor_country) { $uk_gift_aid = get_post_meta($donation_id, '_dgx_donate_uk_gift_aid', true); if (empty($uk_gift_aid)) { $uk_gift_aid_message = __('No', 'seamless-donations'); } else { $uk_gift_aid_message = __('Yes', 'seamless-donations'); } $html .= "<tr><th>" . esc_html__('UK Gift Aid', 'seamless-donations') . "</th>"; $html .= "<td>" . esc_html($uk_gift_aid_message) . "</td></tr>\n"; } $tribute_gift_message = __('No', 'seamless-donations'); $tribute_gift = get_post_meta($donation_id, '_dgx_donate_tribute_gift', true); if (!empty($tribute_gift)) { $tribute_gift_message = __('Yes', 'seamless-donations') . " - "; $honoree_name = get_post_meta($donation_id, '_dgx_donate_honoree_name', true); $honor_by_email = get_post_meta($donation_id, '_dgx_donate_honor_by_email', true); $honoree_email_name = get_post_meta($donation_id, '_dgx_donate_honoree_email_name', true); $honoree_post_name = get_post_meta($donation_id, '_dgx_donate_honoree_post_name', true); $honoree_email = get_post_meta($donation_id, '_dgx_donate_honoree_email', true); $honoree_address = get_post_meta($donation_id, '_dgx_donate_honoree_address', true); $honoree_city = get_post_meta($donation_id, '_dgx_donate_honoree_city', true); $honoree_state = get_post_meta($donation_id, '_dgx_donate_honoree_state', true); $honoree_province = get_post_meta($donation_id, '_dgx_donate_honoree_province', true); $honoree_zip = get_post_meta($donation_id, '_dgx_donate_honoree_zip', true); $honoree_country = get_post_meta($donation_id, '_dgx_donate_honoree_country', true); $memorial_gift = get_post_meta($donation_id, '_dgx_donate_memorial_gift', true); if (empty($memorial_gift)) { $tribute_gift_message .= __('in honor of', 'seamless-donations') . ' '; } else { $tribute_gift_message .= __('in memory of', 'seamless-donations') . ' '; } $tribute_gift_message .= $honoree_name . "<br/><br/>"; if ('TRUE' == $honor_by_email) { $tribute_gift_message .= __('Send acknowledgement via email to', 'seamless-donations') . '<br/>'; $tribute_gift_message .= esc_html($honoree_email_name) . "<br/>"; $tribute_gift_message .= esc_html($honoree_email) . "<br/>"; } else { $tribute_gift_message .= __('Send acknowledgement via postal mail to', 'seamless-donations') . '<br/>'; $tribute_gift_message .= esc_html($honoree_post_name) . "<br/>"; $tribute_gift_message .= esc_html($honoree_address) . "<br/>"; if (!empty($honoree_city)) { $tribute_gift_message .= esc_html($honoree_city . " "); } if ('US' == $honoree_country) { $tribute_gift_message .= esc_html($honoree_state . " "); } else { if ('CA' == $honoree_country) { $tribute_gift_message .= esc_html($honoree_province . " "); } } if (dgx_donate_country_requires_postal_code($honoree_country)) { $tribute_gift_message .= esc_html(" " . $honoree_zip); } $tribute_gift_message .= "<br/>"; $countries = dgx_donate_get_countries(); $honoree_country_name = $countries[$honoree_country]; $tribute_gift_message .= esc_html($honoree_country_name) . "<br/><br/>"; } } $html .= "<tr>"; $html .= "<th>" . esc_html__('Tribute Gift', 'seamless-donations') . "</th>"; $html .= "<td>" . $tribute_gift_message . "</td></tr>\n"; $payment_method = get_post_meta($donation_id, '_dgx_donate_payment_method', true); $html .= "<tr><th>" . esc_html__('Payment Method', 'seamless-donations') . "</th>"; $html .= "<td>" . esc_html($payment_method) . "</td></tr>\n"; $repeating = get_post_meta($donation_id, '_dgx_donate_repeating', true); $is_repeating_donation = !empty($repeating); if ($is_repeating_donation) { $repeatingText = __('Yes', 'seamless-donations'); } else { $repeatingText = __('No', 'seamless-donations'); } $html .= "<tr><th>" . esc_html__('Repeating', 'seamless-donations') . "</th>"; $html .= "<td>" . esc_html($repeatingText) . "</td></tr>\n"; $session_id = get_post_meta($donation_id, '_dgx_donate_session_id', true); $html .= "<tr><th>" . esc_html__('Session ID', 'seamless-donations') . "</th>"; $html .= "<td>" . esc_html($session_id) . "</td></tr>\n"; $transaction_id = get_post_meta($donation_id, '_dgx_donate_transaction_id', true); $html .= "<tr><th>" . esc_html__('Transaction ID', 'seamless-donations') . "</th>"; $html .= "<td>" . esc_html($transaction_id) . "</td></tr>\n"; $html .= "</tbody></table>\n"; if ($is_repeating_donation) { // Display links to related (same session ID) donations $related_donation_ids = get_donations_by_meta('_dgx_donate_session_id', $session_id, -1); // Unset this donation if present (it probably will be) if (($index = array_search($donation_id, $related_donation_ids)) !== false) { unset($related_donation_ids[$index]); } $html .= "<h3>" . esc_html__('Related Donations', 'seamless-donations') . "</h3>\n"; $html .= "<p class='description'>"; $html .= esc_html__('For repeating donations, displays a list of other donations in the series (subscription)', 'seamless-donations'); $html .= "</p>\n"; // Show the array $html .= "<table class='widefat'><tbody>\n"; if (count($related_donation_ids)) { $html .= "<tr>"; $html .= "<th>" . esc_html__('Date', 'seamless-donations') . "</th>"; $html .= "<th>" . esc_html__('Transaction ID', 'seamless-donations') . "</th></tr>"; foreach ((array) $related_donation_ids as $related_donation_id) { $year = get_post_meta($related_donation_id, '_dgx_donate_year', true); $month = get_post_meta($related_donation_id, '_dgx_donate_month', true); $day = get_post_meta($related_donation_id, '_dgx_donate_day', true); $time = get_post_meta($related_donation_id, '_dgx_donate_time', true); $donation_date = $month . "/" . $day . "/" . $year; $transaction_id = get_post_meta($related_donation_id, '_dgx_donate_transaction_id', true); $donation_detail = seamless_donations_get_donation_detail_link($related_donation_id); $html .= "<tr>"; $html .= "<td><a href='" . esc_url($donation_detail) . "'>" . esc_html($donation_date . " " . $time) . "</a></td>"; $html .= "<td>" . esc_html($transaction_id) . "</td></tr>\n"; } } else { $html .= "<tr>"; $html .= "<th>" . esc_html__('No related donations found', 'seamless-donations') . "</th>"; $html .= "</tr>\n"; } $html .= "</tbody></table>\n"; } return $html; }
static function echo_donor_information($donation_id) { $first_name = get_post_meta($donation_id, '_dgx_donate_donor_first_name', true); $last_name = get_post_meta($donation_id, '_dgx_donate_donor_last_name', true); $company = get_post_meta($donation_id, '_dgx_donate_donor_company_name', true); $address1 = get_post_meta($donation_id, '_dgx_donate_donor_address', true); $address2 = get_post_meta($donation_id, '_dgx_donate_donor_address2', true); $city = get_post_meta($donation_id, '_dgx_donate_donor_city', true); $state = get_post_meta($donation_id, '_dgx_donate_donor_state', true); $province = get_post_meta($donation_id, '_dgx_donate_donor_province', true); $country = get_post_meta($donation_id, '_dgx_donate_donor_country', true); if (empty($country)) { /* older versions only did US */ $country = 'US'; update_post_meta($donation_id, '_dgx_donate_donor_country', 'US'); } $zip = get_post_meta($donation_id, '_dgx_donate_donor_zip', true); $phone = get_post_meta($donation_id, '_dgx_donate_donor_phone', true); $email = get_post_meta($donation_id, '_dgx_donate_donor_email', true); echo "<h3>" . esc_html__('Donor Information', 'dgx-donate') . "</h3>\n"; echo "<table class='widefat'><tbody>\n"; echo "<tr>"; echo "<td>" . esc_html($first_name . " " . $last_name) . "<br/>"; if (!empty($company)) { echo esc_html($company) . "<br/>"; } if (!empty($address1)) { echo esc_html($address1) . "<br/>"; } if (!empty($address2)) { echo esc_html($address2) . "<br/>"; } if (!empty($city)) { echo esc_html($city . " "); } if ('US' == $country) { echo esc_html($state . " "); } else { if ('CA' == $country) { echo esc_html($province . " "); } } if (dgx_donate_country_requires_postal_code($country)) { echo esc_html(" " . $zip); } echo "<br/>"; $countries = dgx_donate_get_countries(); $country_name = $countries[$country]; echo esc_html($country_name) . "<br/><br/>"; if (!empty($phone)) { echo esc_html($phone) . "<br/>"; } if (!empty($email)) { echo esc_html($email); } echo "</td>"; echo "</tr>"; echo "</tbody></table>\n"; }
function seamless_donations_get_billing_section() { $show_address = get_option('dgx_donate_show_donor_address_fields'); if ($show_address != 'true') { return array(); } $default_country = get_option('dgx_donate_default_country'); $countries_array = dgx_donate_get_countries(); $states_array = dgx_donate_get_states(); $provinces_array = dgx_donate_get_provinces(); $postal_code_array = dgx_donate_get_countries_requiring_postal_code(); $postal_code_reveal_array = array(); for ($postal_code_index = 0; $postal_code_index < count($postal_code_array); ++$postal_code_index) { $postal_code_country = $postal_code_array[$postal_code_index]; switch ($postal_code_country) { case 'US': $postal_code_reveal_array['US'] = 'conceal-donor-state conceal-donor-postcode'; break; case 'CA': $postal_code_reveal_array['CA'] = 'conceal-donor-province conceal-donor-postcode'; break; case 'GB': $postal_code_reveal_array['GB'] = 'gift-aid conceal-donor-postcode'; break; default: $postal_code_reveal_array[$postal_code_country] = 'conceal-donor-postcode'; } } $billing_section = array('id' => 'dgx-donate-form-billing-section', 'class' => 'dgx-donate-form-section', 'elements' => array('donation_header' => array('type' => 'static', 'before' => '<h2>', 'after' => '</h2>', 'value' => esc_html__('Donor Address', 'seamless-donations')), '_dgx_donate_donor_address' => array('type' => 'text', 'size' => 20, 'validation' => 'required', 'before' => esc_html__('Address: ', 'seamless-donations')), '_dgx_donate_donor_address2' => array('type' => 'text', 'size' => 20, 'before' => esc_html__('Address 2: ', 'seamless-donations'), 'after' => "<span class='dgx-donate-comment'>" . esc_html__('(optional)', 'seamless-donations') . "</span>"), '_dgx_donate_donor_city' => array('type' => 'text', 'size' => 20, 'validation' => 'required', 'before' => esc_html__('City: ', 'seamless-donations')), '_dgx_donate_donor_state' => array('type' => 'select', 'size' => 1, 'options' => $states_array, 'before' => esc_html__('State : ', 'seamless-donations')), '_dgx_donate_donor_province' => array('type' => 'select', 'size' => 1, 'options' => $provinces_array, 'before' => esc_html__('Province: ', 'seamless-donations')), '_dgx_donate_donor_country' => array('type' => 'select', 'conceal' => 'conceal-donor-state conceal-donor-postcode conceal-donor-province gift-aid', 'reveal' => $postal_code_reveal_array, 'options' => $countries_array, 'value' => $default_country, 'size' => 1, 'before' => esc_html__('Country: ', 'seamless-donations')), '_dgx_donate_donor_zip' => array('type' => 'text', 'size' => 10, 'before' => esc_html__('Postal Code: ', 'seamless-donations')), 'dgx_donate_uk_gift_aid' => array('type' => 'checkbox', 'prompt' => esc_html__("I am a UK taxpayer and my gift qualifies for Gift Aid.", 'seamless-donations')))); // since these fields are visible on page load, we need to make certain fields visible based on country // therefore, we don't want them cloaked, but we want them still interactive, so we'll put them in // class instead. switch ($default_country) { case 'US': $billing_section['elements']['_dgx_donate_donor_state']['class'] = 'conceal-donor-state'; $billing_section['elements']['_dgx_donate_donor_province']['cloak'] = 'conceal-donor-province'; $billing_section['elements']['_dgx_donate_donor_zip']['class'] = 'conceal-donor-postcode'; $billing_section['elements']['dgx_donate_uk_gift_aid']['cloak'] = 'gift-aid'; break; case 'CA': $billing_section['elements']['_dgx_donate_donor_state']['cloak'] = 'conceal-donor-state'; $billing_section['elements']['_dgx_donate_donor_province']['class'] = 'conceal-donor-province'; $billing_section['elements']['_dgx_donate_donor_zip']['class'] = 'conceal-donor-postcode'; $billing_section['elements']['dgx_donate_uk_gift_aid']['cloak'] = 'gift-aid'; break; case 'GB': $billing_section['elements']['_dgx_donate_donor_state']['cloak'] = 'conceal-donor-state'; $billing_section['elements']['_dgx_donate_donor_province']['cloak'] = 'conceal-donor-province'; $billing_section['elements']['_dgx_donate_donor_zip']['class'] = 'conceal-donor-postcode'; $billing_section['elements']['dgx_donate_uk_gift_aid']['class'] = 'gift-aid'; break; default: $billing_section['elements']['_dgx_donate_donor_state']['cloak'] = 'conceal-donor-state'; $billing_section['elements']['_dgx_donate_donor_province']['cloak'] = 'conceal-donor-province'; $billing_section['elements']['_dgx_donate_donor_zip']['cloak'] = 'conceal-donor-postcode'; $billing_section['elements']['dgx_donate_uk_gift_aid']['cloak'] = 'gift-aid'; } $billing_section = apply_filters('seamless_donations_form_billing_section', $billing_section); return $billing_section; }
static function show($donation_id) { // Validate User if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.', 'seamless-donations')); } // Get form arguments $delete_donation = ""; if (isset($_POST['delete_donation'])) { $delete_donation = $_POST['delete_donation']; } // If we have form arguments, we must validate the nonce if (count($_POST)) { $nonce = $_POST['dgx_donate_donation_detail_nonce']; if (!wp_verify_nonce($nonce, 'dgx_donate_donation_detail_nonce')) { wp_die(__('You do not have sufficient permissions to access this page.', 'seamless-donations')); } } echo "<div class='wrap'>\n"; echo "<div id='icon-edit-pages' class='icon32'></div>\n"; echo "<h2>" . esc_html__('Donation Detail', 'seamless-donations') . "</h2>\n"; $donation_deleted = false; if ("true" == $delete_donation) { dgx_donate_debug_log("Donation (ID: {$donation_id}) deleted"); wp_delete_post($donation_id, true); /* true = force delete / bypass trash */ $donation_deleted = true; $message = __('Donation deleted', 'seamless-donations'); } // Display any message if (!empty($message)) { echo "<div id='message' class='updated below-h2'>\n"; echo "<p>" . esc_html($message) . "</p>\n"; echo "</div>\n"; } if (!$donation_deleted) { echo "<div id='col-container'>\n"; echo "<div id='col-right'>\n"; echo "<div class='col-wrap'>\n"; echo "<h3>" . esc_html__('Donation Details', 'seamless-donations') . "</h3>\n"; echo "<table class='widefat'><tbody>\n"; $year = get_post_meta($donation_id, '_dgx_donate_year', true); $month = get_post_meta($donation_id, '_dgx_donate_month', true); $day = get_post_meta($donation_id, '_dgx_donate_day', true); $time = get_post_meta($donation_id, '_dgx_donate_time', true); echo "<tr>"; echo "<th>" . esc_html__('Date', 'seamless-donations') . "</th>"; echo "<td>" . esc_html($month . "/" . $day . "/" . $year . " " . $time) . "</td></tr>\n"; $amount = get_post_meta($donation_id, '_dgx_donate_amount', true); $currency_code = dgx_donate_get_donation_currency_code($donation_id); $formatted_amount = dgx_donate_get_escaped_formatted_amount($amount, 2, $currency_code); echo "<tr>"; echo "<th>" . esc_html__('Amount', 'seamless-donations') . "</th>"; echo "<td>" . $formatted_amount . "</td></tr>\n"; $add_to_mailing_list = get_post_meta($donation_id, '_dgx_donate_add_to_mailing_list', true); if (!empty($add_to_mailing_list)) { $add_to_mailing_list = __('Yes', 'seamless-donations'); } else { $add_to_mailing_list = __('No', 'seamless-donations'); } echo "<tr><th>" . esc_html__('Add to Mailing List?', 'seamless-donations') . "</th>"; echo "<td>" . esc_html($add_to_mailing_list) . "</td></tr>\n"; $anonymous = get_post_meta($donation_id, '_dgx_donate_anonymous', true); if (empty($anonymous)) { $anonymous = __('No', 'seamless-donations'); } else { $anonymous = __('Yes', 'seamless-donations'); } echo "<tr><th>" . esc_html__('Would like to remain anonymous?', 'seamless-donations') . "</th>"; echo "<td>" . esc_html($anonymous) . "</td></tr>\n"; $fund_name = __('Undesignated', 'seamless-donations'); $designated = get_post_meta($donation_id, '_dgx_donate_designated', true); if (!empty($designated)) { $fund_name = get_post_meta($donation_id, '_dgx_donate_designated_fund', true); } echo "<tr><th>" . esc_html__('Designated Fund', 'seamless-donations') . "</th>"; echo "<td>" . esc_html($fund_name) . "</td></tr>\n"; $employer_match = get_post_meta($donation_id, '_dgx_donate_employer_match', true); if (empty($employer_match)) { $employer_match_message = __('No', 'seamless-donations'); } else { $employer_match_message = __('Yes', 'seamless-donations'); } echo "<tr><th>" . esc_html__('Employer Match', 'seamless-donations') . "</th>"; echo "<td>" . esc_html($employer_match_message) . "</td></tr>\n"; $employer_name = get_post_meta($donation_id, '_dgx_donate_employer_name', true); if (empty($employer_name)) { $employer_name_message = '-'; } else { $employer_name_message = $employer_name; } echo "<tr><th>" . esc_html__('Employer', 'seamless-donations') . "</th>"; echo "<td>" . esc_html($employer_name_message) . "</td></tr>\n"; $occupation = get_post_meta($donation_id, '_dgx_donate_occupation', true); if (empty($occupation)) { $occupation_message = '-'; } else { $occupation_message = $occupation; } echo "<tr><th>" . esc_html__('Occupation', 'seamless-donations') . "</th>"; echo "<td>" . esc_html($occupation_message) . "</td></tr>\n"; $donor_country = get_post_meta($donation_id, '_dgx_donate_donor_country', true); if ('GB' == $donor_country) { $uk_gift_aid = get_post_meta($donation_id, '_dgx_donate_uk_gift_aid', true); if (empty($uk_gift_aid)) { $uk_gift_aid_message = __('No', 'seamless-donations'); } else { $uk_gift_aid_message = __('Yes', 'seamless-donations'); } echo "<tr><th>" . esc_html__('UK Gift Aid', 'seamless-donations') . "</th>"; echo "<td>" . esc_html($uk_gift_aid_message) . "</td></tr>\n"; } $tribute_gift_message = __('No', 'seamless-donations'); $tribute_gift = get_post_meta($donation_id, '_dgx_donate_tribute_gift', true); if (!empty($tribute_gift)) { $tribute_gift_message = __('Yes', 'seamless-donations') . " - "; $honoree_name = get_post_meta($donation_id, '_dgx_donate_honoree_name', true); $honor_by_email = get_post_meta($donation_id, '_dgx_donate_honor_by_email', true); $honoree_email_name = get_post_meta($donation_id, '_dgx_donate_honoree_email_name', true); $honoree_post_name = get_post_meta($donation_id, '_dgx_donate_honoree_post_name', true); $honoree_email = get_post_meta($donation_id, '_dgx_donate_honoree_email', true); $honoree_address = get_post_meta($donation_id, '_dgx_donate_honoree_address', true); $honoree_city = get_post_meta($donation_id, '_dgx_donate_honoree_city', true); $honoree_state = get_post_meta($donation_id, '_dgx_donate_honoree_state', true); $honoree_province = get_post_meta($donation_id, '_dgx_donate_honoree_province', true); $honoree_zip = get_post_meta($donation_id, '_dgx_donate_honoree_zip', true); $honoree_country = get_post_meta($donation_id, '_dgx_donate_honoree_country', true); $memorial_gift = get_post_meta($donation_id, '_dgx_donate_memorial_gift', true); if (empty($memorial_gift)) { $tribute_gift_message .= __('in honor of', 'seamless-donations') . ' '; } else { $tribute_gift_message .= __('in memory of', 'seamless-donations') . ' '; } $tribute_gift_message .= $honoree_name . "<br/><br/>"; if ('TRUE' == $honor_by_email) { $tribute_gift_message .= __('Send acknowledgement via email to', 'seamless-donations') . '<br/>'; $tribute_gift_message .= esc_html($honoree_email_name) . "<br/>"; $tribute_gift_message .= esc_html($honoree_email) . "<br/>"; } else { $tribute_gift_message .= __('Send acknowledgement via postal mail to', 'seamless-donations') . '<br/>'; $tribute_gift_message .= esc_html($honoree_post_name) . "<br/>"; $tribute_gift_message .= esc_html($honoree_address) . "<br/>"; if (!empty($honoree_city)) { $tribute_gift_message .= esc_html($honoree_city . " "); } if ('US' == $honoree_country) { $tribute_gift_message .= esc_html($honoree_state . " "); } else { if ('CA' == $honoree_country) { $tribute_gift_message .= esc_html($honoree_province . " "); } } if (dgx_donate_country_requires_postal_code($honoree_country)) { $tribute_gift_message .= esc_html(" " . $honoree_zip); } $tribute_gift_message .= "<br/>"; $countries = dgx_donate_get_countries(); $honoree_country_name = $countries[$honoree_country]; $tribute_gift_message .= esc_html($honoree_country_name) . "<br/><br/>"; } } echo "<tr>"; echo "<th>" . esc_html__('Tribute Gift', 'seamless-donations') . "</th>"; echo "<td>" . $tribute_gift_message . "</td></tr>\n"; $payment_method = get_post_meta($donation_id, '_dgx_donate_payment_method', true); echo "<tr><th>" . esc_html__('Payment Method', 'seamless-donations') . "</th>"; echo "<td>" . esc_html($payment_method) . "</td></tr>\n"; $repeating = get_post_meta($donation_id, '_dgx_donate_repeating', true); $is_repeating_donation = !empty($repeating); if ($is_repeating_donation) { $repeatingText = __('Yes', 'seamless-donations'); } else { $repeatingText = __('No', 'seamless-donations'); } echo "<tr><th>" . esc_html__('Repeating', 'seamless-donations') . "</th>"; echo "<td>" . esc_html($repeatingText) . "</td></tr>\n"; $session_id = get_post_meta($donation_id, '_dgx_donate_session_id', true); echo "<tr><th>" . esc_html__('Session ID', 'seamless-donations') . "</th>"; echo "<td>" . esc_html($session_id) . "</td></tr>\n"; $transaction_id = get_post_meta($donation_id, '_dgx_donate_transaction_id', true); echo "<tr><th>" . esc_html__('Transaction ID', 'seamless-donations') . "</th>"; echo "<td>" . esc_html($transaction_id) . "</td></tr>\n"; echo "</tbody></table>\n"; if ($is_repeating_donation) { // Display links to related (same session ID) donations $related_donation_ids = get_donations_by_meta('_dgx_donate_session_id', $session_id, -1); // Unset this donation if present (it probably will be) if (($index = array_search($donation_id, $related_donation_ids)) !== false) { unset($related_donation_ids[$index]); } echo "<h3>" . esc_html__('Related Donations', 'seamless-donations') . "</h3>\n"; echo "<p class='description'>"; echo esc_html__('For repeating donations, displays a list of other donations in the series (subscription)', 'seamless-donations'); echo "</p>\n"; // Show the array echo "<table class='widefat'><tbody>\n"; if (count($related_donation_ids)) { echo "<tr>"; echo "<th>" . esc_html__('Date', 'seamless-donations') . "</th>"; echo "<th>" . esc_html__('Transaction ID', 'seamless-donations') . "</th></tr>"; foreach ((array) $related_donation_ids as $related_donation_id) { $year = get_post_meta($related_donation_id, '_dgx_donate_year', true); $month = get_post_meta($related_donation_id, '_dgx_donate_month', true); $day = get_post_meta($related_donation_id, '_dgx_donate_day', true); $time = get_post_meta($related_donation_id, '_dgx_donate_time', true); $donation_date = $month . "/" . $day . "/" . $year; $transaction_id = get_post_meta($related_donation_id, '_dgx_donate_transaction_id', true); $donation_detail = dgx_donate_get_donation_detail_link($related_donation_id); echo "<tr>"; echo "<td><a href='" . esc_url($donation_detail) . "'>" . esc_html($donation_date . " " . $time) . "</a></td>"; echo "<td>" . esc_html($transaction_id) . "</td></tr>\n"; } } else { echo "<tr>"; echo "<th>" . esc_html__('No related donations found', 'seamless-donations') . "</th>"; echo "</tr>\n"; } echo "</tbody></table>\n"; } do_action('dgx_donate_donation_detail_right', $donation_id); do_action('dgx_donate_admin_footer'); echo "</div> <!-- col-wrap -->\n"; echo "</div> <!-- col-right -->\n"; echo "<div id=\"col-left\">\n"; echo "<div class=\"col-wrap\">\n"; Dgx_Donate_Admin_Donor_Detail_View::echo_donor_information($donation_id); echo "<h3>" . esc_html__('Delete this Donation', 'seamless-donations') . "</h3>"; echo "<p>" . esc_html__('Click the following button to delete this donation. This will also remove this donation from all reports. This operation cannot be undone.', 'seamless-donations') . "</p>"; if ($is_repeating_donation) { echo "<p><strong>" . esc_html__('This is a repeating donation (subscription). Deleting this donation does NOT end the subscription. The donor will need to log into PayPal to end the subscription.', 'seamless-donations') . "</strong></p>"; } echo "<form method='POST' action=''>\n"; $nonce = wp_create_nonce('dgx_donate_donation_detail_nonce'); echo "<input type='hidden' name='dgx_donate_donation_detail_nonce' value='" . esc_attr($nonce) . "' />\n"; echo "<input type='hidden' name='delete_donation' value='true' />"; echo "<p><input class='button' type='submit' value='" . esc_attr__('Delete Donation', 'seamless-donations') . "'"; echo " onclick=\"return confirm('" . esc_attr('Are you sure you want to delete this donation?', 'seamless-donations') . "');\"></p>\n"; echo "</form>"; do_action('dgx_donate_donation_detail_left', $donation_id); echo "</div> <!-- col-wrap -->\n"; echo "</div> <!-- col-left -->\n"; echo "</div> <!-- col-container -->\n"; } echo "</div> <!-- wrap -->\n"; }