Version Description
Download this release
Release Info
Developer | takayukister |
Plugin | ![]() |
Version | 3.9-beta |
Comparing to | |
See all releases |
Code changes from version 3.8.1 to 3.9-beta
- admin/admin-functions.php +112 -0
- admin/admin.php +13 -78
- admin/css/styles.css +14 -0
- admin/edit-contact-form.php +12 -14
- admin/images/menu-icon.png +0 -0
- admin/images/screen-icon.png +0 -0
- admin/includes/class-contact-forms-list-table.php +11 -9
- admin/includes/meta-boxes.php +19 -15
- includes/classes.php +0 -1084
- includes/contact-form.php +899 -0
- includes/controller.php +37 -46
- includes/deprecated.php +0 -26
- includes/functions.php +56 -123
- includes/js/jquery.form.js +10 -11
- includes/js/jquery.form.min.js +3 -3
- includes/mail.php +378 -0
- includes/submission.php +291 -0
- includes/upgrade.php +3 -3
- languages/contact-form-7-fa_IR.mo +0 -0
- languages/contact-form-7-ja.mo +0 -0
- languages/contact-form-7.pot +340 -348
- modules/acceptance.php +1 -1
- modules/akismet.php +5 -3
- modules/captcha.php +1 -1
- modules/checkbox.php +11 -16
- modules/date.php +2 -3
- modules/file.php +26 -21
- modules/flamingo.php +17 -12
- modules/number.php +3 -4
- modules/quiz.php +1 -1
- modules/response.php +0 -1
- modules/select.php +10 -10
- modules/special-mail-tags.php +0 -80
- modules/submit.php +1 -1
- modules/text.php +5 -6
- modules/textarea.php +2 -3
- readme.txt +10 -23
- settings.php +5 -4
- wp-contact-form-7.php +8 -13
admin/admin-functions.php
CHANGED
@@ -49,4 +49,116 @@ function wpcf7_tag_generators() {
|
|
49 |
return $taggenerators;
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
?>
|
49 |
return $taggenerators;
|
50 |
}
|
51 |
|
52 |
+
function wpcf7_save_contact_form( $post_id = -1 ) {
|
53 |
+
if ( -1 != $post_id ) {
|
54 |
+
$contact_form = wpcf7_contact_form( $post_id );
|
55 |
+
}
|
56 |
+
|
57 |
+
if ( empty( $contact_form ) ) {
|
58 |
+
$contact_form = WPCF7_ContactForm::get_template();
|
59 |
+
}
|
60 |
+
|
61 |
+
if ( isset( $_POST['wpcf7-title'] ) ) {
|
62 |
+
$contact_form->set_title( $_POST['wpcf7-title'] );
|
63 |
+
}
|
64 |
+
|
65 |
+
if ( isset( $_POST['wpcf7-locale'] ) ) {
|
66 |
+
$locale = trim( $_POST['wpcf7-locale'] );
|
67 |
+
|
68 |
+
if ( wpcf7_is_valid_locale( $locale ) ) {
|
69 |
+
$contact_form->locale = $locale;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
$properties = $contact_form->get_properties();
|
74 |
+
|
75 |
+
if ( isset( $_POST['wpcf7-form'] ) ) {
|
76 |
+
$properties['form'] = trim( $_POST['wpcf7-form'] );
|
77 |
+
}
|
78 |
+
|
79 |
+
$mail = $properties['mail'];
|
80 |
+
|
81 |
+
if ( isset( $_POST['wpcf7-mail-subject'] ) ) {
|
82 |
+
$mail['subject'] = trim( $_POST['wpcf7-mail-subject'] );
|
83 |
+
}
|
84 |
+
|
85 |
+
if ( isset( $_POST['wpcf7-mail-sender'] ) ) {
|
86 |
+
$mail['sender'] = trim( $_POST['wpcf7-mail-sender'] );
|
87 |
+
}
|
88 |
+
|
89 |
+
if ( isset( $_POST['wpcf7-mail-body'] ) ) {
|
90 |
+
$mail['body'] = trim( $_POST['wpcf7-mail-body'] );
|
91 |
+
}
|
92 |
+
|
93 |
+
if ( isset( $_POST['wpcf7-mail-recipient'] ) ) {
|
94 |
+
$mail['recipient'] = trim( $_POST['wpcf7-mail-recipient'] );
|
95 |
+
}
|
96 |
+
|
97 |
+
if ( isset( $_POST['wpcf7-mail-additional-headers'] ) ) {
|
98 |
+
$mail['additional_headers'] = trim( $_POST['wpcf7-mail-additional-headers'] );
|
99 |
+
}
|
100 |
+
|
101 |
+
if ( isset( $_POST['wpcf7-mail-attachments'] ) ) {
|
102 |
+
$mail['attachments'] = trim( $_POST['wpcf7-mail-attachments'] );
|
103 |
+
}
|
104 |
+
|
105 |
+
$mail['use_html'] = ! empty( $_POST['wpcf7-mail-use-html'] );
|
106 |
+
$mail['exclude_blank'] = ! empty( $_POST['wpcf7-mail-exclude-blank'] );
|
107 |
+
|
108 |
+
$properties['mail'] = $mail;
|
109 |
+
|
110 |
+
$mail_2 = $properties['mail_2'];
|
111 |
+
|
112 |
+
$mail_2['active'] = ! empty( $_POST['wpcf7-mail-2-active'] );
|
113 |
+
|
114 |
+
if ( isset( $_POST['wpcf7-mail-2-subject'] ) ) {
|
115 |
+
$mail_2['subject'] = trim( $_POST['wpcf7-mail-2-subject'] );
|
116 |
+
}
|
117 |
+
|
118 |
+
if ( isset( $_POST['wpcf7-mail-2-sender'] ) ) {
|
119 |
+
$mail_2['sender'] = trim( $_POST['wpcf7-mail-2-sender'] );
|
120 |
+
}
|
121 |
+
|
122 |
+
if ( isset( $_POST['wpcf7-mail-2-body'] ) ) {
|
123 |
+
$mail_2['body'] = trim( $_POST['wpcf7-mail-2-body'] );
|
124 |
+
}
|
125 |
+
|
126 |
+
if ( isset( $_POST['wpcf7-mail-2-recipient'] ) ) {
|
127 |
+
$mail_2['recipient'] = trim( $_POST['wpcf7-mail-2-recipient'] );
|
128 |
+
}
|
129 |
+
|
130 |
+
if ( isset( $_POST['wpcf7-mail-2-additional-headers'] ) ) {
|
131 |
+
$mail_2['additional_headers'] = trim(
|
132 |
+
$_POST['wpcf7-mail-2-additional-headers'] );
|
133 |
+
}
|
134 |
+
|
135 |
+
if ( isset( $_POST['wpcf7-mail-2-attachments'] ) ) {
|
136 |
+
$mail_2['attachments'] = trim( $_POST['wpcf7-mail-2-attachments'] );
|
137 |
+
}
|
138 |
+
|
139 |
+
$mail_2['use_html'] = ! empty( $_POST['wpcf7-mail-2-use-html'] );
|
140 |
+
$mail_2['exclude_blank'] = ! empty( $_POST['wpcf7-mail-2-exclude-blank'] );
|
141 |
+
|
142 |
+
$properties['mail_2'] = $mail_2;
|
143 |
+
|
144 |
+
foreach ( wpcf7_messages() as $key => $arr ) {
|
145 |
+
$field_name = 'wpcf7-message-' . strtr( $key, '_', '-' );
|
146 |
+
|
147 |
+
if ( isset( $_POST[$field_name] ) ) {
|
148 |
+
$properties['messages'][$key] = trim( $_POST[$field_name] );
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
if ( isset( $_POST['wpcf7-additional-settings'] ) ) {
|
153 |
+
$properties['additional_settings'] = trim(
|
154 |
+
$_POST['wpcf7-additional-settings'] );
|
155 |
+
}
|
156 |
+
|
157 |
+
$contact_form->set_properties( $properties );
|
158 |
+
|
159 |
+
do_action( 'wpcf7_save_contact_form', $contact_form );
|
160 |
+
|
161 |
+
return $contact_form->save();
|
162 |
+
}
|
163 |
+
|
164 |
?>
|
admin/admin.php
CHANGED
@@ -5,17 +5,10 @@ require_once WPCF7_PLUGIN_DIR . '/admin/admin-functions.php';
|
|
5 |
add_action( 'admin_menu', 'wpcf7_admin_menu', 9 );
|
6 |
|
7 |
function wpcf7_admin_menu() {
|
8 |
-
$icon_url = wpcf7_plugin_url( 'admin/images/menu-icon.png' );
|
9 |
-
|
10 |
-
if ( defined( 'MP6' ) && MP6
|
11 |
-
|| version_compare( get_bloginfo( 'version' ), '3.8-dev', '>=' ) ) {
|
12 |
-
$icon_url = '';
|
13 |
-
}
|
14 |
-
|
15 |
add_object_page( __( 'Contact Form 7', 'contact-form-7' ),
|
16 |
__( 'Contact', 'contact-form-7' ),
|
17 |
'wpcf7_read_contact_forms', 'wpcf7',
|
18 |
-
'wpcf7_admin_management_page'
|
19 |
|
20 |
$edit = add_submenu_page( 'wpcf7',
|
21 |
__( 'Edit Contact Form', 'contact-form-7' ),
|
@@ -58,65 +51,13 @@ function wpcf7_load_contact_form_admin() {
|
|
58 |
if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) )
|
59 |
wp_die( __( 'You are not allowed to edit this item.', 'contact-form-7' ) );
|
60 |
|
61 |
-
|
62 |
-
$contact_form = new WPCF7_ContactForm();
|
63 |
-
$contact_form->initial = true;
|
64 |
-
}
|
65 |
-
|
66 |
-
$contact_form->title = trim( $_POST['wpcf7-title'] );
|
67 |
-
$contact_form->locale = trim( $_POST['wpcf7-locale'] );
|
68 |
-
|
69 |
-
$form = trim( $_POST['wpcf7-form'] );
|
70 |
-
|
71 |
-
$mail = array(
|
72 |
-
'subject' => trim( $_POST['wpcf7-mail-subject'] ),
|
73 |
-
'sender' => trim( $_POST['wpcf7-mail-sender'] ),
|
74 |
-
'body' => trim( $_POST['wpcf7-mail-body'] ),
|
75 |
-
'recipient' => trim( $_POST['wpcf7-mail-recipient'] ),
|
76 |
-
'additional_headers' => trim( $_POST['wpcf7-mail-additional-headers'] ),
|
77 |
-
'attachments' => trim( $_POST['wpcf7-mail-attachments'] ),
|
78 |
-
'use_html' =>
|
79 |
-
isset( $_POST['wpcf7-mail-use-html'] ) && 1 == $_POST['wpcf7-mail-use-html']
|
80 |
-
);
|
81 |
-
|
82 |
-
$mail_2 = array(
|
83 |
-
'active' =>
|
84 |
-
isset( $_POST['wpcf7-mail-2-active'] ) && 1 == $_POST['wpcf7-mail-2-active'],
|
85 |
-
'subject' => trim( $_POST['wpcf7-mail-2-subject'] ),
|
86 |
-
'sender' => trim( $_POST['wpcf7-mail-2-sender'] ),
|
87 |
-
'body' => trim( $_POST['wpcf7-mail-2-body'] ),
|
88 |
-
'recipient' => trim( $_POST['wpcf7-mail-2-recipient'] ),
|
89 |
-
'additional_headers' => trim( $_POST['wpcf7-mail-2-additional-headers'] ),
|
90 |
-
'attachments' => trim( $_POST['wpcf7-mail-2-attachments'] ),
|
91 |
-
'use_html' =>
|
92 |
-
isset( $_POST['wpcf7-mail-2-use-html'] ) && 1 == $_POST['wpcf7-mail-2-use-html']
|
93 |
-
);
|
94 |
-
|
95 |
-
$messages = isset( $contact_form->messages ) ? $contact_form->messages : array();
|
96 |
-
|
97 |
-
foreach ( wpcf7_messages() as $key => $arr ) {
|
98 |
-
$field_name = 'wpcf7-message-' . strtr( $key, '_', '-' );
|
99 |
-
if ( isset( $_POST[$field_name] ) )
|
100 |
-
$messages[$key] = trim( $_POST[$field_name] );
|
101 |
-
}
|
102 |
-
|
103 |
-
$additional_settings = trim( $_POST['wpcf7-additional-settings'] );
|
104 |
|
105 |
-
$
|
106 |
-
|
107 |
-
|
108 |
-
foreach ( (array) $props as $key => $prop )
|
109 |
-
$contact_form->{$key} = $prop;
|
110 |
-
|
111 |
-
$query = array();
|
112 |
-
$query['message'] = ( $contact_form->initial ) ? 'created' : 'saved';
|
113 |
-
|
114 |
-
$contact_form->save();
|
115 |
-
|
116 |
-
$query['post'] = $contact_form->id;
|
117 |
|
118 |
$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
|
119 |
-
|
120 |
wp_safe_redirect( $redirect_to );
|
121 |
exit();
|
122 |
}
|
@@ -137,7 +78,7 @@ function wpcf7_load_contact_form_admin() {
|
|
137 |
$new_contact_form = $contact_form->copy();
|
138 |
$new_contact_form->save();
|
139 |
|
140 |
-
$query['post'] = $new_contact_form->id;
|
141 |
$query['message'] = 'created';
|
142 |
}
|
143 |
|
@@ -162,12 +103,12 @@ function wpcf7_load_contact_form_admin() {
|
|
162 |
$deleted = 0;
|
163 |
|
164 |
foreach ( $posts as $post ) {
|
165 |
-
$post =
|
166 |
|
167 |
if ( empty( $post ) )
|
168 |
continue;
|
169 |
|
170 |
-
if ( ! current_user_can( 'wpcf7_delete_contact_form', $post->id ) )
|
171 |
wp_die( __( 'You are not allowed to delete this item.', 'contact-form-7' ) );
|
172 |
|
173 |
if ( ! $post->delete() )
|
@@ -192,14 +133,14 @@ function wpcf7_load_contact_form_admin() {
|
|
192 |
$post = null;
|
193 |
|
194 |
if ( 'wpcf7-new' == $plugin_page && isset( $_GET['locale'] ) ) {
|
195 |
-
$post =
|
196 |
'locale' => $_GET['locale'] ) );
|
197 |
} elseif ( ! empty( $_GET['post'] ) ) {
|
198 |
-
$post =
|
199 |
}
|
200 |
|
201 |
-
if ( $post && current_user_can( 'wpcf7_edit_contact_form', $post->id ) ) {
|
202 |
-
wpcf7_add_meta_boxes( $post->id );
|
203 |
|
204 |
} else {
|
205 |
$current_screen = get_current_screen();
|
@@ -215,10 +156,6 @@ function wpcf7_load_contact_form_admin() {
|
|
215 |
'default' => 20,
|
216 |
'option' => 'cfseven_contact_forms_per_page' ) );
|
217 |
}
|
218 |
-
|
219 |
-
if ( $post ) {
|
220 |
-
WPCF7_ContactForm::set_current( $post );
|
221 |
-
}
|
222 |
}
|
223 |
|
224 |
add_action( 'admin_enqueue_scripts', 'wpcf7_admin_enqueue_scripts' );
|
@@ -257,7 +194,7 @@ function wpcf7_admin_enqueue_scripts( $hook_suffix ) {
|
|
257 |
|
258 |
function wpcf7_admin_management_page() {
|
259 |
if ( $post = wpcf7_get_current_contact_form() ) {
|
260 |
-
$post_id = $post->initial ? -1 : $post->id;
|
261 |
|
262 |
require_once WPCF7_PLUGIN_DIR . '/admin/includes/meta-boxes.php';
|
263 |
require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php';
|
@@ -269,7 +206,6 @@ function wpcf7_admin_management_page() {
|
|
269 |
|
270 |
?>
|
271 |
<div class="wrap">
|
272 |
-
<?php screen_icon(); ?>
|
273 |
|
274 |
<h2><?php
|
275 |
echo esc_html( __( 'Contact Forms', 'contact-form-7' ) );
|
@@ -313,7 +249,6 @@ function wpcf7_admin_add_new_page() {
|
|
313 |
|
314 |
?>
|
315 |
<div class="wrap">
|
316 |
-
<?php screen_icon(); ?>
|
317 |
|
318 |
<h2><?php echo esc_html( __( 'Add New Contact Form', 'contact-form-7' ) ); ?></h2>
|
319 |
|
5 |
add_action( 'admin_menu', 'wpcf7_admin_menu', 9 );
|
6 |
|
7 |
function wpcf7_admin_menu() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
add_object_page( __( 'Contact Form 7', 'contact-form-7' ),
|
9 |
__( 'Contact', 'contact-form-7' ),
|
10 |
'wpcf7_read_contact_forms', 'wpcf7',
|
11 |
+
'wpcf7_admin_management_page' );
|
12 |
|
13 |
$edit = add_submenu_page( 'wpcf7',
|
14 |
__( 'Edit Contact Form', 'contact-form-7' ),
|
51 |
if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) )
|
52 |
wp_die( __( 'You are not allowed to edit this item.', 'contact-form-7' ) );
|
53 |
|
54 |
+
$id = wpcf7_save_contact_form( $id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
+
$query = array(
|
57 |
+
'message' => ( -1 == $_POST['post_ID'] ) ? 'created' : 'saved',
|
58 |
+
'post' => $id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
|
|
|
61 |
wp_safe_redirect( $redirect_to );
|
62 |
exit();
|
63 |
}
|
78 |
$new_contact_form = $contact_form->copy();
|
79 |
$new_contact_form->save();
|
80 |
|
81 |
+
$query['post'] = $new_contact_form->id();
|
82 |
$query['message'] = 'created';
|
83 |
}
|
84 |
|
103 |
$deleted = 0;
|
104 |
|
105 |
foreach ( $posts as $post ) {
|
106 |
+
$post = WPCF7_ContactForm::get_instance( $post );
|
107 |
|
108 |
if ( empty( $post ) )
|
109 |
continue;
|
110 |
|
111 |
+
if ( ! current_user_can( 'wpcf7_delete_contact_form', $post->id() ) )
|
112 |
wp_die( __( 'You are not allowed to delete this item.', 'contact-form-7' ) );
|
113 |
|
114 |
if ( ! $post->delete() )
|
133 |
$post = null;
|
134 |
|
135 |
if ( 'wpcf7-new' == $plugin_page && isset( $_GET['locale'] ) ) {
|
136 |
+
$post = WPCF7_ContactForm::get_template( array(
|
137 |
'locale' => $_GET['locale'] ) );
|
138 |
} elseif ( ! empty( $_GET['post'] ) ) {
|
139 |
+
$post = WPCF7_ContactForm::get_instance( $_GET['post'] );
|
140 |
}
|
141 |
|
142 |
+
if ( $post && current_user_can( 'wpcf7_edit_contact_form', $post->id() ) ) {
|
143 |
+
wpcf7_add_meta_boxes( $post->id() );
|
144 |
|
145 |
} else {
|
146 |
$current_screen = get_current_screen();
|
156 |
'default' => 20,
|
157 |
'option' => 'cfseven_contact_forms_per_page' ) );
|
158 |
}
|
|
|
|
|
|
|
|
|
159 |
}
|
160 |
|
161 |
add_action( 'admin_enqueue_scripts', 'wpcf7_admin_enqueue_scripts' );
|
194 |
|
195 |
function wpcf7_admin_management_page() {
|
196 |
if ( $post = wpcf7_get_current_contact_form() ) {
|
197 |
+
$post_id = $post->initial() ? -1 : $post->id();
|
198 |
|
199 |
require_once WPCF7_PLUGIN_DIR . '/admin/includes/meta-boxes.php';
|
200 |
require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php';
|
206 |
|
207 |
?>
|
208 |
<div class="wrap">
|
|
|
209 |
|
210 |
<h2><?php
|
211 |
echo esc_html( __( 'Contact Forms', 'contact-form-7' ) );
|
249 |
|
250 |
?>
|
251 |
<div class="wrap">
|
|
|
252 |
|
253 |
<h2><?php echo esc_html( __( 'Add New Contact Form', 'contact-form-7' ) ); ?></h2>
|
254 |
|
admin/css/styles.css
CHANGED
@@ -92,6 +92,20 @@ input#contact-form-anchor-text, input#contact-form-anchor-text-old {
|
|
92 |
margin-left: 10px;
|
93 |
}
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
.postbox .mail-field, .postbox .message-field {
|
96 |
margin-top: 6px;
|
97 |
margin-bottom: 8px;
|
92 |
margin-left: 10px;
|
93 |
}
|
94 |
|
95 |
+
@media only screen and (max-width: 768px) {
|
96 |
+
.postbox .half, .postbox .half-left, .postbox .half-right {
|
97 |
+
width: 100%;
|
98 |
+
}
|
99 |
+
|
100 |
+
.postbox .half-right {
|
101 |
+
margin-top: 1em;
|
102 |
+
}
|
103 |
+
|
104 |
+
.postbox .half-right > * {
|
105 |
+
margin-left: inherit;
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
.postbox .mail-field, .postbox .message-field {
|
110 |
margin-top: 6px;
|
111 |
margin-bottom: 8px;
|
admin/edit-contact-form.php
CHANGED
@@ -6,10 +6,8 @@ if ( ! defined( 'ABSPATH' ) )
|
|
6 |
|
7 |
?><div class="wrap">
|
8 |
|
9 |
-
<?php screen_icon(); ?>
|
10 |
-
|
11 |
<h2><?php
|
12 |
-
if ( $post->initial ) {
|
13 |
echo esc_html( __( 'Add New Contact Form', 'contact-form-7' ) );
|
14 |
} else {
|
15 |
echo esc_html( __( 'Edit Contact Form', 'contact-form-7' ) );
|
@@ -35,16 +33,16 @@ if ( $post ) :
|
|
35 |
<?php if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) )
|
36 |
wp_nonce_field( 'wpcf7-save-contact-form_' . $post_id ); ?>
|
37 |
<input type="hidden" id="post_ID" name="post_ID" value="<?php echo (int) $post_id; ?>" />
|
38 |
-
<input type="hidden" id="wpcf7-id" name="wpcf7-id" value="<?php echo (int) get_post_meta( $post->id, '_old_cf7_unit_id', true ); ?>" />
|
39 |
<input type="hidden" id="wpcf7-locale" name="wpcf7-locale" value="<?php echo esc_attr( $post->locale ); ?>" />
|
40 |
<input type="hidden" id="hiddenaction" name="action" value="save" />
|
41 |
|
42 |
<div id="poststuff" class="metabox-holder">
|
43 |
|
44 |
<div id="titlediv">
|
45 |
-
<input type="text" id="wpcf7-title" name="wpcf7-title" size="80" value="<?php echo esc_attr( $post->title ); ?>"<?php echo $disabled; ?> />
|
46 |
|
47 |
-
<?php if ( ! $post->initial ) : ?>
|
48 |
<p class="tagcode">
|
49 |
<?php echo esc_html( __( "Copy this code and paste it into your post, page or text widget content.", 'contact-form-7' ) ); ?><br />
|
50 |
|
@@ -64,7 +62,7 @@ if ( $post ) :
|
|
64 |
</div>
|
65 |
<?php endif; ?>
|
66 |
|
67 |
-
<?php if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) && ! $post->initial ) : ?>
|
68 |
<div class="actions-link">
|
69 |
<?php $copy_nonce = wp_create_nonce( 'wpcf7-copy-contact-form_' . $post_id ); ?>
|
70 |
<input type="submit" name="wpcf7-copy" class="copy" value="<?php echo esc_attr( __( 'Duplicate', 'contact-form-7' ) ); ?>"
|
@@ -82,27 +80,27 @@ if ( $post ) :
|
|
82 |
|
83 |
<?php
|
84 |
|
85 |
-
|
86 |
|
87 |
do_meta_boxes( null, 'form', $post );
|
88 |
|
89 |
-
|
90 |
|
91 |
do_meta_boxes( null, 'mail', $post );
|
92 |
|
93 |
-
|
94 |
|
95 |
do_meta_boxes( null, 'mail_2', $post );
|
96 |
|
97 |
-
|
98 |
|
99 |
do_meta_boxes( null, 'messages', $post );
|
100 |
|
101 |
-
|
102 |
|
103 |
do_meta_boxes( null, 'additional_settings', $post );
|
104 |
|
105 |
-
|
106 |
|
107 |
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
108 |
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
@@ -116,4 +114,4 @@ wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
|
116 |
|
117 |
</div>
|
118 |
|
119 |
-
<?php
|
6 |
|
7 |
?><div class="wrap">
|
8 |
|
|
|
|
|
9 |
<h2><?php
|
10 |
+
if ( $post->initial() ) {
|
11 |
echo esc_html( __( 'Add New Contact Form', 'contact-form-7' ) );
|
12 |
} else {
|
13 |
echo esc_html( __( 'Edit Contact Form', 'contact-form-7' ) );
|
33 |
<?php if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) )
|
34 |
wp_nonce_field( 'wpcf7-save-contact-form_' . $post_id ); ?>
|
35 |
<input type="hidden" id="post_ID" name="post_ID" value="<?php echo (int) $post_id; ?>" />
|
36 |
+
<input type="hidden" id="wpcf7-id" name="wpcf7-id" value="<?php echo (int) get_post_meta( $post->id(), '_old_cf7_unit_id', true ); ?>" />
|
37 |
<input type="hidden" id="wpcf7-locale" name="wpcf7-locale" value="<?php echo esc_attr( $post->locale ); ?>" />
|
38 |
<input type="hidden" id="hiddenaction" name="action" value="save" />
|
39 |
|
40 |
<div id="poststuff" class="metabox-holder">
|
41 |
|
42 |
<div id="titlediv">
|
43 |
+
<input type="text" id="wpcf7-title" name="wpcf7-title" size="80" value="<?php echo esc_attr( $post->title() ); ?>"<?php echo $disabled; ?> />
|
44 |
|
45 |
+
<?php if ( ! $post->initial() ) : ?>
|
46 |
<p class="tagcode">
|
47 |
<?php echo esc_html( __( "Copy this code and paste it into your post, page or text widget content.", 'contact-form-7' ) ); ?><br />
|
48 |
|
62 |
</div>
|
63 |
<?php endif; ?>
|
64 |
|
65 |
+
<?php if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) && ! $post->initial() ) : ?>
|
66 |
<div class="actions-link">
|
67 |
<?php $copy_nonce = wp_create_nonce( 'wpcf7-copy-contact-form_' . $post_id ); ?>
|
68 |
<input type="submit" name="wpcf7-copy" class="copy" value="<?php echo esc_attr( __( 'Duplicate', 'contact-form-7' ) ); ?>"
|
80 |
|
81 |
<?php
|
82 |
|
83 |
+
do_action( 'wpcf7_admin_after_general_settings', $post );
|
84 |
|
85 |
do_meta_boxes( null, 'form', $post );
|
86 |
|
87 |
+
do_action( 'wpcf7_admin_after_form', $post );
|
88 |
|
89 |
do_meta_boxes( null, 'mail', $post );
|
90 |
|
91 |
+
do_action( 'wpcf7_admin_after_mail', $post );
|
92 |
|
93 |
do_meta_boxes( null, 'mail_2', $post );
|
94 |
|
95 |
+
do_action( 'wpcf7_admin_after_mail_2', $post );
|
96 |
|
97 |
do_meta_boxes( null, 'messages', $post );
|
98 |
|
99 |
+
do_action( 'wpcf7_admin_after_messages', $post );
|
100 |
|
101 |
do_meta_boxes( null, 'additional_settings', $post );
|
102 |
|
103 |
+
do_action( 'wpcf7_admin_after_additional_settings', $post );
|
104 |
|
105 |
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
106 |
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
114 |
|
115 |
</div>
|
116 |
|
117 |
+
<?php do_action( 'wpcf7_admin_footer', $post ); ?>
|
admin/images/menu-icon.png
DELETED
Binary file
|
admin/images/screen-icon.png
DELETED
Binary file
|
admin/includes/class-contact-forms-list-table.php
CHANGED
@@ -93,20 +93,20 @@ class WPCF7_Contact_Form_List_Table extends WP_List_Table {
|
|
93 |
return sprintf(
|
94 |
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
|
95 |
$this->_args['singular'],
|
96 |
-
$item->id );
|
97 |
}
|
98 |
|
99 |
function column_title( $item ) {
|
100 |
-
$url = admin_url( 'admin.php?page=wpcf7&post=' . absint( $item->id ) );
|
101 |
$edit_link = add_query_arg( array( 'action' => 'edit' ), $url );
|
102 |
|
103 |
$actions = array(
|
104 |
'edit' => '<a href="' . $edit_link . '">' . __( 'Edit', 'contact-form-7' ) . '</a>' );
|
105 |
|
106 |
-
if ( current_user_can( 'wpcf7_edit_contact_form', $item->id ) ) {
|
107 |
$copy_link = wp_nonce_url(
|
108 |
add_query_arg( array( 'action' => 'copy' ), $url ),
|
109 |
-
'wpcf7-copy-contact-form_' . absint( $item->id ) );
|
110 |
|
111 |
$actions = array_merge( $actions, array(
|
112 |
'copy' => '<a href="' . $copy_link . '">' . __( 'Copy', 'contact-form-7' ) . '</a>' ) );
|
@@ -114,14 +114,15 @@ class WPCF7_Contact_Form_List_Table extends WP_List_Table {
|
|
114 |
|
115 |
$a = sprintf( '<a class="row-title" href="%1$s" title="%2$s">%3$s</a>',
|
116 |
$edit_link,
|
117 |
-
esc_attr( sprintf( __( 'Edit “%s”', 'contact-form-7' ),
|
118 |
-
|
|
|
119 |
|
120 |
return '<strong>' . $a . '</strong> ' . $this->row_actions( $actions );
|
121 |
}
|
122 |
|
123 |
function column_author( $item ) {
|
124 |
-
$post = get_post( $item->id );
|
125 |
|
126 |
if ( ! $post )
|
127 |
return;
|
@@ -133,7 +134,8 @@ class WPCF7_Contact_Form_List_Table extends WP_List_Table {
|
|
133 |
|
134 |
function column_shortcode( $item ) {
|
135 |
$shortcodes = array(
|
136 |
-
sprintf( '[contact-form-7 id="%1$d" title="%2$s"]',
|
|
|
137 |
|
138 |
$output = '';
|
139 |
|
@@ -148,7 +150,7 @@ class WPCF7_Contact_Form_List_Table extends WP_List_Table {
|
|
148 |
}
|
149 |
|
150 |
function column_date( $item ) {
|
151 |
-
$post = get_post( $item->id );
|
152 |
|
153 |
if ( ! $post )
|
154 |
return;
|
93 |
return sprintf(
|
94 |
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
|
95 |
$this->_args['singular'],
|
96 |
+
$item->id() );
|
97 |
}
|
98 |
|
99 |
function column_title( $item ) {
|
100 |
+
$url = admin_url( 'admin.php?page=wpcf7&post=' . absint( $item->id() ) );
|
101 |
$edit_link = add_query_arg( array( 'action' => 'edit' ), $url );
|
102 |
|
103 |
$actions = array(
|
104 |
'edit' => '<a href="' . $edit_link . '">' . __( 'Edit', 'contact-form-7' ) . '</a>' );
|
105 |
|
106 |
+
if ( current_user_can( 'wpcf7_edit_contact_form', $item->id() ) ) {
|
107 |
$copy_link = wp_nonce_url(
|
108 |
add_query_arg( array( 'action' => 'copy' ), $url ),
|
109 |
+
'wpcf7-copy-contact-form_' . absint( $item->id() ) );
|
110 |
|
111 |
$actions = array_merge( $actions, array(
|
112 |
'copy' => '<a href="' . $copy_link . '">' . __( 'Copy', 'contact-form-7' ) . '</a>' ) );
|
114 |
|
115 |
$a = sprintf( '<a class="row-title" href="%1$s" title="%2$s">%3$s</a>',
|
116 |
$edit_link,
|
117 |
+
esc_attr( sprintf( __( 'Edit “%s”', 'contact-form-7' ),
|
118 |
+
$item->title() ) ),
|
119 |
+
esc_html( $item->title() ) );
|
120 |
|
121 |
return '<strong>' . $a . '</strong> ' . $this->row_actions( $actions );
|
122 |
}
|
123 |
|
124 |
function column_author( $item ) {
|
125 |
+
$post = get_post( $item->id() );
|
126 |
|
127 |
if ( ! $post )
|
128 |
return;
|
134 |
|
135 |
function column_shortcode( $item ) {
|
136 |
$shortcodes = array(
|
137 |
+
sprintf( '[contact-form-7 id="%1$d" title="%2$s"]',
|
138 |
+
$item->id(), $item->title() ) );
|
139 |
|
140 |
$output = '';
|
141 |
|
150 |
}
|
151 |
|
152 |
function column_date( $item ) {
|
153 |
+
$post = get_post( $item->id() );
|
154 |
|
155 |
if ( ! $post )
|
156 |
return;
|
admin/includes/meta-boxes.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
function wpcf7_form_meta_box( $post ) {
|
6 |
?>
|
7 |
-
<div class="half-left"><textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="24"><?php echo esc_textarea( $post->form ); ?></textarea></div>
|
8 |
|
9 |
<div class="half-right"><div id="taggenerator"></div></div>
|
10 |
|
@@ -15,23 +15,22 @@ function wpcf7_form_meta_box( $post ) {
|
|
15 |
/* Mail */
|
16 |
|
17 |
function wpcf7_mail_meta_box( $post, $box ) {
|
18 |
-
$
|
|
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
|
|
26 |
|
27 |
-
|
28 |
-
$mail = $post->{$name};
|
29 |
-
|
30 |
-
if ( ! empty( $use ) ) :
|
31 |
?>
|
32 |
<div class="mail-field">
|
33 |
<input type="checkbox" id="<?php echo $id; ?>-active" name="<?php echo $id; ?>-active" class="check-if-these-fields-are-active" value="1"<?php echo ( $mail['active'] ) ? ' checked="checked"' : ''; ?> />
|
34 |
-
<label for="<?php echo $id; ?>-active"><?php echo esc_html( $use ); ?></label>
|
35 |
<div class="pseudo-hr"></div>
|
36 |
</div>
|
37 |
|
@@ -78,7 +77,12 @@ function wpcf7_mail_meta_box( $post, $box ) {
|
|
78 |
<div class="half-right">
|
79 |
<div class="mail-field">
|
80 |
<label for="<?php echo $id; ?>-body"><?php echo esc_html( __( 'Message body:', 'contact-form-7' ) ); ?></label><br />
|
81 |
-
<textarea id="<?php echo $id; ?>-body" name="<?php echo $id; ?>-body" cols="100" rows="
|
|
|
|
|
|
|
|
|
|
|
82 |
</div>
|
83 |
</div>
|
84 |
|
@@ -94,7 +98,7 @@ function wpcf7_messages_meta_box( $post ) {
|
|
94 |
?>
|
95 |
<div class="message-field">
|
96 |
<label for="<?php echo $field_name; ?>"><em># <?php echo esc_html( $arr['description'] ); ?></em></label><br />
|
97 |
-
<input type="text" id="<?php echo $field_name; ?>" name="<?php echo $field_name; ?>" class="wide" size="70" value="<?php echo esc_attr( $post->
|
98 |
</div>
|
99 |
<?php
|
100 |
endforeach;
|
@@ -102,7 +106,7 @@ function wpcf7_messages_meta_box( $post ) {
|
|
102 |
|
103 |
function wpcf7_additional_settings_meta_box( $post ) {
|
104 |
?>
|
105 |
-
<textarea id="wpcf7-additional-settings" name="wpcf7-additional-settings" cols="100" rows="8"><?php echo esc_textarea( $post->additional_settings ); ?></textarea>
|
106 |
<?php
|
107 |
}
|
108 |
|
4 |
|
5 |
function wpcf7_form_meta_box( $post ) {
|
6 |
?>
|
7 |
+
<div class="half-left"><textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="24"><?php echo esc_textarea( $post->prop( 'form' ) ); ?></textarea></div>
|
8 |
|
9 |
<div class="half-right"><div id="taggenerator"></div></div>
|
10 |
|
15 |
/* Mail */
|
16 |
|
17 |
function wpcf7_mail_meta_box( $post, $box ) {
|
18 |
+
$args = isset( $box['args'] ) && is_array( $box['args'] )
|
19 |
+
? $box['args'] : array();
|
20 |
|
21 |
+
$args = wp_parse_args( $args, array(
|
22 |
+
'id' => 'wpcf7-mail',
|
23 |
+
'name' => 'mail',
|
24 |
+
'use' => null ) );
|
25 |
|
26 |
+
$id = esc_attr( $args['id'] );
|
27 |
+
$mail = $post->prop( $args['name'] );
|
28 |
|
29 |
+
if ( ! empty( $args['use'] ) ) :
|
|
|
|
|
|
|
30 |
?>
|
31 |
<div class="mail-field">
|
32 |
<input type="checkbox" id="<?php echo $id; ?>-active" name="<?php echo $id; ?>-active" class="check-if-these-fields-are-active" value="1"<?php echo ( $mail['active'] ) ? ' checked="checked"' : ''; ?> />
|
33 |
+
<label for="<?php echo $id; ?>-active"><?php echo esc_html( $args['use'] ); ?></label>
|
34 |
<div class="pseudo-hr"></div>
|
35 |
</div>
|
36 |
|
77 |
<div class="half-right">
|
78 |
<div class="mail-field">
|
79 |
<label for="<?php echo $id; ?>-body"><?php echo esc_html( __( 'Message body:', 'contact-form-7' ) ); ?></label><br />
|
80 |
+
<textarea id="<?php echo $id; ?>-body" name="<?php echo $id; ?>-body" cols="100" rows="18"><?php echo esc_textarea( $mail['body'] ); ?></textarea>
|
81 |
+
</div>
|
82 |
+
|
83 |
+
<div class="mail-field">
|
84 |
+
<input type="checkbox" id="<?php echo $id; ?>-exclude-blank" name="<?php echo $id; ?>-exclude-blank" value="1"<?php echo ( ! empty( $mail['exclude_blank'] ) ) ? ' checked="checked"' : ''; ?> />
|
85 |
+
<label for="<?php echo $id; ?>-exclude-blank"><?php echo esc_html( __( 'Exclude lines with blank mail-tags from output', 'contact-form-7' ) ); ?></label>
|
86 |
</div>
|
87 |
</div>
|
88 |
|
98 |
?>
|
99 |
<div class="message-field">
|
100 |
<label for="<?php echo $field_name; ?>"><em># <?php echo esc_html( $arr['description'] ); ?></em></label><br />
|
101 |
+
<input type="text" id="<?php echo $field_name; ?>" name="<?php echo $field_name; ?>" class="wide" size="70" value="<?php echo esc_attr( $post->message( $key, false ) ); ?>" />
|
102 |
</div>
|
103 |
<?php
|
104 |
endforeach;
|
106 |
|
107 |
function wpcf7_additional_settings_meta_box( $post ) {
|
108 |
?>
|
109 |
+
<textarea id="wpcf7-additional-settings" name="wpcf7-additional-settings" cols="100" rows="8"><?php echo esc_textarea( $post->prop( 'additional_settings' ) ); ?></textarea>
|
110 |
<?php
|
111 |
}
|
112 |
|
includes/classes.php
DELETED
@@ -1,1084 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WPCF7_ContactForm {
|
4 |
-
|
5 |
-
const post_type = 'wpcf7_contact_form';
|
6 |
-
|
7 |
-
private static $found_items = 0;
|
8 |
-
private static $current = null;
|
9 |
-
private static $submission = array(); // result of submit() process
|
10 |
-
|
11 |
-
public $initial = false;
|
12 |
-
public $id;
|
13 |
-
public $name;
|
14 |
-
public $title;
|
15 |
-
public $unit_tag;
|
16 |
-
public $responses_count = 0;
|
17 |
-
public $scanned_form_tags;
|
18 |
-
public $posted_data;
|
19 |
-
public $uploaded_files = array();
|
20 |
-
public $skip_mail = false;
|
21 |
-
|
22 |
-
public static function count() {
|
23 |
-
return self::$found_items;
|
24 |
-
}
|
25 |
-
|
26 |
-
public static function set_current( self $obj ) {
|
27 |
-
self::$current = $obj;
|
28 |
-
}
|
29 |
-
|
30 |
-
public static function get_current() {
|
31 |
-
return self::$current;
|
32 |
-
}
|
33 |
-
|
34 |
-
public static function reset_current() {
|
35 |
-
self::$current = null;
|
36 |
-
}
|
37 |
-
|
38 |
-
private static function add_submission_status( $id, $status ) {
|
39 |
-
self::$submission[$id] = (array) $status;
|
40 |
-
}
|
41 |
-
|
42 |
-
private static function get_submission_status( $id ) {
|
43 |
-
if ( isset( self::$submission[$id] ) ) {
|
44 |
-
return (array) self::$submission[$id];
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
private static function get_unit_tag( $id = 0 ) {
|
49 |
-
static $global_count = 0;
|
50 |
-
|
51 |
-
$global_count += 1;
|
52 |
-
|
53 |
-
if ( in_the_loop() ) {
|
54 |
-
$unit_tag = sprintf( 'wpcf7-f%1$d-p%2$d-o%3$d',
|
55 |
-
absint( $id ), get_the_ID(), $global_count );
|
56 |
-
} else {
|
57 |
-
$unit_tag = sprintf( 'wpcf7-f%1$d-o%2$d',
|
58 |
-
absint( $id ), $global_count );
|
59 |
-
}
|
60 |
-
|
61 |
-
return $unit_tag;
|
62 |
-
}
|
63 |
-
|
64 |
-
public static function register_post_type() {
|
65 |
-
register_post_type( self::post_type, array(
|
66 |
-
'labels' => array(
|
67 |
-
'name' => __( 'Contact Forms', 'contact-form-7' ),
|
68 |
-
'singular_name' => __( 'Contact Form', 'contact-form-7' ) ),
|
69 |
-
'rewrite' => false,
|
70 |
-
'query_var' => false ) );
|
71 |
-
}
|
72 |
-
|
73 |
-
public static function find( $args = '' ) {
|
74 |
-
$defaults = array(
|
75 |
-
'post_status' => 'any',
|
76 |
-
'posts_per_page' => -1,
|
77 |
-
'offset' => 0,
|
78 |
-
'orderby' => 'ID',
|
79 |
-
'order' => 'ASC' );
|
80 |
-
|
81 |
-
$args = wp_parse_args( $args, $defaults );
|
82 |
-
|
83 |
-
$args['post_type'] = self::post_type;
|
84 |
-
|
85 |
-
$q = new WP_Query();
|
86 |
-
$posts = $q->query( $args );
|
87 |
-
|
88 |
-
self::$found_items = $q->found_posts;
|
89 |
-
|
90 |
-
$objs = array();
|
91 |
-
|
92 |
-
foreach ( (array) $posts as $post )
|
93 |
-
$objs[] = new self( $post );
|
94 |
-
|
95 |
-
return $objs;
|
96 |
-
}
|
97 |
-
|
98 |
-
public function __construct( $post = null ) {
|
99 |
-
$this->initial = true;
|
100 |
-
|
101 |
-
$this->form = '';
|
102 |
-
$this->mail = array();
|
103 |
-
$this->mail_2 = array();
|
104 |
-
$this->messages = array();
|
105 |
-
$this->additional_settings = '';
|
106 |
-
|
107 |
-
$post = get_post( $post );
|
108 |
-
|
109 |
-
if ( $post && self::post_type == get_post_type( $post ) ) {
|
110 |
-
$this->initial = false;
|
111 |
-
$this->id = $post->ID;
|
112 |
-
$this->name = $post->post_name;
|
113 |
-
$this->title = $post->post_title;
|
114 |
-
$this->locale = get_post_meta( $post->ID, '_locale', true );
|
115 |
-
|
116 |
-
$props = $this->get_properties();
|
117 |
-
|
118 |
-
foreach ( $props as $prop => $value ) {
|
119 |
-
if ( metadata_exists( 'post', $post->ID, '_' . $prop ) )
|
120 |
-
$this->{$prop} = get_post_meta( $post->ID, '_' . $prop, true );
|
121 |
-
else
|
122 |
-
$this->{$prop} = get_post_meta( $post->ID, $prop, true );
|
123 |
-
}
|
124 |
-
|
125 |
-
$this->upgrade();
|
126 |
-
}
|
127 |
-
|
128 |
-
do_action_ref_array( 'wpcf7_contact_form', array( &$this ) );
|
129 |
-
}
|
130 |
-
|
131 |
-
public static function generate_default_package( $args = '' ) {
|
132 |
-
global $l10n;
|
133 |
-
|
134 |
-
$defaults = array( 'locale' => null, 'title' => '' );
|
135 |
-
$args = wp_parse_args( $args, $defaults );
|
136 |
-
|
137 |
-
$locale = $args['locale'];
|
138 |
-
$title = $args['title'];
|
139 |
-
|
140 |
-
if ( $locale ) {
|
141 |
-
$mo_orig = $l10n['contact-form-7'];
|
142 |
-
wpcf7_load_textdomain( $locale );
|
143 |
-
}
|
144 |
-
|
145 |
-
$contact_form = new self;
|
146 |
-
$contact_form->initial = true;
|
147 |
-
$contact_form->title =
|
148 |
-
( $title ? $title : __( 'Untitled', 'contact-form-7' ) );
|
149 |
-
$contact_form->locale = ( $locale ? $locale : get_locale() );
|
150 |
-
|
151 |
-
$props = $contact_form->get_properties();
|
152 |
-
|
153 |
-
foreach ( $props as $prop => $value ) {
|
154 |
-
$contact_form->{$prop} = wpcf7_get_default_template( $prop );
|
155 |
-
}
|
156 |
-
|
157 |
-
$contact_form = apply_filters( 'wpcf7_contact_form_default_pack',
|
158 |
-
$contact_form, $args );
|
159 |
-
|
160 |
-
if ( isset( $mo_orig ) ) {
|
161 |
-
$l10n['contact-form-7'] = $mo_orig;
|
162 |
-
}
|
163 |
-
|
164 |
-
return $contact_form;
|
165 |
-
}
|
166 |
-
|
167 |
-
public function get_properties() {
|
168 |
-
$prop_names = array( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' );
|
169 |
-
|
170 |
-
$properties = array();
|
171 |
-
|
172 |
-
foreach ( $prop_names as $prop_name )
|
173 |
-
$properties[$prop_name] = isset( $this->{$prop_name} ) ? $this->{$prop_name} : '';
|
174 |
-
|
175 |
-
return apply_filters( 'wpcf7_contact_form_properties', $properties, $this );
|
176 |
-
}
|
177 |
-
|
178 |
-
// Return true if this form is the same one as currently POSTed.
|
179 |
-
public function is_posted() {
|
180 |
-
if ( ! isset( $_POST['_wpcf7_unit_tag'] ) || empty( $_POST['_wpcf7_unit_tag'] ) )
|
181 |
-
return false;
|
182 |
-
|
183 |
-
if ( $this->unit_tag == $_POST['_wpcf7_unit_tag'] )
|
184 |
-
return true;
|
185 |
-
|
186 |
-
return false;
|
187 |
-
}
|
188 |
-
|
189 |
-
public function clear_post() {
|
190 |
-
$fes = $this->form_scan_shortcode();
|
191 |
-
|
192 |
-
foreach ( $fes as $fe ) {
|
193 |
-
if ( ! isset( $fe['name'] ) || empty( $fe['name'] ) )
|
194 |
-
continue;
|
195 |
-
|
196 |
-
$name = $fe['name'];
|
197 |
-
|
198 |
-
if ( isset( $_POST[$name] ) )
|
199 |
-
unset( $_POST[$name] );
|
200 |
-
}
|
201 |
-
}
|
202 |
-
|
203 |
-
/* Generating Form HTML */
|
204 |
-
|
205 |
-
public function form_html( $atts = array() ) {
|
206 |
-
$atts = wp_parse_args( $atts, array(
|
207 |
-
'html_id' => '',
|
208 |
-
'html_name' => '',
|
209 |
-
'html_class' => '' ) );
|
210 |
-
|
211 |
-
$this->unit_tag = self::get_unit_tag( $this->id );
|
212 |
-
|
213 |
-
$html = '<div class="wpcf7" id="' . $this->unit_tag . '">' . "\n";
|
214 |
-
|
215 |
-
$html .= $this->screen_reader_response() . "\n";
|
216 |
-
|
217 |
-
$url = wpcf7_get_request_uri();
|
218 |
-
|
219 |
-
if ( $frag = strstr( $url, '#' ) )
|
220 |
-
$url = substr( $url, 0, -strlen( $frag ) );
|
221 |
-
|
222 |
-
$url .= '#' . $this->unit_tag;
|
223 |
-
|
224 |
-
$url = apply_filters( 'wpcf7_form_action_url', $url );
|
225 |
-
|
226 |
-
$id_attr = apply_filters( 'wpcf7_form_id_attr',
|
227 |
-
preg_replace( '/[^A-Za-z0-9:._-]/', '', $atts['html_id'] ) );
|
228 |
-
|
229 |
-
$name_attr = apply_filters( 'wpcf7_form_name_attr',
|
230 |
-
preg_replace( '/[^A-Za-z0-9:._-]/', '', $atts['html_name'] ) );
|
231 |
-
|
232 |
-
$class = 'wpcf7-form';
|
233 |
-
|
234 |
-
$result = self::get_submission_status( $this->id );
|
235 |
-
|
236 |
-
if ( $this->is_posted() ) {
|
237 |
-
if ( empty( $result['valid'] ) )
|
238 |
-
$class .= ' invalid';
|
239 |
-
elseif ( ! empty( $result['spam'] ) )
|
240 |
-
$class .= ' spam';
|
241 |
-
elseif ( ! empty( $result['mail_sent'] ) )
|
242 |
-
$class .= ' sent';
|
243 |
-
else
|
244 |
-
$class .= ' failed';
|
245 |
-
}
|
246 |
-
|
247 |
-
if ( $atts['html_class'] ) {
|
248 |
-
$class .= ' ' . $atts['html_class'];
|
249 |
-
}
|
250 |
-
|
251 |
-
if ( $this->in_demo_mode() ) {
|
252 |
-
$class .= ' demo';
|
253 |
-
}
|
254 |
-
|
255 |
-
$class = explode( ' ', $class );
|
256 |
-
$class = array_map( 'sanitize_html_class', $class );
|
257 |
-
$class = array_filter( $class );
|
258 |
-
$class = array_unique( $class );
|
259 |
-
$class = implode( ' ', $class );
|
260 |
-
$class = apply_filters( 'wpcf7_form_class_attr', $class );
|
261 |
-
|
262 |
-
$enctype = apply_filters( 'wpcf7_form_enctype', '' );
|
263 |
-
|
264 |
-
$novalidate = apply_filters( 'wpcf7_form_novalidate',
|
265 |
-
wpcf7_support_html5() ? ' novalidate="novalidate"' : '' );
|
266 |
-
|
267 |
-
$html .= '<form action="' . esc_url( $url ) . '" method="post"'
|
268 |
-
. ( $id_attr ? ' id="' . esc_attr( $id_attr ) . '"' : '' )
|
269 |
-
. ( $name_attr ? ' name="' . esc_attr( $name_attr ) . '"' : '' )
|
270 |
-
. ' class="' . esc_attr( $class ) . '"'
|
271 |
-
. $enctype . $novalidate . '>' . "\n";
|
272 |
-
|
273 |
-
$html .= $this->form_hidden_fields();
|
274 |
-
$html .= $this->form_elements();
|
275 |
-
|
276 |
-
if ( ! $this->responses_count )
|
277 |
-
$html .= $this->form_response_output();
|
278 |
-
|
279 |
-
$html .= '</form>';
|
280 |
-
$html .= '</div>';
|
281 |
-
|
282 |
-
return $html;
|
283 |
-
}
|
284 |
-
|
285 |
-
public function form_hidden_fields() {
|
286 |
-
$hidden_fields = array(
|
287 |
-
'_wpcf7' => $this->id,
|
288 |
-
'_wpcf7_version' => WPCF7_VERSION,
|
289 |
-
'_wpcf7_locale' => $this->locale,
|
290 |
-
'_wpcf7_unit_tag' => $this->unit_tag );
|
291 |
-
|
292 |
-
if ( WPCF7_VERIFY_NONCE )
|
293 |
-
$hidden_fields['_wpnonce'] = wpcf7_create_nonce( $this->id );
|
294 |
-
|
295 |
-
$content = '';
|
296 |
-
|
297 |
-
foreach ( $hidden_fields as $name => $value ) {
|
298 |
-
$content .= '<input type="hidden"'
|
299 |
-
. ' name="' . esc_attr( $name ) . '"'
|
300 |
-
. ' value="' . esc_attr( $value ) . '" />' . "\n";
|
301 |
-
}
|
302 |
-
|
303 |
-
return '<div style="display: none;">' . "\n" . $content . '</div>' . "\n";
|
304 |
-
}
|
305 |
-
|
306 |
-
public function form_response_output() {
|
307 |
-
$class = 'wpcf7-response-output';
|
308 |
-
$role = '';
|
309 |
-
$content = '';
|
310 |
-
|
311 |
-
if ( $this->is_posted() ) { // Post response output for non-AJAX
|
312 |
-
|
313 |
-
$result = self::get_submission_status( $this->id );
|
314 |
-
|
315 |
-
if ( empty( $result['valid'] ) )
|
316 |
-
$class .= ' wpcf7-validation-errors';
|
317 |
-
elseif ( ! empty( $result['spam'] ) )
|
318 |
-
$class .= ' wpcf7-spam-blocked';
|
319 |
-
elseif ( ! empty( $result['mail_sent'] ) )
|
320 |
-
$class .= ' wpcf7-mail-sent-ok';
|
321 |
-
else
|
322 |
-
$class .= ' wpcf7-mail-sent-ng';
|
323 |
-
|
324 |
-
$role = 'alert';
|
325 |
-
|
326 |
-
if ( ! empty( $result['message'] ) )
|
327 |
-
$content = $result['message'];
|
328 |
-
|
329 |
-
} else {
|
330 |
-
$class .= ' wpcf7-display-none';
|
331 |
-
}
|
332 |
-
|
333 |
-
$atts = array(
|
334 |
-
'class' => trim( $class ),
|
335 |
-
'role' => trim( $role ) );
|
336 |
-
|
337 |
-
$atts = wpcf7_format_atts( $atts );
|
338 |
-
|
339 |
-
$output = sprintf( '<div %1$s>%2$s</div>',
|
340 |
-
$atts, esc_html( $content ) );
|
341 |
-
|
342 |
-
return apply_filters( 'wpcf7_form_response_output',
|
343 |
-
$output, $class, $content, $this );
|
344 |
-
}
|
345 |
-
|
346 |
-
public function screen_reader_response() {
|
347 |
-
$class = 'screen-reader-response';
|
348 |
-
$role = '';
|
349 |
-
$content = '';
|
350 |
-
|
351 |
-
if ( $this->is_posted() ) { // Post response output for non-AJAX
|
352 |
-
$role = 'alert';
|
353 |
-
$result = self::get_submission_status( $this->id );
|
354 |
-
|
355 |
-
if ( ! empty( $result['message'] ) ) {
|
356 |
-
$content = esc_html( $result['message'] );
|
357 |
-
|
358 |
-
if ( ! empty( $result['invalid_reasons'] ) ) {
|
359 |
-
$content .= "\n" . '<ul>' . "\n";
|
360 |
-
|
361 |
-
foreach ( (array) $result['invalid_reasons'] as $k => $v ) {
|
362 |
-
if ( isset( $result['invalid_fields'][$k] )
|
363 |
-
&& wpcf7_is_name( $result['invalid_fields'][$k] ) ) {
|
364 |
-
$link = sprintf( '<a href="#%1$s">%2$s</a>',
|
365 |
-
$result['invalid_fields'][$k],
|
366 |
-
esc_html( $v ) );
|
367 |
-
$content .= sprintf( '<li>%s</li>', $link );
|
368 |
-
} else {
|
369 |
-
$content .= sprintf( '<li>%s</li>', esc_html( $v ) );
|
370 |
-
}
|
371 |
-
|
372 |
-
$content .= "\n";
|
373 |
-
}
|
374 |
-
|
375 |
-
$content .= '</ul>' . "\n";
|
376 |
-
}
|
377 |
-
}
|
378 |
-
}
|
379 |
-
|
380 |
-
$atts = array(
|
381 |
-
'class' => trim( $class ),
|
382 |
-
'role' => trim( $role ) );
|
383 |
-
|
384 |
-
$atts = wpcf7_format_atts( $atts );
|
385 |
-
|
386 |
-
$output = sprintf( '<div %1$s>%2$s</div>',
|
387 |
-
$atts, $content );
|
388 |
-
|
389 |
-
return $output;
|
390 |
-
}
|
391 |
-
|
392 |
-
public function validation_error( $name ) {
|
393 |
-
if ( ! $this->is_posted() )
|
394 |
-
return '';
|
395 |
-
|
396 |
-
$result = self::get_submission_status( $this->id );
|
397 |
-
|
398 |
-
if ( ! isset( $result['invalid_reasons'][$name] ) )
|
399 |
-
return '';
|
400 |
-
|
401 |
-
$ve = trim( $result['invalid_reasons'][$name] );
|
402 |
-
|
403 |
-
if ( empty( $ve ) )
|
404 |
-
return '';
|
405 |
-
|
406 |
-
$ve = '<span role="alert" class="wpcf7-not-valid-tip">'
|
407 |
-
. esc_html( $ve ) . '</span>';
|
408 |
-
|
409 |
-
return apply_filters( 'wpcf7_validation_error', $ve, $name, $this );
|
410 |
-
}
|
411 |
-
|
412 |
-
/* Form Elements */
|
413 |
-
|
414 |
-
public function form_do_shortcode() {
|
415 |
-
$manager = WPCF7_ShortcodeManager::get_instance();
|
416 |
-
$form = $this->form;
|
417 |
-
|
418 |
-
if ( WPCF7_AUTOP ) {
|
419 |
-
$form = $manager->normalize_shortcode( $form );
|
420 |
-
$form = wpcf7_autop( $form );
|
421 |
-
}
|
422 |
-
|
423 |
-
$form = $manager->do_shortcode( $form );
|
424 |
-
$this->scanned_form_tags = $manager->get_scanned_tags();
|
425 |
-
|
426 |
-
return $form;
|
427 |
-
}
|
428 |
-
|
429 |
-
public function form_scan_shortcode( $cond = null ) {
|
430 |
-
$manager = WPCF7_ShortcodeManager::get_instance();
|
431 |
-
|
432 |
-
if ( ! empty( $this->scanned_form_tags ) ) {
|
433 |
-
$scanned = $this->scanned_form_tags;
|
434 |
-
} else {
|
435 |
-
$scanned = $manager->scan_shortcode( $this->form );
|
436 |
-
$this->scanned_form_tags = $scanned;
|
437 |
-
}
|
438 |
-
|
439 |
-
if ( empty( $scanned ) )
|
440 |
-
return null;
|
441 |
-
|
442 |
-
if ( ! is_array( $cond ) || empty( $cond ) )
|
443 |
-
return $scanned;
|
444 |
-
|
445 |
-
for ( $i = 0, $size = count( $scanned ); $i < $size; $i++ ) {
|
446 |
-
|
447 |
-
if ( isset( $cond['type'] ) ) {
|
448 |
-
if ( is_string( $cond['type'] ) && ! empty( $cond['type'] ) ) {
|
449 |
-
if ( $scanned[$i]['type'] != $cond['type'] ) {
|
450 |
-
unset( $scanned[$i] );
|
451 |
-
continue;
|
452 |
-
}
|
453 |
-
} elseif ( is_array( $cond['type'] ) ) {
|
454 |
-
if ( ! in_array( $scanned[$i]['type'], $cond['type'] ) ) {
|
455 |
-
unset( $scanned[$i] );
|
456 |
-
continue;
|
457 |
-
}
|
458 |
-
}
|
459 |
-
}
|
460 |
-
|
461 |
-
if ( isset( $cond['name'] ) ) {
|
462 |
-
if ( is_string( $cond['name'] ) && ! empty( $cond['name'] ) ) {
|
463 |
-
if ( $scanned[$i]['name'] != $cond['name'] ) {
|
464 |
-
unset ( $scanned[$i] );
|
465 |
-
continue;
|
466 |
-
}
|
467 |
-
} elseif ( is_array( $cond['name'] ) ) {
|
468 |
-
if ( ! in_array( $scanned[$i]['name'], $cond['name'] ) ) {
|
469 |
-
unset( $scanned[$i] );
|
470 |
-
continue;
|
471 |
-
}
|
472 |
-
}
|
473 |
-
}
|
474 |
-
}
|
475 |
-
|
476 |
-
return array_values( $scanned );
|
477 |
-
}
|
478 |
-
|
479 |
-
public function form_elements() {
|
480 |
-
return apply_filters( 'wpcf7_form_elements', $this->form_do_shortcode() );
|
481 |
-
}
|
482 |
-
|
483 |
-
public function setup_posted_data() {
|
484 |
-
$posted_data = (array) $_POST;
|
485 |
-
|
486 |
-
$fes = $this->form_scan_shortcode();
|
487 |
-
|
488 |
-
foreach ( $fes as $fe ) {
|
489 |
-
if ( empty( $fe['name'] ) )
|
490 |
-
continue;
|
491 |
-
|
492 |
-
$name = $fe['name'];
|
493 |
-
$value = '';
|
494 |
-
|
495 |
-
if ( isset( $posted_data[$name] ) )
|
496 |
-
$value = $posted_data[$name];
|
497 |
-
|
498 |
-
$pipes = $fe['pipes'];
|
499 |
-
|
500 |
-
if ( WPCF7_USE_PIPE && is_a( $pipes, 'WPCF7_Pipes' ) && ! $pipes->zero() ) {
|
501 |
-
if ( is_array( $value) ) {
|
502 |
-
$new_value = array();
|
503 |
-
|
504 |
-
foreach ( $value as $v )
|
505 |
-
$new_value[] = $pipes->do_pipe( wp_unslash( $v ) );
|
506 |
-
|
507 |
-
$value = $new_value;
|
508 |
-
} else {
|
509 |
-
$value = $pipes->do_pipe( wp_unslash( $value ) );
|
510 |
-
}
|
511 |
-
}
|
512 |
-
|
513 |
-
$posted_data[$name] = $value;
|
514 |
-
}
|
515 |
-
|
516 |
-
$this->posted_data = apply_filters( 'wpcf7_posted_data', $posted_data );
|
517 |
-
|
518 |
-
return $this->posted_data;
|
519 |
-
}
|
520 |
-
|
521 |
-
public function submit( $ajax = false ) {
|
522 |
-
$result = array(
|
523 |
-
'status' => 'init',
|
524 |
-
'valid' => true,
|
525 |
-
'invalid_reasons' => array(),
|
526 |
-
'invalid_fields' => array(),
|
527 |
-
'spam' => false,
|
528 |
-
'message' => '',
|
529 |
-
'mail_sent' => false,
|
530 |
-
'scripts_on_sent_ok' => null,
|
531 |
-
'scripts_on_submit' => null );
|
532 |
-
|
533 |
-
$this->setup_posted_data();
|
534 |
-
|
535 |
-
$validation = $this->validate();
|
536 |
-
|
537 |
-
if ( ! $validation['valid'] ) { // Validation error occured
|
538 |
-
$result['status'] = 'validation_failed';
|
539 |
-
$result['valid'] = false;
|
540 |
-
$result['invalid_reasons'] = $validation['reason'];
|
541 |
-
$result['invalid_fields'] = $validation['idref'];
|
542 |
-
$result['message'] = $this->message( 'validation_error' );
|
543 |
-
|
544 |
-
} elseif ( ! $this->accepted() ) { // Not accepted terms
|
545 |
-
$result['status'] = 'acceptance_missing';
|
546 |
-
$result['message'] = $this->message( 'accept_terms' );
|
547 |
-
|
548 |
-
} elseif ( $this->spam() ) { // Spam!
|
549 |
-
$result['status'] = 'spam';
|
550 |
-
$result['message'] = $this->message( 'spam' );
|
551 |
-
$result['spam'] = true;
|
552 |
-
|
553 |
-
} elseif ( $this->mail() ) {
|
554 |
-
if ( $this->in_demo_mode() ) {
|
555 |
-
$result['status'] = 'demo_mode';
|
556 |
-
} else {
|
557 |
-
$result['status'] = 'mail_sent';
|
558 |
-
}
|
559 |
-
|
560 |
-
$result['mail_sent'] = true;
|
561 |
-
$result['message'] = $this->message( 'mail_sent_ok' );
|
562 |
-
|
563 |
-
do_action_ref_array( 'wpcf7_mail_sent', array( &$this ) );
|
564 |
-
|
565 |
-
if ( $ajax ) {
|
566 |
-
$on_sent_ok = $this->additional_setting( 'on_sent_ok', false );
|
567 |
-
|
568 |
-
if ( ! empty( $on_sent_ok ) )
|
569 |
-
$result['scripts_on_sent_ok'] = array_map( 'wpcf7_strip_quote', $on_sent_ok );
|
570 |
-
} else {
|
571 |
-
$this->clear_post();
|
572 |
-
}
|
573 |
-
|
574 |
-
} else {
|
575 |
-
$result['status'] = 'mail_failed';
|
576 |
-
$result['message'] = $this->message( 'mail_sent_ng' );
|
577 |
-
|
578 |
-
do_action_ref_array( 'wpcf7_mail_failed', array( &$this ) );
|
579 |
-
}
|
580 |
-
|
581 |
-
if ( $ajax ) {
|
582 |
-
$on_submit = $this->additional_setting( 'on_submit', false );
|
583 |
-
|
584 |
-
if ( ! empty( $on_submit ) )
|
585 |
-
$result['scripts_on_submit'] = array_map( 'wpcf7_strip_quote', $on_submit );
|
586 |
-
}
|
587 |
-
|
588 |
-
// remove upload files
|
589 |
-
foreach ( (array) $this->uploaded_files as $name => $path ) {
|
590 |
-
@unlink( $path );
|
591 |
-
}
|
592 |
-
|
593 |
-
do_action_ref_array( 'wpcf7_submit', array( &$this, $result ) );
|
594 |
-
|
595 |
-
self::add_submission_status( $this->id, $result );
|
596 |
-
|
597 |
-
return $result;
|
598 |
-
}
|
599 |
-
|
600 |
-
/* Validate */
|
601 |
-
|
602 |
-
public function validate() {
|
603 |
-
$fes = $this->form_scan_shortcode();
|
604 |
-
|
605 |
-
$result = array(
|
606 |
-
'valid' => true,
|
607 |
-
'reason' => array(),
|
608 |
-
'idref' => array() );
|
609 |
-
|
610 |
-
foreach ( $fes as $fe ) {
|
611 |
-
$result = apply_filters( 'wpcf7_validate_' . $fe['type'], $result, $fe );
|
612 |
-
}
|
613 |
-
|
614 |
-
$result = apply_filters( 'wpcf7_validate', $result );
|
615 |
-
|
616 |
-
return $result;
|
617 |
-
}
|
618 |
-
|
619 |
-
public function accepted() {
|
620 |
-
$accepted = true;
|
621 |
-
|
622 |
-
return apply_filters( 'wpcf7_acceptance', $accepted );
|
623 |
-
}
|
624 |
-
|
625 |
-
public function spam() {
|
626 |
-
$spam = false;
|
627 |
-
|
628 |
-
if ( WPCF7_VERIFY_NONCE && ! $this->verify_nonce() )
|
629 |
-
$spam = true;
|
630 |
-
|
631 |
-
if ( $this->blacklist_check() )
|
632 |
-
$spam = true;
|
633 |
-
|
634 |
-
return apply_filters( 'wpcf7_spam', $spam );
|
635 |
-
}
|
636 |
-
|
637 |
-
public function verify_nonce() {
|
638 |
-
return wpcf7_verify_nonce( $_POST['_wpnonce'], $this->id );
|
639 |
-
}
|
640 |
-
|
641 |
-
public function blacklist_check() {
|
642 |
-
$target = wpcf7_array_flatten( $this->posted_data );
|
643 |
-
$target[] = $_SERVER['REMOTE_ADDR'];
|
644 |
-
$target[] = $_SERVER['HTTP_USER_AGENT'];
|
645 |
-
|
646 |
-
$target = implode( "\n", $target );
|
647 |
-
|
648 |
-
return wpcf7_blacklist_check( $target );
|
649 |
-
}
|
650 |
-
|
651 |
-
/* Mail */
|
652 |
-
|
653 |
-
public function mail() {
|
654 |
-
if ( $this->in_demo_mode() )
|
655 |
-
$this->skip_mail = true;
|
656 |
-
|
657 |
-
do_action_ref_array( 'wpcf7_before_send_mail', array( &$this ) );
|
658 |
-
|
659 |
-
if ( $this->skip_mail )
|
660 |
-
return true;
|
661 |
-
|
662 |
-
$result = $this->compose_mail( $this->setup_mail_template( $this->mail, 'mail' ) );
|
663 |
-
|
664 |
-
if ( $result ) {
|
665 |
-
$additional_mail = array();
|
666 |
-
|
667 |
-
if ( $this->mail_2['active'] )
|
668 |
-
$additional_mail[] = $this->setup_mail_template( $this->mail_2, 'mail_2' );
|
669 |
-
|
670 |
-
$additional_mail = apply_filters_ref_array( 'wpcf7_additional_mail',
|
671 |
-
array( $additional_mail, &$this ) );
|
672 |
-
|
673 |
-
foreach ( $additional_mail as $mail )
|
674 |
-
$this->compose_mail( $mail );
|
675 |
-
|
676 |
-
return true;
|
677 |
-
}
|
678 |
-
|
679 |
-
return false;
|
680 |
-
}
|
681 |
-
|
682 |
-
public function setup_mail_template( $mail_template, $name = '' ) {
|
683 |
-
$defaults = array(
|
684 |
-
'subject' => '', 'sender' => '', 'body' => '',
|
685 |
-
'recipient' => '', 'additional_headers' => '',
|
686 |
-
'attachments' => '', 'use_html' => false );
|
687 |
-
|
688 |
-
$mail_template = wp_parse_args( $mail_template, $defaults );
|
689 |
-
|
690 |
-
$name = trim( $name );
|
691 |
-
|
692 |
-
if ( ! empty( $name ) )
|
693 |
-
$mail_template['name'] = $name;
|
694 |
-
|
695 |
-
return $mail_template;
|
696 |
-
}
|
697 |
-
|
698 |
-
public function compose_mail( $mail_template, $send = true ) {
|
699 |
-
$this->mail_template_in_process = $mail_template;
|
700 |
-
|
701 |
-
$use_html = (bool) $mail_template['use_html'];
|
702 |
-
|
703 |
-
$subject = $this->replace_mail_tags( $mail_template['subject'] );
|
704 |
-
$sender = $this->replace_mail_tags( $mail_template['sender'] );
|
705 |
-
$recipient = $this->replace_mail_tags( $mail_template['recipient'] );
|
706 |
-
$additional_headers = $this->replace_mail_tags( $mail_template['additional_headers'] );
|
707 |
-
|
708 |
-
if ( $use_html ) {
|
709 |
-
$body = $this->replace_mail_tags( $mail_template['body'], true );
|
710 |
-
$body = wpautop( $body );
|
711 |
-
} else {
|
712 |
-
$body = $this->replace_mail_tags( $mail_template['body'] );
|
713 |
-
}
|
714 |
-
|
715 |
-
$attachments = $this->mail_attachments( $mail_template['attachments'] );
|
716 |
-
|
717 |
-
$components = compact(
|
718 |
-
'subject', 'sender', 'body', 'recipient', 'additional_headers', 'attachments' );
|
719 |
-
|
720 |
-
$components = apply_filters_ref_array( 'wpcf7_mail_components',
|
721 |
-
array( $components, &$this ) );
|
722 |
-
|
723 |
-
extract( $components );
|
724 |
-
|
725 |
-
$subject = wpcf7_strip_newline( $subject );
|
726 |
-
$sender = wpcf7_strip_newline( $sender );
|
727 |
-
$recipient = wpcf7_strip_newline( $recipient );
|
728 |
-
|
729 |
-
$headers = "From: $sender\n";
|
730 |
-
|
731 |
-
if ( $use_html )
|
732 |
-
$headers .= "Content-Type: text/html\n";
|
733 |
-
|
734 |
-
$additional_headers = trim( $additional_headers );
|
735 |
-
|
736 |
-
if ( $additional_headers )
|
737 |
-
$headers .= $additional_headers . "\n";
|
738 |
-
|
739 |
-
if ( $send )
|
740 |
-
return @wp_mail( $recipient, $subject, $body, $headers, $attachments );
|
741 |
-
|
742 |
-
return compact( 'subject', 'sender', 'body', 'recipient', 'headers', 'attachments' );
|
743 |
-
}
|
744 |
-
|
745 |
-
public function replace_mail_tags( $content, $html = false ) {
|
746 |
-
$regex = '/(\[?)\[[\t ]*'
|
747 |
-
. '([a-zA-Z_][0-9a-zA-Z:._-]*)' // [2] = name
|
748 |
-
. '((?:[\t ]+"[^"]*"|[\t ]+\'[^\']*\')*)' // [3] = values
|
749 |
-
. '[\t ]*\](\]?)/';
|
750 |
-
|
751 |
-
if ( $html )
|
752 |
-
$callback = array( $this, 'mail_callback_html' );
|
753 |
-
else
|
754 |
-
$callback = array( $this, 'mail_callback' );
|
755 |
-
|
756 |
-
return preg_replace_callback( $regex, $callback, $content );
|
757 |
-
}
|
758 |
-
|
759 |
-
private function mail_callback_html( $matches ) {
|
760 |
-
return $this->mail_callback( $matches, true );
|
761 |
-
}
|
762 |
-
|
763 |
-
private function mail_callback( $matches, $html = false ) {
|
764 |
-
// allow [[foo]] syntax for escaping a tag
|
765 |
-
if ( $matches[1] == '[' && $matches[4] == ']' )
|
766 |
-
return substr( $matches[0], 1, -1 );
|
767 |
-
|
768 |
-
$tag = $matches[0];
|
769 |
-
$tagname = $matches[2];
|
770 |
-
$values = $matches[3];
|
771 |
-
|
772 |
-
if ( ! empty( $values ) ) {
|
773 |
-
preg_match_all( '/"[^"]*"|\'[^\']*\'/', $values, $matches );
|
774 |
-
$values = wpcf7_strip_quote_deep( $matches[0] );
|
775 |
-
}
|
776 |
-
|
777 |
-
$do_not_heat = false;
|
778 |
-
|
779 |
-
if ( preg_match( '/^_raw_(.+)$/', $tagname, $matches ) ) {
|
780 |
-
$tagname = trim( $matches[1] );
|
781 |
-
$do_not_heat = true;
|
782 |
-
}
|
783 |
-
|
784 |
-
$format = '';
|
785 |
-
|
786 |
-
if ( preg_match( '/^_format_(.+)$/', $tagname, $matches ) ) {
|
787 |
-
$tagname = trim( $matches[1] );
|
788 |
-
$format = $values[0];
|
789 |
-
}
|
790 |
-
|
791 |
-
if ( isset( $this->posted_data[$tagname] ) ) {
|
792 |
-
|
793 |
-
if ( $do_not_heat )
|
794 |
-
$submitted = isset( $_POST[$tagname] ) ? $_POST[$tagname] : '';
|
795 |
-
else
|
796 |
-
$submitted = $this->posted_data[$tagname];
|
797 |
-
|
798 |
-
$replaced = $submitted;
|
799 |
-
|
800 |
-
if ( ! empty( $format ) ) {
|
801 |
-
$replaced = $this->format( $replaced, $format );
|
802 |
-
}
|
803 |
-
|
804 |
-
$replaced = wpcf7_flat_join( $replaced );
|
805 |
-
|
806 |
-
if ( $html ) {
|
807 |
-
$replaced = esc_html( $replaced );
|
808 |
-
$replaced = wptexturize( $replaced );
|
809 |
-
}
|
810 |
-
|
811 |
-
$replaced = apply_filters( 'wpcf7_mail_tag_replaced', $replaced,
|
812 |
-
$submitted, $html );
|
813 |
-
|
814 |
-
return wp_unslash( $replaced );
|
815 |
-
}
|
816 |
-
|
817 |
-
$special = apply_filters( 'wpcf7_special_mail_tags', '', $tagname, $html );
|
818 |
-
|
819 |
-
if ( ! empty( $special ) )
|
820 |
-
return $special;
|
821 |
-
|
822 |
-
return $tag;
|
823 |
-
}
|
824 |
-
|
825 |
-
public function format( $original, $format ) {
|
826 |
-
$original = (array) $original;
|
827 |
-
|
828 |
-
foreach ( $original as $key => $value ) {
|
829 |
-
if ( preg_match( '/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $value ) ) {
|
830 |
-
$original[$key] = mysql2date( $format, $value );
|
831 |
-
}
|
832 |
-
}
|
833 |
-
|
834 |
-
return $original;
|
835 |
-
}
|
836 |
-
|
837 |
-
public function mail_attachments( $template ) {
|
838 |
-
$attachments = array();
|
839 |
-
|
840 |
-
foreach ( (array) $this->uploaded_files as $name => $path ) {
|
841 |
-
if ( false !== strpos( $template, "[${name}]" ) && ! empty( $path ) )
|
842 |
-
$attachments[] = $path;
|
843 |
-
}
|
844 |
-
|
845 |
-
foreach ( explode( "\n", $template ) as $line ) {
|
846 |
-
$line = trim( $line );
|
847 |
-
|
848 |
-
if ( '[' == substr( $line, 0, 1 ) )
|
849 |
-
continue;
|
850 |
-
|
851 |
-
$path = path_join( WP_CONTENT_DIR, $line );
|
852 |
-
|
853 |
-
if ( @is_readable( $path ) && @is_file( $path ) )
|
854 |
-
$attachments[] = $path;
|
855 |
-
}
|
856 |
-
|
857 |
-
return $attachments;
|
858 |
-
}
|
859 |
-
|
860 |
-
/* Message */
|
861 |
-
|
862 |
-
public function message( $status ) {
|
863 |
-
$messages = $this->messages;
|
864 |
-
$message = isset( $messages[$status] ) ? $messages[$status] : '';
|
865 |
-
|
866 |
-
$message = $this->replace_mail_tags( $message, true );
|
867 |
-
|
868 |
-
return apply_filters( 'wpcf7_display_message', $message, $status );
|
869 |
-
}
|
870 |
-
|
871 |
-
/* Additional settings */
|
872 |
-
|
873 |
-
public function additional_setting( $name, $max = 1 ) {
|
874 |
-
$tmp_settings = (array) explode( "\n", $this->additional_settings );
|
875 |
-
|
876 |
-
$count = 0;
|
877 |
-
$values = array();
|
878 |
-
|
879 |
-
foreach ( $tmp_settings as $setting ) {
|
880 |
-
if ( preg_match('/^([a-zA-Z0-9_]+)[\t ]*:(.*)$/', $setting, $matches ) ) {
|
881 |
-
if ( $matches[1] != $name )
|
882 |
-
continue;
|
883 |
-
|
884 |
-
if ( ! $max || $count < (int) $max ) {
|
885 |
-
$values[] = trim( $matches[2] );
|
886 |
-
$count += 1;
|
887 |
-
}
|
888 |
-
}
|
889 |
-
}
|
890 |
-
|
891 |
-
return $values;
|
892 |
-
}
|
893 |
-
|
894 |
-
public function is_true( $name ) {
|
895 |
-
$settings = $this->additional_setting( $name, false );
|
896 |
-
|
897 |
-
foreach ( $settings as $setting ) {
|
898 |
-
if ( in_array( $setting, array( 'on', 'true', '1' ) ) )
|
899 |
-
return true;
|
900 |
-
}
|
901 |
-
|
902 |
-
return false;
|
903 |
-
}
|
904 |
-
|
905 |
-
public function in_demo_mode() {
|
906 |
-
return $this->is_true( 'demo_mode' );
|
907 |
-
}
|
908 |
-
|
909 |
-
/* Upgrade */
|
910 |
-
|
911 |
-
public function upgrade() {
|
912 |
-
if ( is_array( $this->mail ) ) {
|
913 |
-
if ( ! isset( $this->mail['recipient'] ) )
|
914 |
-
$this->mail['recipient'] = get_option( 'admin_email' );
|
915 |
-
}
|
916 |
-
|
917 |
-
if ( is_array( $this->messages ) ) {
|
918 |
-
foreach ( wpcf7_messages() as $key => $arr ) {
|
919 |
-
if ( ! isset( $this->messages[$key] ) )
|
920 |
-
$this->messages[$key] = $arr['default'];
|
921 |
-
}
|
922 |
-
}
|
923 |
-
}
|
924 |
-
|
925 |
-
/* Save */
|
926 |
-
|
927 |
-
public function save() {
|
928 |
-
$props = $this->get_properties();
|
929 |
-
|
930 |
-
$post_content = implode( "\n", wpcf7_array_flatten( $props ) );
|
931 |
-
|
932 |
-
if ( $this->initial ) {
|
933 |
-
$post_id = wp_insert_post( array(
|
934 |
-
'post_type' => self::post_type,
|
935 |
-
'post_status' => 'publish',
|
936 |
-
'post_title' => $this->title,
|
937 |
-
'post_content' => trim( $post_content ) ) );
|
938 |
-
} else {
|
939 |
-
$post_id = wp_update_post( array(
|
940 |
-
'ID' => (int) $this->id,
|
941 |
-
'post_status' => 'publish',
|
942 |
-
'post_title' => $this->title,
|
943 |
-
'post_content' => trim( $post_content ) ) );
|
944 |
-
}
|
945 |
-
|
946 |
-
if ( $post_id ) {
|
947 |
-
foreach ( $props as $prop => $value )
|
948 |
-
update_post_meta( $post_id, '_' . $prop, wpcf7_normalize_newline_deep( $value ) );
|
949 |
-
|
950 |
-
if ( ! empty( $this->locale ) )
|
951 |
-
update_post_meta( $post_id, '_locale', $this->locale );
|
952 |
-
|
953 |
-
if ( $this->initial ) {
|
954 |
-
$this->initial = false;
|
955 |
-
$this->id = $post_id;
|
956 |
-
do_action_ref_array( 'wpcf7_after_create', array( &$this ) );
|
957 |
-
} else {
|
958 |
-
do_action_ref_array( 'wpcf7_after_update', array( &$this ) );
|
959 |
-
}
|
960 |
-
|
961 |
-
do_action_ref_array( 'wpcf7_after_save', array( &$this ) );
|
962 |
-
}
|
963 |
-
|
964 |
-
return $post_id;
|
965 |
-
}
|
966 |
-
|
967 |
-
public function copy() {
|
968 |
-
$new = new self;
|
969 |
-
$new->initial = true;
|
970 |
-
$new->title = $this->title . '_copy';
|
971 |
-
$new->locale = $this->locale;
|
972 |
-
|
973 |
-
$props = $this->get_properties();
|
974 |
-
|
975 |
-
foreach ( $props as $prop => $value )
|
976 |
-
$new->{$prop} = $value;
|
977 |
-
|
978 |
-
$new = apply_filters_ref_array( 'wpcf7_copy', array( &$new, &$this ) );
|
979 |
-
|
980 |
-
return $new;
|
981 |
-
}
|
982 |
-
|
983 |
-
public function delete() {
|
984 |
-
if ( $this->initial )
|
985 |
-
return;
|
986 |
-
|
987 |
-
if ( wp_delete_post( $this->id, true ) ) {
|
988 |
-
$this->initial = true;
|
989 |
-
$this->id = null;
|
990 |
-
return true;
|
991 |
-
}
|
992 |
-
|
993 |
-
return false;
|
994 |
-
}
|
995 |
-
}
|
996 |
-
|
997 |
-
function wpcf7_contact_form( $id ) {
|
998 |
-
$contact_form = new WPCF7_ContactForm( $id );
|
999 |
-
|
1000 |
-
if ( $contact_form->initial )
|
1001 |
-
return false;
|
1002 |
-
|
1003 |
-
return $contact_form;
|
1004 |
-
}
|
1005 |
-
|
1006 |
-
function wpcf7_get_contact_form_by_old_id( $old_id ) {
|
1007 |
-
global $wpdb;
|
1008 |
-
|
1009 |
-
$q = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_old_cf7_unit_id'"
|
1010 |
-
. $wpdb->prepare( " AND meta_value = %d", $old_id );
|
1011 |
-
|
1012 |
-
if ( $new_id = $wpdb->get_var( $q ) )
|
1013 |
-
return wpcf7_contact_form( $new_id );
|
1014 |
-
}
|
1015 |
-
|
1016 |
-
function wpcf7_get_contact_form_by_title( $title ) {
|
1017 |
-
$page = get_page_by_title( $title, OBJECT, WPCF7_ContactForm::post_type );
|
1018 |
-
|
1019 |
-
if ( $page )
|
1020 |
-
return wpcf7_contact_form( $page->ID );
|
1021 |
-
|
1022 |
-
return null;
|
1023 |
-
}
|
1024 |
-
|
1025 |
-
function wpcf7_get_contact_form_default_pack( $args = '' ) {
|
1026 |
-
$contact_form = WPCF7_ContactForm::generate_default_package( $args );
|
1027 |
-
|
1028 |
-
return $contact_form;
|
1029 |
-
}
|
1030 |
-
|
1031 |
-
function wpcf7_get_current_contact_form() {
|
1032 |
-
if ( $current = WPCF7_ContactForm::get_current() ) {
|
1033 |
-
return $current;
|
1034 |
-
}
|
1035 |
-
}
|
1036 |
-
|
1037 |
-
function wpcf7_is_posted() {
|
1038 |
-
if ( ! $contact_form = wpcf7_get_current_contact_form() )
|
1039 |
-
return false;
|
1040 |
-
|
1041 |
-
return $contact_form->is_posted();
|
1042 |
-
}
|
1043 |
-
|
1044 |
-
function wpcf7_get_validation_error( $name ) {
|
1045 |
-
if ( ! $contact_form = wpcf7_get_current_contact_form() )
|
1046 |
-
return '';
|
1047 |
-
|
1048 |
-
return $contact_form->validation_error( $name );
|
1049 |
-
}
|
1050 |
-
|
1051 |
-
function wpcf7_get_message( $status ) {
|
1052 |
-
if ( ! $contact_form = wpcf7_get_current_contact_form() )
|
1053 |
-
return '';
|
1054 |
-
|
1055 |
-
return $contact_form->message( $status );
|
1056 |
-
}
|
1057 |
-
|
1058 |
-
function wpcf7_scan_shortcode( $cond = null ) {
|
1059 |
-
if ( ! $contact_form = wpcf7_get_current_contact_form() )
|
1060 |
-
return null;
|
1061 |
-
|
1062 |
-
return $contact_form->form_scan_shortcode( $cond );
|
1063 |
-
}
|
1064 |
-
|
1065 |
-
function wpcf7_form_controls_class( $type, $default = '' ) {
|
1066 |
-
$type = trim( $type );
|
1067 |
-
$default = array_filter( explode( ' ', $default ) );
|
1068 |
-
|
1069 |
-
$classes = array_merge( array( 'wpcf7-form-control' ), $default );
|
1070 |
-
|
1071 |
-
$typebase = rtrim( $type, '*' );
|
1072 |
-
$required = ( '*' == substr( $type, -1 ) );
|
1073 |
-
|
1074 |
-
$classes[] = 'wpcf7-' . $typebase;
|
1075 |
-
|
1076 |
-
if ( $required )
|
1077 |
-
$classes[] = 'wpcf7-validates-as-required';
|
1078 |
-
|
1079 |
-
$classes = array_unique( $classes );
|
1080 |
-
|
1081 |
-
return implode( ' ', $classes );
|
1082 |
-
}
|
1083 |
-
|
1084 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|