Version Description
Download this release
Release Info
Developer | takayukister |
Plugin | Contact Form 7 |
Version | 1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1 to 1.2
- README.txt +9 -4
- admin-stylesheet.css +8 -9
- includes/admin-panel.php +35 -39
- languages/wpcf7-ja.mo +0 -0
- languages/wpcf7-ja.po +32 -35
- stylesheet.css +28 -0
- wp-contact-form-7.php +173 -31
README.txt
CHANGED
@@ -1,20 +1,25 @@
|
|
1 |
=== Contact Form 7 ===
|
2 |
Contributors: takayukister
|
3 |
-
Tags: contact form, email
|
4 |
-
Requires at least: 2.
|
5 |
Tested up to: 2.3-alpha
|
6 |
-
Stable tag: 1.
|
7 |
|
8 |
Just another contact form plugin. Simple but flexible.
|
9 |
|
10 |
== Description ==
|
11 |
|
|
|
|
|
12 |
* Supports multiple contact forms.
|
13 |
* You can customize form and mail contents with simple markup.
|
14 |
-
*
|
15 |
|
16 |
== Installation ==
|
17 |
|
18 |
1. Upload whole `contact-form-7` folder to the `/wp-content/plugins/` directory
|
19 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
20 |
|
|
|
|
|
|
1 |
=== Contact Form 7 ===
|
2 |
Contributors: takayukister
|
3 |
+
Tags: contact form, email, ajax
|
4 |
+
Requires at least: 2.2
|
5 |
Tested up to: 2.3-alpha
|
6 |
+
Stable tag: 1.2
|
7 |
|
8 |
Just another contact form plugin. Simple but flexible.
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
+
Just another contact form plugin. Simple but flexible.
|
13 |
+
|
14 |
* Supports multiple contact forms.
|
15 |
* You can customize form and mail contents with simple markup.
|
16 |
+
* Client side validation and AJAX submitting with jQuery Form Plugin.
|
17 |
|
18 |
== Installation ==
|
19 |
|
20 |
1. Upload whole `contact-form-7` folder to the `/wp-content/plugins/` directory
|
21 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
22 |
|
23 |
+
== Screenshots ==
|
24 |
+
|
25 |
+
1. screenshot-1.jpg
|
admin-stylesheet.css
CHANGED
@@ -29,7 +29,7 @@ ul.cfmenu a:hover {
|
|
29 |
}
|
30 |
div.cfdiv {
|
31 |
margin: 0;
|
32 |
-
padding:
|
33 |
}
|
34 |
input.cfsave {
|
35 |
font-weight: bold;
|
@@ -48,18 +48,18 @@ input#contact-form-anchor-text {
|
|
48 |
border: 1px solid #eba80e;
|
49 |
font-family: monospace;
|
50 |
}
|
51 |
-
fieldset {
|
52 |
-
|
53 |
-
margin: 1em 1em 1em 0;
|
54 |
}
|
55 |
-
fieldset legend {
|
56 |
font-weight: bolder;
|
|
|
57 |
}
|
58 |
input.wide {
|
59 |
-
width:
|
60 |
}
|
61 |
textarea {
|
62 |
-
width:
|
63 |
}
|
64 |
p.submit {
|
65 |
margin: 0 24px;
|
@@ -71,10 +71,9 @@ input.quick-button {
|
|
71 |
}
|
72 |
div#quick-panel {
|
73 |
display: none;
|
74 |
-
border: 1px dotted #ccc;
|
75 |
margin: 0 0 4px;
|
76 |
padding: 4px;
|
77 |
-
width:
|
78 |
background: #aaecf5;
|
79 |
}
|
80 |
div#quick-panel div.close {
|
29 |
}
|
30 |
div.cfdiv {
|
31 |
margin: 0;
|
32 |
+
padding: 24px;
|
33 |
}
|
34 |
input.cfsave {
|
35 |
font-weight: bold;
|
48 |
border: 1px solid #eba80e;
|
49 |
font-family: monospace;
|
50 |
}
|
51 |
+
div.fieldset {
|
52 |
+
margin: 1.5em 0;
|
|
|
53 |
}
|
54 |
+
div.fieldset div.legend {
|
55 |
font-weight: bolder;
|
56 |
+
margin-bottom: 0.5em;
|
57 |
}
|
58 |
input.wide {
|
59 |
+
width: 99%;
|
60 |
}
|
61 |
textarea {
|
62 |
+
width: 99%;
|
63 |
}
|
64 |
p.submit {
|
65 |
margin: 0 24px;
|
71 |
}
|
72 |
div#quick-panel {
|
73 |
display: none;
|
|
|
74 |
margin: 0 0 4px;
|
75 |
padding: 4px;
|
76 |
+
width: 99%;
|
77 |
background: #aaecf5;
|
78 |
}
|
79 |
div#quick-panel div.close {
|
includes/admin-panel.php
CHANGED
@@ -30,7 +30,7 @@
|
|
30 |
<form method="post" action="<?php echo $base_url . '&contactform=' . $current; ?>" id="wpcf7-admin-form-element">
|
31 |
<input type="hidden" name="wpcf7-id" value="<?php echo $current; ?>" />
|
32 |
|
33 |
-
<fieldset>
|
34 |
<label for="wpcf7-title"><?php _e('Title', 'wpcf7'); ?></label>
|
35 |
<input type="text" id="wpcf7-title" name="wpcf7-title" size="40" value="<?php echo htmlspecialchars($cf['title']); ?>" onchange="update_anchor(this.value);" />
|
36 |
|
@@ -40,9 +40,9 @@
|
|
40 |
<input type="text" id="contact-form-anchor-text" size="50" onfocus="this.select();" readonly="readonly" />
|
41 |
</p>
|
42 |
<?php endif; ?>
|
43 |
-
</
|
44 |
|
45 |
-
<fieldset><legend><?php _e('Form content', 'wpcf7'); ?></
|
46 |
<input type="button" value="text" class="quick-button" onclick="quick_panel('text');" />
|
47 |
<input type="button" value="text*" class="quick-button" onclick="quick_panel('text*');" />
|
48 |
<input type="button" value="email" class="quick-button" onclick="quick_panel('email');" />
|
@@ -52,21 +52,21 @@
|
|
52 |
<input type="button" value="submit" class="quick-button" onclick="quick_panel('submit');" />
|
53 |
<div id="quick-panel"></div>
|
54 |
<textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="16"><?php echo htmlspecialchars($cf['form']); ?></textarea>
|
55 |
-
</
|
56 |
|
57 |
-
<fieldset><legend><?php _e('Mail template', 'wpcf7'); ?></
|
58 |
<label for="wpcf7-mail-subject"><?php _e('Subject field:', 'wpcf7'); ?></label><br />
|
59 |
<input type="text" id="wpcf7-mail-subject" name="wpcf7-mail-subject" class="wide" size="70" value="<?php echo htmlspecialchars($cf['mail']['subject']); ?>" /><br />
|
60 |
<label for="wpcf7-mail-sender"><?php _e('Sender field:', 'wpcf7'); ?></label><br />
|
61 |
<input type="text" id="wpcf7-mail-sender" name="wpcf7-mail-sender" class="wide" size="70" value="<?php echo htmlspecialchars($cf['mail']['sender']); ?>" /><br />
|
62 |
<label for="wpcf7-mail-body"><?php _e('Message body:', 'wpcf7'); ?></label><br />
|
63 |
<textarea id="wpcf7-mail-body" name="wpcf7-mail-body" cols="100" rows="16"><?php echo htmlspecialchars($cf['mail']['body']); ?></textarea>
|
64 |
-
</
|
65 |
|
66 |
-
<fieldset><legend><?php _e('Options', 'wpcf7'); ?></
|
67 |
<label for="wpcf7-options-recipient"><?php _e('Recipient address:', 'wpcf7'); ?></label><br />
|
68 |
<input type="text" id="wpcf7-options-recipient" name="wpcf7-options-recipient" class="wide" size="70" value="<?php echo htmlspecialchars($cf['options']['recipient']); ?>" />
|
69 |
-
</
|
70 |
|
71 |
<p class="submit">
|
72 |
<input type="submit" class="cfsave" name="wpcf7-save" value="<?php _e('Save', 'wpcf7'); ?>" />
|
@@ -107,9 +107,7 @@
|
|
107 |
+ '<td>maxlength= <input type="text" name="qp-maxlength" onchange="create_tag();" /></td></tr>'
|
108 |
+ '<tr><td>id= <input type="text" name="qp-id" onchange="create_tag();" /></td>'
|
109 |
+ '<td>class= <input type="text" name="qp-class" onchange="create_tag();" /></td></tr>'
|
110 |
-
+ '<tr><td><?php _e('Label', 'wpcf7'); ?> <input type="text" name="qp-label" onchange="create_tag();" /></td>'
|
111 |
+ '<td><?php _e('Default value', 'wpcf7'); ?> <input type="text" name="qp-default" onchange="create_tag();" /></td></tr>'
|
112 |
-
+ '<tr><td><?php _e('Create <label> for this ?', 'wpcf7'); ?> <input type="checkbox" name="qp-label-tag" value="1" onchange="create_tag();" /></td></tr>'
|
113 |
+ '</tbody></table>';
|
114 |
break;
|
115 |
case 'textarea':
|
@@ -120,9 +118,7 @@
|
|
120 |
+ '<td>rows= <input type="text" name="qp-rows" onchange="create_tag();" /></td></tr>'
|
121 |
+ '<tr><td>id= <input type="text" name="qp-id" onchange="create_tag();" /></td>'
|
122 |
+ '<td>class= <input type="text" name="qp-class" onchange="create_tag();" /></td></tr>'
|
123 |
-
+ '<tr><td><?php _e('Label', 'wpcf7'); ?> <input type="text" name="qp-label" onchange="create_tag();" /></td>'
|
124 |
+ '<td><?php _e('Default value', 'wpcf7'); ?> <input type="text" name="qp-default" onchange="create_tag();" /></td></tr>'
|
125 |
-
+ '<tr><td><?php _e('Create <label> for this ?', 'wpcf7'); ?> <input type="checkbox" name="qp-label-tag" value="1" onchange="create_tag();" /></td></tr>'
|
126 |
+ '</tbody></table>';
|
127 |
break;
|
128 |
case 'submit':
|
@@ -173,11 +169,7 @@
|
|
173 |
tag += ' ' + name.value;
|
174 |
}
|
175 |
|
176 |
-
var
|
177 |
-
if (label && '' != label.value)
|
178 |
-
tag += ' ' + wrap_quote(label.value);
|
179 |
-
else if (! initial)
|
180 |
-
tag += ' ""';
|
181 |
|
182 |
if (/^(text[*]?|email[*]?)$/.test(type)) {
|
183 |
|
@@ -187,12 +179,16 @@
|
|
187 |
var maxlength = form.elements['qp-maxlength'];
|
188 |
if (maxlength)
|
189 |
maxlength.value = integer(maxlength.value);
|
190 |
-
if (size && '' != size.value && maxlength && '' != maxlength.value)
|
191 |
tag += ' ' + size.value + '/' + maxlength.value;
|
192 |
-
|
|
|
193 |
tag += ' ' + size.value + '/';
|
194 |
-
|
|
|
195 |
tag += ' ' + '/' + maxlength.value;
|
|
|
|
|
196 |
|
197 |
} else if (/^textarea[*]?$/.test(type)) {
|
198 |
|
@@ -202,20 +198,26 @@
|
|
202 |
var rows = form.elements['qp-rows'];
|
203 |
if (rows)
|
204 |
rows.value = integer(rows.value);
|
205 |
-
if (cols && '' != cols.value && rows && '' != rows.value)
|
206 |
tag += ' ' + cols.value + 'x' + rows.value;
|
207 |
-
|
|
|
208 |
tag += ' ' + cols.value + 'x';
|
209 |
-
|
|
|
210 |
tag += ' ' + 'x' + rows.value;
|
|
|
|
|
211 |
|
212 |
}
|
213 |
|
214 |
var id = form.elements['qp-id'];
|
215 |
if (id) {
|
216 |
id.value = cdata(id.value);
|
217 |
-
if ('' != id.value)
|
218 |
tag += ' id:' + id.value;
|
|
|
|
|
219 |
}
|
220 |
|
221 |
var klass = form.elements['qp-class'];
|
@@ -223,29 +225,23 @@
|
|
223 |
var klass_list = klass.value.split(' ');
|
224 |
for (var i = 0; i < klass_list.length; i++) {
|
225 |
var klass_value = cdata(klass_list[i]);
|
226 |
-
if ('' != klass_value)
|
227 |
tag += ' class:' + klass_value;
|
|
|
|
|
228 |
}
|
229 |
}
|
230 |
|
231 |
var default_value = form.elements['qp-default'];
|
232 |
-
if (default_value && '' != default_value.value)
|
233 |
-
|
|
|
|
|
|
|
|
|
234 |
}
|
235 |
|
236 |
tag += ']';
|
237 |
-
|
238 |
-
var label_tag = form.elements['qp-label-tag'];
|
239 |
-
if (label_tag && label_tag.checked) {
|
240 |
-
var required = (-1 != type.indexOf('*')) ? ' (*)' : '';
|
241 |
-
var label_text = (label && '' != label.value) ? (label.value + required) : '';
|
242 |
-
|
243 |
-
if (id && '' != id.value)
|
244 |
-
tag = '<label for="' + id.value + '">' + label_text + '</label> ' + tag;
|
245 |
-
else
|
246 |
-
tag = '<label>' + label_text + ' ' + tag + ' </label>';
|
247 |
-
}
|
248 |
-
|
249 |
insert.value = tag;
|
250 |
}
|
251 |
|
30 |
<form method="post" action="<?php echo $base_url . '&contactform=' . $current; ?>" id="wpcf7-admin-form-element">
|
31 |
<input type="hidden" name="wpcf7-id" value="<?php echo $current; ?>" />
|
32 |
|
33 |
+
<div class="fieldset">
|
34 |
<label for="wpcf7-title"><?php _e('Title', 'wpcf7'); ?></label>
|
35 |
<input type="text" id="wpcf7-title" name="wpcf7-title" size="40" value="<?php echo htmlspecialchars($cf['title']); ?>" onchange="update_anchor(this.value);" />
|
36 |
|
40 |
<input type="text" id="contact-form-anchor-text" size="50" onfocus="this.select();" readonly="readonly" />
|
41 |
</p>
|
42 |
<?php endif; ?>
|
43 |
+
</div>
|
44 |
|
45 |
+
<div class="fieldset"><div class="legend"><?php _e('Form content', 'wpcf7'); ?></div>
|
46 |
<input type="button" value="text" class="quick-button" onclick="quick_panel('text');" />
|
47 |
<input type="button" value="text*" class="quick-button" onclick="quick_panel('text*');" />
|
48 |
<input type="button" value="email" class="quick-button" onclick="quick_panel('email');" />
|
52 |
<input type="button" value="submit" class="quick-button" onclick="quick_panel('submit');" />
|
53 |
<div id="quick-panel"></div>
|
54 |
<textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="16"><?php echo htmlspecialchars($cf['form']); ?></textarea>
|
55 |
+
</div>
|
56 |
|
57 |
+
<div class="fieldset"><div class="legend"><?php _e('Mail template', 'wpcf7'); ?></div>
|
58 |
<label for="wpcf7-mail-subject"><?php _e('Subject field:', 'wpcf7'); ?></label><br />
|
59 |
<input type="text" id="wpcf7-mail-subject" name="wpcf7-mail-subject" class="wide" size="70" value="<?php echo htmlspecialchars($cf['mail']['subject']); ?>" /><br />
|
60 |
<label for="wpcf7-mail-sender"><?php _e('Sender field:', 'wpcf7'); ?></label><br />
|
61 |
<input type="text" id="wpcf7-mail-sender" name="wpcf7-mail-sender" class="wide" size="70" value="<?php echo htmlspecialchars($cf['mail']['sender']); ?>" /><br />
|
62 |
<label for="wpcf7-mail-body"><?php _e('Message body:', 'wpcf7'); ?></label><br />
|
63 |
<textarea id="wpcf7-mail-body" name="wpcf7-mail-body" cols="100" rows="16"><?php echo htmlspecialchars($cf['mail']['body']); ?></textarea>
|
64 |
+
</div>
|
65 |
|
66 |
+
<div class="fieldset"><div class="legend"><?php _e('Options', 'wpcf7'); ?></div>
|
67 |
<label for="wpcf7-options-recipient"><?php _e('Recipient address:', 'wpcf7'); ?></label><br />
|
68 |
<input type="text" id="wpcf7-options-recipient" name="wpcf7-options-recipient" class="wide" size="70" value="<?php echo htmlspecialchars($cf['options']['recipient']); ?>" />
|
69 |
+
</div>
|
70 |
|
71 |
<p class="submit">
|
72 |
<input type="submit" class="cfsave" name="wpcf7-save" value="<?php _e('Save', 'wpcf7'); ?>" />
|
107 |
+ '<td>maxlength= <input type="text" name="qp-maxlength" onchange="create_tag();" /></td></tr>'
|
108 |
+ '<tr><td>id= <input type="text" name="qp-id" onchange="create_tag();" /></td>'
|
109 |
+ '<td>class= <input type="text" name="qp-class" onchange="create_tag();" /></td></tr>'
|
|
|
110 |
+ '<td><?php _e('Default value', 'wpcf7'); ?> <input type="text" name="qp-default" onchange="create_tag();" /></td></tr>'
|
|
|
111 |
+ '</tbody></table>';
|
112 |
break;
|
113 |
case 'textarea':
|
118 |
+ '<td>rows= <input type="text" name="qp-rows" onchange="create_tag();" /></td></tr>'
|
119 |
+ '<tr><td>id= <input type="text" name="qp-id" onchange="create_tag();" /></td>'
|
120 |
+ '<td>class= <input type="text" name="qp-class" onchange="create_tag();" /></td></tr>'
|
|
|
121 |
+ '<td><?php _e('Default value', 'wpcf7'); ?> <input type="text" name="qp-default" onchange="create_tag();" /></td></tr>'
|
|
|
122 |
+ '</tbody></table>';
|
123 |
break;
|
124 |
case 'submit':
|
169 |
tag += ' ' + name.value;
|
170 |
}
|
171 |
|
172 |
+
var has_option = 0;
|
|
|
|
|
|
|
|
|
173 |
|
174 |
if (/^(text[*]?|email[*]?)$/.test(type)) {
|
175 |
|
179 |
var maxlength = form.elements['qp-maxlength'];
|
180 |
if (maxlength)
|
181 |
maxlength.value = integer(maxlength.value);
|
182 |
+
if (size && '' != size.value && maxlength && '' != maxlength.value) {
|
183 |
tag += ' ' + size.value + '/' + maxlength.value;
|
184 |
+
has_option = 1;
|
185 |
+
} else if (size && '' != size.value) {
|
186 |
tag += ' ' + size.value + '/';
|
187 |
+
has_option = 1;
|
188 |
+
} else if (maxlength && '' != maxlength.value) {
|
189 |
tag += ' ' + '/' + maxlength.value;
|
190 |
+
has_option = 1;
|
191 |
+
}
|
192 |
|
193 |
} else if (/^textarea[*]?$/.test(type)) {
|
194 |
|
198 |
var rows = form.elements['qp-rows'];
|
199 |
if (rows)
|
200 |
rows.value = integer(rows.value);
|
201 |
+
if (cols && '' != cols.value && rows && '' != rows.value) {
|
202 |
tag += ' ' + cols.value + 'x' + rows.value;
|
203 |
+
has_option = 1;
|
204 |
+
} else if (cols && '' != cols.value) {
|
205 |
tag += ' ' + cols.value + 'x';
|
206 |
+
has_option = 1;
|
207 |
+
} else if (rows && '' != rows.value) {
|
208 |
tag += ' ' + 'x' + rows.value;
|
209 |
+
has_option = 1;
|
210 |
+
}
|
211 |
|
212 |
}
|
213 |
|
214 |
var id = form.elements['qp-id'];
|
215 |
if (id) {
|
216 |
id.value = cdata(id.value);
|
217 |
+
if ('' != id.value) {
|
218 |
tag += ' id:' + id.value;
|
219 |
+
has_option = 1;
|
220 |
+
}
|
221 |
}
|
222 |
|
223 |
var klass = form.elements['qp-class'];
|
225 |
var klass_list = klass.value.split(' ');
|
226 |
for (var i = 0; i < klass_list.length; i++) {
|
227 |
var klass_value = cdata(klass_list[i]);
|
228 |
+
if ('' != klass_value) {
|
229 |
tag += ' class:' + klass_value;
|
230 |
+
has_option = 1;
|
231 |
+
}
|
232 |
}
|
233 |
}
|
234 |
|
235 |
var default_value = form.elements['qp-default'];
|
236 |
+
if (default_value && '' != default_value.value) {
|
237 |
+
if (has_option)
|
238 |
+
tag += ' ' + wrap_quote(default_value.value);
|
239 |
+
else
|
240 |
+
tag += ' default ' + wrap_quote(default_value.value);
|
241 |
+
}
|
242 |
}
|
243 |
|
244 |
tag += ']';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
insert.value = tag;
|
246 |
}
|
247 |
|
languages/wpcf7-ja.mo
CHANGED
Binary file
|
languages/wpcf7-ja.po
CHANGED
@@ -2,7 +2,7 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: WP Contact Form 7\n"
|
4 |
"POT-Creation-Date: \n"
|
5 |
-
"PO-Revision-Date: 2007-08-
|
6 |
"Last-Translator: Takayuki Miyoshi <takayukister@gmail.com>\n"
|
7 |
"Language-Team: Takayuki Miyoshi <takayukister@gmail.com>\n"
|
8 |
"MIME-Version: 1.0\n"
|
@@ -15,75 +15,79 @@ msgstr ""
|
|
15 |
"X-Poedit-Basepath: ../..\n"
|
16 |
"X-Poedit-SearchPath-0: contact-form-7\n"
|
17 |
|
18 |
-
#: contact-form-7/wp-contact-form-7.php:
|
19 |
-
#: contact-form-7/wp-contact-form-7.php:
|
20 |
msgid "Contact form"
|
21 |
msgstr "コンタクトフォーム"
|
22 |
|
23 |
-
#: contact-form-7/wp-contact-form-7.php:
|
24 |
#: contact-form-7/includes/admin-panel.php:5
|
25 |
msgid "Contact Form 7"
|
26 |
msgstr "Contact Form 7"
|
27 |
|
28 |
-
#: contact-form-7/wp-contact-form-7.php:
|
29 |
#, php-format
|
30 |
msgid "Contact form \"%s\" deleted. "
|
31 |
msgstr "コンタクトフォーム \"%s\" が削除されました。"
|
32 |
|
33 |
-
#: contact-form-7/wp-contact-form-7.php:
|
34 |
#, php-format
|
35 |
msgid "Contact form \"%s\" saved. "
|
36 |
msgstr "コンタクトフォーム \"%s\" が保存されました。"
|
37 |
|
38 |
-
#: contact-form-7/wp-contact-form-7.php:
|
39 |
-
#: contact-form-7/wp-contact-form-7.php:146
|
40 |
msgid "Your Name"
|
41 |
msgstr "お名前"
|
42 |
|
43 |
-
#: contact-form-7/wp-contact-form-7.php:
|
44 |
-
#: contact-form-7/wp-contact-form-7.php:
|
45 |
msgid "(required)"
|
46 |
msgstr "(必須)"
|
47 |
|
48 |
-
#: contact-form-7/wp-contact-form-7.php:
|
49 |
-
#: contact-form-7/wp-contact-form-7.php:148
|
50 |
msgid "Your Email"
|
51 |
msgstr "メールアドレス"
|
52 |
|
53 |
-
#: contact-form-7/wp-contact-form-7.php:
|
54 |
-
#: contact-form-7/wp-contact-form-7.php:150
|
55 |
msgid "Subject"
|
56 |
msgstr "題名"
|
57 |
|
58 |
-
#: contact-form-7/wp-contact-form-7.php:
|
59 |
-
#: contact-form-7/wp-contact-form-7.php:152
|
60 |
msgid "Your Message"
|
61 |
msgstr "メッセージ本文"
|
62 |
|
63 |
-
#: contact-form-7/wp-contact-form-7.php:
|
64 |
-
#: contact-form-7/wp-contact-form-7.php:
|
65 |
msgid "Send"
|
66 |
msgstr "送信"
|
67 |
|
68 |
-
#: contact-form-7/wp-contact-form-7.php:
|
69 |
-
#: contact-form-7/wp-contact-form-7.php:
|
70 |
#, php-format
|
71 |
msgid "Please fill the required field: %s "
|
72 |
msgstr "必須項目に記入もれがあります: %s"
|
73 |
|
74 |
-
#: contact-form-7/wp-contact-form-7.php:
|
75 |
#, php-format
|
76 |
msgid "Email address seems invalid: %s "
|
77 |
msgstr "メールアドレスの形式が正しくないようです: %s "
|
78 |
|
79 |
-
#: contact-form-7/wp-contact-form-7.php:
|
80 |
msgid "Your message was sent successfully. Thanks."
|
81 |
msgstr "あなたのメッセージは送信されました。ありがとうございました。"
|
82 |
|
83 |
-
#: contact-form-7/wp-contact-form-7.php:
|
84 |
msgid "Failed to send your message. Please try later or contact administrator by other way."
|
85 |
msgstr "メッセージの送信に失敗しました。間をおいてもう一度お試しいただくか、別の手段で管理者にお問い合わせ下さい。"
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
#: contact-form-7/includes/admin-panel.php:19
|
88 |
#: contact-form-7/includes/admin-panel.php:22
|
89 |
msgid "Add new"
|
@@ -142,22 +146,15 @@ msgstr ""
|
|
142 |
" 'キャンセル' で中止、 'OK' で削除します。"
|
143 |
|
144 |
#: contact-form-7/includes/admin-panel.php:110
|
145 |
-
#: contact-form-7/includes/admin-panel.php:
|
146 |
-
#: contact-form-7/includes/admin-panel.php:130
|
147 |
-
msgid "Label"
|
148 |
-
msgstr "ラベル"
|
149 |
-
|
150 |
-
#: contact-form-7/includes/admin-panel.php:111
|
151 |
-
#: contact-form-7/includes/admin-panel.php:124
|
152 |
msgid "Default value"
|
153 |
msgstr "デフォルト値"
|
154 |
|
155 |
-
#: contact-form-7/includes/admin-panel.php:
|
156 |
-
|
157 |
-
|
158 |
-
msgstr "このフィールドのための <label> タグを作成しますか?"
|
159 |
|
160 |
-
#: contact-form-7/includes/admin-panel.php:
|
161 |
msgid "Insert"
|
162 |
msgstr "挿入"
|
163 |
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: WP Contact Form 7\n"
|
4 |
"POT-Creation-Date: \n"
|
5 |
+
"PO-Revision-Date: 2007-08-16 19:20+0900\n"
|
6 |
"Last-Translator: Takayuki Miyoshi <takayukister@gmail.com>\n"
|
7 |
"Language-Team: Takayuki Miyoshi <takayukister@gmail.com>\n"
|
8 |
"MIME-Version: 1.0\n"
|
15 |
"X-Poedit-Basepath: ../..\n"
|
16 |
"X-Poedit-SearchPath-0: contact-form-7\n"
|
17 |
|
18 |
+
#: contact-form-7/wp-contact-form-7.php:88
|
19 |
+
#: contact-form-7/wp-contact-form-7.php:161
|
20 |
msgid "Contact form"
|
21 |
msgstr "コンタクトフォーム"
|
22 |
|
23 |
+
#: contact-form-7/wp-contact-form-7.php:117
|
24 |
#: contact-form-7/includes/admin-panel.php:5
|
25 |
msgid "Contact Form 7"
|
26 |
msgstr "Contact Form 7"
|
27 |
|
28 |
+
#: contact-form-7/wp-contact-form-7.php:137
|
29 |
#, php-format
|
30 |
msgid "Contact form \"%s\" deleted. "
|
31 |
msgstr "コンタクトフォーム \"%s\" が削除されました。"
|
32 |
|
33 |
+
#: contact-form-7/wp-contact-form-7.php:153
|
34 |
#, php-format
|
35 |
msgid "Contact form \"%s\" saved. "
|
36 |
msgstr "コンタクトフォーム \"%s\" が保存されました。"
|
37 |
|
38 |
+
#: contact-form-7/wp-contact-form-7.php:182
|
|
|
39 |
msgid "Your Name"
|
40 |
msgstr "お名前"
|
41 |
|
42 |
+
#: contact-form-7/wp-contact-form-7.php:182
|
43 |
+
#: contact-form-7/wp-contact-form-7.php:184
|
44 |
msgid "(required)"
|
45 |
msgstr "(必須)"
|
46 |
|
47 |
+
#: contact-form-7/wp-contact-form-7.php:184
|
|
|
48 |
msgid "Your Email"
|
49 |
msgstr "メールアドレス"
|
50 |
|
51 |
+
#: contact-form-7/wp-contact-form-7.php:186
|
|
|
52 |
msgid "Subject"
|
53 |
msgstr "題名"
|
54 |
|
55 |
+
#: contact-form-7/wp-contact-form-7.php:188
|
|
|
56 |
msgid "Your Message"
|
57 |
msgstr "メッセージ本文"
|
58 |
|
59 |
+
#: contact-form-7/wp-contact-form-7.php:190
|
60 |
+
#: contact-form-7/wp-contact-form-7.php:514
|
61 |
msgid "Send"
|
62 |
msgstr "送信"
|
63 |
|
64 |
+
#: contact-form-7/wp-contact-form-7.php:296
|
65 |
+
#: contact-form-7/wp-contact-form-7.php:303
|
66 |
#, php-format
|
67 |
msgid "Please fill the required field: %s "
|
68 |
msgstr "必須項目に記入もれがあります: %s"
|
69 |
|
70 |
+
#: contact-form-7/wp-contact-form-7.php:306
|
71 |
#, php-format
|
72 |
msgid "Email address seems invalid: %s "
|
73 |
msgstr "メールアドレスの形式が正しくないようです: %s "
|
74 |
|
75 |
+
#: contact-form-7/wp-contact-form-7.php:315
|
76 |
msgid "Your message was sent successfully. Thanks."
|
77 |
msgstr "あなたのメッセージは送信されました。ありがとうございました。"
|
78 |
|
79 |
+
#: contact-form-7/wp-contact-form-7.php:317
|
80 |
msgid "Failed to send your message. Please try later or contact administrator by other way."
|
81 |
msgstr "メッセージの送信に失敗しました。間をおいてもう一度お試しいただくか、別の手段で管理者にお問い合わせ下さい。"
|
82 |
|
83 |
+
#: contact-form-7/wp-contact-form-7.php:361
|
84 |
+
msgid "Email address seems invalid."
|
85 |
+
msgstr "メールアドレスの形式が正しくないようです。"
|
86 |
+
|
87 |
+
#: contact-form-7/wp-contact-form-7.php:368
|
88 |
+
msgid "Please fill the required field."
|
89 |
+
msgstr "必須項目に記入もれがあります。"
|
90 |
+
|
91 |
#: contact-form-7/includes/admin-panel.php:19
|
92 |
#: contact-form-7/includes/admin-panel.php:22
|
93 |
msgid "Add new"
|
146 |
" 'キャンセル' で中止、 'OK' で削除します。"
|
147 |
|
148 |
#: contact-form-7/includes/admin-panel.php:110
|
149 |
+
#: contact-form-7/includes/admin-panel.php:121
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
msgid "Default value"
|
151 |
msgstr "デフォルト値"
|
152 |
|
153 |
+
#: contact-form-7/includes/admin-panel.php:126
|
154 |
+
msgid "Label"
|
155 |
+
msgstr "ラベル"
|
|
|
156 |
|
157 |
+
#: contact-form-7/includes/admin-panel.php:133
|
158 |
msgid "Insert"
|
159 |
msgstr "挿入"
|
160 |
|
stylesheet.css
CHANGED
@@ -2,6 +2,10 @@ div.wpcf7 {
|
|
2 |
padding: 1em 0;
|
3 |
}
|
4 |
|
|
|
|
|
|
|
|
|
5 |
div.wpcf7-mail-sent-ok {
|
6 |
border: 1px solid #398f14;
|
7 |
padding: 0.2em 1em;
|
@@ -15,4 +19,28 @@ div.wpcf7-mail-sent-ng {
|
|
15 |
div.wpcf7-validation-errors {
|
16 |
border: 1px solid #f7e700;
|
17 |
padding: 0.2em 1em;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
2 |
padding: 1em 0;
|
3 |
}
|
4 |
|
5 |
+
div#wpcf7-response-output {
|
6 |
+
margin: 0.5em;
|
7 |
+
}
|
8 |
+
|
9 |
div.wpcf7-mail-sent-ok {
|
10 |
border: 1px solid #398f14;
|
11 |
padding: 0.2em 1em;
|
19 |
div.wpcf7-validation-errors {
|
20 |
border: 1px solid #f7e700;
|
21 |
padding: 0.2em 1em;
|
22 |
+
}
|
23 |
+
|
24 |
+
span.wpcf7-not-valid-tip {
|
25 |
+
position: absolute;
|
26 |
+
top: 20%;
|
27 |
+
left: 20%;
|
28 |
+
z-index: 100;
|
29 |
+
background: #fff;
|
30 |
+
border: 1px solid #ff0000;
|
31 |
+
font-size: 10pt;
|
32 |
+
width: 280px;
|
33 |
+
padding: 2px;
|
34 |
+
}
|
35 |
+
|
36 |
+
input.wpcf7-email-not-valid {
|
37 |
+
}
|
38 |
+
|
39 |
+
input.wpcf7-required-not-valid {
|
40 |
+
}
|
41 |
+
|
42 |
+
textarea.wpcf7-email-not-valid {
|
43 |
+
}
|
44 |
+
|
45 |
+
textarea.wpcf7-required-not-valid {
|
46 |
}
|
wp-contact-form-7.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Contact Form 7
|
|
4 |
Plugin URI: http://ideasilo.wordpress.com/2007/04/30/contact-form-7/
|
5 |
Description: Just another contact form plugin. Simple but flexible.
|
6 |
Author: Takayuki Miyoshi
|
7 |
-
Version: 1.
|
8 |
Author URI: http://ideasilo.wordpress.com/
|
9 |
*/
|
10 |
|
@@ -35,9 +35,46 @@ class tam_contact_form_seven {
|
|
35 |
add_action('admin_menu', array(&$this, 'add_pages'));
|
36 |
add_action('admin_head', array(&$this, 'admin_page_stylesheet'));
|
37 |
add_action('wp_head', array(&$this, 'stylesheet'));
|
|
|
|
|
|
|
38 |
add_filter('the_content', array(&$this, 'the_content_filter'));
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
function set_initial() {
|
42 |
$wpcf7 = get_option('wpcf7');
|
43 |
if (! is_array($wpcf7))
|
@@ -143,13 +180,13 @@ class tam_contact_form_seven {
|
|
143 |
|
144 |
function default_form_template() {
|
145 |
$template .= '<p><label>' . __('Your Name', 'wpcf7') . ' ' . __('(required)', 'wpcf7') . '<br />' . "\n";
|
146 |
-
$template .= ' [text* your-name
|
147 |
$template .= '<p><label>' . __('Your Email', 'wpcf7') . ' ' . __('(required)', 'wpcf7') . '<br />' . "\n";
|
148 |
-
$template .= ' [email* your-email
|
149 |
$template .= '<p><label>' . __('Subject', 'wpcf7') . '<br />' . "\n";
|
150 |
-
$template .= ' [text your-subject
|
151 |
$template .= '<p><label>' . __('Your Message', 'wpcf7') . '<br />' . "\n";
|
152 |
-
$template .= ' [textarea your-message
|
153 |
$template .= '[submit "' . __('Send', 'wpcf7') . '"]';
|
154 |
return $template;
|
155 |
}
|
@@ -178,15 +215,7 @@ class tam_contact_form_seven {
|
|
178 |
$fes = $this->form_elements($cf['form'], false);
|
179 |
$validation = $this->validate_form_elements($fes);
|
180 |
if ($validation['valid']) {
|
181 |
-
|
182 |
-
$callback = create_function('$matches', 'if (isset($_POST[$matches[1]])) return $_POST[$matches[1]]; else return $matches[0];');
|
183 |
-
$mail_subject = preg_replace_callback($regex, $callback, $cf['mail']['subject']);
|
184 |
-
$mail_sender = preg_replace_callback($regex, $callback, $cf['mail']['sender']);
|
185 |
-
$mail_body = preg_replace_callback($regex, $callback, $cf['mail']['body']);
|
186 |
-
$mail_headers = "MIME-Version: 1.0\n"
|
187 |
-
. "From: $mail_sender\n"
|
188 |
-
. "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
|
189 |
-
if (@wp_mail($cf['options']['recipient'], $mail_subject, $mail_body, $mail_headers)) {
|
190 |
$_POST['_wpcf7_mail_sent'] = array('id' => $id, 'ok' => true, 'message' => $this->default_mail_result_message(true));
|
191 |
} else {
|
192 |
$_POST['_wpcf7_mail_sent'] = array('id' => $id, 'ok' => false, 'message' => $this->default_mail_result_message(false));
|
@@ -198,7 +227,10 @@ class tam_contact_form_seven {
|
|
198 |
}
|
199 |
|
200 |
$regex = '/\[\s*contact-form\s+(\d+)(?:\s+.*?)?\s*\]/';
|
201 |
-
|
|
|
|
|
|
|
202 |
}
|
203 |
|
204 |
function the_content_filter_callback($matches) {
|
@@ -219,22 +251,32 @@ class tam_contact_form_seven {
|
|
219 |
$form_content = $this->form_elements($cf['form']);
|
220 |
|
221 |
$form = '<div class="wpcf7" id="wpcf7_' . $id . '">';
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
if (isset($_POST['_wpcf7_mail_sent']) && $_POST['_wpcf7_mail_sent']['id'] == $id) {
|
223 |
-
if ($_POST['_wpcf7_mail_sent']['ok'])
|
224 |
-
$
|
225 |
-
|
226 |
-
|
|
|
|
|
|
|
227 |
} elseif (isset($_POST['_wpcf7_validation_errors']) && $_POST['_wpcf7_validation_errors']['id'] == $id) {
|
228 |
-
$
|
|
|
229 |
foreach ($_POST['_wpcf7_validation_errors']['messages'] as $err) {
|
230 |
-
$
|
231 |
}
|
232 |
-
$
|
233 |
}
|
234 |
-
|
235 |
-
$form .= '<
|
236 |
-
|
237 |
-
$form .= '</
|
238 |
return $form;
|
239 |
}
|
240 |
|
@@ -245,7 +287,7 @@ class tam_contact_form_seven {
|
|
245 |
foreach ($form_elements as $fe) {
|
246 |
$type = $fe['type'];
|
247 |
$name = $fe['name'];
|
248 |
-
$title = $fe['title'];
|
249 |
|
250 |
// Required item (*)
|
251 |
if (preg_match('/^(?:text|textarea)[*]$/', $type)) {
|
@@ -276,14 +318,107 @@ class tam_contact_form_seven {
|
|
276 |
}
|
277 |
|
278 |
function stylesheet() {
|
279 |
-
|
|
|
|
|
|
|
280 |
echo '<link rel="stylesheet" href="' . $stylesheet_url . '" type="text/css" />';
|
281 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
|
283 |
/* Processing form element placeholders */
|
284 |
|
285 |
function form_elements($form, $replace = true) {
|
286 |
-
$regex = '%\[\s*([a-z]+[*]?)(\s+[a-zA-Z][0-9a-zA-Z:._-]*)(\s*(?:"[^"]*"|\'[^\']*\'))([-0-9a-zA-Z:_/\s]*)?(\s*(?:"[^"]*"|\'[^\']*\'))*\]%';
|
287 |
if ($replace) {
|
288 |
$form = preg_replace_callback($regex, array(&$this, 'form_element_replace_callback'), $form);
|
289 |
// Submit button
|
@@ -309,6 +444,7 @@ class tam_contact_form_seven {
|
|
309 |
if ($id = $id_matches[1])
|
310 |
$atts .= ' id="' . $id . '"';
|
311 |
}
|
|
|
312 |
$class_att = "";
|
313 |
$class_array = preg_grep('%^class:[-0-9a-zA-Z_]+$%', $options);
|
314 |
foreach ($class_array as $class) {
|
@@ -316,6 +452,12 @@ class tam_contact_form_seven {
|
|
316 |
if ($class = $class_matches[1])
|
317 |
$class_att .= ' ' . $class;
|
318 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
if ($class_att)
|
320 |
$atts .= ' class="' . trim($class_att) . '"';
|
321 |
}
|
@@ -340,7 +482,7 @@ class tam_contact_form_seven {
|
|
340 |
} else {
|
341 |
$value = array_shift($values);
|
342 |
}
|
343 |
-
return '<input type="text" name="' . $name . '" value="' . $value . '"' . $atts . '
|
344 |
break;
|
345 |
case 'textarea':
|
346 |
if (is_array($options)) {
|
@@ -360,7 +502,7 @@ class tam_contact_form_seven {
|
|
360 |
} else {
|
361 |
$value = array_shift($values);
|
362 |
}
|
363 |
-
return '<textarea name="' . $name . '"' . $atts . '>' . $value . '</textarea>';
|
364 |
break;
|
365 |
}
|
366 |
}
|
4 |
Plugin URI: http://ideasilo.wordpress.com/2007/04/30/contact-form-7/
|
5 |
Description: Just another contact form plugin. Simple but flexible.
|
6 |
Author: Takayuki Miyoshi
|
7 |
+
Version: 1.2
|
8 |
Author URI: http://ideasilo.wordpress.com/
|
9 |
*/
|
10 |
|
35 |
add_action('admin_menu', array(&$this, 'add_pages'));
|
36 |
add_action('admin_head', array(&$this, 'admin_page_stylesheet'));
|
37 |
add_action('wp_head', array(&$this, 'stylesheet'));
|
38 |
+
add_action('wp_head', array(&$this, 'javascript'));
|
39 |
+
add_action('wp_print_scripts', array(&$this, 'load_js'));
|
40 |
+
add_action('init', array(&$this, 'ajax_json_echo'));
|
41 |
add_filter('the_content', array(&$this, 'the_content_filter'));
|
42 |
}
|
43 |
|
44 |
+
function ajax_json_echo() {
|
45 |
+
if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_GET['wpcf7']) && 'json' == $_GET['wpcf7']) {
|
46 |
+
if (isset($_POST['_wpcf7'])) {
|
47 |
+
$id = (int) $_POST['_wpcf7'];
|
48 |
+
$contact_forms = $this->contact_forms();
|
49 |
+
if ($cf = $contact_forms[$id]) {
|
50 |
+
$cf = stripslashes_deep($cf);
|
51 |
+
if ($this->mail($cf)) {
|
52 |
+
echo '{ mailSent: 1, message: "' . $this->default_mail_result_message(true) . '" }';
|
53 |
+
} else {
|
54 |
+
echo '{ mailSent: 0, message: "' . $this->default_mail_result_message(false) . '" }';
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
exit();
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
function mail($contact_form) {
|
63 |
+
$regex = '/\[\s*([a-zA-Z][0-9a-zA-Z:._-]*)\s*\]/';
|
64 |
+
$callback = create_function('$matches', 'if (isset($_POST[$matches[1]])) return $_POST[$matches[1]]; else return $matches[0];');
|
65 |
+
$mail_subject = preg_replace_callback($regex, $callback, $contact_form['mail']['subject']);
|
66 |
+
$mail_sender = preg_replace_callback($regex, $callback, $contact_form['mail']['sender']);
|
67 |
+
$mail_body = preg_replace_callback($regex, $callback, $contact_form['mail']['body']);
|
68 |
+
$mail_headers = "MIME-Version: 1.0\n"
|
69 |
+
. "From: $mail_sender\n"
|
70 |
+
. "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
|
71 |
+
if (@wp_mail($contact_form['options']['recipient'], $mail_subject, $mail_body, $mail_headers)) {
|
72 |
+
return true;
|
73 |
+
} else {
|
74 |
+
return false;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
function set_initial() {
|
79 |
$wpcf7 = get_option('wpcf7');
|
80 |
if (! is_array($wpcf7))
|
180 |
|
181 |
function default_form_template() {
|
182 |
$template .= '<p><label>' . __('Your Name', 'wpcf7') . ' ' . __('(required)', 'wpcf7') . '<br />' . "\n";
|
183 |
+
$template .= ' [text* your-name] </label></p>' . "\n\n";
|
184 |
$template .= '<p><label>' . __('Your Email', 'wpcf7') . ' ' . __('(required)', 'wpcf7') . '<br />' . "\n";
|
185 |
+
$template .= ' [email* your-email] </label></p>' . "\n\n";
|
186 |
$template .= '<p><label>' . __('Subject', 'wpcf7') . '<br />' . "\n";
|
187 |
+
$template .= ' [text your-subject] </label></p>' . "\n\n";
|
188 |
$template .= '<p><label>' . __('Your Message', 'wpcf7') . '<br />' . "\n";
|
189 |
+
$template .= ' [textarea your-message] </label></p>' . "\n\n";
|
190 |
$template .= '[submit "' . __('Send', 'wpcf7') . '"]';
|
191 |
return $template;
|
192 |
}
|
215 |
$fes = $this->form_elements($cf['form'], false);
|
216 |
$validation = $this->validate_form_elements($fes);
|
217 |
if ($validation['valid']) {
|
218 |
+
if ($this->mail($cf)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
$_POST['_wpcf7_mail_sent'] = array('id' => $id, 'ok' => true, 'message' => $this->default_mail_result_message(true));
|
220 |
} else {
|
221 |
$_POST['_wpcf7_mail_sent'] = array('id' => $id, 'ok' => false, 'message' => $this->default_mail_result_message(false));
|
227 |
}
|
228 |
|
229 |
$regex = '/\[\s*contact-form\s+(\d+)(?:\s+.*?)?\s*\]/';
|
230 |
+
if (is_singular())
|
231 |
+
return preg_replace_callback($regex, array(&$this, 'the_content_filter_callback'), $content, 1);
|
232 |
+
else
|
233 |
+
return preg_replace($regex, '', $content);
|
234 |
}
|
235 |
|
236 |
function the_content_filter_callback($matches) {
|
251 |
$form_content = $this->form_elements($cf['form']);
|
252 |
|
253 |
$form = '<div class="wpcf7" id="wpcf7_' . $id . '">';
|
254 |
+
|
255 |
+
$form .= '<form action="' . get_permalink() . '#wpcf7_' . $id . '" method="post" id="wpcf7_the_form">';
|
256 |
+
$form .= '<input type="hidden" name="_wpcf7" value="' . $id . '" />';
|
257 |
+
$form .= $form_content;
|
258 |
+
$form .= '</form>';
|
259 |
+
|
260 |
if (isset($_POST['_wpcf7_mail_sent']) && $_POST['_wpcf7_mail_sent']['id'] == $id) {
|
261 |
+
if ($_POST['_wpcf7_mail_sent']['ok']) {
|
262 |
+
$clsss = ' class="wpcf7-mail-sent-ok"';
|
263 |
+
$content = '<ul><li>' . $_POST['_wpcf7_mail_sent']['message'] . '</li></ul>';
|
264 |
+
} else {
|
265 |
+
$class = ' class="wpcf7-mail-sent-ng"';
|
266 |
+
$content = '<ul><li>' . $_POST['_wpcf7_mail_sent']['message'] . '</li></ul>';
|
267 |
+
}
|
268 |
} elseif (isset($_POST['_wpcf7_validation_errors']) && $_POST['_wpcf7_validation_errors']['id'] == $id) {
|
269 |
+
$class = ' class="wpcf7-validation-errors"';
|
270 |
+
$content = '';
|
271 |
foreach ($_POST['_wpcf7_validation_errors']['messages'] as $err) {
|
272 |
+
$content .= '<li>' . $err . '</li>';
|
273 |
}
|
274 |
+
$content = '<ul>' . $content . '</ul>';
|
275 |
}
|
276 |
+
|
277 |
+
$form .= '<div id="wpcf7-response-output"' . $class . '>' . $content . '</div>';
|
278 |
+
|
279 |
+
$form .= '</div>';
|
280 |
return $form;
|
281 |
}
|
282 |
|
287 |
foreach ($form_elements as $fe) {
|
288 |
$type = $fe['type'];
|
289 |
$name = $fe['name'];
|
290 |
+
$title = $fe['title'] ? $fe['title'] : $name;
|
291 |
|
292 |
// Required item (*)
|
293 |
if (preg_match('/^(?:text|textarea)[*]$/', $type)) {
|
318 |
}
|
319 |
|
320 |
function stylesheet() {
|
321 |
+
if (! is_singular())
|
322 |
+
return;
|
323 |
+
|
324 |
+
$stylesheet_url = get_option('siteurl') . '/wp-content/plugins/contact-form-7/stylesheet.css';
|
325 |
echo '<link rel="stylesheet" href="' . $stylesheet_url . '" type="text/css" />';
|
326 |
}
|
327 |
+
|
328 |
+
function javascript() {
|
329 |
+
if (! is_singular())
|
330 |
+
return;
|
331 |
+
|
332 |
+
$override_url = get_permalink();
|
333 |
+
if (false === strrchr($override_url, '?')) {
|
334 |
+
$override_url .= '?wpcf7=json';
|
335 |
+
} else {
|
336 |
+
$override_url .= '&wpcf7=json';
|
337 |
+
}
|
338 |
+
|
339 |
+
?>
|
340 |
+
<script type="text/javascript">
|
341 |
+
//<![CDATA[
|
342 |
+
|
343 |
+
$(document).ready(function() {
|
344 |
+
$('#wpcf7_the_form').ajaxForm({
|
345 |
+
beforeSubmit: validate,
|
346 |
+
url: '<?php echo $override_url; ?>',
|
347 |
+
dataType: 'json',
|
348 |
+
success: processJson,
|
349 |
+
clearForm: true,
|
350 |
+
resetForm: true
|
351 |
+
});
|
352 |
+
});
|
353 |
+
|
354 |
+
function validate(formData, jqForm, options) {
|
355 |
+
$('#wpcf7-response-output').hide().empty().removeClass('wpcf7-mail-sent-ok wpcf7-mail-sent-ng');
|
356 |
+
var valid = true;
|
357 |
+
|
358 |
+
$('.wpcf7-validates-as-email', jqForm[0]).each(function() {
|
359 |
+
if (! isEmail(this.value)) {
|
360 |
+
$(this).addClass('wpcf7-email-not-valid');
|
361 |
+
this.wpcf7InvalidMessage = '<?php _e('Email address seems invalid.', 'wpcf7'); ?>';
|
362 |
+
}
|
363 |
+
});
|
364 |
+
|
365 |
+
$('.wpcf7-validates-as-required', jqForm[0]).each(function() {
|
366 |
+
if (! this.value) {
|
367 |
+
$(this).addClass('wpcf7-required-not-valid');
|
368 |
+
this.wpcf7InvalidMessage = '<?php _e('Please fill the required field.', 'wpcf7'); ?>';
|
369 |
+
}
|
370 |
+
});
|
371 |
+
|
372 |
+
$.each(jqForm[0].elements, function() {
|
373 |
+
if (this.wpcf7InvalidMessage) {
|
374 |
+
notValidTip(this, this.wpcf7InvalidMessage);
|
375 |
+
valid = false;
|
376 |
+
this.wpcf7InvalidMessage = null;
|
377 |
+
}
|
378 |
+
});
|
379 |
+
|
380 |
+
return valid;
|
381 |
+
}
|
382 |
+
|
383 |
+
function isEmail(user_email) {
|
384 |
+
var chars = /^[-a-z0-9+_.]+@([-a-z0-9_]+[.])+[a-z]{2,6}$/i;
|
385 |
+
return chars.test(user_email);
|
386 |
+
}
|
387 |
+
|
388 |
+
function notValidTip(input, message) {
|
389 |
+
$(input).after('<span class="wpcf7-not-valid-tip">' + message + '</span>');
|
390 |
+
$('span.wpcf7-not-valid-tip').mouseover(function() {
|
391 |
+
$(this).fadeOut('fast');
|
392 |
+
});
|
393 |
+
$(input).mouseover(function() {
|
394 |
+
$(input).siblings('.wpcf7-not-valid-tip').fadeOut('fast');
|
395 |
+
});
|
396 |
+
}
|
397 |
+
|
398 |
+
function processJson(data) {
|
399 |
+
$('#wpcf7-response-output').hide().empty().removeClass('wpcf7-mail-sent-ok wpcf7-mail-sent-ng');
|
400 |
+
if (1 == data.mailSent) {
|
401 |
+
$('#wpcf7-response-output').addClass('wpcf7-mail-sent-ok');
|
402 |
+
} else {
|
403 |
+
$('#wpcf7-response-output').addClass('wpcf7-mail-sent-ng');
|
404 |
+
}
|
405 |
+
$('#wpcf7-response-output').append(data.message).fadeIn('fast');
|
406 |
+
}
|
407 |
+
|
408 |
+
//]]>
|
409 |
+
</script>
|
410 |
+
<?php
|
411 |
+
}
|
412 |
+
|
413 |
+
function load_js() {
|
414 |
+
if (is_singular())
|
415 |
+
wp_enqueue_script('jquery-form');
|
416 |
+
}
|
417 |
|
418 |
/* Processing form element placeholders */
|
419 |
|
420 |
function form_elements($form, $replace = true) {
|
421 |
+
$regex = '%\[\s*([a-z]+[*]?)(\s+[a-zA-Z][0-9a-zA-Z:._-]*)(\s*(?:"[^"]*"|\'[^\']*\'))?([-0-9a-zA-Z:_/\s]*)?(\s*(?:"[^"]*"|\'[^\']*\'))*\]%';
|
422 |
if ($replace) {
|
423 |
$form = preg_replace_callback($regex, array(&$this, 'form_element_replace_callback'), $form);
|
424 |
// Submit button
|
444 |
if ($id = $id_matches[1])
|
445 |
$atts .= ' id="' . $id . '"';
|
446 |
}
|
447 |
+
|
448 |
$class_att = "";
|
449 |
$class_array = preg_grep('%^class:[-0-9a-zA-Z_]+$%', $options);
|
450 |
foreach ($class_array as $class) {
|
452 |
if ($class = $class_matches[1])
|
453 |
$class_att .= ' ' . $class;
|
454 |
}
|
455 |
+
|
456 |
+
if (preg_match('/^email[*]?$/', $type))
|
457 |
+
$class_att .= ' wpcf7-validates-as-email';
|
458 |
+
if (preg_match('/[*]$/', $type))
|
459 |
+
$class_att .= ' wpcf7-validates-as-required';
|
460 |
+
|
461 |
if ($class_att)
|
462 |
$atts .= ' class="' . trim($class_att) . '"';
|
463 |
}
|
482 |
} else {
|
483 |
$value = array_shift($values);
|
484 |
}
|
485 |
+
return '<span style="position: relative;"><input type="text" name="' . $name . '" value="' . $value . '"' . $atts . ' /></span>';
|
486 |
break;
|
487 |
case 'textarea':
|
488 |
if (is_array($options)) {
|
502 |
} else {
|
503 |
$value = array_shift($values);
|
504 |
}
|
505 |
+
return '<span style="position: relative;"><textarea name="' . $name . '"' . $atts . '>' . $value . '</textarea></span>';
|
506 |
break;
|
507 |
}
|
508 |
}
|