public function display_donation_specific_data_fields($donation = false)
    {
        if ($donation) {
            // Edit donation page displayed
            $donation = get_validated_donation($donation);
            ?>


            <label><?php 
            _e('Chronopay customer ID', 'leyka');
            ?>
:</label>
			<div class="leyka-ddata-field">

            <?php 
            if ($donation->type == 'correction') {
                ?>

                <input type="text" id="chronopay-customer-id" name="chronopay-customer-id" placeholder="<?php 
                _e('Enter Chronopay Customer ID', 'leyka');
                ?>
" value="<?php 
                echo $donation->chronopay_customer_id;
                ?>
">
            <?php 
            } else {
                ?>

                <span class="fake-input"><?php 
                echo $donation->chronopay_customer_id;
                ?>
</span>
            <?php 
            }
            ?>

            </div>

        <?php 
        } else {
            // New donation page displayed
            ?>


            <label for="chronopay-customer-id"><?php 
            _e('Chronopay customer ID', 'leyka');
            ?>
:</label>
            <div class="leyka-ddata-field">
                <input type="text" id="chronopay-customer-id" name="chronopay-customer-id" placeholder="<?php 
            _e('Enter Chronopay Customer ID', 'leyka');
            ?>
" value="" />
            </div>
        <?php 
        }
    }
示例#2
0
    public function display_donation_specific_data_fields($donation = false)
    {
        if ($donation) {
            // Edit donation page displayed
            $donation = get_validated_donation($donation);
            ?>

            <label><?php 
            _e('CloudPayments subscription ID', 'leyka');
            ?>
:</label>
            <div class="leyka-ddata-field">

                <?php 
            if ($donation->type == 'correction') {
                ?>
                    <input type="text" id="cp-recurring-id" name="cp-recurring-id" placeholder="<?php 
                _e('Enter CloudPayments subscription ID', 'leyka');
                ?>
" value="<?php 
                echo $donation->recurring_id;
                ?>
">
                <?php 
            } else {
                ?>
                    <span class="fake-input"><?php 
                echo $donation->recurring_id;
                ?>
</span>
                <?php 
            }
            ?>
            </div>

        <?php 
        } else {
            // New donation page displayed
            ?>

            <label for="cp-recurring-id"><?php 
            _e('CloudPayments subscription ID', 'leyka');
            ?>
:</label>
            <div class="leyka-ddata-field">
                <input type="text" id="cp-recurring-id" name="cp-recurring-id" placeholder="<?php 
            _e('Enter CloudPayments subscription ID', 'leyka');
            ?>
" value="" />
            </div>
        <?php 
        }
    }
示例#3
0
 public static function send_managers_notifications($donation)
 {
     if (!leyka_options()->opt('donations_managers_emails')) {
         return false;
     }
     $donation = get_validated_donation($donation);
     if (!$donation || $donation->managers_emails_date) {
         return false;
     }
     if (!function_exists('set_html_content_type')) {
         function set_html_content_type()
         {
             return 'text/html';
         }
     }
     add_filter('wp_mail_content_type', 'set_html_content_type');
     $res = true;
     foreach (explode(',', leyka_options()->opt('leyka_donations_managers_emails')) as $email) {
         $email = trim($email);
         if (!$email) {
             continue;
         }
         $campaign = new Leyka_Campaign($donation->campaign_id);
         if (!wp_mail($email, apply_filters('leyka_email_notification_title', leyka_options()->opt('email_notification_title'), $donation, $campaign), wpautop(str_replace(array('#SITE_NAME#', '#ORG_NAME#', '#DONATION_ID#', '#DONOR_NAME#', '#PAYMENT_METHOD_NAME#', '#CAMPAIGN_NAME#', '#PURPOSE#', '#SUM#', '#DATE#'), array(get_bloginfo('name'), leyka_options()->opt('org_full_name'), $donation->id, $donation->donor_name, $donation->payment_method_label, $campaign->title, $campaign->payment_title, $donation->amount . ' ' . $donation->currency_label, $donation->date), apply_filters('leyka_email_notification_text', leyka_options()->opt('email_notification_text'), $donation, $campaign))), array('From: ' . apply_filters('leyka_email_from_name', leyka_options()->opt_safe('email_from_name'), $donation, $campaign) . ' <' . leyka_options()->opt_safe('email_from') . '>'))) {
             $res &= false;
         }
     }
     if ($res) {
         update_post_meta($donation->id, '_leyka_managers_emails_date', time());
     }
     // Reset content-type to avoid conflicts -- http://core.trac.wordpress.org/ticket/23578
     remove_filter('wp_mail_content_type', 'set_html_content_type');
     return true;
 }
 public function update_total_funded_amount($donation)
 {
     $donation = get_validated_donation($donation);
     if (!$donation) {
         return false;
     }
     $this->_campaign_meta['total_funded'] += $donation->status != 'funded' || $donation->campaign_id != $this->_id ? -$donation->sum : $donation->sum;
     update_post_meta($this->_id, 'total_funded', $this->_campaign_meta['total_funded']);
     return $this;
 }