Пример #1
0
function pn_send_email_notification($invoice_email = '', $invoice_name = '', $product_name = '', $contract_name = '', $transaction_date = '')
{
    if (pn_is_ntf_mail_service_on()) {
        $pn_options = pn_get_options();
        if (!empty($pn_options)) {
            $pn_send_email = (int) $pn_options['pn_tpl_send'];
            $pn_your_name = $pn_options['pn_tpl_name'] != '' ? $pn_options['pn_tpl_name'] : 'Your Name';
            $pn_your_email = $pn_options['pn_tpl_email'] != '' ? $pn_options['pn_tpl_email'] : 'Your Email';
            $pn_tpl_email_text = $pn_options['pn_tpl_email_text'] != '' ? $pn_options['pn_tpl_email_text'] : '';
            $pn_tpl_email_subject_text = $pn_options['pn_tpl_email_subject_text'] != '' ? $pn_options['pn_tpl_email_subject_text'] : '';
            $pn_tpl_html = $pn_options['pn_tpl_html'] != '' ? $pn_options['pn_tpl_html'] : '';
            $transaction_date = date('F jS, Y', strtotime($transaction_date));
            $pn_tpl_email_subject_text = str_replace('{NAME}', htmlentities("{$invoice_name}"), $pn_tpl_email_subject_text);
            $pn_tpl_email_subject_text = str_replace('{PRODUCT}', htmlentities("{$product_name}"), $pn_tpl_email_subject_text);
            $pn_tpl_email_subject_text = str_replace('{CONTRACT}', htmlentities("{$contract_name}"), $pn_tpl_email_subject_text);
            $pn_tpl_email_subject_text = str_replace('{DATE}', htmlentities("{$transaction_date}"), $pn_tpl_email_subject_text);
            $pn_tpl_email_text = str_replace('{NAME}', htmlentities("{$invoice_name}"), $pn_tpl_email_text);
            $pn_tpl_email_text = str_replace('{PRODUCT}', "{$product_name}", $pn_tpl_email_text);
            $pn_tpl_email_text = str_replace('{CONTRACT}', "{$contract_name}", $pn_tpl_email_text);
            $pn_tpl_email_text = str_replace('{DATE}', "{$transaction_date}", $pn_tpl_email_text);
            $html = str_replace('{NAME}', htmlentities("{$invoice_name}"), $pn_tpl_html);
            $html = str_replace('{PRODUCT}', "{$product_name}", $html);
            $html = str_replace('{CONTRACT}', "{$contract_name}", $html);
            $html = str_replace('{DATE}', "{$transaction_date}", $html);
            $headers = "From: {$pn_your_name} <{$pn_your_email}>" . "\r\n\\";
            wp_mail($pn_your_email, $pn_tpl_email_subject_text, $pn_tpl_email_text, $headers);
        }
    }
}
Пример #2
0
             }
             if (pn_is_ntf_mail_service_on() && $pn_request['transactionType'] == "CHARGE") {
                 pn_send_email_notification($pn_request['email'], $pn_request['title'] . ' ' . $pn_request['firstName'] . ' ' . $pn_request['lastName'], $pn_request['productName'], $pn_request['contractName'], $pn_request['transactionDate']);
             }
         }
     }
 } else {
     foreach ($pn_request as $key => $val) {
         $rows_affected = $wpdb->insert($wpdb->prefix . "plimus_pn", array('pn_orn' => $transaction_id, 'pn_meta_key' => $key, 'pn_meta_value' => $val));
     }
     foreach ($promotions as $key => $val) {
         foreach ($val as $or_key => $or_val) {
             $rows_affected = $wpdb->insert($wpdb->prefix . "plimus_pn", array('pn_orn' => $transaction_id, 'pn_meta_key' => $or_key, 'pn_meta_value' => $or_val));
         }
     }
     if (pn_is_ntf_mail_service_on() && $pn_request['transactionType'] == "CHARGE") {
         pn_send_email_notification($pn_request['email'], $pn_request['title'] . ' ' . $pn_request['firstName'] . ' ' . $pn_request['lastName'], $pn_request['productName'], $pn_request['contractName'], $pn_request['transactionDate']);
     }
 }
 if ($pn_request['username'] != '' && pn_is_register_user_on() && $pn_request['transactionType'] == "CHARGE") {
     $pn_user = $pn_request['email'];
     $pn_email = $pn_request['email'];
     $pass_u = pn_create_user($pn_user, $pn_email, $pn_request['firstName'], $pn_request['lastName'], $pn_request['title']);
     if ($pass_u) {
         logToFile($pn_user . ', ' . $pn_email . ', ' . $pass_u);
         $m_sub = 'Account information';
         $m_msg = html_entity_decode(get_option('pn_email_template'));
         $m_user = $pn_user;
         $m_pass = $pass_u;
         $m_login = get_bloginfo('wpurl') . '/wp-login.php';
         $tmp_from = array('{USER_NAME}', '{PASSWORD}', '{LOGIN_URL}');