コード例 #1
1
/**
 * 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
0
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
0
/**
 * 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
0
/**
 * 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
0
/**
 * 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
0
 /**
  * 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
0
 /**
  * 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
0
/**
 * 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
0
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
0
	/**
	 * 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
0
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
0
ファイル: rewrites.php プロジェクト: SelaInc/eassignment
/**
 * 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
0
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
0
/**
 * 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
0
ファイル: template-tags.php プロジェクト: companyjuice/theme
/**
 * 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;
}
コード例 #16
0
/**
 * View Wish Lists shortcode
 * 
 * @param  array $atts
 * @param  $content
 * @return object
 * @since  1.0
 */
function edd_wl_shortcode($atts, $content = null)
{
    extract(shortcode_atts(array('id' => '', 'title' => ''), $atts, 'edd_wish_lists'));
    // exit if no wish list page is set
    if ('none' == edd_get_option('edd_wl_page')) {
        return;
    }
    $content = edd_wl_wish_list();
    return $content;
}
コード例 #17
0
function edd_fes_pu_get_enabled_email_tags()
{
    $tags = edd_fes_pu_get_email_tags();
    $enabled = edd_get_option('fes_pu_tags', array());
    foreach ($tags as $key => $tag) {
        if (!array_key_exists($key, $enabled)) {
            unset($tags[$key]);
        }
    }
    return $tags;
}
コード例 #18
0
 /**
  * Set the CSV columns
  *
  * @access public
  * @since 2.4
  * @return array $cols All the columns
  */
 public function csv_cols()
 {
     $cols = array('id' => __('Payment ID', 'easy-digital-downloads'), 'seq_id' => __('Payment Number', 'easy-digital-downloads'), 'email' => __('Email', 'easy-digital-downloads'), 'customer_id' => __('Customer ID', 'easy-digital-downloads'), 'first' => __('First Name', 'easy-digital-downloads'), 'last' => __('Last Name', 'easy-digital-downloads'), 'address1' => __('Address', 'easy-digital-downloads'), 'address2' => __('Address (Line 2)', 'easy-digital-downloads'), 'city' => __('City', 'easy-digital-downloads'), 'state' => __('State', 'easy-digital-downloads'), 'country' => __('Country', 'easy-digital-downloads'), 'zip' => __('Zip / Postal Code', 'easy-digital-downloads'), 'products' => __('Products (Verbose)', 'easy-digital-downloads'), 'products_raw' => __('Products (Raw)', 'easy-digital-downloads'), 'skus' => __('SKUs', 'easy-digital-downloads'), 'amount' => __('Amount', 'easy-digital-downloads') . ' (' . html_entity_decode(edd_currency_filter('')) . ')', 'tax' => __('Tax', 'easy-digital-downloads') . ' (' . html_entity_decode(edd_currency_filter('')) . ')', 'discount' => __('Discount Code', 'easy-digital-downloads'), 'gateway' => __('Payment Method', 'easy-digital-downloads'), 'trans_id' => __('Transaction ID', 'easy-digital-downloads'), 'key' => __('Purchase Key', 'easy-digital-downloads'), 'date' => __('Date', 'easy-digital-downloads'), 'user' => __('User', 'easy-digital-downloads'), 'currency' => __('Currency', 'easy-digital-downloads'), 'ip' => __('IP Address', 'easy-digital-downloads'), 'mode' => __('Mode (Live|Test)', 'easy-digital-downloads'), 'status' => __('Status', 'easy-digital-downloads'));
     if (!edd_use_skus()) {
         unset($cols['skus']);
     }
     if (!edd_get_option('enable_sequential')) {
         unset($cols['seq_id']);
     }
     return $cols;
 }
コード例 #19
0
ファイル: edd.php プロジェクト: evinw/project_3dBP
/**
 * Cart menu item
 *
 * @since Marketify 1.0
 *
 * @param string $items
 * @param object $args
 * @return string $items
 */
function marketify_wp_nav_menu_items($items, $args)
{
    if ('primary' != $args->theme_location) {
        return $items;
    }
    ob_start();
    $widget_args = array('before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '');
    $widget = the_widget('edd_cart_widget', array('title' => ''), $widget_args);
    $widget = ob_get_clean();
    $link = sprintf('<li class="current-cart"><a href="%s"><i class="icon-cart"></i> <span class="edd-cart-quantity">%d</span></a><ul class="sub-menu nav-menu"><li class="widget">%s</li></ul></li>', get_permalink(edd_get_option('purchase_page')), edd_get_cart_quantity(), $widget);
    return $link . $items;
}
コード例 #20
0
ファイル: functions.php プロジェクト: SelaInc/eassignment
/**
 * Validates the survey results on checkout
 *
 * @since  1.0
 * @param  array $valid_data The array of valid data
 * @param  array $data       The data submitted
 * @return void
 */
function edd_acq_validate_custom_fields($valid_data, $data)
{
    $methods = edd_acq_get_methods();
    if (empty($methods)) {
        return;
    }
    $required = edd_get_option('acq_require_response', false);
    if ($required && (empty($data['edd_acquisition_method']) || $data['edd_acquisition_method'] == '-1')) {
        // check for a phone number
        edd_set_error('invalid_acquisition_method', __('Please tell us how you found us.', 'edd-acquisition-survey'));
    }
}
コード例 #21
0
ファイル: functions.php プロジェクト: SelaInc/eassignment
/**
 * Is edit page?
 *
 * @return boolean
 */
function edd_wl_is_edit_page()
{
    $pages = apply_filters('edd_wl_is_edit_page', array(edd_get_option('edd_wl_page_edit', '')));
    if ($pages) {
        foreach ($pages as $page) {
            if (is_page($page)) {
                return true;
            }
        }
    }
    return false;
}
コード例 #22
0
 /**
  * Include necessary files
  *
  * @access      private
  * @since       1.0.0
  * @return      void
  */
 private function includes()
 {
     require_once EDD_VAULT_DIR . 'includes/functions.php';
     require_once EDD_VAULT_DIR . 'includes/scripts.php';
     require_once EDD_VAULT_DIR . 'includes/actions.php';
     require_once EDD_VAULT_DIR . 'includes/filters.php';
     if (is_admin()) {
         if (edd_get_option('vault_status_column', false) == true) {
             require_once EDD_VAULT_DIR . 'includes/admin/downloads/dashboard-columns.php';
         }
         require_once EDD_VAULT_DIR . 'includes/admin/downloads/actions.php';
     }
 }
コード例 #23
0
function edd_cr_hide_menu_items($items, $args)
{
    if (edd_get_option('edd_content_restriction_hide_menu_items', false)) {
        foreach ($items as $item_id => $item_data) {
            $restricted = edd_cr_is_restricted($item_data->object_id);
            $has_access = edd_cr_user_can_access(get_current_user_id(), $restricted, $item_data->object_id);
            if ($has_access['status'] == false) {
                unset($items[$item_id]);
            }
        }
    }
    return $items;
}
 /**
  * Setup plugin constants
  *
  * @access      private
  * @since       1.0.0
  * @return      void
  */
 private function setup_constants()
 {
     // Plugin version
     define('EDD_SLM_VER', '1.0.0');
     // Plugin path
     define('EDD_SLM_DIR', plugin_dir_path(__FILE__));
     // Plugin URL
     define('EDD_SLM_URL', plugin_dir_url(__FILE__));
     // SLM Credentials
     $api_url = rtrim(edd_get_option('edd_slm_api_url'), '/');
     define('EDD_SLM_API_URL', $api_url);
     define('EDD_SLM_API_SECRET', edd_get_option('edd_slm_api_secret'));
 }
コード例 #25
0
 /**
  * Create the widget
  *
  * @access      public
  * @since       1.0.0
  * @param       array $args The widget arguements
  * @param       array $instance This widget instance
  * @return      void
  */
 public function widget($args, $instance)
 {
     $title = apply_filters('widget_title', $instance['title'], $instance, $args['id']);
     $payment_methods = edd_get_option('accepted_cards', array());
     $icon_width = isset($instance['icon_width']) ? $instance['icon_width'] . 'px' : '32px';
     if (empty($payment_methods)) {
         return;
     }
     echo $args['before_widget'];
     if ($title) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     do_action('edd_before_payment_icons_widget');
     echo '<div class="edd-payment-icons-widget">';
     if ($instance['above_icons']) {
         echo '<div class="edd-payment-icons-widget-text">';
         echo html_entity_decode(esc_html($instance['above_icons']));
         echo '</div>';
     }
     foreach ($payment_methods as $key => $card) {
         if (edd_string_is_image_url($key)) {
             echo '<img class="payment-icon" src="' . esc_url($key) . '" style="width: ' . $icon_width . '" />';
         } else {
             $card = strtolower(str_replace(' ', '', $card));
             if (has_filter('edd_accepted_payment_' . $card . '_image')) {
                 $image = apply_filters('edd_accepted_payment_' . $card . '_image', '');
             } else {
                 $image = edd_locate_template('images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false);
                 $content_dir = WP_CONTENT_DIR;
                 if (function_exists('wp_normalize_path')) {
                     $image = wp_normalize_path($image);
                     $content_dir = wp_normalize_path($content_dir);
                 }
                 $image = str_replace($content_dir, WP_CONTENT_URL, $image);
             }
             if (edd_is_ssl_enforced() || is_ssl()) {
                 $image = edd_enforced_ssl_asset_filter($image);
             }
             echo '<img class="payment-icon" src="' . esc_url($image) . '" style="width: ' . $icon_width . '" />';
         }
     }
     if ($instance['below_icons']) {
         echo '<div class="edd-payment-icons-widget-text">';
         echo html_entity_decode($instance['below_icons']);
         echo '</div>';
     }
     echo '</div>';
     do_action('edd_after_payment_icons_widget');
     echo $args['after_widget'];
 }
コード例 #26
0
 public function __construct()
 {
     if (!function_exists('edd_get_option')) {
         return;
     }
     $api_key = edd_get_option('eddmc_api', '');
     if (!empty($api_key)) {
         $this->key = trim($api_key);
     }
     add_action('init', array($this, 'set_ecommerce360_session'));
     add_action('edd_insert_payment', array($this, 'set_ecommerce360_flags'), 10, 2);
     add_action('edd_complete_purchase', array($this, 'record_ecommerce360_purchase'));
     add_action('edd_update_payment_status', array($this, 'delete_ecommerce360_purchase'), 10, 3);
 }
 /**
  * Get active instance
  *
  * @access      public
  * @since       1.0.0
  * @return      self::$instance The one true EDD_Customerio_Connect
  */
 public static function instance()
 {
     if (!self::$instance) {
         self::$instance = new EDD_Customerio_Connect();
         self::$instance->setup_constants();
         self::$instance->includes();
         self::$instance->load_textdomain();
         $site_id = edd_get_option('edd_customerio_connect_site_id', false);
         $api_key = edd_get_option('edd_customerio_connect_api_key', false);
         if ($site_id && $api_key) {
             self::$instance->api = new Customerio($site_id, $api_key);
         }
     }
     return self::$instance;
 }
コード例 #28
0
/**
 * Change the button text of a free download. Default is "Free - Add to Cart"
 *
 * @since 1.0.0
 */
function edd_wp_downloads_text_args($args)
{
    $free_download_text = edd_get_option('edd_wp_downloads_button_text', __('Free Download', 'edd-wp-downloads'));
    $variable_pricing = edd_has_variable_prices($args['download_id']);
    if ($args['price'] && $args['price'] !== 'no' && !$variable_pricing) {
        $price = edd_get_download_price($args['download_id']);
        if (0 == $price) {
            $wp_downloads_url = get_post_meta($args['download_id'], '_edd_wp_downloads_url', true);
            if ($wp_downloads_url) {
                $args['text'] = $free_download_text;
            }
        }
    }
    return $args;
}
コード例 #29
0
ファイル: recommended.php プロジェクト: evinw/project_3dBP
/**
 * Add our own output of recommended products, as the plugin
 * uses the standard grid by default, and we need our own.
 *
 * @since Marketify 1.0
 *
 * @return void
 */
function marketify_recommended_products()
{
    global $edd_options;
    if (!function_exists('edd_rp_get_suggestions')) {
        return;
    }
    if (is_singular('download')) {
        global $post;
        $suggestion_data = edd_rp_get_suggestions($post->ID);
    } else {
        $cart_items = edd_get_cart_contents();
        if (empty($cart_items)) {
            return;
        }
        $post_ids = wp_list_pluck($cart_items, 'id');
        $user_id = is_user_logged_in() ? get_current_user_id() : false;
        $suggestion_data = edd_rp_get_multi_suggestions($post_ids, $user_id);
    }
    if (!is_array($suggestion_data) || empty($suggestion_data)) {
        return;
    }
    $suggestions = array_keys($suggestion_data);
    $suggested_downloads = new WP_Query(array('post__in' => $suggestions, 'post_type' => 'download', 'posts_per_page' => edd_get_option('edd_rp_suggestion_count')));
    ?>

	<h1 class="section-title recommended-products"><span><?php 
    _e('Recommended Products', 'marketify');
    ?>
</span></h1>

	<div class="row edd-recommended-products">
		<?php 
    while ($suggested_downloads->have_posts()) {
        $suggested_downloads->the_post();
        ?>
		<div class="col-lg-3 col-md-4 col-sm-6">
			<?php 
        get_template_part('content-grid', 'download');
        ?>
		</div>
		<?php 
    }
    ?>
	</div>
<?php 
}
コード例 #30
0
function ck_edd_continue_shopping_button()
{
    $color = edd_get_option('checkout_color', 'green');
    $color = $color == 'inherit' ? '' : $color;
    ?>
	<a href="<?php 
    echo get_post_type_archive_link('download');
    ?>
"><div class="edd-submit button<?php 
    echo ' ' . $color;
    ?>
"><?php 
    _e('Continue Shopping', 'edd');
    ?>
</div></a>
<?php 
}