private function gateway_selection() { global $wpbdp; // Auto-select gateway if there is only one available. $gateways = $wpbdp->payments->get_available_methods(); $skip_gateway_selection = false; if (1 == count($gateways)) { $skip_gateway_selection = true; } $skip_gateway_selection = apply_filters('wpbdp_checkout_skip_gateway_selection', $skip_gateway_selection); if ($skip_gateway_selection) { $this->payment->set_payment_method(array_pop($gateways)); $this->payment->save(); return $this->checkout(); } $html = ''; do_action_ref_array('wpbdp_checkout_page_process', array(&$this->payment)); // Check if the payment changed in case we need to update something. if (0.0 == $this->payment->get_total()) { return $this->dispatch(); } if (isset($_POST['payment_method'])) { $payment_method = trim($_POST['payment_method']); if (!$payment_method) { // $html .= wpbdp_render_msg( _x( 'Please select a valid payment method.', 'checkout', 'WPBDM' ), 'error' ); } else { $this->payment->set_payment_method($payment_method); $this->payment->save(); return $this->checkout(); } } $html .= '<form action="' . esc_url($this->payment->get_checkout_url()) . '" method="POST">'; $html .= $wpbdp->payments->render_invoice($this->payment); $html .= wpbdp_capture_action_array('wpbdp_checkout_page_before_method_selection', array(&$this->payment)); $html .= $wpbdp->payments->render_payment_method_selection($this->payment); $html .= '<input type="submit" value="' . _x('Continue', 'checkout', 'WPBDM') . '" />'; $html .= '</form>'; return $html; }
protected function step_before_save() { if (isset($_POST['continue-with-save'])) { $this->state->advance(); return $this->dispatch(); } $extra = wpbdp_capture_action_array('wpbdp_listing_form_extra_sections', array(&$this->state)); $this->state->save(); // Save state in case extra sections modified it. if (!$extra) { $this->state->advance(false); return $this->dispatch(); } return $this->render('extra-sections', array('output' => $extra)); }
private function processFieldForm() { if (isset($_POST['fee'])) { if ($this->api->add_or_update_fee($_POST['fee'], $errors)) { $this->admin->messages[] = _x('Fee updated.', 'fees admin', 'WPBDM'); return $this->feesTable(); } else { $errmsg = ''; foreach ($errors as $err) { $errmsg .= sprintf('• %s<br />', $err); } $this->admin->messages[] = array($errmsg, 'error'); } } $fee = isset($_GET['id']) ? $this->api->get_fee_by_id($_GET['id']) : null; wpbdp_render_page(WPBDP_PATH . 'admin/templates/fees-addoredit.tpl.php', array('fee' => $fee, 'fee_extra_settings' => wpbdp_capture_action_array('wpbdp_admin_fee_form_extra_settings', array(&$fee))), true); }
public function show_listing() { if (!$this->check_main_page($msg)) { return $msg; } $id_or_slug = ''; if (get_query_var('listing') || isset($_GET['listing'])) { $id_or_slug = get_query_var('listing') ? get_query_var('listing') : wpbdp_getv($_GET, 'listing', 0); } else { $id_or_slug = get_query_var('id') ? get_query_var('id') : wpbdp_getv($_GET, 'id', 0); } $listing_id = wpbdp_get_post_by_id_or_slug($id_or_slug, 'id', 'id'); /* if (get_query_var('listing') || isset($_GET['listing'])) { if ($posts = get_posts(array('post_status' => 'any', 'numberposts' => 1, 'post_type' => WPBDP_POST_TYPE, 'name' => get_query_var('listing') ? get_query_var('listing') : wpbdp_getv($_GET, 'listing', null) ) )) { $listing_id = $posts[0]->ID; } else { $listing_id = null; } } else { $listing_id = get_query_var('id') ? get_query_var('id') : wpbdp_getv($_GET, 'id', null); }*/ if (!$listing_id) { return; } $html = ''; if ('publish' != get_post_status($listing_id)) { if (current_user_can('edit_posts')) { $html .= wpbdp_render_msg(_x('This is just a preview. The listing has not been published yet.', 'preview', 'WPBDM')); } else { return; } } // Handle ?v=viewname argument for alternative views (other than 'single'). $view = ''; if (isset($_GET['v'])) { $view = wpbdp_capture_action_array('wpbdp_listing_view_' . trim($_GET['v']), array($listing_id)); } if (!$view) { $html .= wpbdp_render_listing($listing_id, 'single', false, true); } else { $html .= $view; } wp_reset_query(); // Just in case some shortcode messed this up. return $html; }