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;
}