function _wpsc_merchant_v3_settings_get_gateways($gateways) { foreach (WPSC_Payment_Gateways::get_gateways() as $gateway) { $meta = WPSC_Payment_Gateways::get_meta($gateway); $gateways[] = array('id' => $gateway, 'name' => $meta['name']); } return $gateways; }
private function gateway_list() { $selected_gateways = get_option('custom_gateway_options', array()); foreach (WPSC_Payment_Gateways::get_gateways() as $gateway) { $gateway_meta = WPSC_Payment_Gateways::get_meta($gateway); $this->gateway_item($gateway, $gateway_meta['name'], in_array($gateway, $selected_gateways)); } // compat with older API global $nzshpcrt_gateways; foreach ($nzshpcrt_gateways as $gateway) { if (isset($gateway['admin_name'])) { $gateway['name'] = $gateway['admin_name']; } $this->gateway_item($gateway['internalname'], $gateway['name'], in_array($gateway['internalname'], $selected_gateways)); } }
function _wpsc_filter_merchant_v3_payment_method_form_fields($fields) { $selected_value = isset($_POST['wpsc_payment_method']) ? $_POST['wpsc_payment_method'] : ''; if (empty($selected_value)) { $current_purchase_log_id = wpsc_get_customer_meta('current_purchase_log_id'); $purchase_log = new WPSC_Purchase_Log($current_purchase_log_id); $selected_value = $purchase_log->get('gateway'); } foreach (WPSC_Payment_Gateways::get_active_gateways() as $gateway_name) { $gateway = (object) WPSC_Payment_Gateways::get_meta($gateway_name); $title = $gateway->name; if (!empty($gateway->image)) { $title .= ' <img src="' . $gateway->image . '" alt="' . $gateway->name . '" />'; } if (!empty($gateway->mark)) { $title = $gateway->mark; } $field = array('title' => $title, 'type' => 'radio', 'value' => $gateway->internalname, 'name' => 'wpsc_payment_method', 'checked' => $selected_value == $gateway->internalname); $fields[] = $field; } // check the first payment gateway by default if (empty($selected_value)) { $fields[0]['checked'] = true; } return $fields; }
function wpsc_gateways() { global $nzshpcrt_gateways; foreach (WPSC_Payment_Gateways::get_active_gateways() as $gateway_name) { $this->wpsc_gateways[] = WPSC_Payment_Gateways::get_meta($gateway_name); } $gateway_options = get_option('custom_gateway_options'); foreach ($nzshpcrt_gateways as $gateway) { if (array_search($gateway['internalname'], (array) $gateway_options) !== false) { $this->wpsc_gateways[] = $gateway; } } $this->gateway_count = count($this->wpsc_gateways); }