function seamless_donations_generate_donation_form() { $form_action = plugins_url('/seamless-donations-payment.php', __FILE__); //$session_id = $GLOBALS['seamless_donations_session_id']; //$session_id = 'dgxdonate_' . substr ( session_id (), 0, 10 ) . '_' . time (); $session_id = seamless_donations_get_guid('sd'); dgx_donate_debug_log('----------------------------------------'); dgx_donate_debug_log('PREPARING DONATION FORM'); dgx_donate_debug_log("Seamless Donations Version: " . dgx_donate_get_version()); dgx_donate_debug_log("User browser: " . seamless_donations_get_browser_name()); dgx_donate_debug_log("Assigning hidden field session ID to {$session_id}"); dgx_donate_debug_log("Form action: {$form_action}"); $form = array('id' => 'seamless-donations-form', 'name' => 'seamless-donations-form', 'action' => $form_action, 'method' => 'post', 'elements' => array('session_id_element' => array('type' => 'hidden', 'group' => '_dgx_donate_session_id', 'value' => $session_id), 'redirect_url_element' => array('type' => 'hidden', 'group' => '_dgx_donate_redirect_url', 'value' => $form_action), 'success_url_element' => array('type' => 'hidden', 'group' => '_dgx_donate_success_url', 'value' => dgx_donate_paypalstd_get_current_url()))); // Start the outermost container $form['outermost_container'] = array('id' => 'dgx-donate-container'); // Pick and choose the built in sections this gateway supports $warning_section = seamless_donations_donation_form_warning_section(); if (is_array($warning_section)) { $form['outermost_container']['warning_section'] = $warning_section; } $form['outermost_container']['donation_section'] = seamless_donations_get_donation_section(); $form['outermost_container']['tribute_section'] = seamless_donations_get_tribute_section(); $form['outermost_container']['donor_section'] = seamless_donations_get_donor_section(); $form['outermost_container']['billing_section'] = seamless_donations_get_billing_section(); $form['outermost_container']['paypal_section'] = seamless_donations_get_paypal_section(); $form['outermost_container']['submit_section'] = seamless_donations_get_submit_section(); $form = apply_filters('seamless_donations_form_section_order', $form); // build and display the form $html = seamless_donations_forms_engine($form); return $html; }
function seamless_donations_generate_donation_form() { $process_form_via = get_option('dgx_donate_form_via_action'); // if the option isn't defined, returns false, if defined = '1' // this option exists for host compatibility, where some hosts won't send a form // to another .php file for processing if ($process_form_via == '1') { $form_action = get_permalink(); $process_form_via_status = 'initiating page'; } else { // redirect to seamless-donations-payment.php, which may cause some hosting errors // but is the default behavior since early 4.0.x releases $form_action = plugins_url('/seamless-donations-payment.php', __FILE__); $process_form_via_status = 'external php file'; } $browser_based_ids = get_option('dgx_donate_browser_uuid'); if ($browser_based_ids == '1') { $session_id = 'browser-uuid'; // generate UUID in JavaScript } else { $session_id = seamless_donations_get_guid('sd'); // UUID on server } dgx_donate_debug_log('----------------------------------------'); dgx_donate_debug_log('PREPARING DONATION FORM'); dgx_donate_debug_log("Seamless Donations Version: " . dgx_donate_get_version()); dgx_donate_debug_log("User browser: " . seamless_donations_get_browser_name()); dgx_donate_debug_log("Assigning hidden field session ID to {$session_id}"); dgx_donate_debug_log("Form action via: {$process_form_via_status}"); dgx_donate_debug_log("Form action: {$form_action}"); $form = array('id' => 'seamless-donations-form', 'name' => 'seamless-donations-form', 'action' => $form_action, 'method' => 'post', 'elements' => array('session_id_element' => array('type' => 'hidden', 'group' => '_dgx_donate_session_id', 'value' => $session_id), 'redirect_url_element' => array('type' => 'hidden', 'group' => '_dgx_donate_redirect_url', 'value' => $form_action), 'success_url_element' => array('type' => 'hidden', 'group' => '_dgx_donate_success_url', 'value' => dgx_donate_paypalstd_get_current_url()), 'process_via' => array('type' => 'hidden', 'group' => '_dgx_donate_form_via', 'value' => $process_form_via))); // Start the outermost container $form['outermost_container'] = array('id' => 'dgx-donate-container'); // Pick and choose the built in sections this gateway supports $warning_section = seamless_donations_donation_form_warning_section(); if (is_array($warning_section)) { $form['outermost_container']['warning_section'] = $warning_section; } $form['outermost_container']['donation_section'] = seamless_donations_get_donation_section(); $form['outermost_container']['tribute_section'] = seamless_donations_get_tribute_section(); $form['outermost_container']['donor_section'] = seamless_donations_get_donor_section(); $form['outermost_container']['billing_section'] = seamless_donations_get_billing_section(); $form['outermost_container']['paypal_section'] = seamless_donations_get_paypal_section(); $form['outermost_container']['submit_section'] = seamless_donations_get_submit_section(); $form = apply_filters('seamless_donations_form_section_order', $form); // build and display the form $html = seamless_donations_forms_engine($form); return $html; }
function seamless_form_test() { $form = array('onsubmit' => '', 'method' => 'post', 'id' => 'seamless-donations-form', 'name' => 'seamless-donations-form', 'sectionZero' => array('elements' => array('radio1' => array('type' => 'radio', 'id' => 'radio1', 'group' => 'radio', 'prompt' => 'radio1'), 'radio2' => array('type' => 'radio', 'after' => ' forms R us', 'id' => 'radio2', 'select' => '', 'group' => 'radio'))), 'sectionOne' => array('elements' => array('mister_revealer' => array('type' => 'checkbox', 'id' => 'dgx-donate-formtest', 'prompt' => 'fun with forms', 'reveal' => 'set1', 'class' => 'revealer-check'), 'thing_to_show' => array('type' => 'checkbox', 'after' => ' forms R us', 'cloak' => 'set1', 'id' => 'dgx-donate-memorial'), '_dgx_donate_memorialf_gift' => array('type' => 'text', 'after' => ' forms be us', 'id' => 'dgx-donate-memorial-first', 'cloak' => 'set1', 'size' => '30', 'validation' => 'required'), 'email_address' => array('type' => 'text', 'before' => ' enter email address', 'id' => 'email-address', 'size' => '30', 'validation' => 'email'), 'foobarblingman' => array('type' => 'static', 'cloak' => 'set1', 'value' => '<p>Static text</p>'), 'mylist' => array('type' => 'select', 'id' => 'puppy', 'cloak' => 'set1', 'size' => '1', 'options' => array('teddy' => "Theodore", 'elly' => "Eleanor", 'fdr' => "Franklin"))), 'style' => 'background-color:green'), 'sectionBlohard' => array('elements' => array('mister_revealerb' => array('type' => 'checkbox', 'id' => 'dgx-donate-formtest', 'prompt' => 'fun with forms', 'reveal' => 'set1b', 'class' => 'revealer-check'), 'thing_to_showb' => array('type' => 'checkbox', 'after' => ' forms R us', 'reveal' => 'set2b', 'id' => 'dgx-donate-memorial'), '_dgx_donate_memorialf_giftb' => array('type' => 'text', 'after' => ' forms be us', 'id' => 'dgx-donate-memorial', 'cloak' => 'set1b', 'size' => '30', 'validation' => 'currency,required'), 'foobarblingmanb' => array('type' => 'static', 'cloak' => 'set2b', 'value' => '<p>Static text</p>'), 'mylistb' => array('type' => 'select', 'id' => 'puppy', 'cloak' => 'set2b', 'size' => '1', 'options' => array('teddy' => "Theodore", 'elly' => "Eleanor", 'fdr' => "Franklin"))), 'style' => 'background-color:yellow'), 'elements' => array('submitter' => array('type' => 'submit', 'id' => 'seamless-donations-form', 'value' => 'Donate Now!', 'class' => 'submit-button seamless-donations-form-submit'))); echo "<h2>Form output:</h2>"; echo seamless_donations_forms_engine($form); }