PluginProbe
HTML Forms – Simple WordPress Forms Plugin / 1.3.34
HTML Forms – Simple WordPress Forms Plugin v1.3.34
1.7.0 trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.3.0 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.16 All 67 releases
← All changes | src/actions/class-email.php +13 -24 trunk1.3.34 View file →
@@ -34,33 +34,27 @@
34 34 */
35 35 public function page_settings( $settings, $index ) {
36 36 $settings = array_merge( $this->get_default_settings(), $settings );
37 37 ?>
38 - <span class="hf-action-summary"><?php printf( 'From %s. To %s.', esc_html($settings['from']), esc_html($settings['to']) ); ?></span>
39 - <input type="hidden" name="form[settings][actions][<?php echo esc_attr($index); ?>][type]" value="<?php echo $this->type; ?>" />
40 -
41 - <p class="description">
42 - <?php _e( 'Send out an email notification whenever this form is successfully submitted.', 'html-forms' ); ?>
43 - <a target="_blank" tabindex="-1" class="html-forms-help" href="https://htmlformsplugin.com/kb/sending-email-notifications/"><span class="dashicons dashicons-editor-help"></span></a>
44 - </p>
45 -
38 + <span class="hf-action-summary"><?php printf( 'From %s. To %s.', $settings['from'], $settings['to'] ); ?></span>
39 + <input type="hidden" name="form[settings][actions][<?php echo $index; ?>][type]" value="<?php echo $this->type; ?>" />
46 40 <table class="form-table">
47 41 <tr>
48 42 <th><label><?php echo __( 'From', 'html-forms' ); ?> <span class="hf-required">*</span></label></th>
49 43 <td>
50 - <input name="form[settings][actions][<?php echo esc_attr($index); ?>][from]" value="<?php echo esc_attr( $settings['from'] ); ?>" type="text" class="regular-text" placeholder="jane@email.com" required />
44 + <input name="form[settings][actions][<?php echo $index; ?>][from]" value="<?php echo esc_attr( $settings['from'] ); ?>" type="text" class="regular-text" placeholder="jane@email.com" required />
51 45 </td>
52 46 </tr>
53 47 <tr>
54 48 <th><label><?php echo __( 'To', 'html-forms' ); ?> <span class="hf-required">*</span></label></th>
55 49 <td>
56 - <input name="form[settings][actions][<?php echo esc_attr($index); ?>][to]" value="<?php echo esc_attr( $settings['to'] ); ?>" type="text" class="regular-text" placeholder="john@email.com" required />
50 + <input name="form[settings][actions][<?php echo $index; ?>][to]" value="<?php echo esc_attr( $settings['to'] ); ?>" type="text" class="regular-text" placeholder="john@email.com" required />
57 51 </td>
58 52 </tr>
59 53 <tr>
60 54 <th><label><?php echo __( 'Subject', 'html-forms' ); ?></label></th>
61 55 <td>
62 - <input name="form[settings][actions][<?php echo esc_attr($index); ?>][subject]" value="<?php echo esc_attr( $settings['subject'] ); ?>" type="text" class="regular-text" placeholder="<?php echo esc_attr( __( 'Your email subject', 'html-forms' ) ); ?>" />
56 + <input name="form[settings][actions][<?php echo $index; ?>][subject]" value="<?php echo esc_attr( $settings['subject'] ); ?>" type="text" class="regular-text" placeholder="<?php echo esc_attr( __( 'Your email subject', 'html-forms' ) ); ?>" />
63 57 </td>
64 58 </tr>
65 59
66 60 <tr>
@@ -65,9 +59,9 @@
65 59
66 60 <tr>
67 61 <th><label><?php echo __( 'Message', 'html-forms' ); ?> <span class="hf-required">*</span></label></th>
68 62 <td>
69 - <textarea name="form[settings][actions][<?php echo esc_attr($index); ?>][message]" rows="8" class="widefat" placeholder="<?php echo esc_attr( __( 'Your email message', 'html-forms' ) ); ?>" required><?php echo esc_textarea( $settings['message'] ); ?></textarea>
63 + <textarea name="form[settings][actions][<?php echo $index; ?>][message]" rows="8" class="widefat" placeholder="<?php echo esc_attr( __( 'Your email message', 'html-forms' ) ); ?>" required><?php echo esc_textarea( $settings['message'] ); ?></textarea>
70 64 <p class="help"><?php _e( 'You can use the following variables (in all fields): ', 'html-forms' ); ?><br /><span class="hf-field-names"></span></p>
71 65 </td>
72 66 </tr>
73 67
@@ -73,9 +67,9 @@
73 67
74 68 <tr>
75 69 <th><label><?php echo __( 'Content Type', 'html-forms' ); ?></label></th>
76 70 <td>
77 - <select name="form[settings][actions][<?php echo esc_attr($index); ?>][content_type]" required>
71 + <select name="form[settings][actions][<?php echo $index; ?>][content_type]" required>
78 72 <option <?php selected( $settings['content_type'], 'text/plain' ); ?>>text/plain</option>
79 73 <option <?php selected( $settings['content_type'], 'text/html' ); ?>>text/html</option>
80 74 </select>
81 75 </td>
@@ -83,9 +77,9 @@
83 77
84 78 <tr>
85 79 <th><label><?php echo __( 'Additional Headers', 'html-forms' ); ?></label></th>
86 80 <td>
87 - <textarea name="form[settings][actions][<?php echo esc_attr($index); ?>][headers]" rows="4" class="widefat" placeholder="<?php echo esc_attr( 'Reply-To: [NAME] <[EMAIL]>' ); ?>"><?php echo esc_textarea( $settings['headers'] ); ?></textarea>
81 + <textarea name="form[settings][actions][<?php echo $index; ?>][headers]" rows="4" class="widefat" placeholder="<?php echo esc_attr( 'Reply-To: [NAME] <[EMAIL]>' ); ?>"><?php echo esc_textarea( $settings['headers'] ); ?></textarea>
88 82 </td>
89 83 </tr>
90 84 </table>
91 85 <?php
@@ -105,20 +99,15 @@
105 99
106 100 $settings = array_merge( $this->get_default_settings(), $settings );
107 101 $html_email = $settings['content_type'] === 'text/html';
108 102
109 - // Strip newlines and tags from substituted values
110 - $sanitize_header_value = function( $value ) {
111 - return str_replace( array( "\r", "\n" ), '', strip_tags( $value ) );
112 - };
113 -
114 - $to = hf_replace_data_variables( $settings['to'], $submission, $sanitize_header_value );
103 + $to = hf_replace_data_variables( $settings['to'], $submission->data, 'strip_tags' );
115 104 $to = apply_filters( 'hf_action_email_to', $to, $submission );
116 105
117 - $subject = ! empty( $settings['subject'] ) ? hf_replace_data_variables( $settings['subject'], $submission, $sanitize_header_value ) : '';
106 + $subject = ! empty( $settings['subject'] ) ? hf_replace_data_variables( $settings['subject'], $submission->data, 'strip_tags' ) : '';
118 107 $subject = apply_filters( 'hf_action_email_subject', $subject, $submission );
119 108
120 - $message = hf_replace_data_variables( $settings['message'], $submission, $html_email ? 'esc_html' : null );
109 + $message = hf_replace_data_variables( $settings['message'], $submission->data, $html_email ? 'esc_html' : null );
121 110 $message = ! $html_email ? str_replace( '<br />', '', $message ) : $message;
122 111 $message = apply_filters( 'hf_action_email_message', $message, $submission );
123 112
124 113 // parse additional email headers from settings
@@ -123,9 +112,9 @@
123 112
124 113 // parse additional email headers from settings
125 114 $headers = array();
126 115 if ( ! empty( $settings['headers'] ) ) {
127 - $headers = explode( PHP_EOL, hf_replace_data_variables( $settings['headers'], $submission, $sanitize_header_value ) );
116 + $headers = explode( PHP_EOL, hf_replace_data_variables( $settings['headers'], $submission->data, 'strip_tags' ) );
128 117 }
129 118
130 119 $content_type = $html_email ? 'text/html' : 'text/plain';
131 120 $charset = get_bloginfo( 'charset' );
@@ -131,9 +120,9 @@
131 120 $charset = get_bloginfo( 'charset' );
132 121 $headers[] = sprintf( 'Content-Type: %s; charset=%s', $content_type, $charset );
133 122
134 123 if ( ! empty( $settings['from'] ) ) {
135 - $from = apply_filters( 'hf_action_email_from', hf_replace_data_variables( $settings['from'], $submission, $sanitize_header_value ), $submission );
124 + $from = apply_filters( 'hf_action_email_from', hf_replace_data_variables( $settings['from'], $submission->data, 'strip_tags' ), $submission );
136 125 $headers[] = sprintf( 'From: %s', $from );
137 126 }
138 127
139 128 return wp_mail( $to, $subject, $message, $headers );