本文整理汇总了PHP中edd_die函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_die函数的具体用法?PHP edd_die怎么用?PHP edd_die使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_die函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edd_edit_discount
/**
* Saves an edited discount
*
* @since 1.0
* @param array $data Discount code data
* @return void
*/
function edd_edit_discount($data)
{
if (isset($data['edd-discount-nonce']) && wp_verify_nonce($data['edd-discount-nonce'], 'edd_discount_nonce')) {
// Setup the discount code details
$discount = array();
foreach ($data as $key => $value) {
if ($key != 'edd-discount-nonce' && $key != 'edd-action' && $key != 'discount-id' && $key != 'edd-redirect') {
if (is_string($value) || is_int($value)) {
$discount[$key] = strip_tags(addslashes($value));
} elseif (is_array($value)) {
$discount[$key] = array_map('absint', $value);
}
}
}
$old_discount = edd_get_discount_by('code', $data['code']);
$discount['uses'] = edd_get_discount_uses($old_discount->ID);
if (edd_store_discount($discount, $data['discount-id'])) {
wp_redirect(add_query_arg('edd-message', 'discount_updated', $data['edd-redirect']));
edd_die();
} else {
wp_redirect(add_query_arg('edd-message', 'discount_update_failed', $data['edd-redirect']));
edd_die();
}
}
}
示例2: edd_ppe_edit_receipt
/**
* Saves an edited receipt
*
* @since 1.0
* @param array $data Receipt data
* @return void
*/
function edd_ppe_edit_receipt($data)
{
if (isset($data['edd-receipt-nonce']) && wp_verify_nonce($data['edd-receipt-nonce'], 'edd_receipt_nonce')) {
// Setup the receipt details
$receipt = array();
foreach ($data as $key => $value) {
if ($key != 'edd-receipt-nonce' && $key != 'edd-action' && $key != 'receipt-id' && $key != 'edd-receipt') {
if ('email' == $key) {
$receipt[$key] = $value;
} elseif (is_string($value) || is_int($value)) {
$receipt[$key] = strip_tags(addslashes($value));
} elseif (is_array($value)) {
$receipt[$key] = array_map('absint', $value);
}
}
}
if (edd_ppe_store_receipt($receipt, $data['receipt-id'])) {
wp_redirect(add_query_arg('edd-message', 'receipt_updated', $data['edd-receipt']));
edd_die();
} else {
wp_redirect(add_query_arg('edd-message', 'receipt_update_failed', $data['edd-receipt']));
edd_die();
}
}
}
示例3: edd_cr_check_for_download_price_variations
/**
* Check for download price variations
*
* @since 2.0
* @return void
*/
function edd_cr_check_for_download_price_variations()
{
if (!current_user_can('edit_products')) {
die('-1');
}
$download_id = absint($_POST['download_id']);
$key = isset($_POST['key']) ? absint($_POST['key']) : 0;
$download = get_post($download_id);
if ('download' != $download->post_type) {
die('-2');
}
if (edd_has_variable_prices($download_id)) {
$variable_prices = edd_get_variable_prices($download_id);
if ($variable_prices) {
$ajax_response = '<select class="edd_price_options_select edd-select edd-select edd_cr_download" name="edd_cr_download[' . $key . '][price_id]">';
$ajax_response .= '<option value="all">' . esc_html(__('All prices', 'edd-cr')) . '</option>';
foreach ($variable_prices as $price_id => $price) {
$ajax_response .= '<option value="' . esc_attr($price_id) . '">' . esc_html($price['name']) . '</option>';
}
$ajax_response .= '</select>';
echo $ajax_response;
}
}
edd_die();
}
示例4: affwp_share_thanks
/**
* Sharing message
*/
function affwp_share_thanks()
{
// check nonce
check_ajax_referer('affwp_ajax_nonce', 'nonce');
// EDD()->session->set( 'affwp_shared', true );
$return = array('msg' => 'valid', 'success_title' => 'Thanks for sharing!');
echo json_encode($return);
edd_die();
}
示例5: edd_pup_create_email
/**
* Sets up and saves a product update email when added or edited.
*
* @since 0.9.3
* @param array $data email data
* @return void
*/
function edd_pup_create_email($data)
{
if (isset($data['edd_pup_nonce']) && wp_verify_nonce($data['edd_pup_nonce'], 'edd_pup_nonce')) {
$post = edd_pup_sanitize_save($data);
if (0 != $post) {
if ($data['edd-action'] == 'add_pup_email') {
wp_redirect(esc_url_raw(add_query_arg(array('view' => 'edit_pup_email', 'id' => $post, 'edd_pup_notice' => 2))));
} else {
wp_redirect(esc_url_raw(add_query_arg('edd_pup_notice', 1)));
}
edd_die();
} else {
wp_redirect(esc_url_raw(add_query_arg('edd_pup_notice', 3)));
edd_die();
}
}
}
示例6: edd_wl_redirects
/**
* Performs redirect actions
*
* @since 1.0
* @uses edd_wl_is_private_list()
* @uses edd_wl_get_wish_list_uri()
* @return void
*/
function edd_wl_redirects()
{
// Prevent private lists from being viewed. Also only allows users to access edit slugs with own list ID
if (edd_wl_is_private_list() || !edd_wl_is_users_list(get_query_var('edit')) && get_query_var('edit')) {
// Don't redirect if we're on single download page.
// Extra check to fix compatibility with crowdfunding extension or any other extension that uses an edit query var on the single download page
if (!is_singular('download')) {
$redirect = apply_filters('edd_wl_private_redirect', edd_wl_get_wish_list_uri());
wp_redirect($redirect);
edd_die();
}
}
// redirect if edit or view page is accessed but edit/view query_var does not exist
if (edd_wl_is_page('view') && !get_query_var('view') || edd_wl_is_page('edit') && !get_query_var('edit')) {
wp_redirect(edd_wl_get_wish_list_uri());
edd_die();
}
}
示例7: edd_wallet_process_incentive
function edd_wallet_process_incentive()
{
if ($_REQUEST['gateway'] == 'wallet') {
EDD()->session->set('wallet_has_incentives', '1');
} else {
EDD()->session->set('wallet_has_incentives', null);
}
// Refresh the cart
if (empty($_POST['billing_country'])) {
$_POST['billing_country'] = edd_get_shop_country();
}
ob_start();
edd_checkout_cart();
$cart = ob_get_clean();
$response = array('html' => $cart, 'tax_raw' => edd_get_cart_tax(), 'tax' => html_entity_decode(edd_cart_tax(false), ENT_COMPAT, 'UTF-8'), 'tax_rate_raw' => edd_get_tax_rate(), 'tax_rate' => html_entity_decode(edd_get_formatted_tax_rate(), ENT_COMPAT, 'UTF-8'), 'total' => html_entity_decode(edd_cart_total(false), ENT_COMPAT, 'UTF-8'), 'total_raw' => edd_get_cart_total());
echo json_encode($response);
edd_die();
}
示例8: 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();
}
示例9: edd_trigger_purchase_delete
/**
* Trigger a Purchase Deletion
*
* @since 1.3.4
* @param $data Arguments passed
* @return void
*/
function edd_trigger_purchase_delete($data)
{
if (wp_verify_nonce($data['_wpnonce'], 'edd_payment_nonce')) {
$payment_id = absint($data['purchase_id']);
if (!current_user_can('edit_shop_payments', $payment_id)) {
wp_die(__('You do not have permission to edit this payment record', 'easy-digital-downloads'), __('Error', 'easy-digital-downloads'), array('response' => 403));
}
edd_delete_purchase($payment_id);
wp_redirect(admin_url('/edit.php?post_type=download&page=edd-payment-history&edd-message=payment_deleted'));
edd_die();
}
}
示例10: edd_remove_cart_discount
/**
* Processes a remove discount from cart request
*
* @since 1.4.1
* @return void
*/
function edd_remove_cart_discount()
{
if (!isset($_GET['discount_id']) || !isset($_GET['discount_code'])) {
return;
}
do_action('edd_pre_remove_cart_discount', absint($_GET['discount_id']));
edd_unset_cart_discount(urldecode($_GET['discount_code']));
do_action('edd_post_remove_cart_discount', absint($_GET['discount_id']));
wp_redirect(edd_get_checkout_uri());
edd_die();
}
示例11: edd_check_for_download_price_variations
/**
* Check for Download Price Variations via AJAX (this function can only be used
* in WordPress Admin). This function is used for the Edit Payment screen when downloads
* are added to the purchase. When each download is chosen, an AJAX call is fired
* to this function which will check if variable prices exist for that download.
* If they do, it will output a dropdown of all the variable prices available for
* that download.
*
* @author Sunny Ratilal
* @since 1.5
* @return void
*/
function edd_check_for_download_price_variations()
{
if (!current_user_can('edit_products')) {
die('-1');
}
$download_id = intval($_POST['download_id']);
$download = get_post($download_id);
if ('download' != $download->post_type) {
die('-2');
}
if (edd_has_variable_prices($download_id)) {
$variable_prices = edd_get_variable_prices($download_id);
if ($variable_prices) {
$ajax_response = '<select class="edd_price_options_select edd-select edd-select" name="edd_price_option">';
if (isset($_POST['all_prices'])) {
$ajax_response .= '<option value="">' . __('All Prices', 'easy-digital-downloads') . '</option>';
}
foreach ($variable_prices as $key => $price) {
$ajax_response .= '<option value="' . esc_attr($key) . '">' . esc_html($price['name']) . '</option>';
}
$ajax_response .= '</select>';
echo $ajax_response;
}
}
edd_die();
}
示例12: edd_generate_fes_sysinfo_download
/**
* Generates the System Info Download File
*
* @since 1.4
* @return void
*/
function edd_generate_fes_sysinfo_download()
{
nocache_headers();
header("Content-type: text/plain");
header('Content-Disposition: attachment; filename="fes-system-info.txt"');
echo wp_strip_all_tags($_POST['fes-sysinfo']);
edd_die();
}
示例13: edd_wl_share_via_email
/**
* Share via email
*
* @since 1.0
*/
function edd_wl_share_via_email()
{
check_ajax_referer('edd_wl_ajax_nonce', 'nonce');
global $edd_options;
if (!isset($_POST['post_id'])) {
return;
}
// referrer
$referrer = $_POST['referrer'] ? $_POST['referrer'] : '';
// sender details
$sender_name = isset($_POST['from_name']) ? $_POST['from_name'] : '';
$sender_email = isset($_POST['from_email']) ? $_POST['from_email'] : '';
$emails = isset($_POST['emails']) ? $_POST['emails'] : '';
$post_id = isset($_POST['post_id']) ? $_POST['post_id'] : '';
$from_name = isset($edd_options['from_name']) ? $edd_options['from_name'] : get_bloginfo('name');
$from_email = isset($edd_options['from_email']) ? $edd_options['from_email'] : get_option('admin_email');
$message = isset($_POST['message']) ? $_POST['message'] : '';
// validation
if (!($sender_name || $sender_email || !edd_wl_validate_share_emails($emails))) {
$has_error = true;
}
if (!isset($has_error)) {
$shortlink = wp_get_shortlink($post_id);
// shortlink
$subject = edd_wl_share_via_email_subject($sender_name, $referrer);
$message = edd_wl_share_via_email_message($shortlink, $sender_name, $sender_email, $message, $referrer);
$headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n";
$headers .= "Reply-To: " . $sender_email . "\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
$headers = apply_filters('edd_wl_share_via_email_headers', $headers);
// send email
wp_mail($emails, $subject, $message, $headers);
}
$return['success'] = edd_wl_modal_share_via_email_success();
echo json_encode($return);
edd_die();
}
示例14: process_front_end_tickets_form
/**
* Grabs the submitted front end tickets form and adds the products to the cart.
*/
public function process_front_end_tickets_form()
{
// We're only interested in EDD Tickets submissions
if (!isset($_GET['eddtickets_process']) || empty($_POST['product_id'])) {
return;
}
// Add each ticket product to the cart
foreach ((array) $_POST['product_id'] as $product_id) {
$quantity = isset($_POST['quantity_' . $product_id]) ? (int) $_POST['quantity_' . $product_id] : 0;
if ($quantity > 0) {
$this->add_ticket_to_cart($product_id, $quantity);
}
}
// To minimize accidental re-submissions, redirect back to self
wp_redirect(edd_get_checkout_uri());
edd_die();
}
示例15: output
/**
* Output Query in either JSON/XML. The query data is outputted as JSON
* by default
*
* @author Daniel J Griffiths
* @since 1.5
* @global $wp_query
*
* @param int $status_code
*/
public function output($status_code = 200)
{
global $wp_query;
$format = $this->get_output_format();
status_header($status_code);
do_action('edd_api_output_before', $this->data, $this, $format);
switch ($format) {
case 'xml':
require_once EDD_PLUGIN_DIR . 'includes/libraries/array2xml.php';
$xml = Array2XML::createXML('edd', $this->data);
echo $xml->saveXML();
break;
case 'json':
header('Content-Type: application/json');
if (!empty($this->pretty_print)) {
echo json_encode($this->data, $this->pretty_print);
} else {
echo json_encode($this->data);
}
break;
default:
// Allow other formats to be added via extensions
do_action('edd_api_output_' . $format, $this->data, $this);
break;
}
do_action('edd_api_output_after', $this->data, $this, $format);
edd_die();
}