/** * Get Gateway List * * HTML to display radio button list of payment gateways. * * @return string Payment gateways HTML. * * @uses apply_filters() Calls 'wpsc_gateway_image'. * @uses wpsc_have_gateways() Are there any gateways? * @uses wpsc_the_gateway() Setup gateway data. * @uses wpsc_gateway_name() Gateway display name. * @uses wpsc_gateway_internal_name() Gateway internal name. * @uses wpsc_gateway_is_checked() Gateway radio button checked attribute. * @uses wpsc_show_gateway_image() Show gateway image? * @uses wpsc_gateway_image_url() Gateway image URL * @uses wpsc_gateway_form_field_style() Adds class to show/hide fields based on selected gateway. * @uses wpsc_gateway_form_fields() Addition fields for the gateway. */ function _wpsc_filter_merchant_v2_get_gateway_list() { ob_start(); while (wpsc_have_gateways()) { wpsc_the_gateway(); $gateway_name = wpsc_gateway_name(); ?> <div class="custom_gateway <?php echo sanitize_html_class(wpsc_gateway_internal_name()); ?> "> <label><input type="radio" value="<?php echo wpsc_gateway_internal_name(); ?> " <?php echo wpsc_gateway_is_checked(); ?> name="custom_gateway" class="custom_gateway" /> <?php if (!empty($gateway_name)) { ?> <span class="custom_gateway_name"><?php echo $gateway_name; ?> </span> <?php } ?> <?php if (wpsc_show_gateway_image()) { $gateway_image = '<img src="' . esc_url(wpsc_gateway_image_url()) . '" alt="' . esc_attr($gateway_name) . '" class="custom_gateway_image" />'; echo apply_filters('wpsc_gateway_image', $gateway_image, wpsc_gateway_internal_name()); } ?> </label> <?php if (wpsc_gateway_form_fields()) { ?> <table class="wpsc_checkout_table <?php echo wpsc_gateway_form_field_style(); ?> "> <?php echo wpsc_gateway_form_fields(); ?> </table> <?php } ?> </div> <?php } return ob_get_clean(); }
while (wpsc_have_gateways()) { wpsc_the_gateway(); ?> <div class="custom_gateway"> <label><input type="radio" value="<?php echo wpsc_gateway_internal_name(); ?> " <?php echo wpsc_gateway_is_checked(); ?> name="custom_gateway" class="custom_gateway"/><?php echo wpsc_gateway_name(); ?> <?php if (wpsc_show_gateway_image()) { ?> <img src="<?php echo wpsc_gateway_image_url(); ?> " alt="<?php echo wpsc_gateway_name(); ?> " style="position:relative; top:5px;" /> <?php } ?> </label> <?php if (wpsc_gateway_form_fields()) {
function wpsc_gateway_name() { global $wpsc_gateway; $display_name = ''; $payment_gateway_names = get_option('payment_gateway_names'); if (isset($payment_gateway_names[$wpsc_gateway->gateway['internalname']]) && ($payment_gateway_names[$wpsc_gateway->gateway['internalname']] != '' || wpsc_show_gateway_image())) { $display_name = $payment_gateway_names[$wpsc_gateway->gateway['internalname']]; } elseif (isset($wpsc_gateway->gateway['payment_type'])) { switch ($wpsc_gateway->gateway['payment_type']) { case "paypal": case "paypal_pro": case "wpsc_merchant_paypal_pro": $display_name = "PayPal"; break; case "manual_payment": $display_name = "Manual Payment"; break; case "google_checkout": $display_name = "Google Checkout"; break; case "credit_card": default: $display_name = "Credit Card"; break; } } if ($display_name == '' && !wpsc_show_gateway_image()) { $display_name = 'Credit Card'; } return $display_name; }
/** * WPSC Default Gateway Name Filter * * This filter overrides the display name of a gateway * * @param string $display_name Gateway display name. * @param array $gateway Gateway details. * @return string Filtered gateway name. * * @uses wpsc_show_gateway_image() Checks if gateway has an image. */ function _wpsc_gateway_name_filter($display_name, $gateway) { if (empty($display_name) && isset($gateway['payment_type']) && !wpsc_show_gateway_image()) { switch ($gateway['payment_type']) { case 'paypal': case 'paypal_pro': case 'wpsc_merchant_paypal_pro': $display_name = __('PayPal', 'wpsc'); break; case 'manual_payment': $display_name = __('Manual Payment', 'wpsc'); break; case 'credit_card': default: $display_name = __('Credit Card', 'wpsc'); break; } } return $display_name; }