本文整理汇总了PHP中edd_is_checkout函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_is_checkout函数的具体用法?PHP edd_is_checkout怎么用?PHP edd_is_checkout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_is_checkout函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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')));
}
}
示例2: cross_selling_html
/**
* Changes the cross selling HTML to be more in line what we want
*
* @param string $html The current HTML, we discard this completely.
* @param array $downloads The downloads to cross/up sell.
*
* @return string The new HTML.
*/
public function cross_selling_html($html, $downloads)
{
if (edd_is_checkout()) {
$html = get_template_part('html_includes/shop/checkout-cross-sell', array('return' => true, 'downloads' => $downloads));
}
return $html;
}
示例3: edd_sl_checkout_js
/**
* Output the SL JavaScript for the checkout page
*
* @since 3.2
* @return void
*/
function edd_sl_checkout_js()
{
if (!function_exists('edd_is_checkout')) {
return;
}
if (!edd_is_checkout()) {
return;
}
?>
<script>
jQuery(document).ready(function($) {
$('#edd_sl_show_renewal_form, #edd-cancel-license-renewal').click(function(e) {
e.preventDefault();
$('#edd-license-key-container-wrap,#edd_sl_show_renewal_form,.edd-sl-renewal-actions').toggle();
$('#edd-license-key').focus();
});
$('#edd-license-key').keyup(function(e) {
var input = $('#edd-license-key');
var button = $('#edd-add-license-renewal');
if ( input.val() != '' ) {
button.prop("disabled", false);
} else {
button.prop("disabled", true);
}
});
});
</script>
<?php
}
示例4: edd_process_add_to_cart
/**
* Process the Add to Cart request
*
* @since 1.0
*
* @param $data
*/
function edd_process_add_to_cart($data)
{
$download_id = absint($data['download_id']);
$options = isset($data['edd_options']) ? $data['edd_options'] : array();
if (!empty($data['edd_download_quantity'])) {
$options['quantity'] = absint($data['edd_download_quantity']);
}
if (isset($options['price_id']) && is_array($options['price_id'])) {
foreach ($options['price_id'] as $key => $price_id) {
$options['quantity'][$key] = isset($data['edd_download_quantity_' . $price_id]) ? absint($data['edd_download_quantity_' . $price_id]) : 1;
}
}
$cart = edd_add_to_cart($download_id, $options);
if (edd_straight_to_checkout() && !edd_is_checkout()) {
$query_args = remove_query_arg(array('edd_action', 'download_id', 'edd_options'));
$query_part = strpos($query_args, "?");
$url_parameters = '';
if (false !== $query_part) {
$url_parameters = substr($query_args, $query_part);
}
wp_redirect(edd_get_checkout_uri() . $url_parameters, 303);
edd_die();
} else {
wp_redirect(remove_query_arg(array('edd_action', 'download_id', 'edd_options')));
edd_die();
}
}
示例5: checkout_no_sidebars
function checkout_no_sidebars()
{
if (edd_is_checkout()) {
// TODO: force fluid layout
add_filter('maera/sidebar/primary', '__return_false');
add_filter('maera/sidebar/secondary', '__return_false');
}
}
示例6: edd_rp_display_checkout
function edd_rp_display_checkout()
{
if (edd_is_checkout()) {
// GitHub Issue: https://github.com/pippinsplugins/Easy-Digital-Downloads/issues/1059
add_filter('edd_straight_to_checkout', '__return_true');
}
edd_rp_get_template_part('checkout_recommendations');
}
示例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: edd_rp_display_checkout
function edd_rp_display_checkout()
{
global $post;
if (edd_is_checkout()) {
// GitHub Issue: https://github.com/pippinsplugins/Easy-Digital-Downloads/issues/1059
add_filter('edd_straight_to_checkout', '__return_true');
}
EDD()->session->set('edd_has_recommendations', $post->ID);
edd_rp_get_template_part('checkout_recommendations');
}
示例9: pw_edd_disable_gateway_on_checkout
function pw_edd_disable_gateway_on_checkout($gateways)
{
if (edd_is_checkout()) {
// Disable Stripe if the download with an ID of 10 is in the cart
if (edd_item_in_cart(10)) {
unset($gateways['stripe']);
}
}
return $gateways;
}
示例10: edd_process_add_to_cart
/**
* Process the Add to Cart request
*
* @since 1.0
*
* @param $data
*/
function edd_process_add_to_cart( $data ) {
$download_id = absint( $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();
} else {
wp_redirect( remove_query_arg( array( 'edd_action', 'download_id', 'edd_options' ) ) ); edd_die();
}
}
示例11: reach_hide_post_meta
/**
* A helper function to determine whether the current post should have the meta displayed.
*
* @param WP_Post $post Optional. If a post is not passed, the current $post object will be used.
* @return boolean
* @since 1.0.0
*/
function reach_hide_post_meta($post = '')
{
if (!strlen($post)) {
global $post;
}
if (reach_has_edd() && edd_is_checkout()) {
return true;
}
if (function_exists('hide_meta_start')) {
return get_post_meta($post->ID, '_hide_meta', true);
} else {
return get_post_meta($post->ID, '_reach_hide_post_meta', true);
}
}
示例12: pp_load_navigation_extras
/**
* Navigation extras
*
* @since 1.0
*/
function pp_load_navigation_extras()
{
// don't load on checkout
if (function_exists('edd_is_checkout') && edd_is_checkout()) {
return;
}
if (function_exists('pp_share_icon')) {
pp_share_icon();
}
if (function_exists('pp_show_cart_quantity_icon')) {
pp_show_cart_quantity_icon();
}
get_search_form();
}
示例13: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
if (!empty($instance['hide_on_checkout']) && edd_is_checkout()) {
return;
}
$args['id'] = isset($args['id']) ? $args['id'] : 'edd_cart_widget';
$instance['title'] = isset($instance['title']) ? $instance['title'] : '';
$title = apply_filters('widget_title', $instance['title'], $instance, $args['id']);
echo $args['before_widget'];
if ($title) {
echo $args['before_title'] . $title . $args['after_title'];
}
do_action('edd_before_cart_widget');
edd_shopping_cart(true);
do_action('edd_after_cart_widget');
echo $args['after_widget'];
}
示例14: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
if (isset($instance['hide_on_checkout']) && edd_is_checkout()) {
return;
}
if (!isset($args['id'])) {
$args['id'] = 'edd_cart_widget';
}
$title = apply_filters('widget_title', $instance['title'], $instance, $args['id']);
global $post, $edd_options;
echo $args['before_widget'];
if ($title) {
echo $args['before_title'] . $title . $args['after_title'];
}
do_action('edd_before_cart_widget');
edd_shopping_cart(true);
do_action('edd_after_cart_widget');
echo $args['after_widget'];
}
示例15: edd_process_add_to_cart
/**
* Process the Add to Cart request
*
* @since 1.0
*
* @param $data
*/
function edd_process_add_to_cart($data)
{
$download_id = absint($data['download_id']);
$options = isset($data['edd_options']) ? $data['edd_options'] : array();
if (!empty($data['edd_download_quantity'])) {
$options['quantity'] = absint($data['edd_download_quantity']);
}
if (is_array($options['price_id'])) {
foreach ($options['price_id'] as $key => $price_id) {
$options['quantity'][$key] = absint($data['edd_download_quantity_' . $price_id]);
}
}
$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();
} else {
wp_redirect(remove_query_arg(array('edd_action', 'download_id', 'edd_options')));
edd_die();
}
}