Esempio n. 1
0
/**
 * Return True if the gateway is registered and active, false otherwise.
 *
 * @param string $gateway_id
 * @return bool
 */
function wpsc_is_gateway_active($gateway_id)
{
    $active_gateways = WPSC_Payment_Gateways::get_active_gateways();
    return in_array($gateway_id, $active_gateways);
}
Esempio n. 2
0
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;
}
Esempio n. 3
0
 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);
 }