function cp_calculatedfieldsf_envelope_from($phpmailer)
{
    // Checks if the email's headers should be corrected or not
    if (!get_option('CP_CALCULATEDFIELDSF_EMAIL_HEADERS', false)) {
        return $phpmailer;
    }
    global $cp_calculatedfieldsf_envelope_from;
    $cp_calculatedfieldsf_envelope_from = strtolower($cp_calculatedfieldsf_envelope_from);
    $parts = explode('@', $cp_calculatedfieldsf_envelope_from);
    $home_url = cp_calculatedfieldsf_get_site_url();
    if (strtolower($phpmailer->Mailer) == 'smtp' || count($parts) != 2 || strpos($home_url, $parts[1]) === false) {
        return $phpmailer;
    }
    $phpmailer->Sender = $cp_calculatedfieldsf_envelope_from;
    $phpmailer->From = $cp_calculatedfieldsf_envelope_from;
    return $phpmailer;
}
Exemplo n.º 2
0
function set_cp_calculatedfieldsf_insert_adminScripts($hook)
{
    if (isset($_GET["page"]) && $_GET["page"] == "cp_calculated_fields_form") {
        wp_deregister_script('query-stringify');
        wp_register_script('query-stringify', plugins_url('/js/jQuery.stringify.js', __FILE__));
        wp_enqueue_script("jquery");
        wp_enqueue_script("jquery-ui-core");
        wp_enqueue_script("jquery-ui-sortable");
        wp_enqueue_script("jquery-ui-tabs");
        wp_enqueue_script("jquery-ui-droppable");
        wp_enqueue_script("jquery-ui-button");
        wp_enqueue_script("jquery-ui-datepicker");
        wp_enqueue_script("query-stringify");
        wp_enqueue_script('cp_calculatedfieldsf_buikder_script', cp_calculatedfieldsf_get_site_url(true) . '/?cp_cff_resources=admin', array("jquery", "jquery-ui-core", "jquery-ui-sortable", "jquery-ui-tabs", "jquery-ui-droppable", "jquery-ui-button", "jquery-ui-datepicker", "query-stringify"));
        wp_enqueue_script('cp_calculatedfieldsf_buikder_script_caret', plugins_url('/js/jquery.caret.js', __FILE__), array("jquery"));
        wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
    }
    if ('post.php' != $hook && 'post-new.php' != $hook) {
        return;
    }
    wp_enqueue_script('cp_calculatedfieldsf_script', plugins_url('/cp_calculatedfieldsf_scripts.js', __FILE__));
}
	   var d=new Date();
	   var f = document.cpformconf;    
	   var qs = "&width="+f.cv_width.value;
	   qs += "&height="+f.cv_height.value;
	   qs += "&letter_count="+f.cv_chars.value;
	   qs += "&min_size="+f.cv_min_font_size.value;
	   qs += "&max_size="+f.cv_max_font_size.value;
	   qs += "&noise="+f.cv_noise.value;
	   qs += "&noiselength="+f.cv_noise_length.value;
	   qs += "&bcolor="+f.cv_background.value;
	   qs += "&border="+f.cv_border.value;
	   qs += "&font="+f.cv_font.options[f.cv_font.selectedIndex].value;
	   qs += "&rand="+d;
	   
	   document.getElementById("captchaimg").src= "<?php 
echo cp_calculatedfieldsf_get_site_url(true);
?>
/?cp_calculatedfieldsf=captcha&inAdmin=1"+qs;
	}


	function cff_update_pp_payment_selection() 
	{
	   var f = document.cpformconf;
	   var ppoption = f.enable_paypal.options[f.enable_paypal.selectedIndex].value;     
	   if (ppoption == '2')
		   document.getElementById("cff_paypal_options_label").style.display = "";
	   else
		   document.getElementById("cff_paypal_options_label").style.display = "none";  
	}   
					<div class="clearer"></div>
				</div>
			<?php 
        }
        ?>
			<?php 
        if (cp_calculatedfieldsf_get_option('cv_enable_captcha', CP_CALCULATEDFIELDSF_DEFAULT_cv_enable_captcha, $id) != 'false') {
            ?>
				<div class="fields">    
					<label><?php 
            echo $cpcff_texts_array['captcha_text']['text'];
            ?>
</label>
					<div class="dfield">
						<img src="<?php 
            echo cp_calculatedfieldsf_get_site_url() . '/?cp_calculatedfieldsf=captcha&ps=' . $CP_CFF_global_form_count . '&inAdmin=1&width=' . cp_calculatedfieldsf_get_option('cv_width', CP_CALCULATEDFIELDSF_DEFAULT_cv_width, $id) . '&height=' . cp_calculatedfieldsf_get_option('cv_height', CP_CALCULATEDFIELDSF_DEFAULT_cv_height, $id) . '&letter_count=' . cp_calculatedfieldsf_get_option('cv_chars', CP_CALCULATEDFIELDSF_DEFAULT_cv_chars, $id) . '&min_size=' . cp_calculatedfieldsf_get_option('cv_min_font_size', CP_CALCULATEDFIELDSF_DEFAULT_cv_min_font_size, $id) . '&max_size=' . cp_calculatedfieldsf_get_option('cv_max_font_size', CP_CALCULATEDFIELDSF_DEFAULT_cv_max_font_size, $id) . '&noise=' . cp_calculatedfieldsf_get_option('cv_noise', CP_CALCULATEDFIELDSF_DEFAULT_cv_noise, $id) . '&noiselength=' . cp_calculatedfieldsf_get_option('cv_noise_length', CP_CALCULATEDFIELDSF_DEFAULT_cv_noise_length, $id) . '&bcolor=' . cp_calculatedfieldsf_get_option('cv_background', CP_CALCULATEDFIELDSF_DEFAULT_cv_background, $id) . '&border=' . cp_calculatedfieldsf_get_option('cv_border', CP_CALCULATEDFIELDSF_DEFAULT_cv_border, $id) . '&font=' . cp_calculatedfieldsf_get_option('cv_font', CP_CALCULATEDFIELDSF_DEFAULT_cv_font, $id);
            ?>
"  id="captchaimg<?php 
            echo $CP_CFF_global_form_count;
            ?>
" alt="security code" border="0" title="<?php 
            echo $cpcff_texts_array['refresh_captcha_text']['text'];
            ?>
" width="<?php 
            echo cp_calculatedfieldsf_get_option('cv_width', CP_CALCULATEDFIELDSF_DEFAULT_cv_width, $id);
            ?>
" height="<?php 
            echo cp_calculatedfieldsf_get_option('cv_height', CP_CALCULATEDFIELDSF_DEFAULT_cv_height, $id);
            ?>
" />
					</div>
echo plugins_url('js/jQuery.stringify.js', __FILE__);
?>
'></"+"script>");
			document.write ("<"+"script type='text/javascript' src='<?php 
echo plugins_url('js/jquery.validate.js', __FILE__);
?>
'></"+"script>");         
			document.write ("<"+"script type='text/javascript' src='<?php 
echo plugins_url('/js/jquery.caret.js', __FILE__);
?>
'></"+"script>");
	   }
       if ( typeof $fbuilderloadedflag == 'undefined' )
       {
         document.write ("<"+"script type='text/javascript' src='<?php 
echo cp_calculatedfieldsf_get_site_url(true) . '/?cp_cff_resources=admin';
?>
'></"+"script>");
       } 
     </script>         
        
     <script type="text/javascript">
         
         $calculatedfieldsfQuery(document).ready(function() {
            var f = $calculatedfieldsfQuery("#fbuilder").fbuilder();
            f.fBuild.loadData( "form_structure", "templates" );
            
            $calculatedfieldsfQuery(".itemForm").click(function() {
     	       f.fBuild.addItem($calculatedfieldsfQuery(this).attr("id"));
     	   });