function espresso_display_firstdata_connect_2($payment_data)
{
    global $org_options;
    $firstdata_connect_2_settings = get_option('event_espresso_firstdata_connect_2_settings');
    $payment_data = apply_filters('filter_hook_espresso_prepare_payment_data_for_gateways', $payment_data);
    $payment_data = apply_filters('filter_hook_espresso_get_total_cost', $payment_data);
    require_once 'Fdggutil.php';
    $fdggutil = new Fdggutil($firstdata_connect_2_settings['storename'], $firstdata_connect_2_settings['sharedSecret']);
    $fdggutil->set_timezone($firstdata_connect_2_settings['timezone']);
    $fdggutil->set_chargetotal($payment_data['total_cost']);
    $fdggutil->set_sandbox($firstdata_connect_2_settings['sandbox']);
    $fdggutil->set_returnUrl($org_options['return_url']);
    $fdggutil->set_cancelUrl($org_options['notify_url']);
    $fdggutil->set_attendee_id($payment_data['attendee_id']);
    $fdggutil->set_registration_id($payment_data['registration_id']);
    $fdggutil->set_name($payment_data['fname'] . ' ' . $payment_data['lname']);
    $fdggutil->set_address($payment_data['address']);
    $fdggutil->set_city($payment_data['city']);
    $fdggutil->set_state($payment_data['state']);
    $country_data = getCountryFullData($org_options['organization_country']);
    $fdggutil->set_country($country_data['iso_code_2']);
    $fdggutil->set_zip($payment_data['zip']);
    $fdggutil->set_dateTime();
    $button_url = $firstdata_connect_2_settings['button_url'];
    if (!empty($firstdata_connect_2_settings['bypass_payment_page']) && $firstdata_connect_2_settings['bypass_payment_page'] == 'Y') {
        echo $fdggutil->submitPayment();
    } else {
        echo $fdggutil->submitButton($button_url);
    }
}
Example #2
0
function organization_config_mnu()
{
    global $org_options, $espresso_premium, $espresso_check_for_updates;
    if (isset($_POST['update_org'])) {
        $org_options['organization'] = isset($_POST['org_name']) && !empty($_POST['org_name']) ? stripslashes_deep($_POST['org_name']) : '';
        $org_options['organization_street1'] = isset($_POST['org_street1']) && !empty($_POST['org_street1']) ? $_POST['org_street1'] : '';
        $org_options['organization_street2'] = isset($_POST['org_street2']) && !empty($_POST['org_street2']) ? $_POST['org_street2'] : '';
        $org_options['organization_city'] = isset($_POST['org_city']) && !empty($_POST['org_city']) ? $_POST['org_city'] : '';
        $org_options['organization_state'] = isset($_POST['org_state']) && !empty($_POST['org_state']) ? $_POST['org_state'] : '';
        $org_options['organization_zip'] = isset($_POST['org_zip']) && !empty($_POST['org_zip']) ? $_POST['org_zip'] : '';
        $org_options['organization_country'] = isset($_POST['org_country']) && !empty($_POST['org_country']) ? $_POST['org_country'] : '';
        $org_options['contact_email'] = isset($_POST['email']) && !empty($_POST['email']) ? $_POST['email'] : '';
        $org_options['expire_on_registration_end'] = isset($_POST['expire_on_registration_end']) && !empty($_POST['expire_on_registration_end']) ? $_POST['expire_on_registration_end'] : '';
        $org_options['event_page_id'] = isset($_POST['event_page_id']) && !empty($_POST['event_page_id']) ? $_POST['event_page_id'] : '';
        $org_options['return_url'] = isset($_POST['return_url']) && !empty($_POST['return_url']) ? $_POST['return_url'] : '';
        $org_options['cancel_return'] = isset($_POST['cancel_return']) && !empty($_POST['cancel_return']) ? $_POST['cancel_return'] : '';
        $org_options['notify_url'] = isset($_POST['notify_url']) && !empty($_POST['notify_url']) ? $_POST['notify_url'] : '';
        $org_options['events_in_dasboard'] = isset($_POST['events_in_dasboard']) && !empty($_POST['events_in_dasboard']) ? $_POST['events_in_dasboard'] : '';
        $org_options['default_mail'] = isset($_POST['default_mail']) && !empty($_POST['default_mail']) ? $_POST['default_mail'] : '';
        $org_options['payment_subject'] = isset($_POST['payment_subject']) && !empty($_POST['payment_subject']) ? $_POST['payment_subject'] : '';
        $org_options['payment_message'] = isset($_POST['payment_message']) && !empty($_POST['payment_message']) ? esc_html($_POST['payment_message']) : '';
        $org_options['message'] = isset($_POST['success_message']) && !empty($_POST['success_message']) ? esc_html($_POST['success_message']) : '';
        $org_options['email_before_payment'] = isset($_POST['email_before_payment']) && !empty($_POST['email_before_payment']) ? $_POST['email_before_payment'] : '';
        $org_options['email_fancy_headers'] = isset($_POST['email_fancy_headers']) && !empty($_POST['email_fancy_headers']) ? $_POST['email_fancy_headers'] : '';
        $org_options['use_captcha'] = isset($_POST['use_captcha']) && !empty($_POST['use_captcha']) ? $_POST['use_captcha'] : '';
        $org_options['recaptcha_publickey'] = isset($_POST['recaptcha_publickey']) && !empty($_POST['recaptcha_publickey']) ? $_POST['recaptcha_publickey'] : '';
        $org_options['recaptcha_privatekey'] = isset($_POST['recaptcha_privatekey']) && !empty($_POST['recaptcha_privatekey']) ? $_POST['recaptcha_privatekey'] : '';
        $org_options['recaptcha_theme'] = isset($_POST['recaptcha_theme']) && !empty($_POST['recaptcha_theme']) ? $_POST['recaptcha_theme'] : '';
        $org_options['recaptcha_width'] = isset($_POST['recaptcha_width']) && !empty($_POST['recaptcha_width']) ? $_POST['recaptcha_width'] : '';
        $org_options['recaptcha_language'] = isset($_POST['recaptcha_language']) && !empty($_POST['recaptcha_language']) ? $_POST['recaptcha_language'] : '';
        $org_options['espresso_dashboard_widget'] = isset($_POST['espresso_dashboard_widget']) && !empty($_POST['espresso_dashboard_widget']) ? $_POST['espresso_dashboard_widget'] : '';
        $org_options['time_reg_limit'] = isset($_POST['time_reg_limit']) && !empty($_POST['time_reg_limit']) ? $_POST['time_reg_limit'] : '';
        $org_options['skip_confirmation_page'] = isset($_POST['skip_confirmation_page']) ? $_POST['skip_confirmation_page'] : 'N';
        $org_options['allow_mer_discounts'] = isset($_POST['allow_mer_discounts']) ? $_POST['allow_mer_discounts'] : 'N';
        $org_options['allow_mer_vouchers'] = isset($_POST['allow_mer_vouchers']) ? $_POST['allow_mer_vouchers'] : 'N';
        $org_options['use_attendee_pre_approval'] = isset($_POST['use_attendee_pre_approval']) && !empty($_POST['use_attendee_pre_approval']) ? $_POST['use_attendee_pre_approval'] : '';
        if (!empty($_POST['event_ssl_active'])) {
            $org_options['event_ssl_active'] = isset($_POST['event_ssl_active']) && !empty($_POST['event_ssl_active']) ? $_POST['event_ssl_active'] : '';
        }
        $org_options['show_pending_payment_options'] = isset($_POST['show_pending_payment_options']) && !empty($_POST['show_pending_payment_options']) ? $_POST['show_pending_payment_options'] : '';
        $org_options['use_venue_manager'] = isset($_POST['use_venue_manager']) && !empty($_POST['use_venue_manager']) ? $_POST['use_venue_manager'] : '';
        $org_options['use_personnel_manager'] = isset($_POST['use_personnel_manager']) && !empty($_POST['use_personnel_manager']) ? $_POST['use_personnel_manager'] : '';
        $org_options['use_event_timezones'] = isset($_POST['use_event_timezones']) && !empty($_POST['use_event_timezones']) ? $_POST['use_event_timezones'] : '';
        $org_options['full_logging'] = isset($_POST['full_logging']) && !empty($_POST['full_logging']) ? $_POST['full_logging'] : '';
        $org_options['surcharge'] = isset($_POST['surcharge']) && !empty($_POST['surcharge']) ? $_POST['surcharge'] : '';
        $org_options['surcharge_type'] = isset($_POST['surcharge_type']) && !empty($_POST['surcharge_type']) ? $_POST['surcharge_type'] : '';
        $org_options['surcharge_text'] = isset($_POST['surcharge_text']) && !empty($_POST['surcharge_text']) ? $_POST['surcharge_text'] : '';
        $org_options['show_reg_footer'] = isset($_POST['show_reg_footer']) && !empty($_POST['show_reg_footer']) ? $_POST['show_reg_footer'] : '';
        $org_options['affiliate_id'] = isset($_POST['affiliate_id']) && !empty($_POST['affiliate_id']) ? $_POST['affiliate_id'] : '';
        $org_options['site_license_key'] = isset($_POST['site_license_key']) && !empty($_POST['site_license_key']) ? $_POST['site_license_key'] : '';
        $org_options['default_payment_status'] = isset($_POST['default_payment_status']) && !empty($_POST['default_payment_status']) ? $_POST['default_payment_status'] : '';
        $org_options['default_logo_url'] = isset($_REQUEST['upload_image']) && !empty($_REQUEST['upload_image']) ? $_REQUEST['upload_image'] : '';
        $currency_format = getCountryFullData($org_options['organization_country']);
        switch ($currency_format['iso_code_3']) {
            case 'USA':
                $org_options['currency_symbol'] = '$';
                // US Dollar
                break;
            case 'CHE':
                $org_options['currency_symbol'] = 'Fr.';
                // Swiss Franc
                break;
            case 'AUS':
                $org_options['currency_symbol'] = 'A$';
                // Australian Dollar
                break;
            case 'GBR':
                $org_options['currency_symbol'] = '£';
                // British Pound
                break;
            case 'NOR':
                $org_options['currency_symbol'] = 'kr';
                // Norwegian Krone
                break;
            case 'BRA':
                $org_options['currency_symbol'] = 'R$';
                // Brazillian Real
                break;
            case 'CAN':
                $org_options['currency_symbol'] = 'C$';
                // Canadian Dollar
                break;
            case 'JPN':
                $org_options['currency_symbol'] = '¥';
                // Japanese Yen
                break;
            case 'SWE':
                $org_options['currency_symbol'] = 'kr';
                // Swedish Krona
                break;
            case 'DNK':
                $org_options['currency_symbol'] = 'kr';
                // Danish Krone
                break;
            case 'ZAF':
                $org_options['currency_symbol'] = 'R';
                // South African Rand
                break;
            case 'IND':
                $org_options['currency_symbol'] = 'Rs';
                // Indian Rupee
                break;
            case 'TUR':
                $org_options['currency_symbol'] = 'TL';
                // Turkish Lira
                break;
            case 'NZL':
                $org_options['currency_symbol'] = 'NZ$';
                // New Zealand Dollar
                break;
            case 'HKG':
                $org_options['currency_symbol'] = 'HK$';
                // Hong Kong Dollar
                break;
            case 'SGP':
                $org_options['currency_symbol'] = 'S$';
                // Singapore Dollar
                break;
            case 'POL':
                $org_options['currency_symbol'] = 'zl';
                // Polish Zloty (hex code: zł)
                break;
            case 'HUN':
                $org_options['currency_symbol'] = 'Ft';
                // Hungarian Forint
                break;
            case 'CZE':
                $org_options['currency_symbol'] = 'Kc';
                // Czech Koruna (hex code: Kč)
                break;
            case 'ISR':
                $org_options['currency_symbol'] = 'ILS';
                // Israeli Shekel (hex code: ₪)
                break;
            case 'MEX':
                $org_options['currency_symbol'] = 'Mex$';
                // Mexican Peso
                break;
            case 'MYS':
                $org_options['currency_symbol'] = 'RM';
                // Malaysian Ringgit
                break;
            case 'PHL':
                $org_options['currency_symbol'] = 'PhP';
                // Phillipine Peso (hex code: ₱)
                break;
            case 'TWN':
                $org_options['currency_symbol'] = 'NT$';
                // New Taiwan Dollar
                break;
            case 'THA':
                $org_options['currency_symbol'] = 'THB';
                // Thai Baht (hex code: ฿)
                break;
            case 'AUT' || 'BEL' || 'CYP' || 'EST' || 'FIN' || 'FRA' || 'DEU' || 'GRC' || 'IRL' || 'ITA' || 'LUX' || 'MLT' || 'NLD' || 'PRT' || 'SVK' || 'SVN' || 'ESP' || 'AND' || 'MCO' || 'SMR' || 'VAT' | 'MYT' || 'MNE' || 'XKV' || 'SPM':
                $org_options['currency_symbol'] = 'EUR';
                // use the Euro for all eurozone countries
                break;
            default:
                $org_options['currency_symbol'] = '$';
                break;
        }
        /* if (getCountryZoneId($org_options['organization_country']) == '2') {
        	  $org_options['currency_symbol'] = 'Euro: '; //Creates the symbol for the Euro
        	  } */
        update_option('events_organization_settings', $org_options);
        echo '<div id="message" class="updated fade"><p><strong>' . __('Organization details saved.', 'event_espresso') . '</strong></p></div>';
    }
    $org_options = get_option('events_organization_settings');
    $values = array(array('id' => 'Y', 'text' => __('Yes', 'event_espresso')), array('id' => 'N', 'text' => __('No', 'event_espresso')));
    ?>
	<div class="wrap columns-2">
		<div id="icon-options-event" class="icon32"> </div>
		<h2>
			<?php 
    _e('General Settings', 'event_espresso');
    ?>
		</h2>
		<?php 
    ob_start();
    ?>
		<div class="meta-box-sortables ui-sortable">
			<form class="espresso_form" method="post" action="<?php 
    echo $_SERVER['REQUEST_URI'];
    ?>
">
				<ul id="event_espresso-sortables">
					<li>
						<div class="metabox-holder">
							<div class="postbox">
								<div title="Click to toggle" class="handlediv"><br />
								</div>
								<h3 class="hndle">
									<?php 
    _e('Organization Settings', 'event_espresso');
    ?>
								</h3>
								<div class="inside">
									<div class="padding">
									<h4>
											<?php 
    _e('Company Logo', 'event_espresso');
    ?>
										</h4>
											<ul>
												<li><label for="upload_image">
															<?php 
    _e('Add a Default Logo', 'event_espresso');
    ?>
															<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=espresso_default_logo_info"><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
/images/question-frame.png" width="16" height="16" /></a></label>
															<div id="default-logo-image">
															<?php 
    $org_options['default_logo_url'] = isset($org_options['default_logo_url']) ? $org_options['default_logo_url'] : '';
    ?>
															<input id="upload_image" type="hidden" size="36" name="upload_image" value="<?php 
    echo $org_options['default_logo_url'];
    ?>
" />
															<input id="upload_image_button" type="button" value="Upload Image" />
															<?php 
    if ($org_options['default_logo_url'] != '') {
        ?>
																<p class="default-logo-thumb"><img src="<?php 
        echo $org_options['default_logo_url'];
        ?>
" alt="" /><br />
																<a id="remove-image" href="#" title="Remove this image" onclick="return false;"><?php 
        _e('Remove Image', 'event_espresso');
        ?>
</a></p>
															<?php 
    }
    ?>
														</div>
														<div id="espresso_default_logo_info" class="pop-help" style="display:none">
															<h2>
																<?php 
    _e('Default Logo', 'event_espresso');
    ?>
															</h2>
															<p><?php 
    echo __('The default logo will be used in your custom invoice, ticketing, certificates, and payment templates.', 'event_espresso');
    ?>
</p>
														</div>
														</li>
														<li><h4><?php 
    _e('Contact Information', 'event_espresso');
    ?>
</h4></li>									
											<li>
												<label for="org_name">
													<?php 
    _e('Organization Name:', 'event_espresso');
    ?>
												</label>
												<input type="text" name="org_name" size="45" value="<?php 
    echo stripslashes_deep($org_options['organization']);
    ?>
" />
											</li>
											<li>
												<label for="org_street1">
													<?php 
    _e('Organization Street 1:', 'event_espresso');
    ?>
												</label>
												<input type="text" name="org_street1" size="45" value="<?php 
    echo $org_options['organization_street1'];
    ?>
" />
											</li>
											<li>
												<label for="org_street2">
													<?php 
    _e('Organization Street 2:', 'event_espresso');
    ?>
												</label>
												<input type="text" name="org_street2" size="45" value="<?php 
    echo $org_options['organization_street2'];
    ?>
" />
											</li>
											<li>
												<label for="org_city">
													<?php 
    _e('Organization City:', 'event_espresso');
    ?>
												</label>
												<input type="text" name="org_city" size="45" value="<?php 
    echo $org_options['organization_city'];
    ?>
" />
											</li>
											<li>
												<label for="org_state">
													<?php 
    _e('Organization State:', 'event_espresso');
    ?>
												</label>
												<input type="text" name="org_state" size="45" value="<?php 
    echo $org_options['organization_state'];
    ?>
" />
											</li>
											<li>
												<label for="org_zip">
													<?php 
    _e('Organization Zip/Postal Code:', 'event_espresso');
    ?>
												</label>
												<input type="text" name="org_zip" size="10" value="<?php 
    echo $org_options['organization_zip'];
    ?>
" />
											</li>
											<li>
												<label for="org_country">
													<?php 
    _e('Organization Country:', 'event_espresso');
    ?>
												</label>
												<?php 
    printCountriesSelector("org_country", $org_options['organization_country']);
    ?>
 (<?php 
    echo $org_options['currency_symbol'];
    ?>
)</li>
											<li>
												<label for="email">
													<?php 
    _e('Primary contact email:', 'event_espresso');
    ?>
												</label>
												<input type="text" name="email" size="45" value="<?php 
    echo $org_options['contact_email'];
    ?>
" />
											</li>
											<li>
												<h4>
													<?php 
    _e('Time and Date Settings', 'event_espresso');
    ?>
												</h4>
											</li >
											<li class="time-date">
												<p> <span class="run-in">
														<?php 
    _e('Current Time: ', 'event_espresso');
    ?>
													</span><span class="current-date"> <?php 
    echo date(get_option('date_format') . ' ' . get_option('time_format'));
    ?>
 </span><a class="change-date-time" href="options-general.php" target="_blank">
														<?php 
    _e('Change timezone and date format settings?', 'event_espresso');
    ?>
													</a> </p>
												<p> <span class="important">
														<?php 
    _e('Note:', 'event_espresso');
    ?>
													</span>
													<?php 
    _e('You must set the time zone for your city, or the city closest to you. UTC time will not work.', 'event_espresso');
    ?>
													<a href="http://ee-updates.s3.amazonaws.com/images/time-zone-settings-example.jpg" class="thickbox">View an example?</a> </p>
											</li>
											
										</ul>
										
										<p>
											<input class="button-primary" type="submit" name="Submit" value="<?php 
    _e('Save Options', 'event_espresso');
    ?>
" id="save_organization_saetting_1" />
										</p>
									</div>
								</div>
							</div>
						</div>
					</li>
					<li>
						<div class="metabox-holder">
							<div class="postbox">
								<div title="Click to toggle" class="handlediv"><br />
								</div>
								<h3 class="hndle">
									<?php 
    _e('Page Settings', 'event_espresso');
    ?>
								</h3>
								<div class="inside">
									<div class="padding"> <a name="page_settings" id="page_settings"></a>
										<?php 
    if (empty($org_options['event_page_id']) || empty($org_options['return_url']) || empty($org_options['notify_url']) || empty($org_options['cancel_return'])) {
        espresso_create_default_pages();
    }
    //Check to see if we are using the deprecated SSL option. If we are, recommend updating to WordPress HTTPS (SSL).
    if (!empty($org_options['event_ssl_active']) && $espresso_premium == true && $org_options['event_ssl_active'] == 'Y') {
        echo '<div id="ssl-reg" style="background-color: #ffffe0; border: #e6db55 1px solid; padding:4px;">';
        echo '<p><strong>' . __('Attention!', 'event_espresso') . '</strong><br />' . __('The Secure Payment System has been removed.', 'event_espresso') . '</p>';
        echo '<p>' . __('If your site uses SSL to handle secure transactions. Please install the <a href="http://ee-updates.s3.amazonaws.com/espresso-https.1.0.zip" title="Download Now">Event Espresso SSL/HTTPS</a> plugin now.', 'event_espresso') . ' ' . __('<a href="http://eventespresso.com/forums/2011/09/use-wordpress-https-for-ssl-encryption-on-your-event-espresso-site/" target="_blank">More information here</a>.', 'event_espresso') . '</p>';
        $ssl_values = array(array('id' => 'N', 'text' => __('Yes', 'event_espresso')), array('id' => 'Y', 'text' => __('No', 'event_espresso')));
        ?>
											<label for="event_ssl_active">
												<?php 
        _e('Turn off this message?', 'event_espresso');
        ?>
											</label>
											<br />
											<?php 
        echo select_input('event_ssl_active', $ssl_values, $org_options['event_ssl_active']);
        echo '</div>';
    }
    ?>
										<p>
											<?php 
    _e('The following shortcodes and page settings are required for Event Espresso to function properly. These shortcodes should not be replaced with any other shortcodes. Please view <a href="admin.php?page=support#shortcodes">this page</a> for a list of optional shortcodes.', 'event_espresso');
    ?>
										</p>
										<p>
											<label for="event_page_id">
												<?php 
    _e('Main registration page:', 'event_espresso');
    ?>
											</label>
											<select name="event_page_id">
												<option value="0">
													<?php 
    _e('Main page', 'event_espresso');
    ?>
												</option>
												<?php 
    parent_dropdown($default = $org_options['event_page_id']);
    ?>
											</select>
											<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=registration_page_info"><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
/images/question-frame.png" width="16" height="16" /></a><br />
											<span class="messages"><?php 
    echo sprintf(__("This page should contain the %s shortcode. <br />This page can be hidden from navigation if desired, <br />but should always contain the %s shortcode.", 'event_espresso'), '<span class="highlight">[ESPRESSO_EVENTS]</span>', '[ESPRESSO_EVENTS]');
    ?>
)</span></p>
										<?php 
    ###### Popup help box #######
    ?>
										<div id="registration_page_info" class="pop-help" style="display:none">
											<h2>
												<?php 
    _e('Main Events Page', 'event_espresso');
    ?>
											</h2>
											<p><?php 
    echo sprintf(__('This is the page that displays your events and doubles as your registration page. It is very important that this page always contains the %s shortcode.', 'event_espresso'), '<strong>[ESPRESSO_EVENTS]</strong>');
    ?>
</p>
											<p><?php 
    echo sprintf(__("This page should ALWAYS contain the %s shortcode.", 'event_espresso'), '<strong>[ESPRESSO_EVENTS]</strong>');
    ?>
</p>
										</div>
										<?php 
    ###### close popup help box ######
    ?>
										<p>
											<label for="return_url">
												<?php 
    _e('Auto Return URL (Thank You and Return Payment page):', 'event_espresso');
    ?>
											</label>
											<select name="return_url">
												<option value="0">
													<?php 
    _e('Main page', 'event_espresso');
    ?>
												</option>
												<?php 
    parent_dropdown($default = $org_options['return_url']);
    ?>
											</select>
											<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=return_url_info" target="_blank"><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
/images/question-frame.png" width="16" height="16" /></a><br />
											<span class="messages">(<?php 
    echo sprintf(__("This page should contain the %s shortcode.<br />This page should hidden from your navigation,<br />but still viewable to the public (not password protected.)", 'event_espresso'), '<span class="highlight">[ESPRESSO_PAYMENTS]</span>');
    ?>
 </span></p>
										<?php 
    ##### Popup help box #####
    ?>
										<div id="return_url_info" class="pop-help" style="display:none">
											<h2>
												<?php 
    _e('Auto Return URL', 'event_espresso');
    ?>
											</h2>
											<p>
												<?php 
    _e('The URL to which the payer\'s browser is redirected after completing the payment; for example, a URL on your site that displays a "Thank you for your payment" page.', 'event_espresso');
    ?>
											</p>
											<p><?php 
    echo sprintf(__("This page should contain the %s shortcode.", 'event_espresso'), '<strong>[ESPRESSO_PAYMENTS]</strong>');
    ?>
</p>
											<p><em class="important"><b>
														<?php 
    _e('ATTENTION:', 'event_espresso');
    ?>
													</b><br />
													<?php 
    _e('This page should be hidden from from your navigation menu. Exclude pages by using the "Exclude Pages" plugin from http://wordpress.org/extend/plugins/exclude-pages/ or using the "exclude" parameter in your "wp_list_pages" template tag. Please refer to http://codex.wordpress.org/Template_Tags/wp_list_pages for more inforamation about excluding pages.', 'event_espresso');
    ?>
												</em> </p>
										</div>
										<?php 
    ##### close popup help #####
    ?>
										<p>
											<label for="cancel_return">
												<?php 
    _e('Cancel Return URL (used for cancelled payments):', 'event_espresso');
    ?>
											</label>
											<select name="cancel_return">
												<option value="0">
													<?php 
    _e('Main page', 'event_espresso');
    ?>
												</option>
												<?php 
    parent_dropdown($default = $org_options['cancel_return']);
    ?>
											</select>
											<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=cancel_return_info"><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
/images/question-frame.png" width="16" height="16" /></a><br />
											<span class="messages">(
												<?php 
    echo sprintf(__("This should be a page on your website that contains a cancelled message %s and the %s shortcode. This page should hidden %s from your navigation, but still viewable to the public (not password protected.)", 'event_espresso'), '<br />', '<span class="highlight">[ESPRESSO_CANCELLED]</span>', '<br />');
    ?>
												)</span></p>
										<?php 
    ##### popup help box #####
    ?>
										<div id="cancel_return_info" class="pop-help" style="display:none">
											<h2>
												<?php 
    _e('Cancel Return URL', 'event_espresso');
    ?>
											</h2>
											<p>
												<?php 
    _e('A URL to which the payer\'s browser is redirected if payment is cancelled; for example, a URL on your website that displays a "Payment Canceled" page.', 'event_espresso');
    ?>
											</p>
											<p>
												<?php 
    echo sprintf(__("This should be a page on your website that contains a cancelled message and the %s shortcode.", 'event_espresso'), '<strong>[ESPRESSO_CANCELLED]</strong>');
    ?>
											</p>
											<p><em class="important"><b>
														<?php 
    _e('ATTENTION:', 'event_espresso');
    ?>
													</b><br />
													<?php 
    _e('This page should be hidden from from your navigation menu. Exclude pages by using the "Exclude Pages" plugin from http://wordpress.org/extend/plugins/exclude-pages/ or using the "exclude" parameter in your "wp_list_pages" template tag. Please refer to http://codex.wordpress.org/Template_Tags/wp_list_pages for more inforamation about excluding pages.', 'event_espresso');
    ?>
												</em></p>
										</div>
										<?php 
    ##### close popup help box #####
    ?>
										<p>
											<label for="notify_url">
												<?php 
    _e('Notify URL (used to process payments):', 'event_espresso');
    ?>
											</label>
											<select name="notify_url">
												<option value="0">
													<?php 
    _e('Main page', 'event_espresso');
    ?>
												</option>
												<?php 
    parent_dropdown($default = $org_options['notify_url']);
    ?>
											</select>
											<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=notify_url_info"><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
/images/question-frame.png" width="16" height="16" /></a><br />
											<span class="messages">(<?php 
    echo sprintf(__("This page should contain the %s shortcode.<br />This page should hidden from your navigation, <br />but still viewable to the public (not password protected.)", 'event_espresso'), '<span class="highlight">[ESPRESSO_TXN_PAGE]</span>');
    ?>
</span></p>
										<?php 
    ##### popup help box #####
    ?>
										<div id="notify_url_info" class="pop-help" style="display:none">
											<h2>
												<?php 
    _e('Notify URL', 'event_espresso');
    ?>
											</h2>
											<p>
												<?php 
    _e('The URL to which PayPal posts information about the transaction, in the form of Instant Payment Notification messages.', 'event_espresso');
    ?>
											</p>
											<p> <?php 
    echo sprintf(__('This page should contain the %s shortcode.', 'event_espresso'), '<strong>[ESPRESSO_TXN_PAGE]</strong>');
    ?>
 </p>
											<p><em class="important"><b>
														<?php 
    _e('ATTENTION:', 'event_espresso');
    ?>
													</b><br />
													<?php 
    _e('This page should be hidden from from your navigation menu. Exclude pages by using the "Exclude Pages" plugin from http://wordpress.org/extend/plugins/exclude-pages/ or using the "exclude" parameter in your "wp_list_pages" template tag. Please refer to http://codex.wordpress.org/Template_Tags/wp_list_pages for more inforamation about excluding pages.', 'event_espresso');
    ?>
												</em> </p>
										</div>
										<p>
											<input class="button-primary" type="submit" name="Submit" value="<?php 
    _e('Save Options', 'event_espresso');
    ?>
" id="save_organization_saetting_2" />
										</p>
									</div>
								</div>
							</div>
						</div>
					</li>
					<li>
						<div class="metabox-holder">
							<div class="postbox">
								<div title="Click to toggle" class="handlediv"><br />
								</div>
								<h3 class="hndle">
									<?php 
    _e('Email Settings', 'event_espresso');
    ?>
								</h3>
								<div class="inside">
									<div class="padding"><a name="email-settings" id="email-settings"></a>
										<?php 
    $values = array(array('id' => 'Y', 'text' => __('Yes', 'event_espresso')), array('id' => 'N', 'text' => __('No', 'event_espresso')));
    ?>
										<p>
											<?php 
    _e('Send payment confirmation emails?', 'event_espresso');
    echo select_input('default_mail', $values, $org_options['default_mail']);
    ?>
										</p>
										<p>
											<?php 
    _e('Send registration confirmation emails before payment is received?', 'event_espresso');
    echo select_input('email_before_payment', $values, $org_options['email_before_payment']);
    ?>
										</p>
										<p>
	<?php 
    _e('Use fancy email headers?', 'event_espresso');
    echo select_input('email_fancy_headers', $values, $org_options['email_fancy_headers']);
    ?>
											<a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=fancyemailheaders"><img src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
/images/question-frame.png" width="16" height="16" /></a>
										</p>
												<?php 
    ###### Popup help box #######
    ?>
										<div id="fancyemailheaders" class="pop-help" style="display:none">
											<h2>
	<?php 
    _e('Fancy Email Headers', 'event_espresso');
    ?>
											</h2>
											<p><?php 
    echo sprintf(__("This option enables the use of the email header format %s From: name %s %s Reply-to: name %s %s.", 'event_espresso'), '<br />', '&lt;email@address.com&gt;', '<br />', '&lt;email@address.com&gt;', '<br />');
    ?>
</p>
											<p><?php 
    _e("You should only use this if you know it will not cause email delivery problems. Some servers will not send emails that use this format.", 'event_espresso');
    ?>
</p>
										</div>
										<h4>
												<?php 
    _e('Payment Confirmation Email:', 'event_espresso');
    ?>
										</h4>
										<p>
											<label for="payment_subject">
	<?php 
    _e('Email Subject:', 'event_espresso');
    ?>
											</label>
											<input id="payment_subject" name="payment_subject" size="50" type="text" value="<?php 
    echo stripslashes_deep($org_options['payment_subject']);
    ?>
" />
										</p>

										<div id="payment-conf-email" class="postbox">
											<?php 
    if (function_exists('wp_editor')) {
        $args = array("textarea_rows" => 5, "textarea_name" => "payment_message", "editor_class" => "my_editor_custom");
        wp_editor(espresso_admin_format_content($org_options['payment_message']), "payment_message", $args);
    } else {
        echo '<textarea class="theEditor std-textarea" id="payment_message" name="payment_message">' . espresso_admin_format_content($org_options['payment_message']) . '</textarea>';
    }
    ?>
	<?php 
    /* ?><textarea class="theEditor std-textarea" id="payment_message" name="payment_message"><?php echo espresso_admin_format_content($org_options['payment_message']); ?></textarea><?php */
    ?>
											<table id="payment-confirmation-form" cellspacing="0">
												<tbody>
													<tr>
														<td class="aer-word-count"></td>
														<td class="autosave-info"><span><a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=custom_email_info">
	<?php 
    _e('View Custom Email Tags', 'event_espresso');
    ?>
																</a></span></td>
													</tr>
												</tbody>
											</table>
										</div>
										<h4>
											<?php 
    _e('Default Registration Confirmation Email:', 'event_espresso');
    ?>
										</h4>

										<div id="reg-conf-email" class="postbox">
											<?php 
    if (function_exists('wp_editor')) {
        $args = array("textarea_rows" => 5, "textarea_name" => "success_message", "editor_class" => "my_editor_custom");
        wp_editor(espresso_admin_format_content($org_options['message']), "success_message", $args);
    } else {
        echo '<textarea class="theEditor std-textarea" id="success_message" name="success_message">' . espresso_admin_format_content($org_options['message']) . '</textarea>';
    }
    ?>
	<?php 
    /* ?><textarea class="theEditor std-textarea"  id="reg-conf-email-mce" name="success_message"><?php echo espresso_admin_format_content($org_options['message']); ?></textarea><?php */
    ?>
											<table id="email-confirmation-form" cellspacing="0">
												<tbody>
													<tr>
														<td class="aer-word-count"></td>
														<td class="autosave-info"><span><a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=custom_email_info">
	<?php 
    _e('View Custom Email Tags', 'event_espresso');
    ?>
																</a> | <a class="thickbox" href="#TB_inline?height=300&width=400&inlineId=custom_email_example">
	<?php 
    _e('Example', 'event_espresso');
    ?>
																</a></span></td>
													</tr>
												</tbody>
											</table>
										</div>
										<p>
											<input class="button-primary" type="submit" name="Submit" value="<?php 
    _e('Save Options', 'event_espresso');
    ?>
" id="save_organization_saetting_5" />
										</p>
									</div>
								</div>
							</div>
						</div>
						<div style="clear:both;"></div>
					</li>
					<li>
						<h2>
					<?php 
    _e('Advanced Features', 'event_espresso');
    ?>
						</h2>
						<hr />
					</li>
					<?php 
    if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/recaptcha_form.php') || file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/optional_event_settings.php')) {
        if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/optional_event_settings.php')) {
            echo '<li>';
            require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/optional_event_settings.php';
            echo '</li>';
        }
        if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/recaptcha_form.php')) {
            echo '<li>';
            require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/recaptcha_form.php';
            echo '</li>';
        }
    } else {
        ?>
						<li>
							<div class="metabox-holder">
								<div class="postbox">
									<div title="Click to toggle" class="handlediv"><br />
									</div>
									<h3 class="hndle">
		<?php 
        _e('Optional Event Settings', 'event_espresso');
        ?>
									</h3>
									<div class="inside">
										<div class="padding">
											<p><?php 
        echo __('Please purchase a', 'event_espresso');
        ?>
 <a href="http://eventespresso.com/download/" target="_blank"><?php 
        echo __('support license', 'event_espresso');
        ?>
</a> <?php 
        echo __('to gain access to these features.', 'event_espresso');
        ?>
</p>
											<p>
													<?php 
        _e('Additional features include:', 'event_espresso');
        ?>
											</p>
											<ol>
												<li>
													<?php 
        _e('Upcoming events widget in the admin dashboard', 'event_espresso');
        ?>
												</li>
												<li>
													<?php 
        _e('Registration limits on time slots', 'event_espresso');
        ?>
												</li>
												<li>
													<?php 
        _e('Ability to display short descriptions in the event listings', 'event_espresso');
        ?>
												</li>
												<li>
													<?php 
        _e('Custom post types for events', 'event_espresso');
        ?>
												</li>
												<li>
													<?php 
        _e('Attendee pre-approval feature', 'event_espresso');
        ?>
												</li>
												<li>
													<?php 
        _e('Event Venue/Staff Manager', 'event_espresso');
        ?>
												</li>
												<li>
		<?php 
        _e('Graphical Reports', 'event_espresso');
        ?>
												</li>
											</ol>
										</div>
									</div>
								</div>
							</div>
						</li>
						<li>
							<div class="metabox-holder">
								<div class="postbox">
									<div title="Click to toggle" class="handlediv"><br />
									</div>
									<h3 class="hndle">
		<?php 
        _e('reCAPTCHA Settings', 'event_espresso');
        ?>
									</h3>
									<div class="inside">
										<div class="padding">
											<p><?php 
        echo __('Please purchase a', 'event_espresso');
        ?>
 <a href="http://eventespresso.com/download/" target="_blank"><?php 
        echo __('support license', 'event_espresso');
        ?>
</a> <?php 
        echo __('to gain access to this feature.', 'event_espresso');
        ?>
</p>
											<p> <?php 
        echo sprintf(__('reCAPTCHA helps prevent automated abuse of your site (such as comment spam or bogus registrations) by using a %s to ensure that only humans perform certain actions.', 'event_espresso'), '<a href="http://recaptcha.net/captcha.html">CAPTCHA</a>');
        ?>
 </p>
										</div>
									</div>
								</div>
							</div>
						</li>
						<?php 
    }
    if ($espresso_check_for_updates == true && $espresso_premium == true) {
        ?>

						<li><a name="license_key" id="license_key"></a>
							<div class="metabox-holder">
								<div class="postbox">
									<div title="Click to toggle" class="handlediv"><br />
									</div>
									<h3 class="hndle">
		<?php 
        _e('Support License', 'event_espresso');
        ?>
									</h3>
									<div class="inside">
										<div class="padding">
											<ul>
												<li>
													<label for="site_license_key">
		<?php 
        _e('Site License Key:', 'event_espresso');
        ?>
													</label>
													<input type="text" name="site_license_key" size="45" value="<?php 
        echo isset($org_options['site_license_key']) ? stripslashes_deep($org_options['site_license_key']) : '';
        ?>
" />
												</li>

											</ul>
											<p>
												<input class="button-primary" type="submit" name="Submit" value="<?php 
        _e('Save Options', 'event_espresso');
        ?>
" id="save_organization_saetting_5" />
											</p>
										</div>
									</div>
								</div>
							</div>
						</li>
	<?php 
    }
    ?>
				</ul>
				<input type="hidden" name="update_org" value="update" />
			</form>
		</div>
		<?php 
    $post_content = ob_get_clean();
    espresso_choose_layout($post_content, event_espresso_display_right_column());
    ?>
	</div>
	<script type="text/javascript" charset="utf-8">
		//<![CDATA[
		jQuery(document).ready(function() {
			postboxes.add_postbox_toggles('event_espresso');

			//Logo uploader
			var header_clicked = false;
			jQuery('#upload_image_button').click(function() {
				formfield = jQuery('#upload_image').attr('name');
				tb_show('', 'media-upload.php?type=image&amp;TB_iframe=1');
				jQuery('p.default-logo-thumb').addClass('old');
				header_clicked = true;
				return false;
			});
			window.original_send_to_editor = window.send_to_editor;

			window.send_to_editor = function(html) {
				if(header_clicked) {
					//Remove old image
					jQuery("#upload_image").val('');
					jQuery("p.default-logo-thumb").remove();
					jQuery("p#image-display").remove();
					jQuery('#remove-image').remove();
					
					//Add new image
					imgurl = jQuery('img',html).attr('src');
					jQuery('#' + formfield).val(imgurl);
					jQuery('#default-logo-image').append("<p id='image-display'><img src='"+imgurl+"' alt='' /></p>");
					header_clicked = false;
					tb_remove();
				} else {
					window.original_send_to_editor(html);
				}
			}
			
			// process the remove link in the metabox
			jQuery('#remove-image').click(function(){
				var answer = confirm('<?php 
    _e('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso');
    ?>
');
				if (answer){
					jQuery("#upload_image").val('');
					jQuery("p.default-logo-thumb").remove();
					jQuery("p#image-display").remove();
					jQuery('#remove-image').remove();
				}
				return false;
			});

		});
		//]]>
	</script>
	<?php 
    echo event_espresso_custom_email_info();
    if (!function_exists('wp_editor')) {
        espresso_tiny_mce();
    }
}
function events_payment_page($attendee_id, $price_id = 0, $coupon_code = '', $groupon_code = '')
{
    global $wpdb, $org_options, $simpleMath;
    $today = date("m-d-Y");
    $num_people = 0;
    $Organization = $org_options['organization'];
    $Organization_street1 = $org_options['organization_street1'];
    $Organization_street2 = $org_options['organization_street2'];
    $Organization_city = $org_options['organization_city'];
    $Organization_state = $org_options['organization_state'];
    $Organization_zip = $org_options['organization_zip'];
    $contact = $org_options['contact_email'];
    $registrar = $org_options['contact_email'];
    $currency_format = getCountryFullData($org_options['organization_country']);
    $message = $org_options['message'];
    $return_url = $org_options['return_url'];
    $cancel_return = $org_options['cancel_return'];
    $notify_url = $org_options['notify_url'];
    $event_page_id = $org_options['event_page_id'];
    $attendees = $wpdb->get_results("SELECT * FROM " . EVENTS_ATTENDEE_TABLE . " WHERE id ='" . $attendee_id . "'");
    foreach ($attendees as $attendee) {
        //$attendee_id = $attendee->id;
        $attendee_last = $attendee->lname;
        $attendee_first = $attendee->fname;
        $attendee_address = $attendee->address;
        $attendee_address2 = $attendee->address2;
        $attendee_city = $attendee->city;
        $attendee_state = $attendee->state;
        $attendee_zip = $attendee->zip;
        $attendee_email = $attendee->email;
        //$attendee_organization_name = $attendee->organization_name;
        //$attendee_country = $attendee->country_id;
        $phone = $attendee->phone;
        $attendee_phone = $attendee->phone;
        $date = $attendee->date;
        $quantity = $attendee->quantity;
        $payment_status = $attendee->payment_status;
        $txn_type = $attendee->txn_type;
        //$event_cost = $attendee->amount_pd;
        $payment_date = $attendee->payment_date;
        $event_id = $attendee->event_id;
        $registration_id = $attendee->registration_id;
    }
    //$event_meta = event_espresso_get_event_meta($event_id);
    //Get the questions for the attendee
    $questions = $wpdb->get_results("SELECT ea.answer, eq.question\n\t\t\t\t\t\tFROM " . EVENTS_ANSWER_TABLE . " ea\n\t\t\t\t\t\tLEFT JOIN " . EVENTS_QUESTION_TABLE . " eq ON eq.id = ea.question_id\n\t\t\t\t\t\tWHERE ea.attendee_id = '" . $attendee_id . "' and eq.admin_only = 'N' ORDER BY eq.sequence asc ");
    //echo $wpdb->last_query;
    $display_questions = '';
    foreach ($questions as $question) {
        $display_questions .= '<p>' . $question->question . ':<br /> ' . str_replace(',', '<br />', $question->answer) . '</p>';
    }
    $num_peoplea = $wpdb->get_results("SELECT COUNT(registration_id) FROM " . EVENTS_ATTENDEE_TABLE . " WHERE registration_id ='" . $registration_id . "'", ARRAY_N);
    $num_people = $num_peoplea[0][0];
    //If we are using the number of attendees dropdown, and
    if ($quantity > 1) {
        $num_people = $quantity;
    }
    $events = $wpdb->get_results("SELECT * FROM " . EVENTS_DETAIL_TABLE . " WHERE id ='" . $event_id . "'");
    foreach ($events as $event) {
        //$event_id = $event->id;
        $event_name = stripslashes_deep($event->event_name);
        $event_desc = stripslashes_deep($event->event_desc);
        $event_description = stripslashes_deep($event->event_desc);
        $event_identifier = $event->event_identifier;
        $send_mail = $event->send_mail;
        $active = $event->is_active;
        $conf_mail = $event->conf_mail;
        //$alt_email = $event->alt_email; //This is used to get the alternate email address that a payment can be made to using PayPal
        if (function_exists('event_espresso_coupon_payment_page')) {
            $use_coupon_code = $event->use_coupon_code;
        }
        if (function_exists('event_espresso_groupon_payment_page')) {
            $use_groupon_code = $event->use_groupon_code;
        }
    }
    $attendee_name = stripslashes_deep($attendee_first . ' ' . $attendee_last);
    //Figure out if the person has registered using a price selection
    if (!empty($_REQUEST['price_select']) && $_REQUEST['price_select'] == true) {
        $price_options = explode('|', $_REQUEST['price_option'], 2);
        $price_id = $price_options[0];
        $price_type = $price_options[1];
        $p_id = $price_id;
        $event_cost = event_espresso_get_final_price($price_id, $event_id);
    } elseif ($price_id > 0) {
        $event_cost = event_espresso_get_final_price($price_id, $event_id);
        $p_id = $price_id;
    } else {
        //$event_cost = $_POST['event_cost'];
        $event_cost = event_espresso_get_final_price($_POST['price_id'], $event_id);
        $p_id = $_POST['price_id'];
    }
    //Test the early discount amount to make sure we are getting the right amount
    //print_r(early_discount_amount($event_id, $event_cost));
    $event_price = number_format($event_cost, 2, '.', '');
    $event_price_x_attendees = number_format($event_cost * $num_people, 2, '.', '');
    $event_original_cost = number_format($simpleMath->multiply($event_cost, $num_people), 2, '.', '');
    /*
     * Added for seating chart addon
     */
    /*
     * This code block overrides the cost using seating chart add-on price
     */
    if (defined('ESPRESSO_SEATING_CHART')) {
        if (seating_chart::check_event_has_seating_chart($event_id) !== false) {
            $sc_cost_row = $wpdb->get_row("select sum(sces.purchase_price) as purchase_price from " . EVENTS_SEATING_CHART_EVENT_SEAT_TABLE . " sces inner join " . EVENTS_ATTENDEE_TABLE . " ea on sces.attendee_id = ea.id where ea.registration_id = '{$registration_id}'");
            if ($sc_cost_row !== NULL) {
                $event_cost = number_format($sc_cost_row->purchase_price, 2, '.', '');
                $event_original_cost = $event_cost;
                $event_price_x_attendees = $event_cost;
            }
        }
    }
    /*
     * End seating chart addon
     */
    if (function_exists('event_espresso_coupon_payment_page') && (!empty($_REQUEST['coupon_code']) || !empty($coupon_code))) {
        $event_cost = event_espresso_coupon_payment_page($use_coupon_code, $event_id, $event_original_cost, $attendee_id, $num_people);
        /*
         * at this point , the $event_cost is correct
         * The next line divided by the number of people and reassigned it to the same $even_cost var, making the event cost less
         * I renamed it to another variable
         */
        $event_price_x_attendees = number_format($event_cost, 2, '.', '');
        $coupon_code = $_REQUEST['coupon_code'];
    } else {
        if (function_exists('event_espresso_groupon_payment_page') && ($_REQUEST['groupon_code'] != '' || $coupon_code != '')) {
            $event_cost = event_espresso_groupon_payment_page($use_groupon_code, $event_id, $event_original_cost, $attendee_id);
            $groupon_code = $_REQUEST['groupon_code'];
        } else {
            $event_cost = $event_original_cost;
        }
    }
    if ($num_people != 0) {
        $event_individual_cost = number_format($event_cost / $num_people, 2, '.', '');
    }
    $event_discount_label = $event_original_cost > $event_cost ? ' (' . __('Discount of ', 'event_espresso') . $org_options['currency_symbol'] . number_format($event_original_cost - $event_cost, 2, ".", ",") . __(' applied', 'event_espresso') . ')' : '';
    if ($event_cost == '0.00') {
        $event_cost = '0.00';
        $payment_status = 'Completed';
        $sql = array('amount_pd' => $event_cost, 'payment_status' => $payment_status, 'payment_date' => $today);
        $sql_data = array('%s', '%s', '%s');
    } else {
        $sql = array('amount_pd' => $event_cost, 'payment_status' => $payment_status);
        $sql_data = array('%s', '%s');
    }
    //Add the cost and payment status to the attendee
    $update_id = array('id' => $attendee_id);
    $wpdb->update(EVENTS_ATTENDEE_TABLE, $sql, $update_id, $sql_data, array('%d'));
    //If this is a group registration, we need to make sure all attendees have the same payment status
    if (espresso_count_attendees_for_registration($attendee_id) > 1) {
        $wpdb->query("UPDATE " . EVENTS_ATTENDEE_TABLE . " SET payment_status = '{$payment_status}' WHERE registration_id ='" . $registration_id . "'");
    }
    $display_cost = $event_cost != "0.00" ? $org_options['currency_symbol'] . $event_individual_cost : __('Free', 'event_espresso');
    //Pull in the template
    if (file_exists(EVENT_ESPRESSO_TEMPLATE_DIR . "confirmation_display.php")) {
        require_once EVENT_ESPRESSO_TEMPLATE_DIR . "confirmation_display.php";
        //This is the path to the template file if available
    } else {
        require_once EVENT_ESPRESSO_PLUGINFULLPATH . "templates/confirmation_display.php";
    }
}
Example #4
0
function espresso_display_beanstream($data)
{
    extract($data);
    $states = array(array('id' => 'AB', 'text' => __('Alberta', 'event_espresso')), array('id' => 'AK', 'text' => __('Alaska', 'event_espresso')), array('id' => 'AL', 'text' => __('Alabama', 'event_espresso')), array('id' => 'AS', 'text' => __('American Somoa', 'event_espresso')), array('id' => 'AR', 'text' => __('Arkansas', 'event_espresso')), array('id' => 'AZ', 'text' => __('Arizona', 'event_espresso')), array('id' => 'BC', 'text' => __('British Columbia', 'event_espresso')), array('id' => 'CA', 'text' => __('California', 'event_espresso')), array('id' => 'CO', 'text' => __('Colorado', 'event_espresso')), array('id' => 'CT', 'text' => __('Connecticut', 'event_espresso')), array('id' => 'DC', 'text' => __('District of Columbia', 'event_espresso')), array('id' => 'DE', 'text' => __('Delaware', 'event_espresso')), array('id' => 'FL', 'text' => __('Florida', 'event_espresso')), array('id' => 'GA', 'text' => __('Georgia', 'event_espresso')), array('id' => 'GU', 'text' => __('Guam', 'event_espresso')), array('id' => 'HI', 'text' => __('Hawaii', 'event_espresso')), array('id' => 'IA', 'text' => __('Iowa', 'event_espresso')), array('id' => 'ID', 'text' => __('Idaho', 'event_espresso')), array('id' => 'IL', 'text' => __('Illinois', 'event_espresso')), array('id' => 'IN', 'text' => __('Indiana', 'event_espresso')), array('id' => 'KS', 'text' => __('Kansas', 'event_espresso')), array('id' => 'KY', 'text' => __('Kentucky', 'event_espresso')), array('id' => 'LA', 'text' => __('Louisiana', 'event_espresso')), array('id' => 'MA', 'text' => __('Massachusetts', 'event_espresso')), array('id' => 'MB', 'text' => __('Manitoba', 'event_espresso')), array('id' => 'MD', 'text' => __('Maryland', 'event_espresso')), array('id' => 'ME', 'text' => __('Maine', 'event_espresso')), array('id' => 'MI', 'text' => __('Michigan', 'event_espresso')), array('id' => 'FM', 'text' => __('Micronesia', 'event_espresso')), array('id' => 'MN', 'text' => __('Minnesota', 'event_espresso')), array('id' => 'MO', 'text' => __('Missouri', 'event_espresso')), array('id' => 'MS', 'text' => __('Mississippi', 'event_espresso')), array('id' => 'MT', 'text' => __('Montana', 'event_espresso')), array('id' => 'NB', 'text' => __('New Brunswick', 'event_espresso')), array('id' => 'NC', 'text' => __('North Carolina', 'event_espresso')), array('id' => 'ND', 'text' => __('North Dakota', 'event_espresso')), array('id' => 'NE', 'text' => __('Nebraska', 'event_espresso')), array('id' => 'NL', 'text' => __('Newfoundland/Labrador', 'event_espresso')), array('id' => 'NH', 'text' => __('New Hampshire', 'event_espresso')), array('id' => 'NJ', 'text' => __('New Jersey', 'event_espresso')), array('id' => 'NM', 'text' => __('New Mexico', 'event_espresso')), array('id' => 'NS', 'text' => __('Nova Scotia', 'event_espresso')), array('id' => 'NT', 'text' => __('Northwest Territories', 'event_espresso')), array('id' => 'NU', 'text' => __('Nunavut', 'event_espresso')), array('id' => 'NV', 'text' => __('Nevada', 'event_espresso')), array('id' => 'NY', 'text' => __('New York', 'event_espresso')), array('id' => 'OH', 'text' => __('Ohio', 'event_espresso')), array('id' => 'OK', 'text' => __('Oklahoma', 'event_espresso')), array('id' => 'ON', 'text' => __('Ontario', 'event_espresso')), array('id' => 'OR', 'text' => __('Oregon', 'event_espresso')), array('id' => 'PA', 'text' => __('Pennsylvania', 'event_espresso')), array('id' => 'PE', 'text' => __('Prince Edward Island', 'event_espresso')), array('id' => 'PR', 'text' => __('Puerto Rico', 'event_espresso')), array('id' => 'QC', 'text' => __('Quebec', 'event_espresso')), array('id' => 'RI', 'text' => __('Rhode Island', 'event_espresso')), array('id' => 'SC', 'text' => __('South Carolina', 'event_espresso')), array('id' => 'SD', 'text' => __('South Dakota', 'event_espresso')), array('id' => 'SK', 'text' => __('Saskatchewan', 'event_espresso')), array('id' => 'TN', 'text' => __('Tennessee', 'event_espresso')), array('id' => 'TX', 'text' => __('Texas', 'event_espresso')), array('id' => 'UT', 'text' => __('Utah', 'event_espresso')), array('id' => 'VA', 'text' => __('Virginia', 'event_espresso')), array('id' => 'VI', 'text' => __('Virgin Islands', 'event_espresso')), array('id' => 'VT', 'text' => __('Vermont', 'event_espresso')), array('id' => 'WA', 'text' => __('Washington', 'event_espresso')), array('id' => 'WI', 'text' => __('Wisconsin', 'event_espresso')), array('id' => 'WV', 'text' => __('West Virginia', 'event_espresso')), array('id' => 'WY', 'text' => __('Wyoming', 'event_espresso')), array('id' => 'YT', 'text' => __('Yukon', 'event_espresso')), array('id' => '--', 'text' => __('Outside U.S./Canada', 'event_espresso')));
    $countries = array(array('id' => 'AF', 'text' => __('Afghanistan', 'event_espresso')), array('id' => 'AR', 'text' => __('Argentina', 'event_espresso')), array('id' => 'AX', 'text' => __('land Islands', 'event_espresso')), array('id' => 'AL', 'text' => __('Albania', 'event_espresso')), array('id' => 'DZ', 'text' => __('Algeria', 'event_espresso')), array('id' => 'AS', 'text' => __('American Samoa', 'event_espresso')), array('id' => 'AD', 'text' => __('Andorra', 'event_espresso')), array('id' => 'AO', 'text' => __('Angola', 'event_espresso')), array('id' => 'AI', 'text' => __('Anguilla', 'event_espresso')), array('id' => 'AQ', 'text' => __('Antarctica', 'event_espresso')), array('id' => 'AG', 'text' => __('Antigua and Barbuda', 'event_espresso')), array('id' => 'AM', 'text' => __('Armenia', 'event_espresso')), array('id' => 'AW', 'text' => __('Aruba', 'event_espresso')), array('id' => 'AU', 'text' => __('Australia', 'event_espresso')), array('id' => 'AT', 'text' => __('Austria', 'event_espresso')), array('id' => 'AZ', 'text' => __('Azerbaijan', 'event_espresso')), array('id' => 'BS', 'text' => __('Bahamas', 'event_espresso')), array('id' => 'BH', 'text' => __('Bahrain', 'event_espresso')), array('id' => 'BD', 'text' => __('Bangladesh', 'event_espresso')), array('id' => 'BB', 'text' => __('Barbados', 'event_espresso')), array('id' => 'BY', 'text' => __('Belarus', 'event_espresso')), array('id' => 'BE', 'text' => __('Belgium', 'event_espresso')), array('id' => 'BZ', 'text' => __('Belize IR', 'event_espresso')), array('id' => 'BJ', 'text' => __('Benin', 'event_espresso')), array('id' => 'BM', 'text' => __('Bermuda', 'event_espresso')), array('id' => 'BT', 'text' => __('Bhutan', 'event_espresso')), array('id' => 'BO', 'text' => __('Bolivia', 'event_espresso')), array('id' => 'BA', 'text' => __('Bosnia and Herzegovina', 'event_espresso')), array('id' => 'BW', 'text' => __('Botswana', 'event_espresso')), array('id' => 'BV', 'text' => __('Bouvet Island', 'event_espresso')), array('id' => 'BR', 'text' => __('Brazil', 'event_espresso')), array('id' => 'IO', 'text' => __('British Indian Ocean Territory', 'event_espresso')), array('id' => 'BN', 'text' => __('Brunei Darussalam', 'event_espresso')), array('id' => 'BG', 'text' => __('Bulgaria', 'event_espresso')), array('id' => 'BF', 'text' => __('Burkina Faso', 'event_espresso')), array('id' => 'BI', 'text' => __('Burundi', 'event_espresso')), array('id' => 'KH', 'text' => __('Cambodia', 'event_espresso')), array('id' => 'CM', 'text' => __('Cameroon', 'event_espresso')), array('id' => 'CA', 'text' => __('Canada', 'event_espresso')), array('id' => 'CV', 'text' => __('Cape Verde', 'event_espresso')), array('id' => 'KY', 'text' => __('Cayman Islands', 'event_espresso')), array('id' => 'CF', 'text' => __('Central African Republic', 'event_espresso')), array('id' => 'TD', 'text' => __('Chad', 'event_espresso')), array('id' => 'CL', 'text' => __('Chile', 'event_espresso')), array('id' => 'CN', 'text' => __('China', 'event_espresso')), array('id' => 'CX', 'text' => __('Christmas Island', 'event_espresso')), array('id' => 'CC', 'text' => __(' Cocos (Keeling) Islands', 'event_espresso')), array('id' => 'CO', 'text' => __('Columbia', 'event_espresso')), array('id' => 'KM', 'text' => __('Comoros', 'event_espresso')), array('id' => 'CG', 'text' => __('Congo', 'event_espresso')), array('id' => 'CD', 'text' => __('Congo, The Democratic Republic of the', 'event_espresso')), array('id' => 'CK', 'text' => __('Cook Islands', 'event_espresso')), array('id' => 'CR', 'text' => __('Costa Rica', 'event_espresso')), array('id' => 'CI', 'text' => __('Cote dÕIvoire ÐIvory Coast', 'event_espresso')), array('id' => 'HR', 'text' => __('Croatia', 'event_espresso')), array('id' => 'CU', 'text' => __('Cuba', 'event_espresso')), array('id' => 'CY', 'text' => __('Cyprus', 'event_espresso')), array('id' => 'CZ', 'text' => __('Czech Republic', 'event_espresso')), array('id' => 'DK', 'text' => __('Denmark', 'event_espresso')), array('id' => 'DJ', 'text' => __('Djibouti', 'event_espresso')), array('id' => 'DM', 'text' => __('Dominica', 'event_espresso')), array('id' => 'DO', 'text' => __('Dominican Republic', 'event_espresso')), array('id' => 'TL', 'text' => __('East Timor', 'event_espresso')), array('id' => 'EC', 'text' => __('Ecuador', 'event_espresso')), array('id' => 'EG', 'text' => __('Egypt', 'event_espresso')), array('id' => 'SV', 'text' => __('El Salvador', 'event_espresso')), array('id' => 'GQ', 'text' => __('Equatorial Guinea', 'event_espresso')), array('id' => 'ER', 'text' => __('Eritrea', 'event_espresso')), array('id' => 'EE', 'text' => __('Estonia', 'event_espresso')), array('id' => 'ET', 'text' => __('Ethiopia', 'event_espresso')), array('id' => 'FK', 'text' => __('Falkland Islands (Malvinas)', 'event_espresso')), array('id' => 'FO', 'text' => __('Faroe Islands', 'event_espresso')), array('id' => 'FJ', 'text' => __('Fiji', 'event_espresso')), array('id' => 'FI', 'text' => __('Finland', 'event_espresso')), array('id' => 'FR', 'text' => __('France', 'event_espresso')), array('id' => 'GF', 'text' => __('French Guiana', 'event_espresso')), array('id' => 'PF', 'text' => __('French Polynesia', 'event_espresso')), array('id' => 'TF', 'text' => __('French Southern Territories', 'event_espresso')), array('id' => 'GA', 'text' => __('Gabon', 'event_espresso')), array('id' => 'GM', 'text' => __('Gambia', 'event_espresso')), array('id' => 'GE', 'text' => __('Georgia', 'event_espresso')), array('id' => 'DE', 'text' => __('Germany', 'event_espresso')), array('id' => 'GH', 'text' => __('Ghana', 'event_espresso')), array('id' => 'GI', 'text' => __('Gibraltar', 'event_espresso')), array('id' => 'GB', 'text' => __('Great Britain', 'event_espresso')), array('id' => 'GR', 'text' => __('Greece', 'event_espresso')), array('id' => 'GL', 'text' => __('Greenland', 'event_espresso')), array('id' => 'GD', 'text' => __('Grenada', 'event_espresso')), array('id' => 'GP', 'text' => __('Guadeloupe', 'event_espresso')), array('id' => 'GU', 'text' => __('Guam', 'event_espresso')), array('id' => 'GT', 'text' => __('Guatemala', 'event_espresso')), array('id' => 'GN', 'text' => __('Guinea', 'event_espresso')), array('id' => 'GW', 'text' => __('Guinea Bissau', 'event_espresso')), array('id' => 'GY', 'text' => __('Guyana', 'event_espresso')), array('id' => 'HT', 'text' => __('Haiti', 'event_espresso')), array('id' => 'HM', 'text' => __('Heard and McDonald Islands', 'event_espresso')), array('id' => 'HN', 'text' => __('Honduras', 'event_espresso')), array('id' => 'HK', 'text' => __('Hong Kong', 'event_espresso')), array('id' => 'HU', 'text' => __('Hungary', 'event_espresso')), array('id' => 'IS', 'text' => __('Iceland', 'event_espresso')), array('id' => 'IN', 'text' => __('India', 'event_espresso')), array('id' => 'ID', 'text' => __('Indonesia', 'event_espresso')), array('id' => 'IR', 'text' => __('Iran, Islamic Republic of', 'event_espresso')), array('id' => 'IQ', 'text' => __('Iraq', 'event_espresso')), array('id' => 'IE', 'text' => __('Ireland', 'event_espresso')), array('id' => 'IL', 'text' => __('Israel', 'event_espresso')), array('id' => 'IT', 'text' => __('Italy', 'event_espresso')), array('id' => 'JM', 'text' => __('Jamaica', 'event_espresso')), array('id' => 'JP', 'text' => __('Japan', 'event_espresso')), array('id' => 'JO', 'text' => __('Jordan', 'event_espresso')), array('id' => 'KZ', 'text' => __('Kazakhstan', 'event_espresso')), array('id' => 'KE', 'text' => __('Kenya', 'event_espresso')), array('id' => 'KI', 'text' => __('Kiribati', 'event_espresso')), array('id' => 'KP', 'text' => __('Korea, Democratic PeopleÕs Republic', 'event_espresso')), array('id' => 'KR', 'text' => __('Korea, Republic of', 'event_espresso')), array('id' => 'KW', 'text' => __('Kuwait', 'event_espresso')), array('id' => 'KG', 'text' => __('Kyrgyzstan', 'event_espresso')), array('id' => 'LA', 'text' => __('Lao PeopleÕs Democratic Republic', 'event_espresso')), array('id' => 'LV', 'text' => __('Latvia', 'event_espresso')), array('id' => 'LB', 'text' => __('Lebanon', 'event_espresso')), array('id' => 'LI', 'text' => __('Liechtenstein', 'event_espresso')), array('id' => 'LS', 'text' => __('Lesotho', 'event_espresso')), array('id' => 'LR', 'text' => __('Liberia', 'event_espresso')), array('id' => 'LY', 'text' => __('Libyan Arab Jamahiriya', 'event_espresso')), array('id' => 'LT', 'text' => __('Lithuania', 'event_espresso')), array('id' => 'LU', 'text' => __('Luxembourg', 'event_espresso')), array('id' => 'MO', 'text' => __('Macau', 'event_espresso')), array('id' => 'MK', 'text' => __('Macedonia, Former Yugoslav Republic of', 'event_espresso')), array('id' => 'MG', 'text' => __('Madagascar', 'event_espresso')), array('id' => 'MW', 'text' => __('Malawi', 'event_espresso')), array('id' => 'MY', 'text' => __('Malaysia', 'event_espresso')), array('id' => 'MV', 'text' => __('Maldives', 'event_espresso')), array('id' => 'ML', 'text' => __('Mali', 'event_espresso')), array('id' => 'MT', 'text' => __('Malta', 'event_espresso')), array('id' => 'MH', 'text' => __('Marshall Islands', 'event_espresso')), array('id' => 'MQ', 'text' => __('Martinique', 'event_espresso')), array('id' => 'MR', 'text' => __('Mauritania', 'event_espresso')), array('id' => 'MU', 'text' => __('Mauritius', 'event_espresso')), array('id' => 'YT', 'text' => __('Mayotte', 'event_espresso')), array('id' => 'MX', 'text' => __('Mexico', 'event_espresso')), array('id' => 'FM', 'text' => __('Micronesia, Federated States of', 'event_espresso')), array('id' => 'MD', 'text' => __('Moldova, Republic of', 'event_espresso')), array('id' => 'MC', 'text' => __('Monaco', 'event_espresso')), array('id' => 'MN', 'text' => __('Mongolia', 'event_espresso')), array('id' => 'MS', 'text' => __('Montserrat', 'event_espresso')), array('id' => 'MA', 'text' => __('Morocco', 'event_espresso')), array('id' => 'MZ', 'text' => __('Mozambique', 'event_espresso')), array('id' => 'MM', 'text' => __('Myanmar', 'event_espresso')), array('id' => 'NA', 'text' => __('Namibia', 'event_espresso')), array('id' => 'NR', 'text' => __('Nauru', 'event_espresso')), array('id' => 'NP', 'text' => __('Nepal', 'event_espresso')), array('id' => 'NL', 'text' => __('Netherlands', 'event_espresso')), array('id' => 'AN', 'text' => __('Netherlands Antilles', 'event_espresso')), array('id' => 'NC', 'text' => __('New Caledonia', 'event_espresso')), array('id' => 'NZ', 'text' => __('New Zealand', 'event_espresso')), array('id' => 'NI', 'text' => __('Nicaragua', 'event_espresso')), array('id' => 'NE', 'text' => __('Niger', 'event_espresso')), array('id' => 'NG', 'text' => __('Nigeria', 'event_espresso')), array('id' => 'NU', 'text' => __('Niue', 'event_espresso')), array('id' => 'NF', 'text' => __('Norfolk Island', 'event_espresso')), array('id' => 'MP', 'text' => __('Northern Mariana Islands', 'event_espresso')), array('id' => 'NO', 'text' => __('Norway', 'event_espresso')), array('id' => 'OM', 'text' => __('Oman', 'event_espresso')), array('id' => 'PK', 'text' => __('Pakistan', 'event_espresso')), array('id' => 'PW', 'text' => __('Palau', 'event_espresso')), array('id' => 'PS', 'text' => __('Palestinian Territory, Occupied', 'event_espresso')), array('id' => 'PA', 'text' => __('Panama', 'event_espresso')), array('id' => 'PG', 'text' => __('Papua New Guinea', 'event_espresso')), array('id' => 'PY', 'text' => __('Paraguay', 'event_espresso')), array('id' => 'PE', 'text' => __('Peru', 'event_espresso')), array('id' => 'PH', 'text' => __('Philippines', 'event_espresso')), array('id' => 'PN', 'text' => __('Pitcairn', 'event_espresso')), array('id' => 'PL', 'text' => __('Poland', 'event_espresso')), array('id' => 'PT', 'text' => __('Portugal', 'event_espresso')), array('id' => 'PR', 'text' => __('Puerto Rico', 'event_espresso')), array('id' => 'QA', 'text' => __('Qatar', 'event_espresso')), array('id' => 'RE', 'text' => __('Reunion', 'event_espresso')), array('id' => 'RO', 'text' => __('Romania', 'event_espresso')), array('id' => 'RU', 'text' => __('Russian Federation', 'event_espresso')), array('id' => 'RW', 'text' => __('Rwanda', 'event_espresso')), array('id' => 'KN', 'text' => __('Saint Kitts and Nevis', 'event_espresso')), array('id' => 'LC', 'text' => __('Saint Lucia', 'event_espresso')), array('id' => 'VC', 'text' => __('Saint Vincent and the Grenadines', 'event_espresso')), array('id' => 'WX', 'text' => __('Samoa', 'event_espresso')), array('id' => 'SM', 'text' => __('San Marino', 'event_espresso')), array('id' => 'ST', 'text' => __('Sao Tome and Principe', 'event_espresso')), array('id' => 'SA', 'text' => __('Saudi Arabia', 'event_espresso')), array('id' => 'SN', 'text' => __('Senegal', 'event_espresso')), array('id' => 'CS', 'text' => __('Serbia and Montenegro', 'event_espresso')), array('id' => 'SC', 'text' => __('Seychelles', 'event_espresso')), array('id' => 'SL', 'text' => __('Sierra Leone', 'event_espresso')), array('id' => 'SG', 'text' => __('Singapore', 'event_espresso')), array('id' => 'SK', 'text' => __('Slovakia', 'event_espresso')), array('id' => 'SI', 'text' => __('Slovenia', 'event_espresso')), array('id' => 'SB', 'text' => __('Solomon Islands', 'event_espresso')), array('id' => 'SO', 'text' => __('Somalia', 'event_espresso')), array('id' => 'ZA', 'text' => __('South Africa', 'event_espresso')), array('id' => 'GS', 'text' => __('South Georgia Ð South Sandwich Islands', 'event_espresso')), array('id' => 'ES', 'text' => __('Spain', 'event_espresso')), array('id' => 'LK', 'text' => __('Sri Lanka', 'event_espresso')), array('id' => 'SH', 'text' => __('St. Helena', 'event_espresso')), array('id' => 'PM', 'text' => __('St. Pierre and Miquelon', 'event_espresso')), array('id' => 'SD', 'text' => __('Sudan', 'event_espresso')), array('id' => 'SR', 'text' => __('Suriname', 'event_espresso')), array('id' => 'SJ', 'text' => __('Svalbard and Jan Mayen SZ Swaziland', 'event_espresso')), array('id' => 'SE', 'text' => __('Sweden', 'event_espresso')), array('id' => 'CH', 'text' => __('Switzerland', 'event_espresso')), array('id' => 'SY', 'text' => __('Syrian Arab Republic TW Taiwan', 'event_espresso')), array('id' => 'TJ', 'text' => __('Tajikistan', 'event_espresso')), array('id' => 'TZ', 'text' => __('Tanzania, United Republic of TH Thailand', 'event_espresso')), array('id' => 'TG', 'text' => __('Togo', 'event_espresso')), array('id' => 'TK', 'text' => __('Tokelau', 'event_espresso')), array('id' => 'TO', 'text' => __('Tonga', 'event_espresso')), array('id' => 'TT', 'text' => __('Trinidad and Tobago', 'event_espresso')), array('id' => 'TN', 'text' => __('Tunisia', 'event_espresso')), array('id' => 'TR', 'text' => __('Turkey', 'event_espresso')), array('id' => 'TM', 'text' => __('Turkmenistan', 'event_espresso')), array('id' => 'TC', 'text' => __('Turks and Caicos Islands', 'event_espresso')), array('id' => 'TV', 'text' => __('Tuvalu', 'event_espresso')), array('id' => 'UG', 'text' => __('Uganda', 'event_espresso')), array('id' => 'UA', 'text' => __('Ukraine', 'event_espresso')), array('id' => 'AE', 'text' => __('United Arab Emirates', 'event_espresso')), array('id' => 'US', 'text' => __('United States', 'event_espresso')), array('id' => 'UM', 'text' => __('United States Minor Outlying Islands', 'event_espresso')), array('id' => 'UY', 'text' => __('Uruguay', 'event_espresso')), array('id' => 'UZ', 'text' => __('Uzbekistan', 'event_espresso')), array('id' => 'VU', 'text' => __('Vanuatu', 'event_espresso')), array('id' => 'VA', 'text' => __('Vatican City state', 'event_espresso')), array('id' => 'VE', 'text' => __('Venezuela', 'event_espresso')), array('id' => 'VN', 'text' => __('Viet Nam', 'event_espresso')), array('id' => 'VG', 'text' => __('Virgin Islands (British)', 'event_espresso')), array('id' => 'VI', 'text' => __('Virgin Islands (US)', 'event_espresso')), array('id' => 'WF', 'text' => __('Wallis and Futuna', 'event_espresso')), array('id' => 'EH', 'text' => __('Western Sahara', 'event_espresso')), array('id' => 'YE', 'text' => __('Yemen', 'event_espresso')), array('id' => 'ZM', 'text' => __('Zambia', 'event_espresso')), array('id' => 'ZW', 'text' => __('Zimbabwe', 'event_espresso')));
    global $org_options;
    $beanstream_settings = get_option('event_espresso_beanstream_settings');
    $use_sandbox = $beanstream_settings['beanstream_use_sandbox'];
    if ($beanstream_settings['force_ssl_return']) {
        $home = str_replace('http://', 'https://', home_url());
    } else {
        $home = home_url();
    }
    wp_register_script('beanstream', EVENT_ESPRESSO_PLUGINFULLURL . 'gateways/beanstream/beanstream.js', array('jquery.validate.js'), '1.0', TRUE);
    wp_enqueue_script('beanstream');
    ?>
	<div id="beanstream-payment-option-dv" class="payment-option-dv">

		<a id="beanstream-payment-option-lnk" class="payment-option-lnk display-the-hidden" rel="beanstream-payment-option-form" style="cursor:pointer;">
			<img alt="Pay using Beanstream" src="<?php 
    echo EVENT_ESPRESSO_PLUGINFULLURL;
    ?>
gateways/beanstream/beanstream-logo.png">
		</a>	
	
		<div id="beanstream-payment-option-form-dv" class="hide-if-js">
			<div class="event-display-boxes">
			<?php 
    if ($use_sandbox) {
        ?>
				<div id="sandbox-panel">
					<h2 class="section-title"><?php 
        _e('Beanstream Sandbox Mode', 'event_espresso');
        ?>
</h2>
					<p>Test Master Card # 5100000010001004</p>
					<p>Exp: 10/2012</p>
					<p>CVV2: 123 </p>
					<h3 style="color:#ff0000;" title="Payments will not be processed"><?php 
        _e('Debug Mode Is Turned On', 'event_espresso');
        ?>
</h3>
				</div>
			<?php 
    }
    ?>
			<?php 
    if ($beanstream_settings['display_header']) {
        ?>
				<h3 class="payment_header"><?php 
        echo $beanstream_settings['header'];
        ?>
</h3>
			<?php 
    }
    ?>
			
				<div class = "event_espresso_form_wrapper">
					<form id="beanstream_payment_form" name="beanstream_payment_form" method="post" action="<?php 
    echo $home . '/?page_id=' . $org_options['return_url'] . '&r_id=' . $registration_id;
    ?>
">
					
						<fieldset id="beanstream-billing-info-dv">
							<h4 class="section-title"><?php 
    _e('Billing Information', 'event_espresso');
    ?>
</h4>
							<p>
								<label for="first_name"><?php 
    _e('First Name', 'event_espresso');
    ?>
</label>
								<input name="first_name" type="text" id="ppp_first_name" class="required" value="<?php 
    echo $fname;
    ?>
" />
							</p>
							<p>
								<label for="last_name"><?php 
    _e('Last Name', 'event_espresso');
    ?>
</label>
								<input name="last_name" type="text" id="ppp_last_name" class="required" value="<?php 
    echo $lname;
    ?>
" />
							</p>
							<p>
								<label for="email"><?php 
    _e('Email Address', 'event_espresso');
    ?>
</label>
								<input name="email" type="text" id="ppp_email" class="required" value="<?php 
    echo $attendee_email;
    ?>
" />
							</p>
							<p>
								<label for="address"><?php 
    _e('Address', 'event_espresso');
    ?>
</label>
								<input name="address" type="text" id="ppp_address" class="required" value="<?php 
    echo $address;
    ?>
" />
							</p>
							<p>
								<label for="city"><?php 
    _e('City', 'event_espresso');
    ?>
</label>
								<input name="city" type="text" id="ppp_city" class="required" value="<?php 
    echo $city;
    ?>
" />
							</p>
							<p>
								<label for="state">
								<?php 
    _e('State / Province', 'event_espresso');
    ?>
								</label>
								<?php 
    echo select_input('state', $states, 'AB');
    ?>
							</p>
							<p>
								<label for="country">
								<?php 
    _e('Country', 'event_espresso');
    ?>
								</label>
								<?php 
    $current_country = getCountryFullData($org_options['organization_country']);
    echo select_input('country', $countries, $current_country['iso_code_2']);
    ?>
							</p>
							<p>
								<label for="zip"><?php 
    _e('Zip', 'event_espresso');
    ?>
</label>
								<input name="zip" type="text" id="ppp_zip" class="required" value="<?php 
    echo $zip;
    ?>
" />
							</p>
							<p>
								<label for="phone"><?php 
    _e('Phone', 'event_espresso');
    ?>
</label>
								<input name="phone" type="text" id="ppp_phone" class="required" value="<?php 
    echo $phone;
    ?>
" />
							</p>
						</fieldset>
	
						<fieldset id="beanstream-credit-card-info-dv">
							<p class="section-title"><?php 
    _e('Credit Card Information', 'event_espresso');
    ?>
</p>
							<p>
								<label for="card_num"><?php 
    _e('Card Number', 'event_espresso');
    ?>
</label>
								<input type="text" name="card_num" class="required" id="ppp_card_num" autocomplete="off" />
							</p>
			
			
							<p>				
									<?php 
    $currentMonth = date('m');
    $months = array();
    for ($i = 0; $i < 12; $i++) {
        $months[$i]['id'] = sprintf("%02s", $i + 1);
        $months[$i]['text'] = $months[$i]['id'];
    }
    ?>
						<label for="exp_date"><?php 
    _e('Expiration Month', 'event_espresso');
    ?>
</label>
						<?php 
    echo select_input('expmonth', $months, $currentMonth, 'class="med"');
    ?>
								
								
								
								
								
								
			
							</p>
			
							<p>
								<label for="exp-year"><?php 
    _e('Expiration Year', 'event_espresso');
    ?>
</label>
								<select id="ppp_exp-year" name ="expyear" class="med required">
			
									<?php 
    $curr_year = date("y");
    for ($i = 0; $i < 10; $i++) {
        $disp_year = $curr_year + $i;
        echo "<option value='{$disp_year}'>{$disp_year}</option>";
    }
    ?>
			
								</select>
			
							</p>
			
							<p>
								<label for="cvv"><?php 
    _e('CVV Code', 'event_espresso');
    ?>
</label>
								<input type="text" name="cvv" id="ppp_exp_date" autocomplete="off" class="small" />
							</p>
						</fieldset>
						<input name="amount" type="hidden" value="<?php 
    echo number_format($event_cost, 2);
    ?>
" />
						<input name="beanstream" type="hidden" value="true" />
						<input name="id" type="hidden" value="<?php 
    echo $attendee_id;
    ?>
" />
		
						<input name="beanstream_submit" id="beanstream_submit" class="submit-payment-btn allow-leave-page btn_event_form_submit payment-submit" type="submit" value="<?php 
    _e('Complete Purchase', 'event_espresso');
    ?>
" />
						<span id="processing"></span>
					</form>
				</div><!-- / .event_espresso_or_wrapper -->
			</div>
			
			<br/>
			<p class="choose-diff-pay-option-pg">
				<a class="hide-the-displayed" rel="beanstream-payment-option-form" style="cursor:pointer;"><?php 
    _e('Choose a different payment option', 'event_espresso');
    ?>
</a>
			</p>

		</div>
	</div>
	<?php 
}