本文整理汇总了PHP中edd_get_default_gateway函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_get_default_gateway函数的具体用法?PHP edd_get_default_gateway怎么用?PHP edd_get_default_gateway使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_get_default_gateway函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edd_purchase_form_validate_gateway
/**
* Purchase Form Validate Gateway
*
* @access private
* @since 1.0
* @return string
*/
function edd_purchase_form_validate_gateway()
{
$gateway = edd_get_default_gateway();
// Check if a gateway value is present
if (!empty($_REQUEST['edd-gateway'])) {
$gateway = sanitize_text_field($_REQUEST['edd-gateway']);
if ('0.00' == edd_get_cart_total()) {
$gateway = 'manual';
} elseif (!edd_is_gateway_active($gateway)) {
edd_set_error('invalid_gateway', __('The selected payment gateway is not enabled', 'easy-digital-downloads'));
}
}
return $gateway;
}
示例2: edd_load_scripts
/**
* Load Scripts
*
* Enqueues the required scripts.
*
* @since 1.0
* @global $post
* @return void
*/
function edd_load_scripts()
{
global $post;
$js_dir = EDD_PLUGIN_URL . 'assets/js/';
// Use minified libraries if SCRIPT_DEBUG is turned off
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
// Get position in cart of current download
if (isset($post->ID)) {
$position = edd_get_item_position_in_cart($post->ID);
}
if (edd_is_checkout()) {
if (edd_is_cc_verify_enabled()) {
wp_register_script('creditCardValidator', $js_dir . 'jquery.creditCardValidator' . $suffix . '.js', array('jquery'), EDD_VERSION);
wp_enqueue_script('creditCardValidator');
}
wp_register_script('edd-checkout-global', $js_dir . 'edd-checkout-global' . $suffix . '.js', array('jquery'), EDD_VERSION);
wp_enqueue_script('edd-checkout-global');
wp_localize_script('edd-checkout-global', 'edd_global_vars', apply_filters('edd_global_checkout_script_vars', array('ajaxurl' => edd_get_ajax_url(), 'checkout_nonce' => wp_create_nonce('edd_checkout_nonce'), 'currency_sign' => edd_currency_filter(''), 'currency_pos' => edd_get_option('currency_position', 'before'), 'no_gateway' => __('Please select a payment method', 'edd'), 'no_discount' => __('Please enter a discount code', 'edd'), 'enter_discount' => __('Enter discount', 'edd'), 'discount_applied' => __('Discount Applied', 'edd'), 'no_email' => __('Please enter an email address before applying a discount code', 'edd'), 'no_username' => __('Please enter a username before applying a discount code', 'edd'), 'purchase_loading' => __('Please Wait...', 'edd'), 'complete_purchase' => __('Purchase', 'edd'), 'taxes_enabled' => edd_use_taxes() ? '1' : '0', 'edd_version' => EDD_VERSION)));
}
// Load AJAX scripts, if enabled
if (!edd_is_ajax_disabled()) {
wp_register_script('edd-ajax', $js_dir . 'edd-ajax' . $suffix . '.js', array('jquery'), EDD_VERSION);
wp_enqueue_script('edd-ajax');
wp_localize_script('edd-ajax', 'edd_scripts', apply_filters('edd_ajax_script_vars', array('ajaxurl' => edd_get_ajax_url(), 'position_in_cart' => isset($position) ? $position : -1, 'already_in_cart_message' => __('You have already added this item to your cart', 'edd'), 'empty_cart_message' => __('Your cart is empty', 'edd'), 'loading' => __('Loading', 'edd'), 'select_option' => __('Please select an option', 'edd'), 'ajax_loader' => set_url_scheme(EDD_PLUGIN_URL . 'assets/images/loading.gif', 'relative'), 'is_checkout' => edd_is_checkout() ? '1' : '0', 'default_gateway' => edd_get_default_gateway(), 'redirect_to_checkout' => edd_straight_to_checkout() || edd_is_checkout() ? '1' : '0', 'checkout_page' => edd_get_checkout_uri(), 'permalinks' => get_option('permalink_structure') ? '1' : '0', 'quantities_enabled' => edd_item_quantities_enabled(), 'taxes_enabled' => edd_use_taxes() ? '1' : '0')));
}
}
示例3: edd_email_preview_template_tags
/**
* Email Preview Template Tags
*
* @since 1.0
* @param string $message Email message with template tags
* @return string $message Fully formatted message
*/
function edd_email_preview_template_tags($message)
{
$download_list = '<ul>';
$download_list .= '<li>' . __('Sample Product Title', 'easy-digital-downloads') . '<br />';
$download_list .= '<div>';
$download_list .= '<a href="#">' . __('Sample Download File Name', 'easy-digital-downloads') . '</a> - <small>' . __('Optional notes about this download.', 'easy-digital-downloads') . '</small>';
$download_list .= '</div>';
$download_list .= '</li>';
$download_list .= '</ul>';
$file_urls = esc_html(trailingslashit(get_site_url()) . 'test.zip?test=key&key=123');
$price = edd_currency_filter(edd_format_amount(10.5));
$gateway = edd_get_gateway_admin_label(edd_get_default_gateway());
$receipt_id = strtolower(md5(uniqid()));
$notes = __('These are some sample notes added to a product.', 'easy-digital-downloads');
$tax = edd_currency_filter(edd_format_amount(1.0));
$sub_total = edd_currency_filter(edd_format_amount(9.5));
$payment_id = rand(1, 100);
$user = wp_get_current_user();
$message = str_replace('{download_list}', $download_list, $message);
$message = str_replace('{file_urls}', $file_urls, $message);
$message = str_replace('{name}', $user->display_name, $message);
$message = str_replace('{fullname}', $user->display_name, $message);
$message = str_replace('{username}', $user->user_login, $message);
$message = str_replace('{date}', date(get_option('date_format'), current_time('timestamp')), $message);
$message = str_replace('{subtotal}', $sub_total, $message);
$message = str_replace('{tax}', $tax, $message);
$message = str_replace('{price}', $price, $message);
$message = str_replace('{receipt_id}', $receipt_id, $message);
$message = str_replace('{payment_method}', $gateway, $message);
$message = str_replace('{sitename}', get_bloginfo('name'), $message);
$message = str_replace('{product_notes}', $notes, $message);
$message = str_replace('{payment_id}', $payment_id, $message);
$message = str_replace('{receipt_link}', edd_email_tag_receipt_link($payment_id), $message);
$message = apply_filters('edd_email_preview_template_tags', $message);
return apply_filters('edd_email_template_wpautop', true) ? wpautop($message) : $message;
}
示例4: edd_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 EDD Settings, it will be
* automatically selected.
*
* @since 1.2.2
* @return void
*/
function edd_payment_mode_select()
{
$gateways = edd_get_enabled_payment_gateways(true);
$page_URL = edd_get_current_page_url();
do_action('edd_payment_mode_top');
?>
<?php
if (edd_is_ajax_disabled()) {
?>
<form id="edd_payment_mode" action="<?php
echo $page_URL;
?>
" method="GET">
<?php
}
?>
<fieldset id="edd_payment_mode_select">
<?php
do_action('edd_payment_mode_before_gateways_wrap');
?>
<div id="edd-payment-mode-wrap">
<span class="edd-payment-mode-label"><?php
_e('Select Payment Method', 'edd');
?>
</span><br/>
<?php
do_action('edd_payment_mode_before_gateways');
foreach ($gateways as $gateway_id => $gateway) {
$checked = checked($gateway_id, edd_get_default_gateway(), false);
$checked_class = $checked ? ' edd-gateway-option-selected' : '';
echo '<label for="edd-gateway-' . esc_attr($gateway_id) . '" class="edd-gateway-option' . $checked_class . '" id="edd-gateway-option-' . esc_attr($gateway_id) . '">';
echo '<input type="radio" name="payment-mode" class="edd-gateway" id="edd-gateway-' . esc_attr($gateway_id) . '" value="' . esc_attr($gateway_id) . '"' . $checked . '>' . esc_html($gateway['checkout_label']);
echo '</label>';
}
do_action('edd_payment_mode_after_gateways');
?>
</div>
<?php
do_action('edd_payment_mode_after_gateways_wrap');
?>
</fieldset>
<fieldset id="edd_payment_mode_submit" class="edd-no-js">
<p id="edd-next-submit-wrap">
<?php
echo edd_checkout_button_next();
?>
</p>
</fieldset>
<?php
if (edd_is_ajax_disabled()) {
?>
</form>
<?php
}
?>
<div id="edd_purchase_form_wrap"></div><!-- the checkout fields are loaded into this-->
<?php
do_action('edd_payment_mode_bottom');
}
示例5: edd_tools_sysinfo_get
/**
* Get system info
*
* @since 2.0
* @access public
* @global object $wpdb Used to query the database using the WordPress Database API
* @global array $edd_options Array of all EDD options
* @return string $return A string containing the info to output
*/
function edd_tools_sysinfo_get()
{
global $wpdb, $edd_options;
if (!class_exists('Browser')) {
require_once EDD_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 = edd_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('edd_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('edd_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('edd_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' => 'EDD/' . EDD_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 .= '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('edd_sysinfo_after_wordpress_config', $return);
// EDD configuration
$return .= "\n" . '-- EDD Configuration' . "\n\n";
$return .= 'Version: ' . EDD_VERSION . "\n";
$return .= 'Upgraded From: ' . get_option('edd_version_upgraded_from', 'None') . "\n";
$return .= 'Test Mode: ' . (edd_is_test_mode() ? "Enabled\n" : "Disabled\n");
$return .= 'Ajax: ' . (!edd_is_ajax_disabled() ? "Enabled\n" : "Disabled\n");
$return .= 'Guest Checkout: ' . (edd_no_guest_checkout() ? "Disabled\n" : "Enabled\n");
$return .= 'Symlinks: ' . (apply_filters('edd_symlink_file_downloads', isset($edd_options['symlink_file_downloads'])) && function_exists('symlink') ? "Enabled\n" : "Disabled\n");
$return .= 'Download Method: ' . ucfirst(edd_get_file_download_method()) . "\n";
$return .= 'Currency Code: ' . edd_get_currency() . "\n";
$return .= 'Currency Position: ' . edd_get_option('currency_position', 'before') . "\n";
$return .= 'Decimal Separator: ' . edd_get_option('decimal_separator', '.') . "\n";
$return .= 'Thousands Separator: ' . edd_get_option('thousands_separator', ',') . "\n";
$return = apply_filters('edd_sysinfo_after_edd_config', $return);
// EDD pages
$return .= "\n" . '-- EDD Page Configuration' . "\n\n";
$return .= 'Checkout: ' . (!empty($edd_options['purchase_page']) ? "Valid\n" : "Invalid\n");
$return .= 'Checkout Page: ' . (!empty($edd_options['purchase_page']) ? get_permalink($edd_options['purchase_page']) . "\n" : "Unset\n");
$return .= 'Success Page: ' . (!empty($edd_options['success_page']) ? get_permalink($edd_options['success_page']) . "\n" : "Unset\n");
$return .= 'Failure Page: ' . (!empty($edd_options['failure_page']) ? get_permalink($edd_options['failure_page']) . "\n" : "Unset\n");
$return .= 'Downloads Slug: ' . (defined('EDD_SLUG') ? '/' . EDD_SLUG . "\n" : "/downloads\n");
$return = apply_filters('edd_sysinfo_after_edd_pages', $return);
// EDD gateways
$return .= "\n" . '-- EDD Gateway Configuration' . "\n\n";
$active_gateways = edd_get_enabled_payment_gateways();
if ($active_gateways) {
$default_gateway_is_active = edd_is_gateway_active(edd_get_default_gateway());
if ($default_gateway_is_active) {
//.........这里部分代码省略.........
示例6: edd_get_chosen_gateway
/**
* Determines what the currently selected gateway is
*
* If the cart amount is zero, no option is shown and the cart uses the manual
* gateway to emulate a no-gateway-setup for a free download
*
* @access public
* @since 1.3.2
* @return string $enabled_gateway The slug of the gateway
*/
function edd_get_chosen_gateway()
{
$gateways = edd_get_enabled_payment_gateways();
$chosen = isset($_REQUEST['payment-mode']) ? $_REQUEST['payment-mode'] : false;
if (false !== $chosen) {
$chosen = preg_replace('/[^a-zA-Z0-9-_]+/', '', $chosen);
}
if (!empty($chosen)) {
$enabled_gateway = urldecode($chosen);
} else {
if (count($gateways) >= 1 && !$chosen) {
foreach ($gateways as $gateway_id => $gateway) {
$enabled_gateway = $gateway_id;
if (edd_get_cart_subtotal() <= 0) {
$enabled_gateway = 'manual';
// This allows a free download by filling in the info
}
}
} else {
if (edd_get_cart_subtotal() <= 0) {
$enabled_gateway = 'manual';
} else {
$enabled_gateway = edd_get_default_gateway();
}
}
}
return apply_filters('edd_chosen_gateway', $enabled_gateway);
}
示例7: edd_purchase_form_validate_gateway
/**
* Purchase Form Validate Gateway
*
* @access private
* @since 1.0
* @return string
*/
function edd_purchase_form_validate_gateway()
{
// Check if a gateway value is present
if (!empty($_POST['edd-gateway'])) {
$gateway = sanitize_text_field($_POST['edd-gateway']);
if (edd_is_gateway_active($gateway)) {
return $gateway;
} elseif ('0.00' == edd_get_cart_total()) {
return 'manual';
}
}
return edd_get_default_gateway();
}
示例8: esc_attr
?>
<label class="edd-gateway-option" for="edd-gateway-<?php
echo esc_attr($gateway_id);
?>
">
<input type="radio" name="payment-mode" class="edd-gateway"
id="edd-gateway-<?php
echo esc_attr($gateway_id);
?>
"
value="<?php
echo esc_attr($gateway_id);
?>
"
<?php
checked($gateway_id, edd_get_default_gateway());
?>
/>
<?php
echo esc_html($gateway['checkout_label']);
?>
<?php
the_gateway_image($gateway);
?>
</label>
<?php
}
?>
</fieldset>