Version Description
Download this release
Release Info
Developer | takayukister |
Plugin | ![]() |
Version | 3.0-beta |
Comparing to | |
See all releases |
Code changes from version 2.4.6 to 3.0-beta
- admin/admin.php +45 -105
- admin/edit.php +47 -239
- admin/includes/meta-boxes.php +109 -0
- admin/scripts.js +25 -68
- admin/styles-rtl.css +0 -4
- admin/styles.css +58 -27
- includes/classes.php +102 -173
- includes/controller.php +117 -78
- includes/functions.php +17 -21
- jquery.form.js +2 -2
- languages/wpcf7-de_DE.mo +0 -0
- languages/wpcf7-it_IT.mo +0 -0
- languages/wpcf7-ja.mo +0 -0
- languages/wpcf7-ka_GE.mo +0 -0
- languages/wpcf7.pot +169 -191
- modules/akismet.php +114 -0
- modules/textarea.php +1 -1
- readme.txt +4 -65
- screenshot-1.png +0 -0
- settings.php +114 -19
- wp-contact-form-7.php +4 -2
admin/admin.php
CHANGED
@@ -4,12 +4,14 @@ function wpcf7_admin_has_edit_cap() {
|
|
4 |
return current_user_can( WPCF7_ADMIN_READ_WRITE_CAPABILITY );
|
5 |
}
|
6 |
|
7 |
-
add_action( '
|
8 |
|
9 |
-
function
|
|
|
|
|
10 |
|
11 |
-
if ( isset( $_POST['wpcf7-save'] )
|
12 |
-
$id = $_POST['
|
13 |
check_admin_referer( 'wpcf7-save_' . $id );
|
14 |
|
15 |
if ( ! $contact_form = wpcf7_contact_form( $id ) ) {
|
@@ -17,7 +19,7 @@ function wpcf7_admin_add_pages() {
|
|
17 |
$contact_form->initial = true;
|
18 |
}
|
19 |
|
20 |
-
$title = trim( $_POST['wpcf7-title'] );
|
21 |
|
22 |
$form = trim( $_POST['wpcf7-form'] );
|
23 |
|
@@ -45,7 +47,8 @@ function wpcf7_admin_add_pages() {
|
|
45 |
isset( $_POST['wpcf7-mail-2-use-html'] ) && 1 == $_POST['wpcf7-mail-2-use-html']
|
46 |
);
|
47 |
|
48 |
-
$messages = $contact_form->messages;
|
|
|
49 |
foreach ( wpcf7_messages() as $key => $arr ) {
|
50 |
$field_name = 'wpcf7-message-' . strtr( $key, '_', '-' );
|
51 |
if ( isset( $_POST[$field_name] ) )
|
@@ -54,24 +57,25 @@ function wpcf7_admin_add_pages() {
|
|
54 |
|
55 |
$additional_settings = trim( $_POST['wpcf7-additional-settings'] );
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
$query = array();
|
58 |
$query['message'] = ( $contact_form->initial ) ? 'created' : 'saved';
|
59 |
|
60 |
-
$contact_form->title = $title;
|
61 |
-
$contact_form->form = $form;
|
62 |
-
$contact_form->mail = $mail;
|
63 |
-
$contact_form->mail_2 = $mail_2;
|
64 |
-
$contact_form->messages = $messages;
|
65 |
-
$contact_form->additional_settings = $additional_settings;
|
66 |
-
|
67 |
$contact_form->save();
|
68 |
|
69 |
$query['contactform'] = $contact_form->id;
|
70 |
$redirect_to = wpcf7_admin_url( $query );
|
71 |
wp_redirect( $redirect_to );
|
72 |
exit();
|
73 |
-
}
|
74 |
-
|
|
|
|
|
75 |
check_admin_referer( 'wpcf7-copy_' . $id );
|
76 |
|
77 |
$query = array();
|
@@ -89,8 +93,10 @@ function wpcf7_admin_add_pages() {
|
|
89 |
$redirect_to = wpcf7_admin_url( $query );
|
90 |
wp_redirect( $redirect_to );
|
91 |
exit();
|
92 |
-
}
|
93 |
-
|
|
|
|
|
94 |
check_admin_referer( 'wpcf7-delete_' . $id );
|
95 |
|
96 |
if ( $contact_form = wpcf7_contact_form( $id ) )
|
@@ -99,24 +105,12 @@ function wpcf7_admin_add_pages() {
|
|
99 |
$redirect_to = wpcf7_admin_url( array( 'message' => 'deleted' ) );
|
100 |
wp_redirect( $redirect_to );
|
101 |
exit();
|
102 |
-
} elseif ( isset( $_GET['wpcf7-create-table'] ) ) {
|
103 |
-
check_admin_referer( 'wpcf7-create-table' );
|
104 |
-
|
105 |
-
$query = array();
|
106 |
-
|
107 |
-
if ( ! wpcf7_table_exists() && current_user_can( 'activate_plugins' ) ) {
|
108 |
-
wpcf7_install();
|
109 |
-
if ( wpcf7_table_exists() ) {
|
110 |
-
$query['message'] = 'table_created';
|
111 |
-
} else {
|
112 |
-
$query['message'] = 'table_not_created';
|
113 |
-
}
|
114 |
-
}
|
115 |
-
|
116 |
-
wp_redirect( wpcf7_admin_url( $query ) );
|
117 |
-
exit();
|
118 |
}
|
|
|
119 |
|
|
|
|
|
|
|
120 |
add_menu_page( __( 'Contact Form 7', 'wpcf7' ), __( 'Contact', 'wpcf7' ),
|
121 |
WPCF7_ADMIN_READ_CAPABILITY, 'wpcf7', 'wpcf7_admin_management_page' );
|
122 |
|
@@ -152,6 +146,7 @@ function wpcf7_admin_enqueue_scripts() {
|
|
152 |
return;
|
153 |
|
154 |
wp_enqueue_script( 'thickbox' );
|
|
|
155 |
|
156 |
wp_enqueue_script( 'wpcf7-admin-taggenerator', wpcf7_plugin_url( 'admin/taggenerator.js' ),
|
157 |
array( 'jquery' ), WPCF7_VERSION, true );
|
@@ -159,9 +154,7 @@ function wpcf7_admin_enqueue_scripts() {
|
|
159 |
wp_enqueue_script( 'wpcf7-admin', wpcf7_plugin_url( 'admin/scripts.js' ),
|
160 |
array( 'jquery', 'wpcf7-admin-taggenerator' ), WPCF7_VERSION, true );
|
161 |
wp_localize_script( 'wpcf7-admin', '_wpcf7L10n', array(
|
162 |
-
'generateTag' => __( 'Generate Tag', 'wpcf7' )
|
163 |
-
'show' => __( "Show", 'wpcf7' ),
|
164 |
-
'hide' => __( "Hide", 'wpcf7' ) ) );
|
165 |
}
|
166 |
|
167 |
add_action( 'admin_footer', 'wpcf7_admin_footer' );
|
@@ -187,83 +180,36 @@ var _wpcf7 = {
|
|
187 |
}
|
188 |
|
189 |
function wpcf7_admin_management_page() {
|
190 |
-
$contact_forms =
|
|
|
|
|
|
|
|
|
191 |
|
|
|
192 |
$unsaved = false;
|
193 |
|
194 |
if ( ! isset( $_GET['contactform'] ) )
|
195 |
$_GET['contactform'] = '';
|
196 |
|
197 |
-
if ( 'new' == $_GET['contactform'] ) {
|
198 |
$unsaved = true;
|
199 |
$current = -1;
|
200 |
-
$cf =
|
|
|
201 |
} elseif ( $cf = wpcf7_contact_form( $_GET['contactform'] ) ) {
|
202 |
$current = (int) $_GET['contactform'];
|
203 |
} else {
|
204 |
$first = reset( $contact_forms ); // Returns first item
|
205 |
-
$current = $first->id;
|
206 |
-
$cf = wpcf7_contact_form( $current );
|
207 |
-
}
|
208 |
-
|
209 |
-
require_once WPCF7_PLUGIN_DIR . '/admin/edit.php';
|
210 |
-
}
|
211 |
-
|
212 |
-
/* Install and default settings */
|
213 |
-
|
214 |
-
add_action( 'activate_' . WPCF7_PLUGIN_BASENAME, 'wpcf7_install' );
|
215 |
-
|
216 |
-
function wpcf7_install() {
|
217 |
-
global $wpdb, $wpcf7;
|
218 |
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
$charset_collate = '';
|
223 |
-
if ( $wpdb->has_cap( 'collation' ) ) {
|
224 |
-
if ( ! empty( $wpdb->charset ) )
|
225 |
-
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
226 |
-
if ( ! empty( $wpdb->collate ) )
|
227 |
-
$charset_collate .= " COLLATE $wpdb->collate";
|
228 |
-
}
|
229 |
-
|
230 |
-
$wpdb->query( "CREATE TABLE IF NOT EXISTS $wpcf7->contactforms (
|
231 |
-
cf7_unit_id bigint(20) unsigned NOT NULL auto_increment,
|
232 |
-
title varchar(200) NOT NULL default '',
|
233 |
-
form text NOT NULL,
|
234 |
-
mail text NOT NULL,
|
235 |
-
mail_2 text NOT NULL,
|
236 |
-
messages text NOT NULL,
|
237 |
-
additional_settings text NOT NULL,
|
238 |
-
PRIMARY KEY (cf7_unit_id)) $charset_collate;" );
|
239 |
-
|
240 |
-
if ( ! wpcf7_table_exists() )
|
241 |
-
return false; // Failed to create
|
242 |
-
|
243 |
-
$legacy_data = get_option( 'wpcf7' );
|
244 |
-
if ( is_array( $legacy_data )
|
245 |
-
&& is_array( $legacy_data['contact_forms'] ) && $legacy_data['contact_forms'] ) {
|
246 |
-
foreach ( $legacy_data['contact_forms'] as $key => $value ) {
|
247 |
-
$wpdb->insert( $wpcf7->contactforms, array(
|
248 |
-
'cf7_unit_id' => $key,
|
249 |
-
'title' => $value['title'],
|
250 |
-
'form' => maybe_serialize( $value['form'] ),
|
251 |
-
'mail' => maybe_serialize( $value['mail'] ),
|
252 |
-
'mail_2' => maybe_serialize( $value['mail_2'] ),
|
253 |
-
'messages' => maybe_serialize( $value['messages'] ),
|
254 |
-
'additional_settings' => maybe_serialize( $value['additional_settings'] )
|
255 |
-
), array( '%d', '%s', '%s', '%s', '%s', '%s', '%s' ) );
|
256 |
}
|
257 |
-
} else {
|
258 |
-
wpcf7_load_plugin_textdomain();
|
259 |
-
|
260 |
-
$wpdb->insert( $wpcf7->contactforms, array(
|
261 |
-
'title' => __( 'Contact form', 'wpcf7' ) . ' 1',
|
262 |
-
'form' => maybe_serialize( wpcf7_default_form_template() ),
|
263 |
-
'mail' => maybe_serialize( wpcf7_default_mail_template() ),
|
264 |
-
'mail_2' => maybe_serialize ( wpcf7_default_mail_2_template() ),
|
265 |
-
'messages' => maybe_serialize( wpcf7_default_messages_template() ) ) );
|
266 |
}
|
|
|
|
|
|
|
267 |
}
|
268 |
|
269 |
/* Misc */
|
@@ -317,19 +263,13 @@ function wpcf7_updated_message( &$contact_form ) {
|
|
317 |
case 'deleted':
|
318 |
$updated_message = __( "Contact form deleted.", 'wpcf7' );
|
319 |
break;
|
320 |
-
case 'table_created':
|
321 |
-
$updated_message = __( "Database table created.", 'wpcf7' );
|
322 |
-
break;
|
323 |
-
case 'table_not_created':
|
324 |
-
$updated_message = __( "Failed to create database table.", 'wpcf7' );
|
325 |
-
break;
|
326 |
}
|
327 |
|
328 |
if ( ! $updated_message )
|
329 |
return;
|
330 |
|
331 |
?>
|
332 |
-
<div id="message" class="updated
|
333 |
<?php
|
334 |
}
|
335 |
|
4 |
return current_user_can( WPCF7_ADMIN_READ_WRITE_CAPABILITY );
|
5 |
}
|
6 |
|
7 |
+
add_action( 'admin_init', 'wpcf7_admin_init' );
|
8 |
|
9 |
+
function wpcf7_admin_init() {
|
10 |
+
if ( ! wpcf7_admin_has_edit_cap() )
|
11 |
+
return;
|
12 |
|
13 |
+
if ( isset( $_POST['wpcf7-save'] ) ) {
|
14 |
+
$id = $_POST['post_ID'];
|
15 |
check_admin_referer( 'wpcf7-save_' . $id );
|
16 |
|
17 |
if ( ! $contact_form = wpcf7_contact_form( $id ) ) {
|
19 |
$contact_form->initial = true;
|
20 |
}
|
21 |
|
22 |
+
$contact_form->title = trim( $_POST['wpcf7-title'] );
|
23 |
|
24 |
$form = trim( $_POST['wpcf7-form'] );
|
25 |
|
47 |
isset( $_POST['wpcf7-mail-2-use-html'] ) && 1 == $_POST['wpcf7-mail-2-use-html']
|
48 |
);
|
49 |
|
50 |
+
$messages = isset( $contact_form->messages ) ? $contact_form->messages : array();
|
51 |
+
|
52 |
foreach ( wpcf7_messages() as $key => $arr ) {
|
53 |
$field_name = 'wpcf7-message-' . strtr( $key, '_', '-' );
|
54 |
if ( isset( $_POST[$field_name] ) )
|
57 |
|
58 |
$additional_settings = trim( $_POST['wpcf7-additional-settings'] );
|
59 |
|
60 |
+
$props = apply_filters( 'wpcf7_contact_form_admin_posted_properties',
|
61 |
+
compact( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ) );
|
62 |
+
|
63 |
+
foreach ( (array) $props as $key => $prop )
|
64 |
+
$contact_form->{$key} = $prop;
|
65 |
+
|
66 |
$query = array();
|
67 |
$query['message'] = ( $contact_form->initial ) ? 'created' : 'saved';
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
$contact_form->save();
|
70 |
|
71 |
$query['contactform'] = $contact_form->id;
|
72 |
$redirect_to = wpcf7_admin_url( $query );
|
73 |
wp_redirect( $redirect_to );
|
74 |
exit();
|
75 |
+
}
|
76 |
+
|
77 |
+
if ( isset( $_POST['wpcf7-copy'] ) ) {
|
78 |
+
$id = $_POST['post_ID'];
|
79 |
check_admin_referer( 'wpcf7-copy_' . $id );
|
80 |
|
81 |
$query = array();
|
93 |
$redirect_to = wpcf7_admin_url( $query );
|
94 |
wp_redirect( $redirect_to );
|
95 |
exit();
|
96 |
+
}
|
97 |
+
|
98 |
+
if ( isset( $_POST['wpcf7-delete'] ) ) {
|
99 |
+
$id = $_POST['post_ID'];
|
100 |
check_admin_referer( 'wpcf7-delete_' . $id );
|
101 |
|
102 |
if ( $contact_form = wpcf7_contact_form( $id ) )
|
105 |
$redirect_to = wpcf7_admin_url( array( 'message' => 'deleted' ) );
|
106 |
wp_redirect( $redirect_to );
|
107 |
exit();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
+
}
|
110 |
|
111 |
+
add_action( 'admin_menu', 'wpcf7_admin_menu', 9 );
|
112 |
+
|
113 |
+
function wpcf7_admin_menu() {
|
114 |
add_menu_page( __( 'Contact Form 7', 'wpcf7' ), __( 'Contact', 'wpcf7' ),
|
115 |
WPCF7_ADMIN_READ_CAPABILITY, 'wpcf7', 'wpcf7_admin_management_page' );
|
116 |
|
146 |
return;
|
147 |
|
148 |
wp_enqueue_script( 'thickbox' );
|
149 |
+
wp_enqueue_script( 'postbox' );
|
150 |
|
151 |
wp_enqueue_script( 'wpcf7-admin-taggenerator', wpcf7_plugin_url( 'admin/taggenerator.js' ),
|
152 |
array( 'jquery' ), WPCF7_VERSION, true );
|
154 |
wp_enqueue_script( 'wpcf7-admin', wpcf7_plugin_url( 'admin/scripts.js' ),
|
155 |
array( 'jquery', 'wpcf7-admin-taggenerator' ), WPCF7_VERSION, true );
|
156 |
wp_localize_script( 'wpcf7-admin', '_wpcf7L10n', array(
|
157 |
+
'generateTag' => __( 'Generate Tag', 'wpcf7' ) ) );
|
|
|
|
|
158 |
}
|
159 |
|
160 |
add_action( 'admin_footer', 'wpcf7_admin_footer' );
|
180 |
}
|
181 |
|
182 |
function wpcf7_admin_management_page() {
|
183 |
+
$contact_forms = get_posts( array(
|
184 |
+
'numberposts' => -1,
|
185 |
+
'orderby' => 'ID',
|
186 |
+
'order' => 'ASC',
|
187 |
+
'post_type' => 'wpcf7_contact_form' ) );
|
188 |
|
189 |
+
$cf = null;
|
190 |
$unsaved = false;
|
191 |
|
192 |
if ( ! isset( $_GET['contactform'] ) )
|
193 |
$_GET['contactform'] = '';
|
194 |
|
195 |
+
if ( 'new' == $_GET['contactform'] && wpcf7_admin_has_edit_cap() ) {
|
196 |
$unsaved = true;
|
197 |
$current = -1;
|
198 |
+
$cf = wpcf7_get_contact_form_default_pack(
|
199 |
+
array( 'locale' => ( isset( $_GET['locale'] ) ? $_GET['locale'] : '' ) ) );
|
200 |
} elseif ( $cf = wpcf7_contact_form( $_GET['contactform'] ) ) {
|
201 |
$current = (int) $_GET['contactform'];
|
202 |
} else {
|
203 |
$first = reset( $contact_forms ); // Returns first item
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
|
205 |
+
if ( $first ) {
|
206 |
+
$current = $first->ID;
|
207 |
+
$cf = wpcf7_contact_form( $current );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
}
|
210 |
+
|
211 |
+
require_once WPCF7_PLUGIN_DIR . '/admin/includes/meta-boxes.php';
|
212 |
+
require_once WPCF7_PLUGIN_DIR . '/admin/edit.php';
|
213 |
}
|
214 |
|
215 |
/* Misc */
|
263 |
case 'deleted':
|
264 |
$updated_message = __( "Contact form deleted.", 'wpcf7' );
|
265 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
}
|
267 |
|
268 |
if ( ! $updated_message )
|
269 |
return;
|
270 |
|
271 |
?>
|
272 |
+
<div id="message" class="updated"><p><?php echo esc_html( $updated_message ); ?></p></div>
|
273 |
<?php
|
274 |
}
|
275 |
|
admin/edit.php
CHANGED
@@ -1,29 +1,4 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
/* No table warning */
|
4 |
-
if ( ! wpcf7_table_exists() ) {
|
5 |
-
if ( current_user_can( 'activate_plugins' ) ) {
|
6 |
-
$create_table_link_url = wpcf7_admin_url( array( 'wpcf7-create-table' => 1 ) );
|
7 |
-
$create_table_link_url = wp_nonce_url( $create_table_link_url, 'wpcf7-create-table' );
|
8 |
-
$message = sprintf(
|
9 |
-
__( '<strong>The database table for Contact Form 7 does not exist.</strong> You must <a href="%s">create the table</a> for it to work.', 'wpcf7' ),
|
10 |
-
$create_table_link_url );
|
11 |
-
} else {
|
12 |
-
$message = __( "<strong>The database table for Contact Form 7 does not exist.</strong>", 'wpcf7' );
|
13 |
-
}
|
14 |
-
?>
|
15 |
-
<div class="wrap">
|
16 |
-
<?php screen_icon( 'edit-pages' ); ?>
|
17 |
-
<h2><?php echo esc_html( __( 'Contact Form 7', 'wpcf7' ) ); ?></h2>
|
18 |
-
<div id="message" class="updated fade">
|
19 |
-
<p><?php echo $message; ?></p>
|
20 |
-
</div>
|
21 |
-
</div>
|
22 |
-
<?php
|
23 |
-
return;
|
24 |
-
}
|
25 |
-
|
26 |
-
?><div class="wrap wpcf7">
|
27 |
|
28 |
<?php screen_icon( 'edit-pages' ); ?>
|
29 |
|
@@ -35,14 +10,14 @@ if ( ! wpcf7_table_exists() ) {
|
|
35 |
<?php
|
36 |
$first = array_shift( $contact_forms );
|
37 |
if ( ! is_null( $first ) ) : ?>
|
38 |
-
<li><a href="<?php echo wpcf7_admin_url( array( 'contactform' => $first->
|
39 |
<?php endif;
|
40 |
foreach ( $contact_forms as $v ) : ?>
|
41 |
-
<li>| <a href="<?php echo wpcf7_admin_url( array( 'contactform' => $v->
|
42 |
<?php endforeach; ?>
|
43 |
|
44 |
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
|
45 |
-
<li class="addnew"><a class="thickbox<?php if ( $unsaved ) echo ' current'; ?>" href="#TB_inline?height=300&width=400&inlineId=wpcf7-lang-select-modal"><?php echo esc_html( __( 'Add
|
46 |
<?php endif; ?>
|
47 |
</ul>
|
48 |
|
@@ -51,15 +26,14 @@ foreach ( $contact_forms as $v ) : ?>
|
|
51 |
<?php if ( $cf ) : ?>
|
52 |
<?php $disabled = ( wpcf7_admin_has_edit_cap() ) ? '' : ' disabled="disabled"'; ?>
|
53 |
|
54 |
-
<form method="post" action="<?php echo wpcf7_admin_url( array( 'contactform' => $current ) ); ?>" id="wpcf7-admin-form-element"
|
55 |
<?php if ( wpcf7_admin_has_edit_cap() ) wp_nonce_field( 'wpcf7-save_' . $current ); ?>
|
56 |
-
<input type="hidden" id="
|
|
|
|
|
|
|
57 |
|
58 |
-
<
|
59 |
-
<tbody>
|
60 |
-
<tr>
|
61 |
-
<td scope="col">
|
62 |
-
<div style="position: relative;">
|
63 |
<input type="text" id="wpcf7-title" name="wpcf7-title" size="40" value="<?php echo esc_attr( $cf->title ); ?>"<?php echo $disabled; ?> />
|
64 |
|
65 |
<?php if ( ! $unsaved ) : ?>
|
@@ -68,11 +42,17 @@ foreach ( $contact_forms as $v ) : ?>
|
|
68 |
|
69 |
<input type="text" id="contact-form-anchor-text" onfocus="this.select();" readonly="readonly" />
|
70 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
<?php endif; ?>
|
72 |
|
73 |
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
|
74 |
<div class="save-contact-form">
|
75 |
-
<input type="submit" class="button
|
76 |
</div>
|
77 |
<?php endif; ?>
|
78 |
|
@@ -91,230 +71,58 @@ foreach ( $contact_forms as $v ) : ?>
|
|
91 |
</div>
|
92 |
<?php endif; ?>
|
93 |
</div>
|
94 |
-
</td>
|
95 |
-
</tr>
|
96 |
-
</tbody>
|
97 |
-
</table>
|
98 |
-
|
99 |
-
<?php do_action_ref_array( 'wpcf7_admin_after_general_settings', array( &$cf ) ); ?>
|
100 |
-
|
101 |
-
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
|
102 |
-
|
103 |
-
<table class="widefat" style="margin-top: 1em;">
|
104 |
-
<thead><tr><th scope="col" colspan="2"><?php echo esc_html( __( 'Form', 'wpcf7' ) ); ?></th></tr></thead>
|
105 |
-
|
106 |
-
<tbody>
|
107 |
-
<tr>
|
108 |
-
|
109 |
-
<td scope="col" style="width: 50%;">
|
110 |
-
<div><textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="20"><?php echo esc_html( $cf->form ); ?></textarea></div>
|
111 |
-
</td>
|
112 |
-
|
113 |
-
<td scope="col" style="width: 50%;">
|
114 |
-
<div id="taggenerator"></div>
|
115 |
-
</td>
|
116 |
-
|
117 |
-
</tr>
|
118 |
-
</tbody>
|
119 |
-
</table>
|
120 |
-
|
121 |
-
<?php endif; ?>
|
122 |
-
|
123 |
-
<?php do_action_ref_array( 'wpcf7_admin_after_form', array( &$cf ) ); ?>
|
124 |
-
|
125 |
-
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
|
126 |
-
|
127 |
-
<table class="widefat" style="margin-top: 1em;">
|
128 |
-
<thead><tr><th scope="col" colspan="2"><?php echo esc_html( __( 'Mail', 'wpcf7' ) ); ?></th></tr></thead>
|
129 |
-
|
130 |
-
<tbody>
|
131 |
-
<tr>
|
132 |
-
<td scope="col" style="width: 50%;">
|
133 |
-
|
134 |
-
<div class="mail-field">
|
135 |
-
<label for="wpcf7-mail-recipient"><?php echo esc_html( __( 'To:', 'wpcf7' ) ); ?></label><br />
|
136 |
-
<input type="text" id="wpcf7-mail-recipient" name="wpcf7-mail-recipient" class="wide" size="70" value="<?php echo esc_attr( $cf->mail['recipient'] ); ?>" />
|
137 |
-
</div>
|
138 |
-
|
139 |
-
<div class="mail-field">
|
140 |
-
<label for="wpcf7-mail-sender"><?php echo esc_html( __( 'From:', 'wpcf7' ) ); ?></label><br />
|
141 |
-
<input type="text" id="wpcf7-mail-sender" name="wpcf7-mail-sender" class="wide" size="70" value="<?php echo esc_attr( $cf->mail['sender'] ); ?>" />
|
142 |
-
</div>
|
143 |
-
|
144 |
-
<div class="mail-field">
|
145 |
-
<label for="wpcf7-mail-subject"><?php echo esc_html( __( 'Subject:', 'wpcf7' ) ); ?></label><br />
|
146 |
-
<input type="text" id="wpcf7-mail-subject" name="wpcf7-mail-subject" class="wide" size="70" value="<?php echo esc_attr( $cf->mail['subject'] ); ?>" />
|
147 |
-
</div>
|
148 |
-
|
149 |
-
<div class="pseudo-hr"></div>
|
150 |
-
|
151 |
-
<div class="mail-field">
|
152 |
-
<label for="wpcf7-mail-additional-headers"><?php echo esc_html( __( 'Additional headers:', 'wpcf7' ) ); ?></label><br />
|
153 |
-
<textarea id="wpcf7-mail-additional-headers" name="wpcf7-mail-additional-headers" cols="100" rows="2"><?php echo esc_html( $cf->mail['additional_headers'] ); ?></textarea>
|
154 |
-
</div>
|
155 |
-
|
156 |
-
<div class="mail-field">
|
157 |
-
<label for="wpcf7-mail-attachments"><?php echo esc_html( __( 'File attachments:', 'wpcf7' ) ); ?></label><br />
|
158 |
-
<input type="text" id="wpcf7-mail-attachments" name="wpcf7-mail-attachments" class="wide" size="70" value="<?php echo esc_attr( $cf->mail['attachments'] ); ?>" />
|
159 |
-
</div>
|
160 |
-
|
161 |
-
<div class="pseudo-hr"></div>
|
162 |
-
|
163 |
-
<div class="mail-field">
|
164 |
-
<input type="checkbox" id="wpcf7-mail-use-html" name="wpcf7-mail-use-html" value="1"<?php echo ( $cf->mail['use_html'] ) ? ' checked="checked"' : ''; ?> />
|
165 |
-
<label for="wpcf7-mail-use-html"><?php echo esc_html( __( 'Use HTML content type', 'wpcf7' ) ); ?></label>
|
166 |
-
</div>
|
167 |
-
|
168 |
-
</td>
|
169 |
-
<td scope="col" style="width: 50%;">
|
170 |
|
171 |
-
|
172 |
-
<label for="wpcf7-mail-body"><?php echo esc_html( __( 'Message body:', 'wpcf7' ) ); ?></label><br />
|
173 |
-
<textarea id="wpcf7-mail-body" name="wpcf7-mail-body" cols="100" rows="16"><?php echo esc_html( $cf->mail['body'] ); ?></textarea>
|
174 |
-
</div>
|
175 |
-
|
176 |
-
</td>
|
177 |
-
</tr>
|
178 |
-
</tbody>
|
179 |
-
</table>
|
180 |
-
|
181 |
-
<?php endif; ?>
|
182 |
-
|
183 |
-
<?php do_action_ref_array( 'wpcf7_admin_after_mail', array( &$cf ) ); ?>
|
184 |
-
|
185 |
-
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
|
186 |
|
187 |
-
|
188 |
-
|
|
|
189 |
|
190 |
-
|
191 |
-
|
192 |
-
<td scope="col" colspan="2">
|
193 |
-
<input type="checkbox" id="wpcf7-mail-2-active" name="wpcf7-mail-2-active" value="1"<?php echo ( $cf->mail_2['active'] ) ? ' checked="checked"' : ''; ?> />
|
194 |
-
<label for="wpcf7-mail-2-active"><?php echo esc_html( __( 'Use mail (2)', 'wpcf7' ) ); ?></label>
|
195 |
-
</td>
|
196 |
-
</tr>
|
197 |
|
198 |
-
|
199 |
-
|
|
|
|
|
|
|
|
|
200 |
|
201 |
-
|
202 |
-
|
203 |
-
<input type="text" id="wpcf7-mail-2-recipient" name="wpcf7-mail-2-recipient" class="wide" size="70" value="<?php echo esc_attr( $cf->mail_2['recipient'] ); ?>" />
|
204 |
-
</div>
|
205 |
-
|
206 |
-
<div class="mail-field">
|
207 |
-
<label for="wpcf7-mail-2-sender"><?php echo esc_html( __( 'From:', 'wpcf7' ) ); ?></label><br />
|
208 |
-
<input type="text" id="wpcf7-mail-2-sender" name="wpcf7-mail-2-sender" class="wide" size="70" value="<?php echo esc_attr( $cf->mail_2['sender'] ); ?>" />
|
209 |
-
</div>
|
210 |
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
</div>
|
215 |
|
216 |
-
|
217 |
|
218 |
-
|
219 |
-
<label for="wpcf7-mail-2-additional-headers"><?php echo esc_html( __( 'Additional headers:', 'wpcf7' ) ); ?></label><br />
|
220 |
-
<textarea id="wpcf7-mail-2-additional-headers" name="wpcf7-mail-2-additional-headers" cols="100" rows="2"><?php echo esc_html( $cf->mail_2['additional_headers'] ); ?></textarea>
|
221 |
-
</div>
|
222 |
-
|
223 |
-
<div class="mail-field">
|
224 |
-
<label for="wpcf7-mail-2-attachments"><?php echo esc_html( __( 'File attachments:', 'wpcf7' ) ); ?></label><br />
|
225 |
-
<input type="text" id="wpcf7-mail-2-attachments" name="wpcf7-mail-2-attachments" class="wide" size="70" value="<?php echo esc_attr( $cf->mail_2['attachments'] ); ?>" />
|
226 |
-
</div>
|
227 |
|
228 |
-
|
229 |
|
230 |
-
|
231 |
-
<input type="checkbox" id="wpcf7-mail-2-use-html" name="wpcf7-mail-2-use-html" value="1"<?php echo ( $cf->mail_2['use_html'] ) ? ' checked="checked"' : ''; ?> />
|
232 |
-
<label for="wpcf7-mail-2-use-html"><?php echo esc_html( __( 'Use HTML content type', 'wpcf7' ) ); ?></label>
|
233 |
-
</div>
|
234 |
|
235 |
-
|
236 |
-
<td scope="col" style="width: 50%;">
|
237 |
|
238 |
-
|
239 |
-
<label for="wpcf7-mail-2-body"><?php echo esc_html( __( 'Message body:', 'wpcf7' ) ); ?></label><br />
|
240 |
-
<textarea id="wpcf7-mail-2-body" name="wpcf7-mail-2-body" cols="100" rows="16"><?php echo esc_html( $cf->mail_2['body'] ); ?></textarea>
|
241 |
-
</div>
|
242 |
|
243 |
-
|
244 |
-
</tr>
|
245 |
-
</tbody>
|
246 |
-
</table>
|
247 |
|
248 |
-
|
249 |
|
250 |
-
|
251 |
|
252 |
-
|
253 |
|
254 |
-
|
255 |
-
<thead><tr><th scope="col"><?php echo esc_html( __( 'Messages', 'wpcf7' ) ); ?> <span id="message-fields-toggle-switch"></span></th></tr></thead>
|
256 |
|
257 |
-
|
258 |
-
|
259 |
-
<td scope="col">
|
260 |
-
<div id="message-fields">
|
261 |
|
262 |
-
<?php foreach ( wpcf7_messages() as $key => $arr ) :
|
263 |
-
$field_name = 'wpcf7-message-' . strtr( $key, '_', '-' );
|
264 |
?>
|
265 |
-
<div class="message-field">
|
266 |
-
<label for="<?php echo $field_name; ?>"><em># <?php echo esc_html( $arr['description'] ); ?></em></label><br />
|
267 |
-
<input type="text" id="<?php echo $field_name; ?>" name="<?php echo $field_name; ?>" class="wide" size="70" value="<?php echo esc_attr( $cf->messages[$key] ); ?>" />
|
268 |
</div>
|
269 |
|
270 |
-
<?php endforeach; ?>
|
271 |
-
|
272 |
-
</div>
|
273 |
-
</td>
|
274 |
-
</tr>
|
275 |
-
</tbody>
|
276 |
-
</table>
|
277 |
-
|
278 |
-
<?php endif; ?>
|
279 |
-
|
280 |
-
<?php do_action_ref_array( 'wpcf7_admin_after_messages', array( &$cf ) ); ?>
|
281 |
-
|
282 |
-
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
|
283 |
-
|
284 |
-
<table class="widefat" style="margin-top: 1em;">
|
285 |
-
<thead><tr><th scope="col"><?php echo esc_html( __( 'Additional Settings', 'wpcf7' ) ); ?> <span id="additional-settings-fields-toggle-switch"></span></th></tr></thead>
|
286 |
-
|
287 |
-
<tbody>
|
288 |
-
<tr>
|
289 |
-
<td scope="col">
|
290 |
-
<div id="additional-settings-fields">
|
291 |
-
<textarea id="wpcf7-additional-settings" name="wpcf7-additional-settings" cols="100" rows="8"><?php echo esc_html( $cf->additional_settings ); ?></textarea>
|
292 |
-
</div>
|
293 |
-
</td>
|
294 |
-
</tr>
|
295 |
-
</tbody>
|
296 |
-
</table>
|
297 |
-
|
298 |
-
<?php endif; ?>
|
299 |
-
|
300 |
-
<?php do_action_ref_array( 'wpcf7_admin_after_additional_settings', array( &$cf ) ); ?>
|
301 |
-
|
302 |
-
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
|
303 |
-
|
304 |
-
<table class="widefat" style="margin-top: 1em;">
|
305 |
-
<tbody>
|
306 |
-
<tr>
|
307 |
-
<td scope="col">
|
308 |
-
<div class="save-contact-form">
|
309 |
-
<input type="submit" class="button button-highlighted" name="wpcf7-save" value="<?php echo esc_attr( __( 'Save', 'wpcf7' ) ); ?>" />
|
310 |
-
</div>
|
311 |
-
</td>
|
312 |
-
</tr>
|
313 |
-
</tbody>
|
314 |
-
</table>
|
315 |
-
|
316 |
-
<?php endif; ?>
|
317 |
-
|
318 |
</form>
|
319 |
|
320 |
<?php endif; ?>
|
1 |
+
<div class="wrap">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
<?php screen_icon( 'edit-pages' ); ?>
|
4 |
|
10 |
<?php
|
11 |
$first = array_shift( $contact_forms );
|
12 |
if ( ! is_null( $first ) ) : ?>
|
13 |
+
<li><a href="<?php echo wpcf7_admin_url( array( 'contactform' => $first->ID ) ); ?>"<?php if ( $first->ID == $current ) echo ' class="current"'; ?>><?php echo esc_html( $first->post_title ); ?></a></li>
|
14 |
<?php endif;
|
15 |
foreach ( $contact_forms as $v ) : ?>
|
16 |
+
<li>| <a href="<?php echo wpcf7_admin_url( array( 'contactform' => $v->ID ) ); ?>"<?php if ( $v->ID == $current ) echo ' class="current"'; ?>><?php echo esc_html( $v->post_title ); ?></a></li>
|
17 |
<?php endforeach; ?>
|
18 |
|
19 |
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
|
20 |
+
<li class="addnew"><a class="button thickbox<?php if ( $unsaved ) echo ' current'; ?>" href="#TB_inline?height=300&width=400&inlineId=wpcf7-lang-select-modal"><?php echo esc_html( __( 'Add New', 'wpcf7' ) ); ?></a></li>
|
21 |
<?php endif; ?>
|
22 |
</ul>
|
23 |
|
26 |
<?php if ( $cf ) : ?>
|
27 |
<?php $disabled = ( wpcf7_admin_has_edit_cap() ) ? '' : ' disabled="disabled"'; ?>
|
28 |
|
29 |
+
<form method="post" action="<?php echo wpcf7_admin_url( array( 'contactform' => $current ) ); ?>" id="wpcf7-admin-form-element"<?php do_action( 'wpcf7_post_edit_form_tag' ); ?>>
|
30 |
<?php if ( wpcf7_admin_has_edit_cap() ) wp_nonce_field( 'wpcf7-save_' . $current ); ?>
|
31 |
+
<input type="hidden" id="post_ID" name="post_ID" value="<?php echo (int) $current; ?>" />
|
32 |
+
<input type="hidden" id="wpcf7-id" name="wpcf7-id" value="<?php echo (int) get_post_meta( $cf->id, '_old_cf7_unit_id', true ); ?>" />
|
33 |
+
|
34 |
+
<div id="poststuff" class="metabox-holder">
|
35 |
|
36 |
+
<div id="titlediv">
|
|
|
|
|
|
|
|
|
37 |
<input type="text" id="wpcf7-title" name="wpcf7-title" size="40" value="<?php echo esc_attr( $cf->title ); ?>"<?php echo $disabled; ?> />
|
38 |
|
39 |
<?php if ( ! $unsaved ) : ?>
|
42 |
|
43 |
<input type="text" id="contact-form-anchor-text" onfocus="this.select();" readonly="readonly" />
|
44 |
</p>
|
45 |
+
|
46 |
+
<p class="tagcode" style="display: none;">
|
47 |
+
<?php echo esc_html( __( "Old code is also available.", 'wpcf7' ) ); ?><br />
|
48 |
+
|
49 |
+
<input type="text" id="contact-form-anchor-text-old" onfocus="this.select();" readonly="readonly" />
|
50 |
+
</p>
|
51 |
<?php endif; ?>
|
52 |
|
53 |
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
|
54 |
<div class="save-contact-form">
|
55 |
+
<input type="submit" class="button" name="wpcf7-save" value="<?php echo esc_attr( __( 'Save', 'wpcf7' ) ); ?>" />
|
56 |
</div>
|
57 |
<?php endif; ?>
|
58 |
|
71 |
</div>
|
72 |
<?php endif; ?>
|
73 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
+
if ( wpcf7_admin_has_edit_cap() ) {
|
78 |
+
add_meta_box( 'formdiv', __( 'Form', 'wpcf7' ),
|
79 |
+
'wpcf7_form_meta_box', 'cfseven', 'form', 'core' );
|
80 |
|
81 |
+
add_meta_box( 'maildiv', __( 'Mail', 'wpcf7' ),
|
82 |
+
'wpcf7_mail_meta_box', 'cfseven', 'mail', 'core' );
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
+
add_meta_box( 'mail2div', __( 'Mail (2)', 'wpcf7' ),
|
85 |
+
'wpcf7_mail_meta_box', 'cfseven', 'mail_2', 'core',
|
86 |
+
array(
|
87 |
+
'id' => 'wpcf7-mail-2',
|
88 |
+
'name' => 'mail_2',
|
89 |
+
'use' => __( 'Use mail (2)', 'wpcf7' ) ) );
|
90 |
|
91 |
+
add_meta_box( 'messagesdiv', __( 'Messages', 'wpcf7' ),
|
92 |
+
'wpcf7_messages_meta_box', 'cfseven', 'messages', 'core' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
+
add_meta_box( 'additionalsettingsdiv', __( 'Additional Settings', 'wpcf7' ),
|
95 |
+
'wpcf7_additional_settings_meta_box', 'cfseven', 'additional_settings', 'core' );
|
96 |
+
}
|
|
|
97 |
|
98 |
+
do_action_ref_array( 'wpcf7_admin_after_general_settings', array( &$cf ) );
|
99 |
|
100 |
+
do_meta_boxes( 'cfseven', 'form', $cf );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
+
do_action_ref_array( 'wpcf7_admin_after_form', array( &$cf ) );
|
103 |
|
104 |
+
do_meta_boxes( 'cfseven', 'mail', $cf );
|
|
|
|
|
|
|
105 |
|
106 |
+
do_action_ref_array( 'wpcf7_admin_after_mail', array( &$cf ) );
|
|
|
107 |
|
108 |
+
do_meta_boxes( 'cfseven', 'mail_2', $cf );
|
|
|
|
|
|
|
109 |
|
110 |
+
do_action_ref_array( 'wpcf7_admin_after_mail_2', array( &$cf ) );
|
|
|
|
|
|
|
111 |
|
112 |
+
do_meta_boxes( 'cfseven', 'messages', $cf );
|
113 |
|
114 |
+
do_action_ref_array( 'wpcf7_admin_after_messages', array( &$cf ) );
|
115 |
|
116 |
+
do_meta_boxes( 'cfseven', 'additional_settings', $cf );
|
117 |
|
118 |
+
do_action_ref_array( 'wpcf7_admin_after_additional_settings', array( &$cf ) );
|
|
|
119 |
|
120 |
+
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
121 |
+
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
|
|
|
|
122 |
|
|
|
|
|
123 |
?>
|
|
|
|
|
|
|
124 |
</div>
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
</form>
|
127 |
|
128 |
<?php endif; ?>
|
admin/includes/meta-boxes.php
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/* Form */
|
4 |
+
|
5 |
+
function wpcf7_form_meta_box( $post ) {
|
6 |
+
?>
|
7 |
+
<div class="half-left"><textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="20"><?php echo esc_textarea( $post->form ); ?></textarea></div>
|
8 |
+
|
9 |
+
<div class="half-right"><div id="taggenerator"></div></div>
|
10 |
+
|
11 |
+
<br class="clear" />
|
12 |
+
<?php
|
13 |
+
}
|
14 |
+
|
15 |
+
/* Mail */
|
16 |
+
|
17 |
+
function wpcf7_mail_meta_box( $post, $box ) {
|
18 |
+
$defaults = array( 'id' => 'wpcf7-mail', 'name' => 'mail', 'use' => null );
|
19 |
+
|
20 |
+
if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) )
|
21 |
+
$args = array();
|
22 |
+
else
|
23 |
+
$args = $box['args'];
|
24 |
+
|
25 |
+
extract( wp_parse_args( $args, $defaults ), EXTR_SKIP );
|
26 |
+
|
27 |
+
$id = esc_attr( $id );
|
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 |
+
|
38 |
+
<br class="clear" />
|
39 |
+
<?php endif; ?>
|
40 |
+
|
41 |
+
<div class="mail-fields">
|
42 |
+
<div class="half-left">
|
43 |
+
<div class="mail-field">
|
44 |
+
<label for="<?php echo $id; ?>-recipient"><?php echo esc_html( __( 'To:', 'wpcf7' ) ); ?></label><br />
|
45 |
+
<input type="text" id="<?php echo $id; ?>-recipient" name="<?php echo $id; ?>-recipient" class="wide" size="70" value="<?php echo esc_attr( $mail['recipient'] ); ?>" />
|
46 |
+
</div>
|
47 |
+
|
48 |
+
<div class="mail-field">
|
49 |
+
<label for="<?php echo $id; ?>-sender"><?php echo esc_html( __( 'From:', 'wpcf7' ) ); ?></label><br />
|
50 |
+
<input type="text" id="<?php echo $id; ?>-sender" name="<?php echo $id; ?>-sender" class="wide" size="70" value="<?php echo esc_attr( $mail['sender'] ); ?>" />
|
51 |
+
</div>
|
52 |
+
|
53 |
+
<div class="mail-field">
|
54 |
+
<label for="<?php echo $id; ?>-subject"><?php echo esc_html( __( 'Subject:', 'wpcf7' ) ); ?></label><br />
|
55 |
+
<input type="text" id="<?php echo $id; ?>-subject" name="<?php echo $id; ?>-subject" class="wide" size="70" value="<?php echo esc_attr( $mail['subject'] ); ?>" />
|
56 |
+
</div>
|
57 |
+
|
58 |
+
<div class="pseudo-hr"></div>
|
59 |
+
|
60 |
+
<div class="mail-field">
|
61 |
+
<label for="<?php echo $id; ?>-additional-headers"><?php echo esc_html( __( 'Additional headers:', 'wpcf7' ) ); ?></label><br />
|
62 |
+
<textarea id="<?php echo $id; ?>-additional-headers" name="<?php echo $id; ?>-additional-headers" cols="100" rows="2"><?php echo esc_textarea( $mail['additional_headers'] ); ?></textarea>
|
63 |
+
</div>
|
64 |
+
|
65 |
+
<div class="mail-field">
|
66 |
+
<label for="<?php echo $id; ?>-attachments"><?php echo esc_html( __( 'File attachments:', 'wpcf7' ) ); ?></label><br />
|
67 |
+
<input type="text" id="<?php echo $id; ?>-attachments" name="<?php echo $id; ?>-attachments" class="wide" size="70" value="<?php echo esc_attr( $mail['attachments'] ); ?>" />
|
68 |
+
</div>
|
69 |
+
|
70 |
+
<div class="pseudo-hr"></div>
|
71 |
+
|
72 |
+
<div class="mail-field">
|
73 |
+
<input type="checkbox" id="<?php echo $id; ?>-use-html" name="<?php echo $id; ?>-use-html" value="1"<?php echo ( $mail['use_html'] ) ? ' checked="checked"' : ''; ?> />
|
74 |
+
<label for="<?php echo $id; ?>-use-html"><?php echo esc_html( __( 'Use HTML content type', 'wpcf7' ) ); ?></label>
|
75 |
+
</div>
|
76 |
+
</div>
|
77 |
+
|
78 |
+
<div class="half-right">
|
79 |
+
<div class="mail-field">
|
80 |
+
<label for="<?php echo $id; ?>-body"><?php echo esc_html( __( 'Message body:', 'wpcf7' ) ); ?></label><br />
|
81 |
+
<textarea id="<?php echo $id; ?>-body" name="<?php echo $id; ?>-body" cols="100" rows="16"><?php echo esc_textarea( $mail['body'] ); ?></textarea>
|
82 |
+
</div>
|
83 |
+
</div>
|
84 |
+
|
85 |
+
<br class="clear" />
|
86 |
+
</div>
|
87 |
+
<?php
|
88 |
+
}
|
89 |
+
|
90 |
+
function wpcf7_messages_meta_box( $post ) {
|
91 |
+
foreach ( wpcf7_messages() as $key => $arr ) :
|
92 |
+
$field_name = 'wpcf7-message-' . strtr( $key, '_', '-' );
|
93 |
+
|
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->messages[$key] ); ?>" />
|
98 |
+
</div>
|
99 |
+
<?php
|
100 |
+
endforeach;
|
101 |
+
}
|
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 |
+
|
109 |
+
?>
|
admin/scripts.js
CHANGED
@@ -6,42 +6,22 @@
|
|
6 |
$('#taggenerator').tagGenerator(_wpcf7L10n.generateTag,
|
7 |
{ dropdownIconUrl: _wpcf7.pluginUrl + '/images/dropdown.gif' });
|
8 |
|
9 |
-
$('input#wpcf7-title:
|
10 |
-
cursor: 'pointer'
|
11 |
-
});
|
12 |
|
13 |
$('input#wpcf7-title').mouseover(function() {
|
14 |
-
$(this).not('.focus').
|
15 |
-
'background-color': '#ffffdd'
|
16 |
-
});
|
17 |
});
|
18 |
|
19 |
$('input#wpcf7-title').mouseout(function() {
|
20 |
-
$(this).
|
21 |
-
'background-color': '#fff'
|
22 |
-
});
|
23 |
});
|
24 |
|
25 |
$('input#wpcf7-title').focus(function() {
|
26 |
-
$(this).addClass('focus');
|
27 |
-
$(this).css({
|
28 |
-
cursor: 'text',
|
29 |
-
color: '#333',
|
30 |
-
border: '1px solid #777',
|
31 |
-
font: 'normal 13px Verdana, Arial, Helvetica, sans-serif',
|
32 |
-
'background-color': '#fff'
|
33 |
-
});
|
34 |
});
|
35 |
|
36 |
$('input#wpcf7-title').blur(function() {
|
37 |
$(this).removeClass('focus');
|
38 |
-
$(this).css({
|
39 |
-
cursor: 'pointer',
|
40 |
-
color: '#555',
|
41 |
-
border: 'none',
|
42 |
-
font: 'bold 20px serif',
|
43 |
-
'background-color': '#fff'
|
44 |
-
});
|
45 |
});
|
46 |
|
47 |
$('input#wpcf7-title').change(function() {
|
@@ -50,51 +30,22 @@
|
|
50 |
|
51 |
updateTag();
|
52 |
|
53 |
-
|
54 |
-
if (! $(
|
55 |
-
$('
|
56 |
-
|
57 |
-
$(
|
58 |
-
if ($('
|
59 |
-
&& $(
|
60 |
-
$('
|
61 |
-
} else if ($('
|
62 |
-
&& $(
|
63 |
-
$('
|
64 |
}
|
65 |
});
|
66 |
-
}
|
67 |
-
|
68 |
-
$('#message-fields-toggle-switch').text(_wpcf7L10n.show);
|
69 |
-
$('#message-fields').hide();
|
70 |
-
|
71 |
-
$('#message-fields-toggle-switch').click(function() {
|
72 |
-
if ($('#message-fields').is(':hidden')) {
|
73 |
-
$('#message-fields').slideDown('fast');
|
74 |
-
$('#message-fields-toggle-switch').text(_wpcf7L10n.hide);
|
75 |
-
} else {
|
76 |
-
$('#message-fields').hide('fast');
|
77 |
-
$('#message-fields-toggle-switch').text(_wpcf7L10n.show);
|
78 |
-
}
|
79 |
});
|
80 |
|
81 |
-
|
82 |
-
$('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.show);
|
83 |
-
$('#additional-settings-fields').hide();
|
84 |
-
} else {
|
85 |
-
$('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.hide);
|
86 |
-
$('#additional-settings-fields').show();
|
87 |
-
}
|
88 |
-
|
89 |
-
$('#additional-settings-fields-toggle-switch').click(function() {
|
90 |
-
if ($('#additional-settings-fields').is(':hidden')) {
|
91 |
-
$('#additional-settings-fields').slideDown('fast');
|
92 |
-
$('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.hide);
|
93 |
-
} else {
|
94 |
-
$('#additional-settings-fields').hide('fast');
|
95 |
-
$('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.show);
|
96 |
-
}
|
97 |
-
});
|
98 |
|
99 |
} catch (e) {
|
100 |
}
|
@@ -107,10 +58,16 @@
|
|
107 |
title = title.replace(/["'\[\]]/g, '');
|
108 |
|
109 |
$('input#wpcf7-title').val(title);
|
110 |
-
var
|
111 |
-
var tag = '[contact-form ' +
|
112 |
-
|
113 |
$('input#contact-form-anchor-text').val(tag);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
}
|
115 |
|
116 |
})(jQuery);
|
6 |
$('#taggenerator').tagGenerator(_wpcf7L10n.generateTag,
|
7 |
{ dropdownIconUrl: _wpcf7.pluginUrl + '/images/dropdown.gif' });
|
8 |
|
9 |
+
$('input#wpcf7-title:disabled').css({cursor: 'default'});
|
|
|
|
|
10 |
|
11 |
$('input#wpcf7-title').mouseover(function() {
|
12 |
+
$(this).not('.focus').addClass('mouseover');
|
|
|
|
|
13 |
});
|
14 |
|
15 |
$('input#wpcf7-title').mouseout(function() {
|
16 |
+
$(this).removeClass('mouseover');
|
|
|
|
|
17 |
});
|
18 |
|
19 |
$('input#wpcf7-title').focus(function() {
|
20 |
+
$(this).addClass('focus').removeClass('mouseover');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
});
|
22 |
|
23 |
$('input#wpcf7-title').blur(function() {
|
24 |
$(this).removeClass('focus');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
});
|
26 |
|
27 |
$('input#wpcf7-title').change(function() {
|
30 |
|
31 |
updateTag();
|
32 |
|
33 |
+
$('.check-if-these-fields-are-active').each(function(index) {
|
34 |
+
if (! $(this).is(':checked'))
|
35 |
+
$(this).parent().siblings('.mail-fields').hide();
|
36 |
+
|
37 |
+
$(this).click(function() {
|
38 |
+
if ($(this).parent().siblings('.mail-fields').is(':hidden')
|
39 |
+
&& $(this).is(':checked')) {
|
40 |
+
$(this).parent().siblings('.mail-fields').slideDown('fast');
|
41 |
+
} else if ($(this).parent().siblings('.mail-fields').is(':visible')
|
42 |
+
&& $(this).not(':checked')) {
|
43 |
+
$(this).parent().siblings('.mail-fields').slideUp('fast');
|
44 |
}
|
45 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
});
|
47 |
|
48 |
+
postboxes.add_postbox_toggles('cfseven');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
} catch (e) {
|
51 |
}
|
58 |
title = title.replace(/["'\[\]]/g, '');
|
59 |
|
60 |
$('input#wpcf7-title').val(title);
|
61 |
+
var postId = $('input#post_ID').val();
|
62 |
+
var tag = '[contact-form-7 id="' + postId + '" title="' + title + '"]';
|
|
|
63 |
$('input#contact-form-anchor-text').val(tag);
|
64 |
+
|
65 |
+
var oldId = $('input#wpcf7-id').val();
|
66 |
+
|
67 |
+
if (0 != oldId) {
|
68 |
+
var tagOld = '[contact-form ' + oldId + ' "' + title + '"]';
|
69 |
+
$('input#contact-form-anchor-text-old').val(tagOld).parent('p.tagcode').show();
|
70 |
+
}
|
71 |
}
|
72 |
|
73 |
})(jQuery);
|
admin/styles-rtl.css
CHANGED
@@ -9,10 +9,6 @@ div.actions-link {
|
|
9 |
right: auto;
|
10 |
left: 0;
|
11 |
}
|
12 |
-
span#message-fields-toggle-switch {
|
13 |
-
margin-left: 0;
|
14 |
-
margin-right: 1em;
|
15 |
-
}
|
16 |
div.tg-pane table caption {
|
17 |
text-align: right;
|
18 |
}
|
9 |
right: auto;
|
10 |
left: 0;
|
11 |
}
|
|
|
|
|
|
|
|
|
12 |
div.tg-pane table caption {
|
13 |
text-align: right;
|
14 |
}
|
admin/styles.css
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
div.
|
2 |
text-align: right;
|
3 |
font-size: .8em;
|
4 |
margin-top: -1.6em;
|
5 |
}
|
6 |
|
7 |
-
div.
|
8 |
text-decoration: none;
|
9 |
}
|
10 |
|
11 |
-
div.
|
12 |
border-width: 1px;
|
13 |
border-style: solid;
|
14 |
padding: 0 0.6em;
|
@@ -22,23 +22,23 @@ div.wpcf7 div.donation {
|
|
22 |
text-align: center;
|
23 |
}
|
24 |
|
25 |
-
div.
|
26 |
margin: .7em 0;
|
27 |
line-height: 1;
|
28 |
padding: 2px;
|
29 |
font-size: 107%;
|
30 |
}
|
31 |
|
32 |
-
div.
|
33 |
font-weight: bold;
|
34 |
color: #3f3f3f;
|
35 |
}
|
36 |
|
37 |
-
div.
|
38 |
margin-left: 1em;
|
39 |
}
|
40 |
|
41 |
-
div.
|
42 |
white-space: normal;
|
43 |
}
|
44 |
|
@@ -50,11 +50,22 @@ ul.subsubsub li.addnew a {
|
|
50 |
color: #e6255b;
|
51 |
}
|
52 |
|
|
|
|
|
|
|
|
|
53 |
ul.subsubsub li.addnew a:hover,
|
54 |
ul.subsubsub li.addnew a:active {
|
55 |
color: #999;
|
56 |
}
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
div.save-contact-form {
|
59 |
padding: 1.4em 0 0 0;
|
60 |
text-align: right;
|
@@ -65,14 +76,13 @@ div.actions-link {
|
|
65 |
top: 0;
|
66 |
right: 0;
|
67 |
margin: 0;
|
68 |
-
padding:
|
69 |
}
|
70 |
|
71 |
div.actions-link input {
|
72 |
padding: 0;
|
73 |
margin: 0;
|
74 |
border: none;
|
75 |
-
background-color: #fff;
|
76 |
font-size: 11px;
|
77 |
cursor: pointer;
|
78 |
}
|
@@ -87,38 +97,61 @@ div.actions-link input.delete {
|
|
87 |
|
88 |
input#wpcf7-title {
|
89 |
color: #555;
|
90 |
-
background-color: #fff;
|
91 |
border: none;
|
92 |
font: bold 20px serif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
|
95 |
p.tagcode {
|
96 |
color: #333;
|
97 |
-
margin: 2ex 0 1ex
|
98 |
}
|
99 |
|
100 |
-
input#contact-form-anchor-text {
|
101 |
color: #fff;
|
102 |
background: #7e4e0b;
|
103 |
border: none;
|
104 |
-
width:
|
105 |
-moz-border-radius: 6px;
|
106 |
-khtml-border-radius: 6px;
|
107 |
-webkit-border-radius: 6px;
|
108 |
border-radius: 6px;
|
109 |
}
|
110 |
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
}
|
118 |
|
119 |
div.pseudo-hr {
|
120 |
-
border-bottom: 1px solid
|
121 |
-
margin:
|
122 |
}
|
123 |
|
124 |
input, textarea {
|
@@ -137,14 +170,10 @@ label.disabled {
|
|
137 |
color: #777;
|
138 |
}
|
139 |
|
140 |
-
div.message-field {
|
141 |
-
margin: .2em 0 .4em;
|
142 |
-
}
|
143 |
-
|
144 |
div.tag-generator {
|
145 |
position: relative;
|
146 |
-
background:
|
147 |
-
padding:
|
148 |
}
|
149 |
|
150 |
div.tg-pane {
|
@@ -156,6 +185,7 @@ div.tg-pane {
|
|
156 |
-khtml-border-radius: 6px;
|
157 |
-webkit-border-radius: 6px;
|
158 |
border-radius: 6px;
|
|
|
159 |
}
|
160 |
|
161 |
div.tg-pane table {
|
@@ -178,6 +208,7 @@ div.tg-pane table td {
|
|
178 |
vertical-align: top;
|
179 |
width: 50%;
|
180 |
border: none;
|
|
|
181 |
}
|
182 |
|
183 |
div.tg-pane input.tag, div.tg-pane input.mail-tag {
|
1 |
+
div.wrap div.cf7com-links {
|
2 |
text-align: right;
|
3 |
font-size: .8em;
|
4 |
margin-top: -1.6em;
|
5 |
}
|
6 |
|
7 |
+
div.wrap div.cf7com-links a {
|
8 |
text-decoration: none;
|
9 |
}
|
10 |
|
11 |
+
div.wrap div.donation {
|
12 |
border-width: 1px;
|
13 |
border-style: solid;
|
14 |
padding: 0 0.6em;
|
22 |
text-align: center;
|
23 |
}
|
24 |
|
25 |
+
div.wrap div.donation p {
|
26 |
margin: .7em 0;
|
27 |
line-height: 1;
|
28 |
padding: 2px;
|
29 |
font-size: 107%;
|
30 |
}
|
31 |
|
32 |
+
div.wrap div.donation p a {
|
33 |
font-weight: bold;
|
34 |
color: #3f3f3f;
|
35 |
}
|
36 |
|
37 |
+
div.wrap div.donation p a.button {
|
38 |
margin-left: 1em;
|
39 |
}
|
40 |
|
41 |
+
div.wrap ul.subsubsub {
|
42 |
white-space: normal;
|
43 |
}
|
44 |
|
50 |
color: #e6255b;
|
51 |
}
|
52 |
|
53 |
+
ul.subsubsub li.addnew a.current {
|
54 |
+
border: 1px solid #bbb;
|
55 |
+
}
|
56 |
+
|
57 |
ul.subsubsub li.addnew a:hover,
|
58 |
ul.subsubsub li.addnew a:active {
|
59 |
color: #999;
|
60 |
}
|
61 |
|
62 |
+
#titlediv {
|
63 |
+
margin-bottom: 20px;
|
64 |
+
position: relative;
|
65 |
+
border: 1px solid #c7c7c7;
|
66 |
+
padding: 6px;
|
67 |
+
}
|
68 |
+
|
69 |
div.save-contact-form {
|
70 |
padding: 1.4em 0 0 0;
|
71 |
text-align: right;
|
76 |
top: 0;
|
77 |
right: 0;
|
78 |
margin: 0;
|
79 |
+
padding: 6px;
|
80 |
}
|
81 |
|
82 |
div.actions-link input {
|
83 |
padding: 0;
|
84 |
margin: 0;
|
85 |
border: none;
|
|
|
86 |
font-size: 11px;
|
87 |
cursor: pointer;
|
88 |
}
|
97 |
|
98 |
input#wpcf7-title {
|
99 |
color: #555;
|
|
|
100 |
border: none;
|
101 |
font: bold 20px serif;
|
102 |
+
cursor: pointer;
|
103 |
+
background-color: transparent;
|
104 |
+
}
|
105 |
+
|
106 |
+
input#wpcf7-title.focus {
|
107 |
+
color: #333;
|
108 |
+
border: 1px solid #777;
|
109 |
+
font: normal 13px Verdana, Arial, Helvetica, sans-serif;
|
110 |
+
cursor: text;
|
111 |
+
background-color: transparent;
|
112 |
+
}
|
113 |
+
|
114 |
+
input#wpcf7-title.mouseover {
|
115 |
+
background-color: #ffffdd;
|
116 |
}
|
117 |
|
118 |
p.tagcode {
|
119 |
color: #333;
|
120 |
+
margin: 2ex 0 1ex 0;
|
121 |
}
|
122 |
|
123 |
+
input#contact-form-anchor-text, input#contact-form-anchor-text-old {
|
124 |
color: #fff;
|
125 |
background: #7e4e0b;
|
126 |
border: none;
|
127 |
+
width: 100%;
|
128 |
-moz-border-radius: 6px;
|
129 |
-khtml-border-radius: 6px;
|
130 |
-webkit-border-radius: 6px;
|
131 |
border-radius: 6px;
|
132 |
}
|
133 |
|
134 |
+
.postbox .half, .postbox .half-left, .postbox .half-right {
|
135 |
+
float: left;
|
136 |
+
width: 50%;
|
137 |
+
}
|
138 |
+
|
139 |
+
.postbox .half-right > * {
|
140 |
+
margin-left: 10px;
|
141 |
+
}
|
142 |
+
|
143 |
+
.postbox .mail-field, .postbox .message-field {
|
144 |
+
margin-top: 6px;
|
145 |
+
margin-bottom: 8px;
|
146 |
+
}
|
147 |
+
|
148 |
+
.postbox .mail-field label, .postbox .message-field label {
|
149 |
+
line-height: 1.4em;
|
150 |
}
|
151 |
|
152 |
div.pseudo-hr {
|
153 |
+
border-bottom: 1px solid transparent;
|
154 |
+
margin: 8px 0;
|
155 |
}
|
156 |
|
157 |
input, textarea {
|
170 |
color: #777;
|
171 |
}
|
172 |
|
|
|
|
|
|
|
|
|
173 |
div.tag-generator {
|
174 |
position: relative;
|
175 |
+
background: transparent;
|
176 |
+
padding: 0 0 5px 1px;
|
177 |
}
|
178 |
|
179 |
div.tg-pane {
|
185 |
-khtml-border-radius: 6px;
|
186 |
-webkit-border-radius: 6px;
|
187 |
border-radius: 6px;
|
188 |
+
line-height: 140%;
|
189 |
}
|
190 |
|
191 |
div.tg-pane table {
|
208 |
vertical-align: top;
|
209 |
width: 50%;
|
210 |
border: none;
|
211 |
+
padding: 2px 0;
|
212 |
}
|
213 |
|
214 |
div.tg-pane input.tag, div.tg-pane input.mail-tag {
|
includes/classes.php
CHANGED
@@ -6,11 +6,6 @@ class WPCF7_ContactForm {
|
|
6 |
|
7 |
var $id;
|
8 |
var $title;
|
9 |
-
var $form;
|
10 |
-
var $mail;
|
11 |
-
var $mail_2;
|
12 |
-
var $messages;
|
13 |
-
var $additional_settings;
|
14 |
|
15 |
var $unit_tag;
|
16 |
|
@@ -18,7 +13,7 @@ class WPCF7_ContactForm {
|
|
18 |
var $scanned_form_tags;
|
19 |
|
20 |
var $posted_data;
|
21 |
-
var $uploaded_files;
|
22 |
|
23 |
var $skip_mail = false;
|
24 |
|
@@ -216,89 +211,6 @@ class WPCF7_ContactForm {
|
|
216 |
return $result;
|
217 |
}
|
218 |
|
219 |
-
/* Acceptance */
|
220 |
-
|
221 |
-
function accepted() {
|
222 |
-
$accepted = true;
|
223 |
-
|
224 |
-
return apply_filters( 'wpcf7_acceptance', $accepted );
|
225 |
-
}
|
226 |
-
|
227 |
-
/* Akismet */
|
228 |
-
|
229 |
-
function akismet() {
|
230 |
-
global $akismet_api_host, $akismet_api_port;
|
231 |
-
|
232 |
-
if ( ! function_exists( 'akismet_http_post' ) ||
|
233 |
-
! ( get_option( 'wordpress_api_key' ) || $wpcom_api_key ) )
|
234 |
-
return false;
|
235 |
-
|
236 |
-
$akismet_ready = false;
|
237 |
-
$author = $author_email = $author_url = $content = '';
|
238 |
-
$fes = $this->form_scan_shortcode();
|
239 |
-
|
240 |
-
foreach ( $fes as $fe ) {
|
241 |
-
if ( ! isset( $fe['name'] ) || ! is_array( $fe['options'] ) )
|
242 |
-
continue;
|
243 |
-
|
244 |
-
if ( preg_grep( '%^akismet:author$%', $fe['options'] ) && '' == $author ) {
|
245 |
-
$author = $_POST[$fe['name']];
|
246 |
-
$akismet_ready = true;
|
247 |
-
}
|
248 |
-
|
249 |
-
if ( preg_grep( '%^akismet:author_email$%', $fe['options'] ) && '' == $author_email ) {
|
250 |
-
$author_email = $_POST[$fe['name']];
|
251 |
-
$akismet_ready = true;
|
252 |
-
}
|
253 |
-
|
254 |
-
if ( preg_grep( '%^akismet:author_url$%', $fe['options'] ) && '' == $author_url ) {
|
255 |
-
$author_url = $_POST[$fe['name']];
|
256 |
-
$akismet_ready = true;
|
257 |
-
}
|
258 |
-
|
259 |
-
if ( '' != $content )
|
260 |
-
$content .= "\n\n";
|
261 |
-
|
262 |
-
$content .= $_POST[$fe['name']];
|
263 |
-
}
|
264 |
-
|
265 |
-
if ( ! $akismet_ready )
|
266 |
-
return false;
|
267 |
-
|
268 |
-
$c['blog'] = get_option( 'home' );
|
269 |
-
$c['user_ip'] = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] );
|
270 |
-
$c['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
|
271 |
-
$c['referrer'] = $_SERVER['HTTP_REFERER'];
|
272 |
-
$c['comment_type'] = 'contactform7';
|
273 |
-
if ( $permalink = get_permalink() )
|
274 |
-
$c['permalink'] = $permalink;
|
275 |
-
if ( '' != $author )
|
276 |
-
$c['comment_author'] = $author;
|
277 |
-
if ( '' != $author_email )
|
278 |
-
$c['comment_author_email'] = $author_email;
|
279 |
-
if ( '' != $author_url )
|
280 |
-
$c['comment_author_url'] = $author_url;
|
281 |
-
if ( '' != $content )
|
282 |
-
$c['comment_content'] = $content;
|
283 |
-
|
284 |
-
$ignore = array( 'HTTP_COOKIE' );
|
285 |
-
|
286 |
-
foreach ( $_SERVER as $key => $value )
|
287 |
-
if ( ! in_array( $key, (array) $ignore ) )
|
288 |
-
$c["$key"] = $value;
|
289 |
-
|
290 |
-
$query_string = '';
|
291 |
-
foreach ( $c as $key => $data )
|
292 |
-
$query_string .= $key . '=' . urlencode( stripslashes( (string) $data ) ) . '&';
|
293 |
-
|
294 |
-
$response = akismet_http_post( $query_string, $akismet_api_host,
|
295 |
-
'/1.1/comment-check', $akismet_api_port );
|
296 |
-
if ( 'true' == $response[1] )
|
297 |
-
return true;
|
298 |
-
else
|
299 |
-
return false;
|
300 |
-
}
|
301 |
-
|
302 |
/* Mail */
|
303 |
|
304 |
function mail() {
|
@@ -336,8 +248,15 @@ class WPCF7_ContactForm {
|
|
336 |
return true;
|
337 |
|
338 |
if ( $this->compose_and_send_mail( $this->mail ) ) {
|
|
|
|
|
339 |
if ( $this->mail_2['active'] )
|
340 |
-
$
|
|
|
|
|
|
|
|
|
|
|
341 |
|
342 |
return true;
|
343 |
}
|
@@ -350,23 +269,33 @@ class WPCF7_ContactForm {
|
|
350 |
|
351 |
$use_html = (bool) $mail_template['use_html'];
|
352 |
|
353 |
-
|
354 |
-
|
355 |
-
else
|
356 |
-
$callback = array( &$this, 'mail_callback' );
|
357 |
|
358 |
$subject = preg_replace_callback( $regex, $callback, $mail_template['subject'] );
|
359 |
$sender = preg_replace_callback( $regex, $callback, $mail_template['sender'] );
|
360 |
$recipient = preg_replace_callback( $regex, $callback, $mail_template['recipient'] );
|
361 |
$additional_headers =
|
362 |
preg_replace_callback( $regex, $callback, $mail_template['additional_headers'] );
|
363 |
-
$body = preg_replace_callback( $regex, $callback, $mail_template['body'] );
|
364 |
|
365 |
-
if ( $use_html )
|
|
|
366 |
$body = wpautop( $body );
|
|
|
|
|
|
|
|
|
|
|
367 |
|
368 |
-
|
369 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
|
371 |
$headers = "From: $sender\n";
|
372 |
|
@@ -375,18 +304,7 @@ class WPCF7_ContactForm {
|
|
375 |
|
376 |
$headers .= trim( $additional_headers ) . "\n";
|
377 |
|
378 |
-
|
379 |
-
$for_this_mail = array();
|
380 |
-
foreach ( $this->uploaded_files as $name => $path ) {
|
381 |
-
if ( false === strpos( $mail_template['attachments'], "[${name}]" ) )
|
382 |
-
continue;
|
383 |
-
$for_this_mail[] = $path;
|
384 |
-
}
|
385 |
-
|
386 |
-
return @wp_mail( $recipient, $subject, $body, $headers, $for_this_mail );
|
387 |
-
} else {
|
388 |
-
return @wp_mail( $recipient, $subject, $body, $headers );
|
389 |
-
}
|
390 |
}
|
391 |
|
392 |
function mail_callback_html( $matches ) {
|
@@ -422,9 +340,9 @@ class WPCF7_ContactForm {
|
|
422 |
|
423 |
function message( $status ) {
|
424 |
$messages = $this->messages;
|
425 |
-
$message = $messages[$status];
|
426 |
|
427 |
-
return apply_filters( 'wpcf7_display_message', $message );
|
428 |
}
|
429 |
|
430 |
/* Additional settings */
|
@@ -481,72 +399,58 @@ class WPCF7_ContactForm {
|
|
481 |
/* Save */
|
482 |
|
483 |
function save() {
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
'
|
488 |
-
'
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
|
|
|
|
|
|
|
|
497 |
|
498 |
-
if ( $
|
499 |
$this->initial = false;
|
500 |
-
$this->id = $
|
501 |
-
|
502 |
do_action_ref_array( 'wpcf7_after_create', array( &$this ) );
|
503 |
} else {
|
504 |
-
return false; // Failed to save
|
505 |
-
}
|
506 |
-
|
507 |
-
} else { // Update
|
508 |
-
if ( ! (int) $this->id )
|
509 |
-
return false; // Missing ID
|
510 |
-
|
511 |
-
$result = $wpdb->update( $wpcf7->contactforms, $fields,
|
512 |
-
array( 'cf7_unit_id' => absint( $this->id ) ) );
|
513 |
-
|
514 |
-
if ( false !== $result ) {
|
515 |
do_action_ref_array( 'wpcf7_after_update', array( &$this ) );
|
516 |
-
} else {
|
517 |
-
return false; // Failed to save
|
518 |
}
|
|
|
|
|
519 |
}
|
520 |
|
521 |
-
|
522 |
-
return true; // Succeeded to save
|
523 |
}
|
524 |
|
525 |
function copy() {
|
526 |
$new = new WPCF7_ContactForm();
|
527 |
$new->initial = true;
|
528 |
-
|
529 |
$new->title = $this->title . '_copy';
|
530 |
-
|
531 |
-
$
|
532 |
-
|
533 |
-
|
534 |
-
|
|
|
|
|
535 |
|
536 |
return $new;
|
537 |
}
|
538 |
|
539 |
function delete() {
|
540 |
-
global $wpdb, $wpcf7;
|
541 |
-
|
542 |
if ( $this->initial )
|
543 |
return;
|
544 |
|
545 |
-
$
|
546 |
-
"DELETE FROM $wpcf7->contactforms WHERE cf7_unit_id = %d LIMIT 1",
|
547 |
-
absint( $this->id ) );
|
548 |
-
|
549 |
-
$wpdb->query( $query );
|
550 |
|
551 |
$this->initial = true;
|
552 |
$this->id = null;
|
@@ -554,30 +458,52 @@ class WPCF7_ContactForm {
|
|
554 |
}
|
555 |
|
556 |
function wpcf7_contact_form( $id ) {
|
557 |
-
|
558 |
|
559 |
-
|
560 |
-
|
561 |
-
if ( ! $row = $wpdb->get_row( $query ) )
|
562 |
-
return false; // No data
|
563 |
|
564 |
$contact_form = new WPCF7_ContactForm();
|
565 |
-
$contact_form->id = $
|
566 |
-
$contact_form->title =
|
567 |
-
|
568 |
-
$
|
569 |
-
|
570 |
-
|
571 |
-
|
|
|
|
|
572 |
|
573 |
$contact_form->upgrade();
|
574 |
|
575 |
return $contact_form;
|
576 |
}
|
577 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
578 |
function wpcf7_contact_form_default_pack( $locale = null ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
579 |
global $l10n;
|
580 |
|
|
|
|
|
|
|
|
|
|
|
|
|
581 |
if ( $locale && $locale != get_locale() ) {
|
582 |
$mo_orig = $l10n['wpcf7'];
|
583 |
unset( $l10n['wpcf7'] );
|
@@ -594,11 +520,14 @@ function wpcf7_contact_form_default_pack( $locale = null ) {
|
|
594 |
$contact_form = new WPCF7_ContactForm();
|
595 |
$contact_form->initial = true;
|
596 |
|
597 |
-
$contact_form->title = __( 'Untitled', 'wpcf7' );
|
598 |
-
|
599 |
-
$
|
600 |
-
|
601 |
-
|
|
|
|
|
|
|
602 |
|
603 |
if ( isset( $mo_orig ) )
|
604 |
$l10n['wpcf7'] = $mo_orig;
|
6 |
|
7 |
var $id;
|
8 |
var $title;
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
var $unit_tag;
|
11 |
|
13 |
var $scanned_form_tags;
|
14 |
|
15 |
var $posted_data;
|
16 |
+
var $uploaded_files = array();
|
17 |
|
18 |
var $skip_mail = false;
|
19 |
|
211 |
return $result;
|
212 |
}
|
213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
/* Mail */
|
215 |
|
216 |
function mail() {
|
248 |
return true;
|
249 |
|
250 |
if ( $this->compose_and_send_mail( $this->mail ) ) {
|
251 |
+
$additional_mail = array();
|
252 |
+
|
253 |
if ( $this->mail_2['active'] )
|
254 |
+
$additional_mail[] = $this->mail_2;
|
255 |
+
|
256 |
+
$additional_mail = apply_filters( 'wpcf7_additional_mail', $additional_mail, $this );
|
257 |
+
|
258 |
+
foreach ( $additional_mail as $mail )
|
259 |
+
$this->compose_and_send_mail( $mail );
|
260 |
|
261 |
return true;
|
262 |
}
|
269 |
|
270 |
$use_html = (bool) $mail_template['use_html'];
|
271 |
|
272 |
+
$callback = array( &$this, 'mail_callback' );
|
273 |
+
$callback_html = array( &$this, 'mail_callback_html' );
|
|
|
|
|
274 |
|
275 |
$subject = preg_replace_callback( $regex, $callback, $mail_template['subject'] );
|
276 |
$sender = preg_replace_callback( $regex, $callback, $mail_template['sender'] );
|
277 |
$recipient = preg_replace_callback( $regex, $callback, $mail_template['recipient'] );
|
278 |
$additional_headers =
|
279 |
preg_replace_callback( $regex, $callback, $mail_template['additional_headers'] );
|
|
|
280 |
|
281 |
+
if ( $use_html ) {
|
282 |
+
$body = preg_replace_callback( $regex, $callback_html, $mail_template['body'] );
|
283 |
$body = wpautop( $body );
|
284 |
+
} else {
|
285 |
+
$body = preg_replace_callback( $regex, $callback, $mail_template['body'] );
|
286 |
+
}
|
287 |
+
|
288 |
+
$attachments = array();
|
289 |
|
290 |
+
foreach ( (array) $this->uploaded_files as $name => $path ) {
|
291 |
+
if ( false === strpos( $mail_template['attachments'], "[${name}]" ) || empty( $path ) )
|
292 |
+
continue;
|
293 |
+
|
294 |
+
$attachments[] = $path;
|
295 |
+
}
|
296 |
+
|
297 |
+
extract( apply_filters( 'wpcf7_mail_components', compact(
|
298 |
+
'subject', 'sender', 'body', 'recipient', 'additional_headers', 'attachments' ) ) );
|
299 |
|
300 |
$headers = "From: $sender\n";
|
301 |
|
304 |
|
305 |
$headers .= trim( $additional_headers ) . "\n";
|
306 |
|
307 |
+
return @wp_mail( $recipient, $subject, $body, $headers, $attachments );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
}
|
309 |
|
310 |
function mail_callback_html( $matches ) {
|
340 |
|
341 |
function message( $status ) {
|
342 |
$messages = $this->messages;
|
343 |
+
$message = isset( $messages[$status] ) ? $messages[$status] : '';
|
344 |
|
345 |
+
return apply_filters( 'wpcf7_display_message', $message, $status );
|
346 |
}
|
347 |
|
348 |
/* Additional settings */
|
399 |
/* Save */
|
400 |
|
401 |
function save() {
|
402 |
+
$postarr = array(
|
403 |
+
'ID' => (int) $this->id,
|
404 |
+
'post_type' => 'wpcf7_contact_form',
|
405 |
+
'post_status' => 'publish',
|
406 |
+
'post_title' => $this->title );
|
407 |
+
|
408 |
+
$post_id = wp_insert_post( $postarr );
|
409 |
+
|
410 |
+
if ( $post_id ) {
|
411 |
+
$props = apply_filters( 'wpcf7_contact_form_properties',
|
412 |
+
array( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ),
|
413 |
+
'save' );
|
414 |
+
|
415 |
+
foreach ( (array) $props as $prop ) {
|
416 |
+
if ( isset( $this->{$prop} ) )
|
417 |
+
update_post_meta( $post_id, $prop, $this->{$prop} );
|
418 |
+
}
|
419 |
|
420 |
+
if ( $this->initial ) {
|
421 |
$this->initial = false;
|
422 |
+
$this->id = $post_id;
|
|
|
423 |
do_action_ref_array( 'wpcf7_after_create', array( &$this ) );
|
424 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
do_action_ref_array( 'wpcf7_after_update', array( &$this ) );
|
|
|
|
|
426 |
}
|
427 |
+
|
428 |
+
do_action_ref_array( 'wpcf7_after_save', array( &$this ) );
|
429 |
}
|
430 |
|
431 |
+
return $post_id;
|
|
|
432 |
}
|
433 |
|
434 |
function copy() {
|
435 |
$new = new WPCF7_ContactForm();
|
436 |
$new->initial = true;
|
|
|
437 |
$new->title = $this->title . '_copy';
|
438 |
+
|
439 |
+
$props = apply_filters( 'wpcf7_contact_form_properties',
|
440 |
+
array( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ),
|
441 |
+
'copy' );
|
442 |
+
|
443 |
+
foreach ( (array) $props as $prop )
|
444 |
+
$new->{$prop} = $this->{$prop};
|
445 |
|
446 |
return $new;
|
447 |
}
|
448 |
|
449 |
function delete() {
|
|
|
|
|
450 |
if ( $this->initial )
|
451 |
return;
|
452 |
|
453 |
+
wp_delete_post( $this->id, true );
|
|
|
|
|
|
|
|
|
454 |
|
455 |
$this->initial = true;
|
456 |
$this->id = null;
|
458 |
}
|
459 |
|
460 |
function wpcf7_contact_form( $id ) {
|
461 |
+
$post = get_post( $id );
|
462 |
|
463 |
+
if ( empty( $post ) || 'wpcf7_contact_form' != get_post_type( $post ) )
|
464 |
+
return false;
|
|
|
|
|
465 |
|
466 |
$contact_form = new WPCF7_ContactForm();
|
467 |
+
$contact_form->id = $post->ID;
|
468 |
+
$contact_form->title = $post->post_title;
|
469 |
+
|
470 |
+
$props = apply_filters( 'wpcf7_contact_form_properties',
|
471 |
+
array( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ),
|
472 |
+
'new' );
|
473 |
+
|
474 |
+
foreach ( (array) $props as $prop )
|
475 |
+
$contact_form->{$prop} = get_post_meta( $post->ID, $prop, true );
|
476 |
|
477 |
$contact_form->upgrade();
|
478 |
|
479 |
return $contact_form;
|
480 |
}
|
481 |
|
482 |
+
function wpcf7_get_contact_form_by_old_id( $old_id ) {
|
483 |
+
global $wpdb;
|
484 |
+
|
485 |
+
$q = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_old_cf7_unit_id'"
|
486 |
+
. $wpdb->prepare( " AND meta_value = %d", $old_id );
|
487 |
+
|
488 |
+
if ( $new_id = $wpdb->get_var( $q ) )
|
489 |
+
return wpcf7_contact_form( $new_id );
|
490 |
+
}
|
491 |
+
|
492 |
function wpcf7_contact_form_default_pack( $locale = null ) {
|
493 |
+
// For backward compatibility
|
494 |
+
|
495 |
+
return wpcf7_get_contact_form_default_pack( array( 'locale' => $locale ) );
|
496 |
+
}
|
497 |
+
|
498 |
+
function wpcf7_get_contact_form_default_pack( $args = '' ) {
|
499 |
global $l10n;
|
500 |
|
501 |
+
$defaults = array( 'locale' => null, 'title' => '' );
|
502 |
+
$args = wp_parse_args( $args, $defaults );
|
503 |
+
|
504 |
+
$locale = $args['locale'];
|
505 |
+
$title = $args['title'];
|
506 |
+
|
507 |
if ( $locale && $locale != get_locale() ) {
|
508 |
$mo_orig = $l10n['wpcf7'];
|
509 |
unset( $l10n['wpcf7'] );
|
520 |
$contact_form = new WPCF7_ContactForm();
|
521 |
$contact_form->initial = true;
|
522 |
|
523 |
+
$contact_form->title = ( $title ? $title : __( 'Untitled', 'wpcf7' ) );
|
524 |
+
|
525 |
+
$props = apply_filters( 'wpcf7_contact_form_properties',
|
526 |
+
array( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ),
|
527 |
+
'default' );
|
528 |
+
|
529 |
+
foreach ( (array) $props as $prop )
|
530 |
+
$contact_form->{$prop} = wpcf7_get_default_template( $prop );
|
531 |
|
532 |
if ( isset( $mo_orig ) )
|
533 |
$l10n['wpcf7'] = $mo_orig;
|
includes/controller.php
CHANGED
@@ -1,22 +1,13 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
add_action( 'init', '
|
4 |
-
|
5 |
-
function wpcf7_init_switch() {
|
6 |
-
if ( 'GET' == $_SERVER['REQUEST_METHOD'] && isset( $_GET['_wpcf7_is_ajax_call'] ) ) {
|
7 |
-
wpcf7_ajax_onload();
|
8 |
-
exit();
|
9 |
-
} elseif ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['_wpcf7_is_ajax_call'] ) ) {
|
10 |
-
wpcf7_ajax_json_echo();
|
11 |
-
exit();
|
12 |
-
} elseif ( isset( $_POST['_wpcf7'] ) ) {
|
13 |
-
wpcf7_process_nonajax_submitting();
|
14 |
-
}
|
15 |
-
}
|
16 |
|
17 |
function wpcf7_ajax_onload() {
|
18 |
global $wpcf7_contact_form;
|
19 |
|
|
|
|
|
|
|
20 |
$echo = '';
|
21 |
|
22 |
if ( isset( $_GET['_wpcf7'] ) ) {
|
@@ -34,11 +25,18 @@ function wpcf7_ajax_onload() {
|
|
34 |
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
35 |
echo $echo;
|
36 |
}
|
|
|
|
|
37 |
}
|
38 |
|
|
|
|
|
39 |
function wpcf7_ajax_json_echo() {
|
40 |
global $wpcf7_contact_form;
|
41 |
|
|
|
|
|
|
|
42 |
$echo = '';
|
43 |
|
44 |
if ( isset( $_POST['_wpcf7'] ) ) {
|
@@ -46,55 +44,39 @@ function wpcf7_ajax_json_echo() {
|
|
46 |
$unit_tag = $_POST['_wpcf7_unit_tag'];
|
47 |
|
48 |
if ( $wpcf7_contact_form = wpcf7_contact_form( $id ) ) {
|
49 |
-
$validation = $wpcf7_contact_form->validate();
|
50 |
|
51 |
$items = array(
|
52 |
'mailSent' => false,
|
53 |
'into' => '#' . $unit_tag,
|
54 |
'captcha' => null );
|
55 |
|
56 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
-
if ( ! $
|
59 |
$invalids = array();
|
60 |
-
|
|
|
61 |
$invalids[] = array(
|
62 |
'into' => 'span.wpcf7-form-control-wrap.' . $name,
|
63 |
'message' => $reason );
|
64 |
}
|
65 |
|
66 |
-
$items['message'] = wpcf7_get_message( 'validation_error' );
|
67 |
$items['invalids'] = $invalids;
|
|
|
68 |
|
69 |
-
|
70 |
-
$items['message'] = wpcf7_get_message( 'accept_terms' );
|
71 |
-
|
72 |
-
} elseif ( $wpcf7_contact_form->akismet() ) { // Spam!
|
73 |
-
$items['message'] = wpcf7_get_message( 'akismet_says_spam' );
|
74 |
$items['spam'] = true;
|
75 |
|
76 |
-
|
77 |
-
$items['
|
78 |
-
$items['message'] = wpcf7_get_message( 'mail_sent_ok' );
|
79 |
-
|
80 |
-
$on_sent_ok = $wpcf7_contact_form->additional_setting( 'on_sent_ok', false );
|
81 |
-
if ( ! empty( $on_sent_ok ) ) {
|
82 |
-
$on_sent_ok = array_map( 'wpcf7_strip_quote', $on_sent_ok );
|
83 |
-
} else {
|
84 |
-
$on_sent_ok = null;
|
85 |
-
}
|
86 |
-
$items['onSentOk'] = $on_sent_ok;
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
} else {
|
91 |
-
$items['message'] = wpcf7_get_message( 'mail_sent_ng' );
|
92 |
-
}
|
93 |
-
|
94 |
-
// remove upload files
|
95 |
-
foreach ( (array) $wpcf7_contact_form->uploaded_files as $name => $path ) {
|
96 |
-
@unlink( $path );
|
97 |
-
}
|
98 |
|
99 |
$wpcf7_contact_form = null;
|
100 |
}
|
@@ -109,42 +91,92 @@ function wpcf7_ajax_json_echo() {
|
|
109 |
@header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
|
110 |
echo '<textarea>' . $echo . '</textarea>';
|
111 |
}
|
|
|
|
|
112 |
}
|
113 |
|
114 |
-
|
|
|
|
|
115 |
global $wpcf7_contact_form;
|
116 |
|
117 |
-
if ( ! isset($_POST['_wpcf7'] ) )
|
118 |
return;
|
119 |
|
120 |
$id = (int) $_POST['_wpcf7'];
|
121 |
|
122 |
if ( $wpcf7_contact_form = wpcf7_contact_form( $id ) ) {
|
123 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
$_POST['_wpcf7_mail_sent'] = array( 'id' => $id, 'ok' => false, 'message' => wpcf7_get_message( 'accept_terms' ) );
|
129 |
-
} elseif ( $wpcf7_contact_form->akismet() ) { // Spam!
|
130 |
-
$_POST['_wpcf7_mail_sent'] = array( 'id' => $id, 'ok' => false, 'message' => wpcf7_get_message( 'akismet_says_spam' ), 'spam' => true );
|
131 |
-
} elseif ( $wpcf7_contact_form->mail() ) {
|
132 |
-
$_POST['_wpcf7_mail_sent'] = array( 'id' => $id, 'ok' => true, 'message' => wpcf7_get_message( 'mail_sent_ok' ) );
|
133 |
|
134 |
-
|
|
|
135 |
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
} else {
|
138 |
-
$
|
139 |
}
|
140 |
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
}
|
145 |
|
146 |
-
|
|
|
|
|
147 |
}
|
|
|
|
|
148 |
}
|
149 |
|
150 |
add_action( 'the_post', 'wpcf7_the_post' );
|
@@ -169,38 +201,45 @@ add_filter( 'widget_text', 'wpcf7_widget_text_filter', 9 );
|
|
169 |
function wpcf7_widget_text_filter( $content ) {
|
170 |
global $wpcf7;
|
171 |
|
|
|
|
|
|
|
172 |
$wpcf7->widget_count += 1;
|
173 |
$wpcf7->processing_within = 'w' . $wpcf7->widget_count;
|
174 |
$wpcf7->unit_count = 0;
|
175 |
|
176 |
-
$
|
177 |
-
$content = preg_replace_callback( $regex, 'wpcf7_widget_text_filter_callback', $content );
|
178 |
|
179 |
$wpcf7->processing_within = '';
|
|
|
180 |
return $content;
|
181 |
}
|
182 |
|
183 |
-
|
184 |
-
return do_shortcode( $matches[0] );
|
185 |
-
}
|
186 |
|