コード例 #1
0
 /**
  * Show a pane based on the page within checkout. If not on the checkout
  * show all invoice panes and the active cc processors payments pane.
  *
  * @param  string $current
  * @return string
  */
 public static function show_payments_pane($current = '')
 {
     $processor = '';
     $checkout = SI_Checkouts::get_instance();
     if (SI_Checkouts::is_checkout_page()) {
         $current = $checkout->get_current_page();
         do_action('payments_pane_action_' . strtolower($current), $checkout);
         do_action('payments_pane_action', $current, $checkout);
         $processor = $checkout->get_processor();
     }
     $pane = '';
     switch ($current) {
         case SI_Checkouts::CONFIRMATION_PAGE:
             if (method_exists($processor, 'confirmation_pane')) {
                 $pane = $processor->confirmation_pane($checkout);
             }
             break;
         case SI_Checkouts::REVIEW_PAGE:
             if (method_exists($processor, 'review_pane')) {
                 $pane = $processor->review_pane($checkout);
             }
             break;
         case SI_Checkouts::PAYMENT_PAGE:
             if (method_exists($processor, 'payments_pane')) {
                 $pane = $processor->payments_pane($checkout);
             }
             break;
         default:
             // Load up all invoice level panes
             self::$active_payment_processors = self::enabled_processors();
             foreach (self::$active_payment_processors as $class) {
                 $processor = self::load_processor($class);
                 if (method_exists($processor, 'invoice_pane')) {
                     $pane .= $processor->invoice_pane($checkout);
                 }
                 if (self::is_cc_processor($class) && method_exists($processor, 'payments_pane')) {
                     $pane .= $processor->payments_pane($checkout);
                 }
             }
             break;
     }
     return $pane;
 }