当前位置: 首页>>代码示例>>PHP>>正文


PHP give_get_enabled_payment_gateways函数代码示例

本文整理汇总了PHP中give_get_enabled_payment_gateways函数的典型用法代码示例。如果您正苦于以下问题:PHP give_get_enabled_payment_gateways函数的具体用法?PHP give_get_enabled_payment_gateways怎么用?PHP give_get_enabled_payment_gateways使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了give_get_enabled_payment_gateways函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: give_no_gateway_error

/**
 * Sets an error on checkout if no gateways are enabled
 *
 * @since 1.0
 * @return void
 */
function give_no_gateway_error()
{
    $gateways = give_get_enabled_payment_gateways();
    if (empty($gateways)) {
        give_set_error('no_gateways', __('You must enable a payment gateway to use Give', 'give'));
    } else {
        give_unset_error('no_gateways');
    }
}
开发者ID:lots0logs,项目名称:Give,代码行数:15,代码来源:actions.php

示例2: give_is_cc_verify_enabled

/**
 * Verify credit card numbers live?
 *
 * @since 1.0
 * @global $give_options
 * @return bool $ret True is verify credit cards is live
 */
function give_is_cc_verify_enabled()
{
    $ret = true;
    /*
     * Enable if use a single gateway other than PayPal or Manual. We have to assume it accepts credit cards
     * Enable if using more than one gateway if they aren't both PayPal and manual, again assuming credit card usage
     */
    $gateways = give_get_enabled_payment_gateways();
    if (count($gateways) == 1 && !isset($gateways['paypal']) && !isset($gateways['manual'])) {
        $ret = true;
    } else {
        if (count($gateways) == 1) {
            $ret = false;
        } else {
            if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) {
                $ret = false;
            }
        }
    }
    return (bool) apply_filters('give_verify_credit_cards', $ret);
}
开发者ID:lots0logs,项目名称:Give,代码行数:28,代码来源:misc-functions.php

示例3: give_payment_mode_select

/**
 * Payment Mode Select
 *
 * Renders the payment mode form by getting all the enabled payment gateways and
 * outputting them as radio buttons for the user to choose the payment gateway. If
 * a default payment gateway has been chosen from the Give Settings, it will be
 * automatically selected.
 *
 * @since 1.0
 *
 * @param int $form_id
 *
 * @return void
 */
function give_payment_mode_select($form_id)
{
    $gateways = give_get_enabled_payment_gateways();
    do_action('give_payment_mode_top');
    ?>

	<fieldset id="give-payment-mode-select">
		<?php 
    do_action('give_payment_mode_before_gateways_wrap');
    ?>
		<div id="give-payment-mode-wrap">
			<legend class="give-payment-mode-label"><?php 
    _e('Select Payment Method', 'give');
    ?>
</legend>
			<?php 
    do_action('give_payment_mode_before_gateways');
    ?>

			<ul id="give-gateway-radio-list">
				<?php 
    foreach ($gateways as $gateway_id => $gateway) {
        $checked = checked($gateway_id, give_get_default_gateway($form_id), false);
        $checked_class = $checked ? ' give-gateway-option-selected' : '';
        echo '<li><label for="give-gateway-' . esc_attr($gateway_id) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr($gateway_id) . '">';
        echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr($gateway_id) . '-' . $form_id . '" value="' . esc_attr($gateway_id) . '"' . $checked . '>' . esc_html($gateway['checkout_label']);
        echo '</label></li>';
    }
    ?>
			</ul>
			<?php 
    do_action('give_payment_mode_after_gateways');
    ?>
			<p class="give-loading-text"><span class="give-loading-animation"></span> <?php 
    _e('Loading', 'give');
    ?>
				<span class="elipsis">.</span><span class="elipsis">.</span><span class="elipsis">.</span></p>
		</div>
		<?php 
    do_action('give_payment_mode_after_gateways_wrap');
    ?>
	</fieldset>

	<div id="give_purchase_form_wrap">

		<?php 
    do_action('give_purchase_form', $form_id);
    ?>

	</div><!-- the checkout fields are loaded into this-->

	<?php 
    do_action('give_payment_mode_bottom');
}
开发者ID:pantelicnevena,项目名称:hanan,代码行数:68,代码来源:template.php

示例4: give_default_gateway_callback

/**
 * Gateways Callback (drop down)
 *
 * Renders gateways select menu
 *
 * @since 1.0
 *
 * @param $field_object , $escaped_value, $object_id, $object_type, $field_type_object Arguments passed by CMB2
 *
 * @return void
 */
function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object)
{
    $id = $field_type_object->field->args['id'];
    $field_description = $field_type_object->field->args['desc'];
    $gateways = give_get_enabled_payment_gateways();
    echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">';
    //Add a field to the Give Form admin single post view of this field
    if ($field_type_object->field->object_type === 'post') {
        echo '<option value="global">' . __('Global Default', 'give') . '</option>';
    }
    foreach ($gateways as $key => $option) {
        $selected = isset($escaped_value) ? selected($key, $escaped_value, false) : '';
        echo '<option value="' . esc_attr($key) . '"' . $selected . '>' . esc_html($option['admin_label']) . '</option>';
    }
    echo '</select>';
    echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
}
开发者ID:helgatheviking,项目名称:Give,代码行数:28,代码来源:register-settings.php

示例5: give_tools_sysinfo_get

/**
 * Get system info
 *
 * @since       1.0
 * @access      public
 * @global      object $wpdb         Used to query the database using the WordPress Database API
 * @global      array  $give_options Array of all Give options
 * @return      string $return A string containing the info to output
 */
function give_tools_sysinfo_get()
{
    global $wpdb, $give_options;
    if (!class_exists('Browser')) {
        require_once GIVE_PLUGIN_DIR . 'includes/libraries/browser.php';
    }
    $browser = new Browser();
    // Get theme info
    if (get_bloginfo('version') < '3.4') {
        $theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');
        $theme = $theme_data['Name'] . ' ' . $theme_data['Version'];
    } else {
        $theme_data = wp_get_theme();
        $theme = $theme_data->Name . ' ' . $theme_data->Version;
    }
    // Try to identify the hosting provider
    $host = give_get_host();
    $return = '### Begin System Info ###' . "\n\n";
    // Start with the basics...
    $return .= '-- Site Info' . "\n\n";
    $return .= 'Site URL:                 ' . site_url() . "\n";
    $return .= 'Home URL:                 ' . home_url() . "\n";
    $return .= 'Multisite:                ' . (is_multisite() ? 'Yes' : 'No') . "\n";
    $return = apply_filters('give_sysinfo_after_site_info', $return);
    // Can we determine the site's host?
    if ($host) {
        $return .= "\n" . '-- Hosting Provider' . "\n\n";
        $return .= 'Host:                     ' . $host . "\n";
        $return = apply_filters('give_sysinfo_after_host_info', $return);
    }
    // The local users' browser information, handled by the Browser class
    $return .= "\n" . '-- User Browser' . "\n\n";
    $return .= $browser;
    $return = apply_filters('give_sysinfo_after_user_browser', $return);
    // WordPress configuration
    $return .= "\n" . '-- WordPress Configuration' . "\n\n";
    $return .= 'Version:                  ' . get_bloginfo('version') . "\n";
    $return .= 'Language:                 ' . (defined('WPLANG') && WPLANG ? WPLANG : 'en_US') . "\n";
    $return .= 'Permalink Structure:      ' . (get_option('permalink_structure') ? get_option('permalink_structure') : 'Default') . "\n";
    $return .= 'Active Theme:             ' . $theme . "\n";
    $return .= 'Show On Front:            ' . get_option('show_on_front') . "\n";
    // Only show page specs if frontpage is set to 'page'
    if (get_option('show_on_front') == 'page') {
        $front_page_id = get_option('page_on_front');
        $blog_page_id = get_option('page_for_posts');
        $return .= 'Page On Front:            ' . ($front_page_id != 0 ? get_the_title($front_page_id) . ' (#' . $front_page_id . ')' : 'Unset') . "\n";
        $return .= 'Page For Posts:           ' . ($blog_page_id != 0 ? get_the_title($blog_page_id) . ' (#' . $blog_page_id . ')' : 'Unset') . "\n";
    }
    // Make sure wp_remote_post() is working
    $request['cmd'] = '_notify-validate';
    $params = array('sslverify' => false, 'timeout' => 60, 'user-agent' => 'Give/' . GIVE_VERSION, 'body' => $request);
    $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params);
    if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
        $WP_REMOTE_POST = 'wp_remote_post() works';
    } else {
        $WP_REMOTE_POST = 'wp_remote_post() does not work';
    }
    $return .= 'Remote Post:              ' . $WP_REMOTE_POST . "\n";
    $return .= 'Table Prefix:             ' . 'Length: ' . strlen($wpdb->prefix) . '   Status: ' . (strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable') . "\n";
    $return .= 'Admin AJAX:               ' . (give_test_ajax_works() ? 'Accessible' : 'Inaccessible') . "\n";
    $return .= 'WP_DEBUG:                 ' . (defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set') . "\n";
    $return .= 'Memory Limit:             ' . WP_MEMORY_LIMIT . "\n";
    $return .= 'Registered Post Stati:    ' . implode(', ', get_post_stati()) . "\n";
    $return = apply_filters('give_sysinfo_after_wordpress_config', $return);
    // GIVE configuration
    $return .= "\n" . '-- Give Configuration' . "\n\n";
    $return .= 'Version:                  ' . GIVE_VERSION . "\n";
    $return .= 'Upgraded From:            ' . get_option('give_version_upgraded_from', 'None') . "\n";
    $return .= 'Test Mode:                ' . (give_is_test_mode() ? "Enabled\n" : "Disabled\n");
    $return .= 'Currency Code:            ' . give_get_currency() . "\n";
    $return .= 'Currency Position:        ' . give_get_option('currency_position', 'before') . "\n";
    $return .= 'Decimal Separator:        ' . give_get_option('decimal_separator', '.') . "\n";
    $return .= 'Thousands Separator:      ' . give_get_option('thousands_separator', ',') . "\n";
    $return = apply_filters('give_sysinfo_after_give_config', $return);
    // GIVE pages
    $return .= "\n" . '-- Give Page Configuration' . "\n\n";
    $return .= 'Success Page:             ' . (!empty($give_options['success_page']) ? get_permalink($give_options['success_page']) . "\n" : "Unset\n");
    $return .= 'Failure Page:             ' . (!empty($give_options['failure_page']) ? get_permalink($give_options['failure_page']) . "\n" : "Unset\n");
    $return .= 'Give Forms Slug:           ' . (defined('GIVE_SLUG') ? '/' . GIVE_SLUG . "\n" : "/donations\n");
    $return = apply_filters('give_sysinfo_after_give_pages', $return);
    // GIVE gateways
    $return .= "\n" . '-- Give Gateway Configuration' . "\n\n";
    $active_gateways = give_get_enabled_payment_gateways();
    if ($active_gateways) {
        $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null));
        if ($default_gateway_is_active) {
            $default_gateway = give_get_default_gateway(null);
            $default_gateway = $active_gateways[$default_gateway]['admin_label'];
        } else {
            $default_gateway = 'Test Payment';
        }
//.........这里部分代码省略.........
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:101,代码来源:system-info.php

示例6: give_get_chosen_gateway

/**
 * Determines what the currently selected gateway is
 *
 * If the amount is zero, no option is shown and the checkout uses the manual
 * gateway to emulate a no-gateway-setup for a free donation
 *
 * @access public
 * @since  1.0
 *
 * @param  int $form_id The ID of the Form
 *
 * @return string $enabled_gateway The slug of the gateway
 */
function give_get_chosen_gateway($form_id)
{
    $gateways = give_get_enabled_payment_gateways();
    $request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0;
    if (empty($request_form_id)) {
        $request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0;
    }
    $chosen = give_get_default_gateway($form_id);
    $enabled_gateway = '';
    //Take into account request Form ID args
    if (!empty($request_form_id) && $form_id == $request_form_id) {
        $chosen = $_REQUEST['payment-mode'];
    }
    if ($chosen) {
        $enabled_gateway = urldecode($chosen);
    } else {
        if (count($gateways) >= 1 && !$chosen) {
            foreach ($gateways as $gateway_id => $gateway) {
                $enabled_gateway = $gateway_id;
            }
        } else {
            $enabled_gateway = give_get_default_gateway($form_id);
        }
    }
    return apply_filters('give_chosen_gateway', $enabled_gateway);
}
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:39,代码来源:functions.php

示例7: give_get_chosen_gateway

/**
 * Determines what the currently selected gateway is
 *
 * If the amount is zero, no option is shown and the checkout uses the manual
 * gateway to emulate a no-gateway-setup for a free donation
 *
 * @access public
 * @since  1.0
 *
 * @param  int $form_id The ID of the Form
 *
 * @return string $enabled_gateway The slug of the gateway
 */
function give_get_chosen_gateway($form_id)
{
    $gateways = give_get_enabled_payment_gateways();
    $chosen = isset($_REQUEST['payment-mode']) ? $_REQUEST['payment-mode'] : give_get_default_gateway($form_id);
    $enabled_gateway = '';
    if ($chosen) {
        $enabled_gateway = urldecode($chosen);
    } else {
        if (count($gateways) >= 1 && !$chosen) {
            foreach ($gateways as $gateway_id => $gateway) {
                $enabled_gateway = $gateway_id;
            }
        } else {
            $enabled_gateway = give_get_default_gateway($form_id);
        }
    }
    return apply_filters('give_chosen_gateway', $enabled_gateway);
}
开发者ID:helgatheviking,项目名称:Give,代码行数:31,代码来源:functions.php


注:本文中的give_get_enabled_payment_gateways函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。