/** * Get the purchase form * * @access private * @since 1.4 * @return string */ function edd_show_purchase_form() { global $edd_options; $payment_mode = edd_get_chosen_gateway(); $form_action = esc_url(edd_get_checkout_uri('payment-mode=' . $payment_mode)); do_action('edd_before_purchase_form'); ?> <form id="edd_purchase_form" action="<?php echo $form_action; ?> " method="POST"> <?php do_action('edd_purchase_form_top'); if (edd_can_checkout()) { ?> <?php if (isset($edd_options['show_register_form']) && !is_user_logged_in() && !isset($_GET['login'])) { ?> <div id="edd_checkout_login_register"><?php do_action('edd_purchase_form_register_fields'); ?> </div> <?php } elseif (isset($edd_options['show_register_form']) && !is_user_logged_in() && isset($_GET['login'])) { ?> <div id="edd_checkout_login_register"><?php do_action('edd_purchase_form_login_fields'); ?> </div> <?php } ?> <?php if (!isset($_GET['login']) && is_user_logged_in() || !isset($edd_options['show_register_form'])) { do_action('edd_purchase_form_after_user_info'); } do_action('edd_purchase_form_before_cc_form'); // load the credit card form and allow gateways to load their own if they wish if (has_action('edd_' . $payment_mode . '_cc_form')) { do_action('edd_' . $payment_mode . '_cc_form'); } else { do_action('edd_cc_form'); } do_action('edd_purchase_form_after_cc_form'); } else { // can't checkout do_action('edd_purchase_form_no_access'); } do_action('edd_purchase_form_bottom'); ?> </form> <?php do_action('edd_after_purchase_form'); }
/** * Renders the Purchase Form, hooks are provided to add to the purchase form. * The default Purchase Form rendered displays a list of the enabled payment * gateways, a user registration form (if enable) and a credit card info form * if credit cards are enabled * * @since 1.4 * @global $edd_options Array of all the EDD options * @return string */ function edd_show_purchase_form() { global $edd_options; $payment_mode = edd_get_chosen_gateway(); do_action('edd_purchase_form_top'); if (edd_can_checkout()) { do_action('edd_purchase_form_before_register_login'); $show_register_form = edd_get_option('show_register_form', 'none'); if (($show_register_form === 'registration' || $show_register_form === 'both' && !isset($_GET['login'])) && !is_user_logged_in()) { ?> <div id="edd_checkout_login_register"> <?php do_action('edd_purchase_form_register_fields'); ?> </div> <?php } elseif (($show_register_form === 'login' || $show_register_form === 'both' && isset($_GET['login'])) && !is_user_logged_in()) { ?> <div id="edd_checkout_login_register"> <?php do_action('edd_purchase_form_login_fields'); ?> </div> <?php } ?> <?php if (!isset($_GET['login']) && is_user_logged_in() || !isset($edd_options['show_register_form']) || 'none' === $show_register_form) { do_action('edd_purchase_form_after_user_info'); } do_action('edd_purchase_form_before_cc_form'); if (edd_get_cart_total() > 0) { // Load the credit card form and allow gateways to load their own if they wish if (has_action('edd_' . $payment_mode . '_cc_form')) { do_action('edd_' . $payment_mode . '_cc_form'); } else { do_action('edd_cc_form'); } } do_action('edd_purchase_form_after_cc_form'); } else { // Can't checkout do_action('edd_purchase_form_no_access'); } do_action('edd_purchase_form_bottom'); }