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.1 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 / includes / functions.php
contact-form-7 / includes Last commit date
classes.php 16 years ago formatting.php 16 years ago functions.php 16 years ago pipe.php 16 years ago shortcodes.php 16 years ago
functions.php
173 lines
1 <?php
2
3 function wpcf7_default_message( $status ) {
4 switch ( $status ) {
5 case 'mail_sent_ok':
6 return __( 'Your message was sent successfully. Thanks.', 'wpcf7' );
7 case 'mail_sent_ng':
8 return __( 'Failed to send your message. Please try later or contact administrator by other way.', 'wpcf7' );
9 case 'akismet_says_spam':
10 return __( 'Failed to send your message. Please try later or contact administrator by other way.', 'wpcf7' );
11 case 'validation_error':
12 return __( 'Validation errors occurred. Please confirm the fields and submit it again.', 'wpcf7' );
13 case 'accept_terms':
14 return __( 'Please accept the terms to proceed.', 'wpcf7' );
15 case 'invalid_email':
16 return __( 'Email address seems invalid.', 'wpcf7' );
17 case 'invalid_required':
18 return __( 'Please fill the required field.', 'wpcf7' );
19 case 'captcha_not_match':
20 return __( 'Your entered code is incorrect.', 'wpcf7' );
21 case 'quiz_answer_not_correct':
22 return __( 'Your answer is not correct.', 'wpcf7' );
23 case 'upload_failed':
24 return __( 'Failed to upload file.', 'wpcf7' );
25 case 'upload_file_type_invalid':
26 return __( 'This file type is not allowed.', 'wpcf7' );
27 case 'upload_file_too_large':
28 return __( 'This file is too large.', 'wpcf7' );
29 }
30 }
31
32 function wpcf7_default_form_template() {
33 $template .= '<p>' . __( 'Your Name', 'wpcf7' ) . ' ' . __( '(required)', 'wpcf7' ) . '<br />' . "\n";
34 $template .= ' [text* your-name] </p>' . "\n\n";
35 $template .= '<p>' . __( 'Your Email', 'wpcf7' ) . ' ' . __( '(required)', 'wpcf7' ) . '<br />' . "\n";
36 $template .= ' [email* your-email] </p>' . "\n\n";
37 $template .= '<p>' . __( 'Subject', 'wpcf7' ) . '<br />' . "\n";
38 $template .= ' [text your-subject] </p>' . "\n\n";
39 $template .= '<p>' . __( 'Your Message', 'wpcf7' ) . '<br />' . "\n";
40 $template .= ' [textarea your-message] </p>' . "\n\n";
41 $template .= '<p>[submit "' . __( 'Send', 'wpcf7' ) . '"]</p>';
42 return $template;
43 }
44
45 function wpcf7_default_mail_template() {
46 $subject = '[your-subject]';
47 $sender = '[your-name] <[your-email]>';
48 $body = '[your-message]';
49 $recipient = get_option( 'admin_email' );
50 return compact( 'subject', 'sender', 'body', 'recipient' );
51 }
52
53 function wpcf7_default_mail_2_template() {
54 $active = false;
55 $subject = '[your-subject]';
56 $sender = '[your-name] <[your-email]>';
57 $body = '[your-message]';
58 $recipient = '[your-email]';
59 return compact( 'active', 'subject', 'sender', 'body', 'recipient' );
60 }
61
62 function wpcf7_default_messages_template() {
63 $mail_sent_ok = wpcf7_default_message( 'mail_sent_ok' );
64 $mail_sent_ng = wpcf7_default_message( 'mail_sent_ng' );
65 $akismet_says_spam = wpcf7_default_message( 'akismet_says_spam' );
66 $validation_error = wpcf7_default_message( 'validation_error' );
67 $accept_terms = wpcf7_default_message( 'accept_terms' );
68 $invalid_email = wpcf7_default_message( 'invalid_email' );
69 $invalid_required = wpcf7_default_message( 'invalid_required' );
70 $quiz_answer_not_correct = wpcf7_default_message( 'quiz_answer_not_correct' );
71 $captcha_not_match = wpcf7_default_message( 'captcha_not_match' );
72 $upload_failed = wpcf7_default_message( 'upload_failed' );
73 $upload_file_type_invalid = wpcf7_default_message( 'upload_file_type_invalid' );
74 $upload_file_too_large = wpcf7_default_message( 'upload_file_too_large' );
75
76 return compact( 'mail_sent_ok', 'mail_sent_ng', 'akismet_says_spam',
77 'validation_error', 'accept_terms', 'invalid_email', 'invalid_required', 'quiz_answer_not_correct',
78 'captcha_not_match', 'upload_failed', 'upload_file_type_invalid', 'upload_file_too_large' );
79 }
80
81 function wpcf7_upload_dir( $type = false ) {
82 $siteurl = get_option( 'siteurl' );
83 $upload_path = trim( get_option( 'upload_path' ) );
84 if ( empty( $upload_path ) )
85 $dir = WP_CONTENT_DIR . '/uploads';
86 else
87 $dir = $upload_path;
88
89 $dir = path_join( ABSPATH, $dir );
90
91 if ( ! $url = get_option( 'upload_url_path' ) ) {
92 if ( empty( $upload_path ) || $upload_path == $dir )
93 $url = WP_CONTENT_URL . '/uploads';
94 else
95 $url = trailingslashit( $siteurl ) . $upload_path;
96 }
97
98 if ( defined( 'UPLOADS' ) ) {
99 $dir = ABSPATH . UPLOADS;
100 $url = trailingslashit( $siteurl ) . UPLOADS;
101 }
102
103 if ( 'dir' == $type )
104 return $dir;
105 if ( 'url' == $type )
106 return $url;
107 return array( 'dir' => $dir, 'url' => $url );
108 }
109
110 function wpcf7_captcha_tmp_dir() {
111 if ( defined( 'WPCF7_CAPTCHA_TMP_DIR' ) )
112 return WPCF7_CAPTCHA_TMP_DIR;
113 else
114 return wpcf7_upload_dir( 'dir' ) . '/wpcf7_captcha';
115 }
116
117 function wpcf7_captcha_tmp_url() {
118 if ( defined( 'WPCF7_CAPTCHA_TMP_URL' ) )
119 return WPCF7_CAPTCHA_TMP_URL;
120 else
121 return wpcf7_upload_dir( 'url' ) . '/wpcf7_captcha';
122 }
123
124 function wpcf7_upload_tmp_dir() {
125 if ( defined( 'WPCF7_UPLOADS_TMP_DIR' ) )
126 return WPCF7_UPLOADS_TMP_DIR;
127 else
128 return wpcf7_upload_dir( 'dir' ) . '/wpcf7_uploads';
129 }
130
131 function wpcf7_json( $items ) {
132 if ( is_array( $items ) ) {
133 if ( empty( $items ) )
134 return 'null';
135
136 $keys = array_keys( $items );
137 $all_int = true;
138 foreach ( $keys as $key ) {
139 if ( ! is_int( $key ) ) {
140 $all_int = false;
141 break;
142 }
143 }
144
145 if ( $all_int ) {
146 $children = array();
147 foreach ( $items as $item ) {
148 $children[] = wpcf7_json( $item );
149 }
150 return '[' . join( ', ', $children ) . ']';
151 } else { // Object
152 $children = array();
153 foreach ( $items as $key => $item ) {
154 $key = esc_js( (string) $key );
155 if ( preg_match( '/[^a-zA-Z]/', $key ) )
156 $key = '"' . $key . '"';
157
158 $children[] = $key . ': ' . wpcf7_json( $item );
159 }
160 return '{ ' . join( ', ', $children ) . ' }';
161 }
162 } elseif ( is_numeric( $items ) ) {
163 return (string) $items;
164 } elseif ( is_bool( $items ) ) {
165 return $items ? '1' : '0';
166 } elseif ( is_null( $items ) ) {
167 return 'null';
168 } else {
169 return '"' . esc_js( (string) $items ) . '"';
170 }
171 }
172
173 ?>