PluginProbe ʕ •ᴥ•ʔ
Advanced Custom Fields: Extended / 0.8
Advanced Custom Fields: Extended v0.8
0.9.2.6 0.9.2.5 0.8.6 0.8.6.1 0.8.6.3 0.8.6.5 0.8.6.6 0.8.6.7 0.8.6.8 0.8.6.9 0.8.7 0.8.7.1 0.8.7.2 0.8.7.3 0.8.7.4 0.8.7.5 0.8.7.6 0.8.8 0.8.8.1 0.8.8.10 0.8.8.11 0.8.8.2 0.8.8.3 0.8.8.4 0.8.8.5 0.8.8.6 0.8.8.7 0.8.8.8 0.8.8.9 0.8.9 0.8.9.1 0.8.9.2 0.8.9.3 0.8.9.4 0.8.9.5 0.9 0.9.0.1 0.9.0.2 0.9.0.3 0.9.0.4 0.9.0.5 0.9.0.6 0.9.0.7 0.9.0.8 0.9.0.9 0.9.1 0.9.1.1 0.9.2 0.9.2.1 0.9.2.2 0.9.2.3 0.9.2.4 trunk 0.5 0.5.1 0.5.2 0.5.2.1 0.5.2.3 0.5.5 0.5.5.1 0.5.8 0.5.8.1 0.6 0.6.0.1 0.6.0.2 0.6.1 0.6.3 0.6.5 0.6.7 0.6.7.2 0.7 0.7.0.3 0.7.5 0.7.5.5 0.7.8 0.7.9 0.7.9.3 0.7.9.4 0.7.9.9.8 0.7.9.9.9 0.8 0.8.1 0.8.2 0.8.3 0.8.3.1 0.8.4 0.8.4.1 0.8.4.5 0.8.4.6 0.8.5 0.8.5.5
acf-extended / includes / modules / form / actions / email.php
acf-extended / includes / modules / form / actions Last commit date
custom.php 6 years ago email.php 6 years ago option.php 6 years ago post.php 6 years ago term.php 6 years ago user.php 6 years ago
email.php
84 lines
1 <?php
2
3 if(!defined('ABSPATH'))
4 exit;
5
6 if(!class_exists('acfe_form_email')):
7
8 class acfe_form_email{
9
10 function __construct(){
11
12 add_action('acfe/form/submit/action/email', array($this, 'submit'), 1, 2);
13
14 add_filter('acf/prepare_field/name=acfe_form_email_file', array(acfe()->acfe_form, 'map_fields_deep'));
15
16 }
17
18 function submit($form, $post_id){
19
20 $form_name = acf_maybe_get($form, 'form_name');
21 $form_id = acf_maybe_get($form, 'form_id');
22 $post_info = acf_get_post_id_info($post_id);
23
24 $from = get_sub_field('acfe_form_email_from');
25 $from = acfe_form_map_field_value($from, $_POST['acf']);
26
27 $to = get_sub_field('acfe_form_email_to');
28 $to = acfe_form_map_field_value($to, $_POST['acf']);
29
30 $subject = get_sub_field('acfe_form_email_subject');
31 $subject = acfe_form_map_field_value($subject, $_POST['acf']);
32
33 $content = get_sub_field('acfe_form_email_content');
34 $content = acfe_form_map_field_value($content, $_POST['acf']);
35
36 $headers = array();
37 $attachments = array();
38
39 if(have_rows('acfe_form_email_files')):
40 while(have_rows('acfe_form_email_files')): the_row();
41
42 $file_field_key = get_sub_field('acfe_form_email_file');
43 $file_id = acfe_form_map_field_value($file_field_key, $_POST['acf']);
44
45 $field = acf_get_field($file_field_key);
46 $file = acf_format_value($file_id, 0, $field);
47
48 if(!acf_maybe_get($file, 'ID'))
49 continue;
50
51 $attachments[] = get_attached_file($file['ID']);
52
53 endwhile;
54 endif;
55
56 $headers[] = 'From: ' . $from;
57 $headers[] = 'Content-Type: text/html';
58 $headers[] = 'charset=UTF-8';
59
60 $args = array(
61 'from' => $from,
62 'to' => $to,
63 'subject' => $subject,
64 'content' => $content,
65 'headers' => $headers,
66 'attachments' => $attachments,
67 );
68
69 $args = apply_filters('acfe/form/submit/action/mail/args', $args, $form, $post_id);
70 $args = apply_filters('acfe/form/submit/action/mail/args/name=' . $form_name, $args, $form, $post_id);
71 $args = apply_filters('acfe/form/submit/action/mail/args/id=' . $form_id, $args, $form, $post_id);
72
73 if(!$args)
74 return;
75
76 wp_mail($args['to'], $args['subject'], $args['content'], $args['headers'], $args['attachments']);
77
78 }
79
80 }
81
82 new acfe_form_email();
83
84 endif;