本文整理汇总了PHP中affwp_currency_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP affwp_currency_filter函数的具体用法?PHP affwp_currency_filter怎么用?PHP affwp_currency_filter使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了affwp_currency_filter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_pending_referral
/**
* Add pending referral
*
* @function add_pending_referral
* @access public
*/
public function add_pending_referral($order_id = 0)
{
if ($this->was_referred()) {
$this->order = apply_filters('affwp_get_jigoshop_order', new jigoshop_order($order_id));
// Fetch order
if ($this->is_affiliate_email($this->order->billing_email)) {
return;
// Customers cannot refer themselves
}
$description = '';
$items = $this->order->items;
foreach ($items as $key => $item) {
$description .= $item['name'];
if ($key + 1 < count($items)) {
$description .= ', ';
}
}
$amount = $this->order->order_total;
if (affiliate_wp()->settings->get('exclude_tax')) {
$amount -= $this->order->get_total_tax();
}
if (affiliate_wp()->settings->get('exclude_shipping')) {
$amount -= $this->order->order_shipping;
}
$referral_total = $this->calculate_referral_amount($amount, $order_id);
$this->insert_pending_referral($referral_total, $order_id, $description);
$referral = affiliate_wp()->referrals->get_by('reference', $order_id, $this->context);
$amount = affwp_currency_filter(affwp_format_amount($referral->amount));
$name = affiliate_wp()->affiliates->get_affiliate_name($referral->affiliate_id);
$this->order->add_order_note(sprintf(__('Referral #%d for %s recorded for %s', 'affiliate-wp'), $referral->referral_id, $amount, $name));
}
}
示例2: revoke_referral_on_refund
/**
* Revoke a referral when a payment is refunded
*
* @access public
* @since 1.6
*/
public function revoke_referral_on_refund($payment_id = 0)
{
if (!affiliate_wp()->settings->get('revoke_on_refund')) {
return;
}
$this->reject_referral($payment_id);
$referral = affiliate_wp()->referrals->get_by('reference', $payment_id, $this->context);
$amount = affwp_currency_filter(affwp_format_amount($referral->amount));
$name = affiliate_wp()->affiliates->get_affiliate_name($referral->affiliate_id);
$note = sprintf(__('Referral #%d for %s for %s rejected', 'affiliate-wp'), $referral->referral_id, $amount, $name);
$payment = SI_Payment::get_instance($payment_id);
$new_data = wp_parse_args($payment->get_data(), array('affwp_notes' => $note));
$payment->set_data($new_data);
}
示例3: affwp_frontend_scripts_and_styles
/**
* Load the frontend scripts and styles
*
* @since 1.0
* @return void
*/
function affwp_frontend_scripts_and_styles()
{
global $post;
if (!is_object($post)) {
return;
}
if (has_shortcode($post->post_content, 'affiliate_area') || apply_filters('affwp_force_frontend_scripts', false)) {
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
wp_enqueue_script('affwp-frontend', AFFILIATEWP_PLUGIN_URL . 'assets/js/frontend' . $suffix . '.js', array('jquery'), AFFILIATEWP_VERSION);
wp_localize_script('affwp-frontend', 'affwp_vars', array('affwp_version' => AFFILIATEWP_VERSION, 'permalinks' => get_option('permalink_structure'), 'pretty_affiliate_urls' => affwp_is_pretty_referral_urls(), 'currency_sign' => affwp_currency_filter(''), 'currency_pos' => affiliate_wp()->settings->get('currency_position', 'before')));
wp_enqueue_style('affwp-forms', AFFILIATEWP_PLUGIN_URL . 'assets/css/forms' . $suffix . '.css', AFFILIATEWP_VERSION);
wp_enqueue_style('dashicons');
}
}
示例4: affwp_eawrp_affiliate_referral_paid_email
/**
* Plugin Name: AffiliateWP - Email Affiliate When Referral Paid
* Plugin URI: http://affiliatewp.com
* Description: Sends an email to the affiliate when a referral has been paid
* Author: Andrew Munro
* Author URI: http://affiliatewp.com
* Version: 1.0
*/
function affwp_eawrp_affiliate_referral_paid_email($referral_id, $new_status, $old_status)
{
if (!function_exists('affiliate_wp') || ('paid' != $new_status || 'unpaid' != $old_status)) {
return;
}
$referral = affiliate_wp()->referrals->get_by('referral_id', $referral_id);
$affiliate_id = $referral->affiliate_id;
$affiliate_email = affwp_get_affiliate_email($affiliate_id);
$amount = html_entity_decode(affwp_currency_filter($referral->amount), ENT_COMPAT, 'UTF-8');
$date = date_i18n(get_option('date_format'), strtotime($referral->date));
// email subject
$subject = sprintf('Congratulations, your referral for %s has just been paid', $amount);
// email body
$message = affwp_eawrp_affiliate_referral_paid_email_body($affiliate_id, $amount, $date);
// send mail
affiliate_wp()->emails->send($affiliate_email, $subject, $message);
}
开发者ID:companyjuice,项目名称:affiliatewp-code-snippet-library,代码行数:25,代码来源:email-affiliate-when-referral-paid.php
示例5: affwp_custom_referral_sale_email
/**
* Send referral email to admin
* Requires AffiliateWP v1.6+
*/
function affwp_custom_referral_sale_email($add)
{
$emails = new Affiliate_WP_Emails();
$referral = affwp_get_referral($add);
$affiliate_id = $referral->affiliate_id;
$context = $referral->context;
$reference = $referral->reference;
$products = $referral->products;
switch ($context) {
case 'edd':
$link = esc_url(admin_url('edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=' . $reference));
break;
case 'woocommerce':
$link = esc_url(admin_url('post.php?post=' . $reference . '&action=edit'));
break;
default:
$link = '';
break;
}
$email = apply_filters('affwp_registration_admin_email', get_option('admin_email'));
$amount = html_entity_decode(affwp_currency_filter($referral->amount), ENT_COMPAT, 'UTF-8');
$subject = __('New referral sale!', 'affiliate-wp');
$message = __('Congratulations!', 'affiliate-wp') . "\n\n";
$message .= __('You have just received a new referral sale:', 'affiliate-wp') . "\n\n";
if ($link) {
$message .= sprintf(__('Order: %s ', 'affiliate-wp'), '<a href="' . $link . '">#' . $reference . '</a>') . "\n";
} else {
$message .= sprintf(__('Order: #%s ', 'affiliate-wp'), $reference) . "\n";
}
$message .= sprintf(__('Affiliate Name: %s ', 'affiliate-wp'), affiliate_wp()->affiliates->get_affiliate_name($affiliate_id)) . "\n";
$message .= sprintf(__('Referral amount: %s ', 'affiliate-wp'), $amount) . "\n\n";
$message .= __('Products that earned commission:', 'affiliate-wp') . "\n\n";
if ($products) {
foreach ($products as $product) {
$referral_amount = html_entity_decode(affwp_currency_filter(affwp_format_amount($product['referral_amount'])), ENT_COMPAT, 'UTF-8');
$message .= '<strong>' . $product['name'] . '</strong>' . "\n";
$message .= sprintf(__('Referral Amount: %s ', 'affiliate-wp'), $referral_amount) . "\n\n";
}
}
$emails->send($email, $subject, $message);
}
示例6: mark_referral_complete
public function mark_referral_complete($order)
{
if ('success' !== strtolower($order->status)) {
return;
}
$this->complete_referral($order->id);
$referral = affiliate_wp()->referrals->get_by('reference', $order->id, $this->context);
$order = new MemberOrder($order->id);
// Prevent infinite loop
remove_action('pmpro_updated_order', array($this, 'mark_referral_complete'), 10);
$order->affiliate_id = $referral->affiliate_id;
$amount = html_entity_decode(affwp_currency_filter(affwp_format_amount($referral->amount)), ENT_QUOTES, 'UTF-8');
$name = affiliate_wp()->affiliates->get_affiliate_name($referral->affiliate_id);
$note = sprintf(__('Referral #%d for %s recorded for %s', 'affiliate-wp'), $referral->referral_id, $amount, $name);
if (empty($order->notes)) {
$order->notes = $note;
} else {
$order->notes = $order->notes . "\n\n" . $note;
}
$order->saveOrder();
}
示例7: add_pending_referral
public function add_pending_referral($order_id = 0)
{
if ($this->was_referred()) {
$this->order = apply_filters('affwp_get_shopp_order', shopp_order($order_id->order));
$customer_email = $this->order->email;
if ($this->is_affiliate_email($customer_email)) {
return;
// Customers cannot refer themselves
}
$description = '';
foreach ($this->order->purchased as $key => $item) {
$description .= $item->name;
if ($key + 1 < count($this->order->purchased)) {
$description .= ', ';
}
}
$amount = $this->order->total;
if (affiliate_wp()->settings->get('exclude_tax')) {
$amount -= $this->order->tax;
}
if (affiliate_wp()->settings->get('exclude_shipping')) {
$amount -= $this->order->shipping;
}
$referral_total = $this->calculate_referral_amount($amount, $order_id->order);
$this->insert_pending_referral($referral_total, $order_id->order, $description);
$referral = affiliate_wp()->referrals->get_by('reference', $order_id->order, 'shopp');
$amount = affwp_currency_filter(affwp_format_amount($referral->amount));
$name = affiliate_wp()->affiliates->get_affiliate_name($referral->affiliate_id);
$user = wp_get_current_user();
$Note = new ShoppMetaObject();
$Note->parent = $order_id->order;
$Note->context = 'purchase';
$Note->type = 'order_note';
$Note->value = new stdClass();
$Note->value->author = $user->ID;
$Note->value->message = sprintf(__('Referral #%d for %s recorded for %s', 'affiliate-wp'), $referral->referral_id, $amount, $name);
$Note->save();
}
}
示例8: revoke_referral_on_refund
/**
* Revoke referral on refund
*
* @access public
* @uses GFFormsModel::add_note()
*
* @param array $entry
* @param array $action
*/
public function revoke_referral_on_refund($entry, $action)
{
$this->reject_referral($entry['id']);
$referral = affiliate_wp()->referrals->get_by('reference', $entry['id'], $this->context);
$amount = affwp_currency_filter(affwp_format_amount($referral->amount));
$name = affiliate_wp()->affiliates->get_affiliate_name($referral->affiliate_id);
$note = sprintf(__('Referral #%d for %s for %s rejected', 'affiliate-wp'), $referral->referral_id, $amount, $name);
GFFormsModel::add_note($entry["id"], 0, 'AffiliateWP', $note);
}
示例9: affwp_get_affiliate_unpaid_earnings
/**
* Retrieves the total unpaid earnings for an affiliate
*
* @since 1.0
* @return float
*/
function affwp_get_affiliate_unpaid_earnings($affiliate, $formatted = false)
{
if (is_object($affiliate) && isset($affiliate->affiliate_id)) {
$affiliate_id = $affiliate->affiliate_id;
} elseif (is_numeric($affiliate)) {
$affiliate_id = absint($affiliate);
} else {
return false;
}
$referrals = affiliate_wp()->referrals->get_referrals(array('affiliate_id' => $affiliate_id, 'status' => 'unpaid', 'number' => -1));
$earnings = 0;
if (!empty($referrals)) {
foreach ($referrals as $referral) {
$earnings += $referral->amount;
}
}
if ($formatted) {
$earnings = affwp_currency_filter($earnings);
}
return $earnings;
}
示例10: column_amount
/**
* Render the amount column
*
* @access public
* @since 1.0
* @param array $referral Contains all the data for the checkbox column
* @return string Displays the referral amount
*/
public function column_amount($referral)
{
return affwp_currency_filter(affwp_format_amount($referral->amount));
}
示例11: do_action
do_action('affwp_referrals_dashboard_th');
?>
</tr>
</thead>
<tbody>
<?php
if ($referrals) {
?>
<?php
foreach ($referrals as $referral) {
?>
<tr>
<td class="referral-amount"><?php
echo affwp_currency_filter(affwp_format_amount($referral->amount));
?>
</td>
<td class="referral-description"><?php
echo wp_kses_post(nl2br($referral->description));
?>
</td>
<td class="referral-status <?php
echo $referral->status;
?>
"><?php
echo affwp_get_referral_status_label($referral);
?>
</td>
<td class="referral-date"><?php
echo date_i18n(get_option('date_format'), strtotime($referral->date));
示例12: affwp_notify_on_new_referral
/**
* Send email on new referrals
*
* @since 1.6
* @param int $affiliate_id The ID of the registered affiliate
* @param array $referral
*/
function affwp_notify_on_new_referral($affiliate_id = 0, $referral)
{
$user_id = affwp_get_affiliate_user_id($affiliate_id);
if (!get_user_meta($user_id, 'affwp_referral_notifications', true)) {
return;
}
if (empty($affiliate_id)) {
return;
}
if (empty($referral)) {
return;
}
$emails = new Affiliate_WP_Emails();
$emails->__set('affiliate_id', $affiliate_id);
$emails->__set('referral', $referral);
$email = affwp_get_affiliate_email($affiliate_id);
$subject = affiliate_wp()->settings->get('referral_subject', __('Referral Awarded!', 'affiliate-wp'));
$message = affiliate_wp()->settings->get('referral_email', false);
$amount = html_entity_decode(affwp_currency_filter($referral->amount), ENT_COMPAT, 'UTF-8');
if (!$message) {
$message = sprintf(__('Congratulations %s!', 'affiliate-wp'), affiliate_wp()->affiliates->get_affiliate_name($affiliate_id)) . "\n\n";
$message .= sprintf(__('You have been awarded a new referral of %s on %s!', 'affiliate-wp'), $amount, home_url()) . "\n\n";
$message .= sprintf(__('log into your affiliate area to view your earnings or disable these notifications: %s', 'affiliate-wp'), affiliate_wp()->login->get_login_url()) . "\n\n";
}
// $args is setup for backwards compatibility with < 1.6
$args = array('affiliate_id' => $affiliate_id, 'amount' => $referral->amount, 'referral' => $referral);
$subject = apply_filters('affwp_new_referral_subject', $subject, $args);
$message = apply_filters('affwp_new_referral_email', $message, $args);
if (apply_filters('affwp_notify_on_new_referral', true, $referral)) {
$emails->send($email, $subject, $message);
}
}
示例13: insert_payment_note
/**
* Insert payment note
*
* @access public
* @since 1.3.1
*/
public function insert_payment_note($payment_id = 0)
{
$referral = affiliate_wp()->referrals->get_by('reference', $payment_id, $this->context);
if (empty($referral)) {
return;
}
$amount = affwp_currency_filter(affwp_format_amount($referral->amount));
$affiliate_id = $referral->affiliate_id;
$name = affiliate_wp()->affiliates->get_affiliate_name($affiliate_id);
edd_insert_payment_note($payment_id, sprintf(__('Referral #%d for %s recorded for %s', 'affiliate-wp'), $referral->referral_id, $amount, $name));
}
示例14: _e
<th><?php
_e('Total visits', 'affiliate-wp');
?>
</th>
<?php
do_action('affwp_view_affiliate_report_table_header', $affiliate_id);
?>
</tr>
</thead>
<tbody>
<tr>
<td><?php
echo affwp_currency_filter(affwp_get_affiliate_earnings($affiliate_id));
?>
</td>
<td><?php
echo affwp_get_affiliate_unpaid_earnings($affiliate_id, true);
?>
</td>
<td><?php
echo affwp_get_affiliate_referral_count($affiliate_id);
?>
</td>
<td><?php
echo affiliate_wp()->referrals->count(array('affiliate_id' => $affiliate_id, 'status' => 'unpaid'));
?>
</td>
<td><?php
示例15: column_amount
/**
* Render the amount column
*
* @access public
* @since 1.0
* @param array $referral Contains all the data for the checkbox column
* @return string Displays the referral amount
*/
public function column_amount($referral)
{
$value = affwp_currency_filter(affwp_format_amount($referral->amount));
return apply_filters('affwp_referral_table_amount', $value, $referral);
}