function dgx_donate_paypalstd_get_hidden_form()
{
    seamless_donations_debug_log("Inside dgx_donate_paypalstd_get_hidden_form");
    $paypalEmail = get_option('dgx_donate_paypal_email');
    $payPalServer = get_option('dgx_donate_paypal_server');
    if ($payPalServer == "SANDBOX") {
        $formAction = "https://www.sandbox.paypal.com/cgi-bin/webscr";
    } else {
        $formAction = "https://www.paypal.com/cgi-bin/webscr";
    }
    $notifyUrl = plugins_url('/dgx-donate-paypalstd-ipn.php', __FILE__);
    $sessionID = session_id();
    $successUrl = dgx_donate_paypalstd_get_current_url();
    if (strpos($successUrl, "?") === false) {
        $successUrl .= "?";
    } else {
        $successUrl .= "&";
    }
    $successUrl .= "thanks=1&sessionid=";
    $successUrl .= "{$sessionID}";
    $currency_code = get_option('dgx_donate_currency');
    $item_name = apply_filters('dgx_donate_item_name', __('Donation', 'seamless-donations'));
    $output = "";
    $output .= "<form id='dgx-donate-hidden-form' action='" . esc_attr($formAction) . "' method='post' target='_top' >";
    $output .= "<input type='hidden' name='cmd' value='_donations' />";
    $output .= "<input type='hidden' name='business' value='" . esc_attr($paypalEmail) . "' />";
    $output .= "<input type='hidden' name='return' value='" . esc_attr($successUrl) . "' />";
    $output .= "<input type='hidden' name='first_name' value='' /> ";
    $output .= "<input type='hidden' name='last_name' value='' />";
    $output .= "<input type='hidden' name='address1' value='' />";
    $output .= "<input type='hidden' name='address2' value='' />";
    $output .= "<input type='hidden' name='city' value='' />";
    $output .= "<input type='hidden' name='state' value='' />";
    // removed if country not US or Canada
    $output .= "<input type='hidden' name='zip' value='' />";
    $output .= "<input type='hidden' name='country' value='' />";
    $output .= "<input type='hidden' name='email' value='' />";
    $output .= "<input type='hidden' name='custom' value='' />";
    $output .= "<input type='hidden' name='notify_url' value='" . esc_attr($notifyUrl) . "' />";
    $output .= "<input type='hidden' name='item_name' value='" . esc_attr($item_name) . "' />";
    $output .= "<input type='hidden' name='amount' value='1.00' />";
    $output .= "<input type='hidden' name='quantity' value='1' />";
    $output .= "<input type='hidden' name='currency_code' value='" . esc_attr($currency_code) . "' />";
    $output .= "<input type='hidden' name='no_note' value='1' />";
    $output .= "<input type='hidden' name='src' value='1' />";
    // removed when not repeating
    $output .= "<input type='hidden' name='p3' value='1' />";
    // removed when not repeating
    $output .= "<input type='hidden' name='t3' value='1' />";
    // removed when not repeating
    $output .= "<input type='hidden' name='a3' value='1' />";
    // removed when not repeating
    $output .= "</form>";
    seamless_donations_debug_log("Exiting dgx_donate_paypalstd_get_hidden_form");
    return $output;
}
Exemplo n.º 2
0
/**
 * @return array|mixed|void
 */
function seamless_donations_get_paypal_section()
{
    $paypal_email = get_option('dgx_donate_paypal_email');
    $currency_code = get_option('dgx_donate_currency');
    $notify_url = plugins_url('/dgx-donate-paypalstd-ipn.php', __FILE__);
    //$session_id = session_id ();
    // set up success URL
    $success_url = dgx_donate_paypalstd_get_current_url();
    //	if( strpos ( $success_url, "?" ) === false ) {
    //		$success_url .= "?";
    //	} else {
    //		$success_url .= "&";
    //	}
    //	$success_url .= "thanks=1&sessionid=";
    //	$success_url .= "$session_id";
    // not used in core code, but users might be including this somewhere
    $item_name = apply_filters('dgx_donate_item_name', __('Donation', 'seamless-donations'));
    $paypal_hidden_section = array('id' => 'dgx-donate-form-paypal-hidden-section', 'class' => 'dgx-donate-form-section', 'style' => 'display:none', 'elements' => array('nonce' => array('type' => 'hidden', 'value' => wp_create_nonce('dgx-donate-nonce')), 'cmd' => array('type' => 'hidden', 'value' => ''), 'business' => array('type' => 'hidden', 'value' => esc_attr($paypal_email)), 'return' => array('type' => 'hidden', 'value' => ''), 'first_name' => array('type' => 'hidden', 'value' => ''), 'last_name' => array('type' => 'hidden', 'value' => ''), 'address1' => array('type' => 'hidden', 'value' => ''), 'address2' => array('type' => 'hidden', 'value' => ''), 'city' => array('type' => 'hidden', 'value' => ''), 'state' => array('type' => 'hidden', 'value' => ''), 'zip' => array('type' => 'hidden', 'value' => ''), 'country' => array('type' => 'hidden', 'value' => ''), 'email' => array('type' => 'hidden', 'value' => ''), 'custom' => array('type' => 'hidden', 'value' => ''), 'notify_url' => array('type' => 'hidden', 'value' => esc_attr($notify_url)), 'item_name' => array('type' => 'hidden', 'value' => esc_attr($item_name)), 'amount' => array('type' => 'hidden', 'value' => '1.00'), 'quantity' => array('type' => 'hidden', 'value' => '1'), 'currency_code' => array('type' => 'hidden', 'value' => esc_attr($currency_code)), 'no_note' => array('type' => 'hidden', 'value' => '1'), 'src' => array('type' => 'hidden', 'value' => '1'), 'p3' => array('type' => 'hidden', 'value' => ''), 't3' => array('type' => 'hidden', 'value' => ''), 'a3' => array('type' => 'hidden', 'value' => '')));
    $paypal_hidden_section = apply_filters('seamless_donations_form_paypal_section', $paypal_hidden_section);
    return $paypal_hidden_section;
}