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 3.9 3.9-beta 3.9.1 3.9.2 3.9.3 4.0 4.0.1 4.0.2 4.0.3 4.1 4.1-beta 4.1.1 4.1.2 4.2 4.2-beta 4.2.1 4.2.2 4.3 4.3.1 4.4 4.4.1 4.4.2 4.5 4.5.1 4.6 4.6.1 4.7 4.8 4.8.1 4.9 4.9.1 4.9.2 5.0 5.0.1
contact-form-7 / admin / admin-functions.php
contact-form-7 / admin Last commit date
css 11 years ago images 11 years ago includes 11 years ago js 12 years ago admin-functions.php 11 years ago admin.php 11 years ago edit-contact-form.php 11 years ago
admin-functions.php
164 lines
1 <?php
2
3 function wpcf7_current_action() {
4 if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] )
5 return $_REQUEST['action'];
6
7 if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] )
8 return $_REQUEST['action2'];
9
10 return false;
11 }
12
13 function wpcf7_admin_has_edit_cap() {
14 return current_user_can( 'wpcf7_edit_contact_forms' );
15 }
16
17 function wpcf7_add_tag_generator( $name, $title, $elm_id, $callback, $options = array() ) {
18 global $wpcf7_tag_generators;
19
20 $name = trim( $name );
21 if ( '' == $name )
22 return false;
23
24 if ( ! is_array( $wpcf7_tag_generators ) )
25 $wpcf7_tag_generators = array();
26
27 $wpcf7_tag_generators[$name] = array(
28 'title' => $title,
29 'content' => $elm_id,
30 'options' => $options );
31
32 if ( is_callable( $callback ) )
33 add_action( 'wpcf7_admin_footer', $callback );
34
35 return true;
36 }
37
38 function wpcf7_tag_generators() {
39 global $wpcf7_tag_generators;
40
41 $taggenerators = array();
42
43 foreach ( (array) $wpcf7_tag_generators as $name => $tg ) {
44 $taggenerators[$name] = array_merge(
45 (array) $tg['options'],
46 array( 'title' => $tg['title'], 'content' => $tg['content'] ) );
47 }
48
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 ?>