本文整理汇总了PHP中edd_get_option函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_get_option函数的具体用法?PHP edd_get_option怎么用?PHP edd_get_option使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_get_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edd_get_default_gateway
/**
* Gets the default payment gateway selected from the EDD Settings
*
* @since 1.5
* @return string Gateway ID
*/
function edd_get_default_gateway()
{
$default = edd_get_option('default_gateway', 'paypal');
if (!edd_is_gateway_active($default)) {
$gateways = edd_get_enabled_payment_gateways();
$gateways = array_keys($gateways);
$default = reset($gateways);
}
return apply_filters('edd_default_gateway', $default);
}
示例2: edd_slm_add_log
function edd_slm_add_log($log_string, $date = false)
{
$debug = edd_get_option('edd_slm_debug');
if ($debug == 1) {
$folder = EDD_SLM_DIR . 'log';
$file = EDD_SLM_DIR . 'log/edd_slm_debug.log';
if ($date) {
$log_string = "Log Date: " . date("r") . "\n" . $log_string . "\n";
} else {
$log_string .= "\n";
}
if (file_exists($file)) {
if ($log = fopen($file, "a")) {
fwrite($log, $log_string, strlen($log_string));
fclose($log);
}
} else {
if (!file_exists($folder)) {
mkdir($folder, 0755, true);
}
if ($log = fopen($file, "c")) {
fwrite($log, $log_string, strlen($log_string));
fclose($log);
}
}
}
}
示例3: edd_wallet_cart_items_renewal_row
/**
* Displays the incentive discount row on the cart
*
* @since 1.0.1
* @return void
*/
function edd_wallet_cart_items_renewal_row()
{
$incentive_type = edd_get_option('edd_wallet_incentive_type', 'flatrate');
$incentive_amount = edd_get_option('edd_wallet_incentive_amount', 0);
$incentive_description = edd_get_option('edd_wallet_incentive_description', __('Wallet Discount', 'edd-wallet'));
if ($incentive_amount <= 0) {
return;
}
if (!EDD()->session->get('wallet_has_incentives')) {
return;
}
if ($incentive_type == 'percent') {
$discount = $incentive_amount . '%';
} else {
$discount = edd_currency_filter(edd_sanitize_amount($incentive_amount * edd_get_cart_quantity()));
}
?>
<tr class="edd_cart_footer_row edd_wallet_incentive_row">
<td colspan="3"><?php
printf(__('%1$s: %2$s', 'edd-wallet'), $incentive_description, $discount);
?>
</td>
</tr>
<?php
}
示例4: wc_edd_email_purchase_receipt
/**
* Helper Functions
*/
function wc_edd_email_purchase_receipt($payment_id, $download_id)
{
$payment_data = edd_get_payment_meta($payment_id);
$download = get_post($download_id);
$license = edd_software_licensing()->get_license_by_purchase($payment_id, $download_id);
$from_name = edd_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
$from_name = apply_filters('edd_purchase_from_name', $from_name, $payment_id, $payment_data);
$from_email = edd_get_option('from_email', get_bloginfo('admin_email'));
$from_email = apply_filters('edd_purchase_from_address', $from_email, $payment_id, $payment_data);
$to_email = edd_get_payment_user_email($payment_id);
$subject = edd_get_option('purchase_subject', __('New License Key', 'edd'));
$subject = apply_filters('edd_purchase_subject', wp_strip_all_tags($subject), $payment_id);
$subject = edd_do_email_tags($subject, $payment_id);
$message = "Dear " . edd_email_tag_first_name($payment_id) . ",\n\n";
$message .= "As you have updated " . $download->post_title . ", please use following new license key to continue getting future updates: \n\n";
$message .= "License Key : " . edd_software_licensing()->get_license_key($license->ID) . "\n\n";
$message .= "Sorry for inconvenience.";
$emails = EDD()->emails;
$emails->__set('from_name', $from_name);
$emails->__set('from_email', $from_email);
$emails->__set('heading', __('Purchase Receipt', 'edd'));
$headers = apply_filters('edd_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
$emails->__set('headers', $headers);
$emails->send($to_email, $subject, $message, array());
if ($admin_notice && !edd_admin_notices_disabled($payment_id)) {
do_action('edd_admin_sale_notice', $payment_id, $payment_data);
}
}
示例5: edd_format_amount
/**
* Returns a nicely formatted amount.
*
* @since 1.0
*
* @param string $amount Price amount to format
* @param string $decimals Whether or not to use decimals. Useful when set to false for non-currency numbers.
*
* @return string $amount Newly formatted amount or Price Not Available
*/
function edd_format_amount($amount, $decimals = true)
{
global $edd_options;
$thousands_sep = edd_get_option('thousands_separator', ',');
$decimal_sep = edd_get_option('decimal_separator', '.');
// Format the amount
if ($decimal_sep == ',' && false !== ($sep_found = strpos($amount, $decimal_sep))) {
$whole = substr($amount, 0, $sep_found);
$part = substr($amount, $sep_found + 1, strlen($amount) - 1);
$amount = $whole . '.' . $part;
}
// Strip , from the amount (if set as the thousands separator)
if ($thousands_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) {
$amount = str_replace(',', '', $amount);
}
// Strip ' ' from the amount (if set as the thousands separator)
if ($thousands_sep == ' ' && false !== ($found = strpos($amount, $thousands_sep))) {
$amount = str_replace(' ', '', $amount);
}
if (empty($amount)) {
$amount = 0;
}
$decimals = apply_filters('edd_format_amount_decimals', $decimals ? 2 : 0, $amount);
$formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep);
return apply_filters('edd_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep);
}
示例6: __construct
/**
* Class constructor
*
* @param string $_file
* @param string $_item_name
* @param string $_version
* @param string $_author
* @param string $_optname
* @param string $_api_url
*/
function __construct($_file, $_item, $_version, $_author, $_optname = null, $_api_url = null)
{
$this->file = $_file;
if (is_numeric($_item)) {
$this->item_id = absint($_item);
} else {
$this->item_name = $_item;
}
$this->item_shortname = 'edd_' . preg_replace('/[^a-zA-Z0-9_\\s]/', '', str_replace(' ', '_', strtolower($this->item_name)));
$this->version = $_version;
$this->license = trim(edd_get_option($this->item_shortname . '_license_key', ''));
$this->author = $_author;
$this->api_url = is_null($_api_url) ? $this->api_url : $_api_url;
/**
* Allows for backwards compatibility with old license options,
* i.e. if the plugins had license key fields previously, the license
* handler will automatically pick these up and use those in lieu of the
* user having to reactive their license.
*/
if (!empty($_optname)) {
$opt = edd_get_option($_optname, false);
if (isset($opt) && empty($this->license)) {
$this->license = trim($opt);
}
}
// Setup hooks
$this->includes();
$this->hooks();
//$this->auto_updater();
}
示例7: details
/**
* Get EDD details
*
* ## OPTIONS
*
* None. Returns basic info regarding your EDD instance.
*
* ## EXAMPLES
*
* wp edd details
*
* @access public
* @param array $args
* @param array $assoc_args
* @return void
*/
public function details($args, $assoc_args)
{
$symlink_file_downloads = edd_get_option('symlink_file_downloads', false);
$purchase_page = edd_get_option('purchase_page', '');
$success_page = edd_get_option('success_page', '');
$failure_page = edd_get_option('failure_page', '');
WP_CLI::line(sprintf(__('You are running EDD version: %s', 'easy-digital-downloads'), EDD_VERSION));
WP_CLI::line("\n" . sprintf(__('Test mode is: %s', 'easy-digital-downloads'), edd_is_test_mode() ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Ajax is: %s', 'easy-digital-downloads'), edd_is_ajax_enabled() ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Guest checkouts are: %s', 'easy-digital-downloads'), edd_no_guest_checkout() ? __('Disabled', 'easy-digital-downloads') : __('Enabled', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Symlinks are: %s', 'easy-digital-downloads'), apply_filters('edd_symlink_file_downloads', isset($symlink_file_downloads)) && function_exists('symlink') ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
WP_CLI::line("\n" . sprintf(__('Checkout page is: %s', 'easy-digital-downloads'), !edd_get_option('purchase_page', false) ? __('Valid', 'easy-digital-downloads') : __('Invalid', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Checkout URL is: %s', 'easy-digital-downloads'), !empty($purchase_page) ? get_permalink($purchase_page) : __('Undefined', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Success URL is: %s', 'easy-digital-downloads'), !empty($success_page) ? get_permalink($success_page) : __('Undefined', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Failure URL is: %s', 'easy-digital-downloads'), !empty($failure_page) ? get_permalink($failure_page) : __('Undefined', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Downloads slug is: %s', 'easy-digital-downloads'), defined('EDD_SLUG') ? '/' . EDD_SLUG : '/downloads'));
WP_CLI::line("\n" . sprintf(__('Taxes are: %s', 'easy-digital-downloads'), edd_use_taxes() ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Tax rate is: %s', 'easy-digital-downloads'), edd_get_tax_rate() * 100 . '%'));
$rates = edd_get_tax_rates();
if (!empty($rates)) {
foreach ($rates as $rate) {
WP_CLI::line(sprintf(__('Country: %s, State: %s, Rate: %s', 'easy-digital-downloads'), $rate['country'], $rate['state'], $rate['rate']));
}
}
}
示例8: edd_pre_approval_emails_send_admin_email
/**
* Admin notification
*/
function edd_pre_approval_emails_send_admin_email($payment_id = 0, $payment_data = array())
{
$payment_id = absint($payment_id);
// get payment data from payment ID
$payment_data = edd_get_payment_meta($payment_id);
if (empty($payment_id)) {
return;
}
if (!edd_get_payment_by('id', $payment_id)) {
return;
}
$from_name = edd_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
$from_name = apply_filters('edd_purchase_from_name', $from_name, $payment_id, $payment_data);
$from_email = edd_get_option('from_email', get_bloginfo('admin_email'));
$from_email = apply_filters('edd_purchase_from_address', $from_email, $payment_id, $payment_data);
$subject = sprintf(__('New pledge - Order #%1$s', 'edd-pre-approval-emails'), $payment_id);
$subject = wp_strip_all_tags($subject);
$subject = edd_do_email_tags($subject, $payment_id);
$headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n";
$headers .= "Reply-To: " . $from_email . "\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
$headers = apply_filters('edd_admin_pledge_notification_headers', $headers, $payment_id, $payment_data);
$attachments = apply_filters('edd_admin_pledge_notification_attachments', array(), $payment_id, $payment_data);
$message = edd_pre_approval_emails_get_admin_email_body($payment_id, $payment_data);
if (class_exists('EDD_Emails')) {
$emails = EDD()->emails;
$emails->__set('from_name', $from_name);
$emails->__set('from_email', $from_email);
$emails->__set('headers', $headers);
$emails->__set('heading', __('New Pledge!', 'edd-pre-approval-emails'));
$emails->send(edd_get_admin_notice_emails(), $subject, $message, $attachments);
}
}
示例9: gateway_function_to_process_payment
function gateway_function_to_process_payment($purchase_data)
{
// payment processing happens here
// if (edd_is_test_mode()) {
//
// } else {
//
// }
$purchase_summary = edd_get_purchase_summary($purchase_data);
// var_dump($purchase_data);
$payment_data = array('price' => $purchase_data['price'], 'date' => $purchase_data['date'], 'user_email' => $purchase_data['user_email'], 'purchase_key' => $purchase_data['purchase_key'], 'currency' => edd_get_currency(), 'downloads' => $purchase_data['downloads'], 'cart_details' => $purchase_data['cart_details'], 'user_info' => $purchase_data['user_info'], 'status' => 'pending');
// echo $purchase_data['purchase_key'];
// Record the pending payment
$payment = edd_insert_payment($payment_data);
// Setup Yandex.Kassa arguments
$yandex_args = array('ShopID' => edd_get_option('ya_shop_id', false), 'scid' => edd_get_option('ya_scid', false), 'cps_email' => $purchase_data['user_email'], 'Sum' => $purchase_data['price'], 'orderNumber' => $purchase_data['purchase_key'], 'orderDetails' => $purchase_data['cart_details'], 'CustName' => $purchase_data['user_info']['first_name'], 'paymentType' => 'AC');
// Build query
$yandex_redirect = 'https://money.yandex.ru/eshop.xml?';
$yandex_redirect .= http_build_query($yandex_args);
// Redirect
// wp_redirect( $yandex_redirect );
// if the merchant payment is complete, set a flag
$merchant_payment_confirmed = false;
if ($merchant_payment_confirmed) {
// this is used when processing credit cards on site
// once a transaction is successful, set the purchase to complete
edd_update_payment_status($payment, 'complete');
// go to the success page
edd_send_to_success_page();
} else {
$fail = true;
// payment wasn't recorded
}
}
示例10: csv_cols
/**
* Set the CSV columns
*
* @access public
* @since 2.4
* @return array $cols All the columns
*/
public function csv_cols() {
$cols = array(
'id' => __( 'ID', 'edd' ), // unaltered payment ID (use for querying)
'seq_id' => __( 'Payment Number', 'edd' ), // sequential payment ID
'email' => __( 'Email', 'edd' ),
'first' => __( 'First Name', 'edd' ),
'last' => __( 'Last Name', 'edd' ),
'address1' => __( 'Address', 'edd' ),
'address2' => __( 'Address (Line 2)', 'edd' ),
'city' => __( 'City', 'edd' ),
'state' => __( 'State', 'edd' ),
'country' => __( 'Country', 'edd' ),
'zip' => __( 'Zip Code', 'edd' ),
'products' => __( 'Products', 'edd' ),
'skus' => __( 'SKUs', 'edd' ),
'amount' => __( 'Amount', 'edd' ) . ' (' . html_entity_decode( edd_currency_filter( '' ) ) . ')',
'tax' => __( 'Tax', 'edd' ) . ' (' . html_entity_decode( edd_currency_filter( '' ) ) . ')',
'discount' => __( 'Discount Code', 'edd' ),
'gateway' => __( 'Payment Method', 'edd' ),
'trans_id' => __( 'Transaction ID', 'edd' ),
'key' => __( 'Purchase Key', 'edd' ),
'date' => __( 'Date', 'edd' ),
'user' => __( 'User', 'edd' ),
'status' => __( 'Status', 'edd' )
);
if( ! edd_use_skus() ){
unset( $cols['skus'] );
}
if ( ! edd_get_option( 'enable_sequential' ) ) {
unset( $cols['seq_id'] );
}
return $cols;
}
示例11: jp_customize_verification_email
function jp_customize_verification_email($message, $user_id)
{
$user_data = get_userdata($user_id);
$url = edd_get_user_verification_url($user_id);
$from_name = edd_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
$message = sprintf(__("Howdy %s,\n\nYour account with %s needs to be verified before you can access your purchase history. <a href='%s'>Click here</a> to verify your account and get access to your purchases.", 'edd'), $user_data->display_name, $from_name, $url);
return $message;
}
示例12: edd_wl_rewrite_rules
/**
* Rewrite rules
* @since 1.0
*/
function edd_wl_rewrite_rules()
{
$wish_list_view_page_id = edd_get_option('edd_wl_page_view');
$wish_list_edit_page_id = edd_get_option('edd_wl_page_edit');
$view_slug = edd_wl_get_page_slug('view') ? edd_wl_get_page_slug('view') : 'view';
$edit_slug = edd_wl_get_page_slug('edit') ? edd_wl_get_page_slug('edit') : 'edit';
add_rewrite_rule('.*' . $view_slug . '/([0-9]+)?$', 'index.php?page_id=' . $wish_list_view_page_id . '&wl_view=$matches[1]', 'top');
add_rewrite_rule('.*' . $edit_slug . '/([0-9]+)?$', 'index.php?page_id=' . $wish_list_edit_page_id . '&wl_edit=$matches[1]', 'top');
}
示例13: edd_slm_api_validation
function edd_slm_api_validation()
{
$api_url = edd_get_option('edd_slm_api_url');
$api_secret = edd_get_option('edd_slm_api_secret');
if (empty($api_url) || empty($api_secret)) {
return false;
}
return true;
}
示例14: edd_vault_display_admin_notice
/**
* Add a notification bar for admins
*
* @since 1.0.0
* @param string $the_content The post content
* @return string $the_content The updated post content
*/
function edd_vault_display_admin_notice($the_content)
{
if (isset($GLOBALS['post']) && $GLOBALS['post']->post_type == 'download') {
$status = array_values(edd_vault_is_stored($GLOBALS['post']->ID));
if (in_array(true, $status)) {
$the_content = '<div class="edd-vault-notice"><p>' . edd_get_option('vault_notice_text', sprintf(__('This %s is currently in the vault.', 'edd-vault'), edd_get_label_singular(true))) . '</p></div>' . $the_content;
}
}
return $the_content;
}
示例15: affwp_show_sharing_buttons_after_purchase
/**
* Share purchase shortcode
*/
function affwp_show_sharing_buttons_after_purchase($atts, $content = null)
{
$success_page = edd_get_option('success_page') ? is_page(edd_get_option('success_page')) : false;
// return if no affiliate was rewarded via the select menu
if (!$success_page) {
return;
}
$content = affwp_share_box('', 'I just purchased AffiliateWP, the best affiliate marketing plugin for WordPress!');
return $content;
}