本文整理汇总了PHP中edd_get_checkout_uri函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_get_checkout_uri函数的具体用法?PHP edd_get_checkout_uri怎么用?PHP edd_get_checkout_uri使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_get_checkout_uri函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edd_shopping_cart
/**
* Shopping Cart
*
* @access public
* @since 1.0
* @return string
*/
function edd_shopping_cart($echo = false)
{
global $edd_options;
ob_start();
?>
<?php
do_action('edd_before_cart');
?>
<ul class="edd-cart">
<?php
$cart_items = edd_get_cart_contents();
if ($cart_items) {
foreach ($cart_items as $key => $item) {
echo edd_get_cart_item_template($key, $item, false);
}
echo '<li class="cart_item edd_checkout"><a href="' . edd_get_checkout_uri() . '">' . __('Checkout', 'edd') . '</a></li>';
} else {
echo '<li class="cart_item empty">' . edd_empty_cart_message() . '</li>';
echo '<li class="cart_item edd_checkout" style="display:none;"><a href="' . edd_get_checkout_uri() . '">' . __('Checkout', 'edd') . '</a></li>';
}
?>
</ul>
<?php
do_action('edd_after_cart');
if ($echo) {
echo ob_get_clean();
} else {
return ob_get_clean();
}
}
示例2: edd_load_scripts
/**
* Load Scripts
*
* Enqueues the required scripts.
*
* @access private
* @since 1.0
* @return void
*/
function edd_load_scripts()
{
global $edd_options, $post;
wp_enqueue_script('jquery');
// Get position in cart of current download
if (isset($post->ID)) {
$position = edd_get_item_position_in_cart($post->ID);
}
// Load AJAX scripts, if enabled
if (edd_is_ajax_enabled()) {
wp_enqueue_script('edd-ajax', EDD_PLUGIN_URL . 'assets/js/edd-ajax.js', array('jquery'), EDD_VERSION);
wp_localize_script('edd-ajax', 'edd_scripts', array('ajaxurl' => edd_get_ajax_url(), 'ajax_nonce' => wp_create_nonce('edd_ajax_nonce'), 'no_discount' => __('Please enter a discount code', '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'), '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'), 'ajax_loader' => EDD_PLUGIN_URL . 'assets/images/loading.gif', 'checkout_page' => edd_get_checkout_uri(), 'permalinks' => get_option('permalink_structure') ? '1' : '0'));
}
// Load jQuery validation
if (isset($edd_options['jquery_validation']) && edd_is_checkout()) {
wp_enqueue_script('jquery-validation', EDD_PLUGIN_URL . 'assets/js/jquery.validate.min.js');
wp_enqueue_script('edd-validation', EDD_PLUGIN_URL . 'assets/js/form-validation.js', array('jquery', 'jquery-validation'), EDD_VERSION);
$required = array('firstname' => true, 'lastname' => true);
wp_localize_script('edd-validation', 'edd_scripts_validation', apply_filters('edd_scripts_validation', $required));
}
if (edd_is_checkout()) {
if (edd_is_cc_verify_enabled()) {
wp_enqueue_script('creditCardValidator', EDD_PLUGIN_URL . 'assets/js/jquery.creditCardValidator.js', array('jquery'), EDD_VERSION);
}
wp_enqueue_script('edd-checkout-global', EDD_PLUGIN_URL . 'assets/js/edd-checkout-global.js', array('jquery'), EDD_VERSION);
wp_localize_script('edd-checkout-global', 'edd_global_vars', array('currency_sign' => edd_currency_filter(''), 'currency_pos' => isset($edd_options['currency_position']) ? $edd_options['currency_position'] : 'before', 'no_gateway' => __('Please select a payment method', 'edd')));
}
}
示例3: huesos_edd_show_header_cart_link
/**
* Show cart link and quantity count in header if the cart has contents.
*
* The ".edd-cart-quantity" class is needed in order for the quantity to be
* updated dynamically via AJAX.
*
* @todo Add cart link to mobile navigation bar.
*
* @since 1.0.0
*/
function huesos_edd_show_header_cart_link()
{
if (!edd_get_cart_contents()) {
return;
}
printf('<p class="cart-quantity"><a class="button" href="%1$s">%2$s (<span class="edd-cart-quantity">%3$s</span>)</a></p>', esc_url(edd_get_checkout_uri()), esc_html__('Cart', 'huesos'), esc_html(edd_get_cart_quantity()));
}
示例4: edd_wl_process_purchase_all
/**
* Process the Add all to cart request
*
* @since 1.0
*
* @param $data
*/
function edd_wl_process_purchase_all($data)
{
$cart_items = edd_wl_add_all_to_cart($data['list_id']);
// redirect straight to checkout with items added
wp_redirect(edd_get_checkout_uri());
edd_die();
}
示例5: 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')));
}
}
示例6: edd_show_purchase_form
/**
* Get the purchase form
*
* @access private
* @since 1.4
* @return string
*/
function edd_show_purchase_form()
{
global $edd_options;
$payment_mode = edd_get_chosen_gateway();
$form_action = esc_url(edd_get_checkout_uri('payment-mode=' . $payment_mode));
do_action('edd_before_purchase_form');
?>
<form id="edd_purchase_form" action="<?php
echo $form_action;
?>
" method="POST">
<?php
do_action('edd_purchase_form_top');
if (edd_can_checkout()) {
?>
<?php
if (isset($edd_options['show_register_form']) && !is_user_logged_in() && !isset($_GET['login'])) {
?>
<div id="edd_checkout_login_register"><?php
do_action('edd_purchase_form_register_fields');
?>
</div>
<?php
} elseif (isset($edd_options['show_register_form']) && !is_user_logged_in() && isset($_GET['login'])) {
?>
<div id="edd_checkout_login_register"><?php
do_action('edd_purchase_form_login_fields');
?>
</div>
<?php
}
?>
<?php
if (!isset($_GET['login']) && is_user_logged_in() || !isset($edd_options['show_register_form'])) {
do_action('edd_purchase_form_after_user_info');
}
do_action('edd_purchase_form_before_cc_form');
// load the credit card form and allow gateways to load their own if they wish
if (has_action('edd_' . $payment_mode . '_cc_form')) {
do_action('edd_' . $payment_mode . '_cc_form');
} else {
do_action('edd_cc_form');
}
do_action('edd_purchase_form_after_cc_form');
} else {
// can't checkout
do_action('edd_purchase_form_no_access');
}
do_action('edd_purchase_form_bottom');
?>
</form> <?php
do_action('edd_after_purchase_form');
}
示例7: edd_process_add_to_cart
/**
* Process the Add to Cart request
*
* @since 1.0
* @return void
*/
function edd_process_add_to_cart($data)
{
$download_id = $data['download_id'];
$options = isset($data['edd_options']) ? $data['edd_options'] : array();
$cart = edd_add_to_cart($download_id, $options);
if (edd_straight_to_checkout() && !edd_is_checkout()) {
wp_redirect(edd_get_checkout_uri(), 303);
edd_die();
}
}
示例8: pw_edd_prevent_duplicate_cart_items
/**
* Prevents items from being added to the cart multiple times
*
*/
function pw_edd_prevent_duplicate_cart_items($download_id, $options)
{
if (edd_item_in_cart($download_id, $options)) {
if (edd_is_ajax_enabled()) {
die('1');
} else {
wp_redirect(edd_get_checkout_uri());
exit;
}
}
}
示例9: edd_checkout_form
/**
* Get Checkout Form
*
* @since 1.0
* @return string
*/
function edd_checkout_form()
{
$payment_mode = edd_get_chosen_gateway();
$form_action = esc_url(edd_get_checkout_uri('payment-mode=' . $payment_mode));
ob_start();
echo '<div id="edd_checkout_wrap">';
if (edd_get_cart_contents() || edd_cart_has_fees()) {
edd_checkout_cart();
?>
<div id="edd_checkout_form_wrap" class="edd_clearfix">
<?php
do_action('edd_before_purchase_form');
?>
<form id="edd_purchase_form" class="edd_form" action="<?php
echo $form_action;
?>
" method="POST">
<?php
/**
* Hooks in at the top of the checkout form
*
* @since 1.0
*/
do_action('edd_checkout_form_top');
if (edd_show_gateways()) {
do_action('edd_payment_mode_select');
} else {
do_action('edd_purchase_form');
}
/**
* Hooks in at the bottom of the checkout form
*
* @since 1.0
*/
do_action('edd_checkout_form_bottom');
?>
</form>
<?php
do_action('edd_after_purchase_form');
?>
</div><!--end #edd_checkout_form_wrap-->
<?php
} else {
/**
* Fires off when there is nothing in the cart
*
* @since 1.0
*/
do_action('edd_cart_empty');
}
echo '</div><!--end #edd_checkout_wrap-->';
return ob_get_clean();
}
示例10: idf_lightbox
function idf_lightbox()
{
wp_register_script('idf-lite', plugins_url('js/idf-lite.js', __FILE__));
wp_register_script('idf', plugins_url('js/idf.js', __FILE__));
wp_register_style('magnific', plugins_url('lib/magnific/magnific.css', __FILE__));
wp_register_script('magnific', plugins_url('lib/magnific/magnific.js', __FILE__));
wp_register_style('idf', plugins_url('css/idf.css', __FILE__));
wp_enqueue_script('jquery');
if (idf_enable_checkout()) {
$checkout_url = '';
$platform = idf_platform();
if ($platform == 'wc' && !is_admin()) {
if (class_exists('WooCommerce')) {
global $woocommerce;
$checkout_url = $woocommerce->cart->get_checkout_url();
}
} else {
if ($platform == 'edd' && class_exists('Easy_Digital_Downloads') && !is_admin()) {
$checkout_url = edd_get_checkout_uri();
} else {
if ($platform == 'itexchange' && class_exists('IT_Exchange') && !is_admin()) {
// Getting checkout URL for iT exchange product
global $post;
$post_id = $post->ID;
$checkout_links = array();
// Get levels and setting url for each level
$number_of_levels = get_post_meta($post_id, "ign_product_level_count", true);
for ($i = 1; $i <= $number_of_levels; $i++) {
$iditexch_project_id = get_post_meta($post_id, 'iditexch_level_pairing_' . $i, true);
$checkout_links[$i]['url'] = get_permalink($iditexch_project_id);
$checkout_links[$i]['product'] = $iditexch_project_id;
}
$checkout_url = json_encode($checkout_links);
}
}
}
wp_enqueue_style('magnific');
wp_enqueue_style('idf');
wp_enqueue_script('idf');
wp_enqueue_script('magnific');
wp_localize_script('idf', 'idf_platform', $platform);
// Let's set the ajax url
$idf_ajaxurl = site_url('/wp-admin/admin-ajax.php');
wp_localize_script('idf', 'idf_siteurl', site_url());
wp_localize_script('idf', 'idf_ajaxurl', $idf_ajaxurl);
if (isset($checkout_url)) {
wp_localize_script('idf', 'idf_checkout_url', $checkout_url);
}
} else {
wp_enqueue_script('idf-lite');
}
}
示例11: parse_url
/**
* Parse the URL for the package downloader
*
* @since 3.2.4
* @return array Array of parsed url information
*/
private function parse_url()
{
if (false === stristr($_SERVER['REQUEST_URI'], 'edd-sl/package_download')) {
return false;
// Not a package download request
}
$data = array();
$url_parts = parse_url($_SERVER['REQUEST_URI']);
$paths = array_values(explode('/', $url_parts['path']));
$token = end($paths);
$values = explode(':', base64_decode($token));
if (count($values) !== 5) {
wp_die(__('Invalid token supplied', 'edd_sl'), __('Error', 'edd_sl'), array('response' => 401));
}
$expires = $values[0];
$license_key = $values[1];
$download_id = (int) $values[2];
$url = str_replace('@', ':', $values[4]);
if (!edd_software_licensing()->is_download_id_valid_for_license($download_id, $license_key)) {
wp_die(__('Invalid license supplied', 'edd_sl'), __('Error', 'edd_sl'), array('response' => 401));
}
$license_check_args = array('url' => $url, 'key' => $license_key, 'item_id' => $download_id);
$license_status = edd_software_licensing()->check_license($license_check_args);
switch ($license_status) {
case 'expired':
$renewal_link = add_query_arg('edd_license_key', $license_key, edd_get_checkout_uri());
wp_die(sprintf(__('Your license has expired, please <a href="%s" title="Renew your license">renew it</a> to install this update.', 'edd_sl'), $renewal_link), __('Error', 'edd_sl'), array('response' => 401));
break;
case 'inactive':
case 'site_inactive':
wp_die(__('Your license has not been activated for this domain, please activate it first.', 'edd_sl'), __('Error', 'edd_sl'), array('response' => 401));
break;
case 'disabled':
wp_die(__('Your license has been disabled.', 'edd_sl'), __('Error', 'edd_sl'), array('response' => 401));
break;
case 'valid':
break;
default:
wp_die(__('Your license could not be validated.', 'edd_sl'), __('Error', 'edd_sl'), array('response' => 401));
break;
}
$download_name = get_the_title($download_id);
$file_key = get_post_meta($download_id, '_edd_sl_upgrade_file_key', true);
$hash = md5($download_name . $file_key . $download_id . $license_key . $expires);
if (!hash_equals($hash, $values[3])) {
wp_die(__('Provided hash does not validate.', 'edd_sl'), __('Error', 'edd_sl'), array('response' => 401));
}
$data = array('expires' => $expires, 'license' => $license_key, 'id' => $download_id, 'key' => $hash);
return $data;
}
示例12: edd_process_cart_endpoints
/**
* Process cart endpoints
*
* Listens for add / remove requests
*
* @access private
* @since 1.3.4
* @return void
*/
function edd_process_cart_endpoints()
{
global $wp_query;
// adds an item to the cart with a /edd-add/# URL
if (isset($wp_query->query_vars['edd-add'])) {
$download_id = absint($wp_query->query_vars['edd-add']);
$cart = edd_add_to_cart($download_id, array());
wp_redirect(edd_get_checkout_uri());
exit;
}
// removes an item from the cart with a /edd-remove/# URL
if (isset($wp_query->query_vars['edd-remove'])) {
$cart_key = absint($wp_query->query_vars['edd-remove']);
$cart = edd_remove_from_cart($cart_key);
wp_redirect(edd_get_checkout_uri());
exit;
}
}
示例13: edd_checkout_form
/**
* Get Checkout Form
*
* @since 1.0
* @global $edd_options Array of all the EDD options
* @global $user_ID ID of current logged in user
* @global $post Current Post Object
* @return string
*/
function edd_checkout_form()
{
global $edd_options, $user_ID, $post;
$payment_mode = edd_get_chosen_gateway();
$form_action = esc_url(edd_get_checkout_uri('payment-mode=' . $payment_mode));
ob_start();
echo '<div id="edd_checkout_wrap">';
if (edd_get_cart_contents() || edd_cart_has_fees()) {
edd_checkout_cart();
?>
<div id="edd_checkout_form_wrap" class="edd_clearfix">
<?php
do_action('edd_before_purchase_form');
?>
<form id="edd_purchase_form" class="edd_form" action="<?php
echo $form_action;
?>
" method="POST">
<?php
do_action('edd_checkout_form_top');
if (edd_show_gateways()) {
do_action('edd_payment_mode_select');
} else {
do_action('edd_purchase_form');
}
do_action('edd_checkout_form_bottom');
?>
</form>
<?php
do_action('edd_after_purchase_form');
?>
</div><!--end #edd_checkout_form_wrap-->
<?php
} else {
do_action('edd_cart_empty');
}
echo '</div><!--end #edd_checkout_wrap-->';
return ob_get_clean();
}
示例14: edd_wallet_process_deposit
/**
* Process deposit
*
* @since 1.0.0
* @return void
*/
function edd_wallet_process_deposit()
{
// Verify the nonce
if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'edd-wallet-deposit-nonce')) {
wp_die(__('Nonce verification failed', 'edd-wallet'), __('Error', 'edd-wallet'), array('response' => 403));
}
// Make sure the cart is empty
edd_empty_cart();
$value = $_POST['edd_wallet_deposit_amount'];
if ($value == 'custom') {
$value = $_POST['edd_wallet_custom_deposit'];
}
// Setup the fee label
$label = edd_get_option('edd_wallet_deposit_description', __('Deposit to wallet', 'edd-wallet'));
$label = str_replace('{val}', edd_currency_filter(edd_format_amount($value)), $label);
// Setup the fee (product) for the deposit
$fee = array('amount' => $value, 'label' => $label, 'type' => 'item', 'no_tax' => true, 'id' => 'edd-wallet-deposit');
EDD()->fees->add_fee($fee);
// Redirect to checkout
wp_redirect(edd_get_checkout_uri(), 303);
edd_die();
}
示例15: ninja_forms_edd_checkout_redirect
/**
* Redirect to EDD checkout after form submission
*
* @since 1.0
*/
function ninja_forms_edd_checkout_redirect()
{
global $ninja_forms_processing;
// get settings
$settings = $ninja_forms_processing->get_all_form_settings();
// is ajax enabled
$ajax_enabled = isset($ninja_forms_processing->data['form']['ajax']) ? $ninja_forms_processing->data['form']['ajax'] : '';
// send this form to EDD checkout?
$send_to_edd = isset($settings['ninja_forms_send_to_edd']) ? $settings['ninja_forms_send_to_edd'] : '';
// return if this form shouldn't send to EDD checkout
if (!$send_to_edd) {
return;
}
if ($ajax_enabled) {
ninja_forms_edd_process_form();
return;
}
// process form
ninja_forms_edd_process_form();
// redirect non-ajax form
wp_redirect(edd_get_checkout_uri());
exit;
}