Пример #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
    function pn_handle_pdf_page()
    {
        global $pn_plugin_url;
        $action_url = $_SERVER['REQUEST_URI'];
        $run_file_path = $pn_plugin_url . "/plimusipn.php";
        if (isset($_REQUEST['clear_all'])) {
            $plimus_pn = $wpdb->prefix . "plimus_pn";
            $query_db = "DROP TABLE IF EXISTS {$plimus_pn}";
            $drop = $wpdb->query($query_db);
        }
        if (isset($_REQUEST['save_settings']) != '') {
            $pn_options = array();
            $pn_options['pn_email_template'] = stripslashes(htmlspecialchars($_POST['pn_email_tmp']));
            $pn_options['pn_reg_email_on'] = isset($_POST['pn_reg_mail_on']) && $_POST['pn_reg_mail_on'] == 'on' ? 1 : 0;
            $pn_options['pn_reg_user_on'] = isset($_POST['pn_reg_user_on']) && $_POST['pn_reg_user_on'] == 'on' ? 1 : 0;
            $pn_options['pn_register_role'] = isset($_POST['pn_register_role']) ? $_POST['pn_register_role'] : 'subscriber';
            $pn_options['pn_tpl_send'] = isset($_POST['pn_send_mail_on']) && $_POST['pn_send_mail_on'] == 'on' ? 1 : 0;
            $pn_options['pn_tpl_name'] = isset($_POST['your_name']) ? $_POST['your_name'] : '';
            $pn_options['pn_tpl_email'] = isset($_POST['your_email']) ? $_POST['your_email'] : '';
            $pn_options['pn_tpl_email_text'] = stripslashes(htmlspecialchars($_POST['email_tmp']));
            $pn_options['pn_tpl_email_subject_text'] = stripslashes(htmlspecialchars($_POST['tpl_subject_text']));
            foreach ($pn_options as $key => $val) {
                add_option($key, $val) or update_option($key, $val);
            }
        }
        if (isset($_REQUEST['refresh']) != '') {
            $pn_options['pn_tpl_send'] = $_POST['pn_send_mail_on'] == 'on' ? 1 : 0;
            $pn_options['pn_tpl_name'] = $_POST['your_name'];
            $pn_options['pn_tpl_email'] = $_POST['your_email'];
            $pn_options['pn_tpl_email_text'] = stripslashes(htmlspecialchars($_POST['email_tmp']));
            $pn_options['pn_tpl_email_subject_text'] = stripslashes(htmlspecialchars($_POST['tpl_subject_text']));
            foreach ($pn_options as $key => $val) {
                add_option($key, $val) or update_option($key, $val);
            }
            pn_send_email_notification($_REQUEST['your_email'], $_REQUEST['your_name'], 'Test Product Name', 'Test Contract Name', 'NOW', true);
        }
        $pn_options = pn_get_options();
        if (!empty($pn_options)) {
            $pn_email_on = $pn_options['pn_tpl_send'] == 1 ? 'checked' : '';
            $pn_reg_email_on = $pn_options['pn_reg_email_on'] == 1 ? 'checked' : '';
            $pn_reg_user_on = $pn_options['pn_reg_user_on'] == 1 ? 'checked' : '';
            $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_reg_email_text = html_entity_decode($pn_options['pn_email_template'] != '' ? $pn_options['pn_email_template'] : "Account successfully created.<br />\n<br />\nUser name: {USER_NAME}<br />\nPassword: {PASSWORD}<br />\nLogin URL: {LOGIN_URL}\n<br />\n<br />\n");
            $pn_tpl_reg_email_subject = html_entity_decode($pn_options['pn_tpl_email_subject_text'] != '' ? $pn_options['pn_tpl_email_subject_text'] : 'Insert Your Registration Email Subject Here');
            $pn_tpl_email_text = html_entity_decode($pn_options['pn_tpl_email_text'] != '' ? $pn_options['pn_tpl_email_text'] : 'Insert Your Notification Email Template Here');
        }
        if (!function_exists('wp_dropdown_roles')) {
            include_once ABSPATH . 'wp-admin/user-new.php';
        }
        ?>
		<div class="wrap" style="min-width:1000px !important;">
			<h2><a href="http://www.Bluesnap.com" title="Bluesnap - Take charge" target="_blank"><img src="<?php 
        echo $pn_plugin_url;
        ?>
/images/plimus_logo.png" alt="Bluesnap" id="plimus-logo" /></a>for WordPress Options</h2><br />
			<h3>Bluesnap IPN URL</h3>
			<i id="note">* This is the path to Bluesnap IPN file. Copy and paste this URL to General Settings page in your Bluesnap dashboard.</i><br /><br />
			<div id="plimus_run_path"><?php 
        echo $run_file_path;
        ?>
</div><br /><br />
			<h3 id="notification">Registration Email</h3>
			<form action="<?php 
        echo $action_url;
        ?>
" method="post" id="settings_form">
				<input type="checkbox" name="pn_reg_user_on" <?php 
        echo $pn_reg_user_on;
        ?>
 /> Register new buyers as 
					<select name="pn_register_role" id="adduser-role"> 
						<?php 
        wp_dropdown_roles(get_option('pn_register_role') != '' ? get_option('pn_register_role') : 'subscriber');
        ?>
 
					</select>
				<input type="submit" name="save_settings" id="save_settings" value="Save Settings" class="button-primary"/><br />
				<input type="checkbox" name="pn_reg_mail_on" <?php 
        echo $pn_reg_email_on;
        ?>
 /> Send registration email to new users
					<br /><br /><i id="note">* you may use <code>{USER_NAME}</code> <code>{PASSWORD}</code> <code>{LOGIN_URL}</code> codes that will be replaced with new user data.</i><br />
				<textarea cols="90" rows="10" name="pn_email_tmp" id="pn_email_tmp" ><?php 
        echo $pn_tpl_reg_email_text;
        ?>
</textarea>
				<div id="legend"></div>
				<div style="clear:both"></div>
				<h3 id="notification">Purchase Notification Email</h3>
				<input type="checkbox" name="pn_send_mail_on" <?php 
        echo $pn_email_on;
        ?>
 /> Turn purchase notification email on &nbsp;&nbsp;&nbsp;
				<input type="submit" name="save_settings" id="save_settings" value="Save Settings" class="button-primary"/><br />
				<div id="template_exp">
					<i id="note">Set your subject, name and email, that will appear in e-mail header.</i>
				  <br /><i id="note">* you may use <code>{NAME}</code> <code>{PRODUCT}</code> <code>{CONTRACT}</code> <code>{DATE}</code> codes that will be replaced with data from the invoice.</i><br />
				</div>
				<input type="text" name="tpl_subject_text" id="tpl_subject_text" size="120" value="<?php 
        echo $pn_tpl_reg_email_subject;
        ?>
" /><br />
				<input type="text" name="your_name" id="your_name" size="30" value="<?php 
        echo $pn_your_name;
        ?>
" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="text" name="your_email" id="your_email" size="60" value="<?php 
        echo $pn_your_email;
        ?>
" /><br />
				<div id="template_exp">
					
				</div>
				<textarea cols="90" rows="10" name="email_tmp" id="email_tmp" ><?php 
        echo $pn_tpl_email_text;
        ?>
</textarea>
				
						  
			</form><br />
		</div>
		</div>
	<h5><a href="http://www.prelovac.com" title="Plugin by Prelovac Media" ><img src="<?php 
        echo $pn_plugin_url;
        ?>
/images/logo.png"  style="margin-top: 30px;"/></a> </h5>
	<br clear="both">
	<?php 
    }