Version Description
Download this release
Release Info
Developer | takayukister |
Plugin | Contact Form 7 |
Version | 1.1 |
Comparing to | |
See all releases |
Version 1.1
- README.txt +20 -0
- admin-stylesheet.css +104 -0
- includes/admin-panel.php +309 -0
- languages/wpcf7-ja.mo +0 -0
- languages/wpcf7-ja.po +163 -0
- screenshot-1.jpg +0 -0
- stylesheet.css +18 -0
- wp-contact-form-7.php +410 -0
README.txt
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Contact Form 7 ===
|
2 |
+
Contributors: takayukister
|
3 |
+
Tags: contact form, email
|
4 |
+
Requires at least: 2.0.10
|
5 |
+
Tested up to: 2.3-alpha
|
6 |
+
Stable tag: 1.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 |
+
* Includes simple input validations.
|
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 |
+
|
admin-stylesheet.css
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ul.cfmenu {
|
2 |
+
padding: 2em 0 3px;
|
3 |
+
border-bottom: 1px solid #777;
|
4 |
+
}
|
5 |
+
ul.cfmenu li {
|
6 |
+
display: inline;
|
7 |
+
list-style: none;
|
8 |
+
margin: 1em 0.5em;
|
9 |
+
}
|
10 |
+
ul.cfmenu li.current {
|
11 |
+
padding: 4px;
|
12 |
+
border: 1px solid #777;
|
13 |
+
border-bottom: 1px solid #fff;
|
14 |
+
font-weight: bolder;
|
15 |
+
}
|
16 |
+
ul.cfmenu li.add-new {
|
17 |
+
margin-left: 1em;
|
18 |
+
color: #eba80e;
|
19 |
+
}
|
20 |
+
ul.cfmenu li.add-new a {
|
21 |
+
color: #eba80e;
|
22 |
+
}
|
23 |
+
ul.cfmenu a {
|
24 |
+
border-bottom: none;
|
25 |
+
color: #454545;
|
26 |
+
}
|
27 |
+
ul.cfmenu a:hover {
|
28 |
+
border-bottom: 1px solid #0e98ea;
|
29 |
+
}
|
30 |
+
div.cfdiv {
|
31 |
+
margin: 0;
|
32 |
+
padding: 12px;
|
33 |
+
}
|
34 |
+
input.cfsave {
|
35 |
+
font-weight: bold;
|
36 |
+
}
|
37 |
+
input.cfdelete:hover {
|
38 |
+
background: #ce0000;
|
39 |
+
color: #fff;
|
40 |
+
}
|
41 |
+
p.important {
|
42 |
+
color: #eba80e;
|
43 |
+
}
|
44 |
+
input#contact-form-anchor-text {
|
45 |
+
margin-left: 1em;
|
46 |
+
color: #333;
|
47 |
+
background: #fff;
|
48 |
+
border: 1px solid #eba80e;
|
49 |
+
font-family: monospace;
|
50 |
+
}
|
51 |
+
fieldset {
|
52 |
+
padding: .5em 2em 1em;
|
53 |
+
margin: 1em 1em 1em 0;
|
54 |
+
}
|
55 |
+
fieldset legend {
|
56 |
+
font-weight: bolder;
|
57 |
+
}
|
58 |
+
input.wide {
|
59 |
+
width: 97%;
|
60 |
+
}
|
61 |
+
textarea {
|
62 |
+
width: 97%;
|
63 |
+
}
|
64 |
+
p.submit {
|
65 |
+
margin: 0 24px;
|
66 |
+
}
|
67 |
+
input.quick-button {
|
68 |
+
background: #fff url( images/fade-butt.png ) repeat-x 0 -2px;
|
69 |
+
margin: 3px 0;
|
70 |
+
padding: 1px 0;
|
71 |
+
}
|
72 |
+
div#quick-panel {
|
73 |
+
display: none;
|
74 |
+
border: 1px dotted #ccc;
|
75 |
+
margin: 0 0 4px;
|
76 |
+
padding: 4px;
|
77 |
+
width: 97%;
|
78 |
+
background: #aaecf5;
|
79 |
+
}
|
80 |
+
div#quick-panel div.close {
|
81 |
+
float: right;
|
82 |
+
font-size: 8pt;
|
83 |
+
font-weight: bold;
|
84 |
+
border: 1px solid #999;
|
85 |
+
background: #bbb;
|
86 |
+
color: #fff;
|
87 |
+
padding: 1px 3px;
|
88 |
+
cursor: pointer;
|
89 |
+
}
|
90 |
+
div#quick-panel input {
|
91 |
+
background: #fff;
|
92 |
+
}
|
93 |
+
div#quick-panel input.qp-button {
|
94 |
+
background: #fff url( images/fade-butt.png ) repeat-x 0 -2px;
|
95 |
+
margin: 3px 1px 2px;
|
96 |
+
padding: 2px;
|
97 |
+
}
|
98 |
+
div#quick-panel input.required {
|
99 |
+
border: 1px solid #777;
|
100 |
+
}
|
101 |
+
div#quick-panel table td {
|
102 |
+
text-align: right;
|
103 |
+
padding: 0 1em;
|
104 |
+
}
|
includes/admin-panel.php
ADDED
@@ -0,0 +1,309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if (isset($updated_message)) : ?>
|
2 |
+
<div id="message" class="updated fade"><p><strong><?php echo $updated_message; ?></strong></p></div>
|
3 |
+
<?php endif; ?>
|
4 |
+
<div class="wrap">
|
5 |
+
<h2><?php _e('Contact Form 7', 'wpcf7'); ?></h2>
|
6 |
+
<ul class="cfmenu">
|
7 |
+
<?php foreach ($contact_forms as $key => $cf) : if (! $cf['initial']) : ?>
|
8 |
+
<li class="<?php if ($key == $current) echo 'current' ?>">
|
9 |
+
<?php if ($key == $current) : ?>
|
10 |
+
<?php echo $cf['title']; ?>
|
11 |
+
<?php else : ?>
|
12 |
+
<a href="<?php echo $base_url . '&contactform=' . $key; ?>"><?php echo $cf['title']; ?></a>
|
13 |
+
<?php endif; ?>
|
14 |
+
</li>
|
15 |
+
<?php endif; endforeach; ?>
|
16 |
+
|
17 |
+
<li class="add-new <?php if ($initial) echo 'current' ?>">
|
18 |
+
<?php if ($initial) : ?>
|
19 |
+
<?php _e('Add new', 'wpcf7'); ?>
|
20 |
+
<?php else : ?>
|
21 |
+
<a href="<?php echo $base_url . '&contactform=new'; ?>">
|
22 |
+
<?php _e('Add new', 'wpcf7'); ?>
|
23 |
+
</a>
|
24 |
+
<?php endif; ?>
|
25 |
+
</li>
|
26 |
+
</ul>
|
27 |
+
<?php $cf = stripslashes_deep($contact_forms[$current]); ?>
|
28 |
+
<div class="cfdiv">
|
29 |
+
|
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 |
+
|
37 |
+
<?php if (! $initial) : ?>
|
38 |
+
<p class="important">
|
39 |
+
<?php _e('Copy and paste this code into your post content.', 'wpcf7'); ?> »
|
40 |
+
<input type="text" id="contact-form-anchor-text" size="50" onfocus="this.select();" readonly="readonly" />
|
41 |
+
</p>
|
42 |
+
<?php endif; ?>
|
43 |
+
</fieldset>
|
44 |
+
|
45 |
+
<fieldset><legend><?php _e('Form content', 'wpcf7'); ?></legend>
|
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');" />
|
49 |
+
<input type="button" value="email*" class="quick-button" onclick="quick_panel('email*');" />
|
50 |
+
<input type="button" value="textarea" class="quick-button" onclick="quick_panel('textarea');" />
|
51 |
+
<input type="button" value="textarea*" class="quick-button" onclick="quick_panel('textarea*');" />
|
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 |
+
</fieldset>
|
56 |
+
|
57 |
+
<fieldset><legend><?php _e('Mail template', 'wpcf7'); ?></legend>
|
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 |
+
</fieldset>
|
65 |
+
|
66 |
+
<fieldset><legend><?php _e('Options', 'wpcf7'); ?></legend>
|
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 |
+
</fieldset>
|
70 |
+
|
71 |
+
<p class="submit">
|
72 |
+
<input type="submit" class="cfsave" name="wpcf7-save" value="<?php _e('Save', 'wpcf7'); ?>" />
|
73 |
+
<?php wp_nonce_field('wpcf7-save_' . $current); ?>
|
74 |
+
</p>
|
75 |
+
|
76 |
+
<p class="submit" style="text-align: left;">
|
77 |
+
<?php if (! $cf['initial']) : ?>
|
78 |
+
<?php $delete_nonce = wp_create_nonce('wpcf7-delete_' . $current); ?>
|
79 |
+
<input type="submit" name="wpcf7-delete" class="cfdelete" value="<?php _e('Delete this contact form', 'wpcf7'); ?>"
|
80 |
+
<?php echo "onclick=\"if (confirm('" . js_escape(__("You are about to delete this contact form.\n 'Cancel' to stop, 'OK' to delete.", 'wpcf7')) . "')) {this.form._wpnonce.value = '$delete_nonce'; return true;} return false;\""; ?> />
|
81 |
+
<?php endif; ?>
|
82 |
+
</p>
|
83 |
+
</form>
|
84 |
+
|
85 |
+
<script type="text/javascript">
|
86 |
+
//<![CDATA[
|
87 |
+
|
88 |
+
function quick_panel(type) {
|
89 |
+
var quick_panel = document.getElementById('quick-panel');
|
90 |
+
if (! quick_panel) return;
|
91 |
+
|
92 |
+
var valid_types = /^(text[*]?|email[*]?|textarea[*]?|submit)$/;
|
93 |
+
if (! valid_types.test(type)) return;
|
94 |
+
|
95 |
+
quick_panel.innerHTML = '<div class="close" style="float: right;"><span onclick="document.getElementById(\'quick-panel\').style.display = \'none\';">X</span></div>';
|
96 |
+
quick_panel.innerHTML += '<div style="text-align: center; font-weight: bold; color: #555;"><code>[' + type + ']</code></div>';
|
97 |
+
quick_panel.innerHTML += '<input type="hidden" name="qp-type" value="' + type + '" />';
|
98 |
+
|
99 |
+
switch (type) {
|
100 |
+
case 'text':
|
101 |
+
case 'text*':
|
102 |
+
case 'email':
|
103 |
+
case 'email*':
|
104 |
+
quick_panel.innerHTML += '<table><tbody>'
|
105 |
+
+ '<tr><td>name= <input type="text" name="qp-name" id="qp-name" class="required" onchange="create_tag();" /></td></tr>'
|
106 |
+
+ '<tr><td>size= <input type="text" name="qp-size" onchange="create_tag();" /></td>'
|
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':
|
116 |
+
case 'textarea*':
|
117 |
+
quick_panel.innerHTML += '<table><tbody>'
|
118 |
+
+ '<tr><td>name= <input type="text" name="qp-name" id="qp-name" class="required" onchange="create_tag();" /></td></tr>'
|
119 |
+
+ '<tr><td>cols= <input type="text" name="qp-cols" onchange="create_tag();" /></td>'
|
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':
|
129 |
+
quick_panel.innerHTML += '<table><tbody>'
|
130 |
+
+ '<tr><td><?php _e('Label', 'wpcf7'); ?> <input type="text" name="qp-label" onchange="create_tag();" /></td></tr>'
|
131 |
+
+ '</tbody></table>';
|
132 |
+
break;
|
133 |
+
}
|
134 |
+
|
135 |
+
quick_panel.innerHTML += '<div style="margin: 10px 0 0; text-align: center;">'
|
136 |
+
+ '<input type="text" name="qp-insert" style="width: 80%; border: none; font-family: monospace;" /> '
|
137 |
+
+ '<input type="button" value="<?php _e('Insert', 'wpcf7'); ?>" class="qp-button" onclick="insert_tag(this.form.elements[\'qp-insert\'].value);" />'
|
138 |
+
+ '</div>';
|
139 |
+
quick_panel.style.display = 'block';
|
140 |
+
create_tag(true);
|
141 |
+
var qp_name = document.getElementById('qp-name');
|
142 |
+
if (qp_name)
|
143 |
+
qp_name.focus();
|
144 |
+
}
|
145 |
+
|
146 |
+
function create_tag(initial) {
|
147 |
+
var form = document.getElementById('wpcf7-admin-form-element');
|
148 |
+
if (! form) return;
|
149 |
+
|
150 |
+
var insert = form.elements['qp-insert'];
|
151 |
+
if (! insert) return;
|
152 |
+
|
153 |
+
var type = form.elements['qp-type'];
|
154 |
+
if (! type) return;
|
155 |
+
|
156 |
+
type = type.value;
|
157 |
+
var valid_types = /^(text[*]?|email[*]?|textarea[*]?|submit)$/;
|
158 |
+
if (! valid_types.test(type)) return;
|
159 |
+
|
160 |
+
var tag = '[' + type;
|
161 |
+
|
162 |
+
if ('submit' == type) {
|
163 |
+
var label = form.elements['qp-label'];
|
164 |
+
if (label && '' != label.value)
|
165 |
+
tag += ' ' + wrap_quote(label.value);
|
166 |
+
} else {
|
167 |
+
var name = form.elements['qp-name'];
|
168 |
+
if (name && ! initial) {
|
169 |
+
name.value = name.value.replace(/[^0-9a-zA-Z:._-]/g, '');
|
170 |
+
name.value = name.value.replace(/^[^a-zA-Z]+/, '');
|
171 |
+
if ('' == name.value)
|
172 |
+
name.value = 'form_' + Math.floor(Math.random() * 1000);
|
173 |
+
tag += ' ' + name.value;
|
174 |
+
}
|
175 |
+
|
176 |
+
var label = form.elements['qp-label'];
|
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 |
+
|
184 |
+
var size = form.elements['qp-size'];
|
185 |
+
if (size)
|
186 |
+
size.value = integer(size.value);
|
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 |
+
else if (size && '' != size.value)
|
193 |
+
tag += ' ' + size.value + '/';
|
194 |
+
else if (maxlength && '' != maxlength.value)
|
195 |
+
tag += ' ' + '/' + maxlength.value;
|
196 |
+
|
197 |
+
} else if (/^textarea[*]?$/.test(type)) {
|
198 |
+
|
199 |
+
var cols = form.elements['qp-cols'];
|
200 |
+
if (cols)
|
201 |
+
cols.value = integer(cols.value);
|
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 |
+
else if (cols && '' != cols.value)
|
208 |
+
tag += ' ' + cols.value + 'x';
|
209 |
+
else if (rows && '' != rows.value)
|
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'];
|
222 |
+
if (klass) {
|
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 |
+
tag += ' ' + wrap_quote(default_value.value);
|
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 |
+
|
252 |
+
function integer(str) {
|
253 |
+
return str.replace(/[^0-9]/g, '');
|
254 |
+
}
|
255 |
+
|
256 |
+
function cdata(str) {
|
257 |
+
return str.replace(/[^-0-9a-zA-Z_]/g, '');
|
258 |
+
}
|
259 |
+
|
260 |
+
function wrap_quote(str) {
|
261 |
+
if (-1 == str.indexOf('"'))
|
262 |
+
return '"' + str + '"';
|
263 |
+
else if (-1 == str.indexOf("'"))
|
264 |
+
return "'" + str + "'";
|
265 |
+
else
|
266 |
+
return '"' + str.replace('"', '') + '"';
|
267 |
+
}
|
268 |
+
|
269 |
+
function insert_tag(tag) {
|
270 |
+
var f = document.getElementById('wpcf7-form');
|
271 |
+
if (! f) return;
|
272 |
+
|
273 |
+
if (document.selection) {
|
274 |
+
f.focus();
|
275 |
+
var sel = document.selection.createRange();
|
276 |
+
sel.text = tag;
|
277 |
+
f.focus();
|
278 |
+
} else if (f.selectionStart || f.selectionStart == '0') {
|
279 |
+
var startPos = f.selectionStart;
|
280 |
+
var endPos = f.selectionEnd;
|
281 |
+
var cursorPos = endPos;
|
282 |
+
var scrollTop = f.scrollTop;
|
283 |
+
f.value = f.value.substring(0, startPos) + tag + f.value.substring(endPos, f.value.length);
|
284 |
+
cursorPos = startPos + tag.length;
|
285 |
+
f.focus();
|
286 |
+
f.selectionStart = cursorPos;
|
287 |
+
f.selectionEnd = cursorPos;
|
288 |
+
f.scrollTop = scrollTop;
|
289 |
+
} else {
|
290 |
+
f.value += tag;
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
function update_anchor(title) {
|
295 |
+
if (title == null) title = document.getElementById('wpcf7-title').value;
|
296 |
+
var anchor = document.getElementById('contact-form-anchor-text');
|
297 |
+
if (anchor) {
|
298 |
+
title = title.replace(/-+/g, '-');
|
299 |
+
title = title.replace(/["'\[\]<>]/g, '');
|
300 |
+
anchor.value = '[contact-form <?php echo $current; ?> "' + title + '"]';
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
update_anchor();
|
305 |
+
//]]>
|
306 |
+
</script>
|
307 |
+
|
308 |
+
</div>
|
309 |
+
</div>
|
languages/wpcf7-ja.mo
ADDED
Binary file
|
languages/wpcf7-ja.po
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WP Contact Form 7\n"
|
4 |
+
"POT-Creation-Date: \n"
|
5 |
+
"PO-Revision-Date: 2007-08-02 22:04+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"
|
9 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"X-Poedit-Language: Japanese\n"
|
12 |
+
"X-Poedit-Country: JAPAN\n"
|
13 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
14 |
+
"X-Poedit-KeywordsList: __;_e\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:51
|
19 |
+
#: contact-form-7/wp-contact-form-7.php:124
|
20 |
+
msgid "Contact form"
|
21 |
+
msgstr "コンタクトフォーム"
|
22 |
+
|
23 |
+
#: contact-form-7/wp-contact-form-7.php:80
|
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:100
|
29 |
+
#, php-format
|
30 |
+
msgid "Contact form \"%s\" deleted. "
|
31 |
+
msgstr "コンタクトフォーム \"%s\" が削除されました。"
|
32 |
+
|
33 |
+
#: contact-form-7/wp-contact-form-7.php:116
|
34 |
+
#, php-format
|
35 |
+
msgid "Contact form \"%s\" saved. "
|
36 |
+
msgstr "コンタクトフォーム \"%s\" が保存されました。"
|
37 |
+
|
38 |
+
#: contact-form-7/wp-contact-form-7.php:145
|
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:145
|
44 |
+
#: contact-form-7/wp-contact-form-7.php:147
|
45 |
+
msgid "(required)"
|
46 |
+
msgstr "(必須)"
|
47 |
+
|
48 |
+
#: contact-form-7/wp-contact-form-7.php:147
|
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:149
|
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:151
|
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:153
|
64 |
+
#: contact-form-7/wp-contact-form-7.php:372
|
65 |
+
msgid "Send"
|
66 |
+
msgstr "送信"
|
67 |
+
|
68 |
+
#: contact-form-7/wp-contact-form-7.php:254
|
69 |
+
#: contact-form-7/wp-contact-form-7.php:261
|
70 |
+
#, php-format
|
71 |
+
msgid "Please fill the required field: %s "
|
72 |
+
msgstr "必須項目に記入もれがあります: %s"
|
73 |
+
|
74 |
+
#: contact-form-7/wp-contact-form-7.php:264
|
75 |
+
#, php-format
|
76 |
+
msgid "Email address seems invalid: %s "
|
77 |
+
msgstr "メールアドレスの形式が正しくないようです: %s "
|
78 |
+
|
79 |
+
#: contact-form-7/wp-contact-form-7.php:273
|
80 |
+
msgid "Your message was sent successfully. Thanks."
|
81 |
+
msgstr "あなたのメッセージは送信されました。ありがとうございました。"
|
82 |
+
|
83 |
+
#: contact-form-7/wp-contact-form-7.php:275
|
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"
|
90 |
+
msgstr "新規追加"
|
91 |
+
|
92 |
+
#: contact-form-7/includes/admin-panel.php:34
|
93 |
+
msgid "Title"
|
94 |
+
msgstr "タイトル"
|
95 |
+
|
96 |
+
#: contact-form-7/includes/admin-panel.php:39
|
97 |
+
msgid "Copy and paste this code into your post content."
|
98 |
+
msgstr "次のコードをコピーして投稿の本文中にペーストして下さい。"
|
99 |
+
|
100 |
+
#: contact-form-7/includes/admin-panel.php:45
|
101 |
+
msgid "Form content"
|
102 |
+
msgstr "フォームの内容"
|
103 |
+
|
104 |
+
#: contact-form-7/includes/admin-panel.php:57
|
105 |
+
msgid "Mail template"
|
106 |
+
msgstr "メールのテンプレート"
|
107 |
+
|
108 |
+
#: contact-form-7/includes/admin-panel.php:58
|
109 |
+
msgid "Subject field:"
|
110 |
+
msgstr "題名欄:"
|
111 |
+
|
112 |
+
#: contact-form-7/includes/admin-panel.php:60
|
113 |
+
msgid "Sender field:"
|
114 |
+
msgstr "送信者欄:"
|
115 |
+
|
116 |
+
#: contact-form-7/includes/admin-panel.php:62
|
117 |
+
msgid "Message body:"
|
118 |
+
msgstr "メッセージ本文:"
|
119 |
+
|
120 |
+
#: contact-form-7/includes/admin-panel.php:66
|
121 |
+
msgid "Options"
|
122 |
+
msgstr "オプション"
|
123 |
+
|
124 |
+
#: contact-form-7/includes/admin-panel.php:67
|
125 |
+
msgid "Recipient address:"
|
126 |
+
msgstr "受信者アドレス:"
|
127 |
+
|
128 |
+
#: contact-form-7/includes/admin-panel.php:72
|
129 |
+
msgid "Save"
|
130 |
+
msgstr "保存"
|
131 |
+
|
132 |
+
#: contact-form-7/includes/admin-panel.php:79
|
133 |
+
msgid "Delete this contact form"
|
134 |
+
msgstr "このコンタクトフォームを削除"
|
135 |
+
|
136 |
+
#: contact-form-7/includes/admin-panel.php:80
|
137 |
+
msgid ""
|
138 |
+
"You are about to delete this contact form.\n"
|
139 |
+
" 'Cancel' to stop, 'OK' to delete."
|
140 |
+
msgstr ""
|
141 |
+
"このコンタクトフォームを削除しようとしています。\n"
|
142 |
+
" 'キャンセル' で中止、 'OK' で削除します。"
|
143 |
+
|
144 |
+
#: contact-form-7/includes/admin-panel.php:110
|
145 |
+
#: contact-form-7/includes/admin-panel.php:123
|
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:112
|
156 |
+
#: contact-form-7/includes/admin-panel.php:125
|
157 |
+
msgid "Create <label> for this ?"
|
158 |
+
msgstr "このフィールドのための <label> タグを作成しますか?"
|
159 |
+
|
160 |
+
#: contact-form-7/includes/admin-panel.php:137
|
161 |
+
msgid "Insert"
|
162 |
+
msgstr "挿入"
|
163 |
+
|
screenshot-1.jpg
ADDED
Binary file
|
stylesheet.css
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
div.wpcf7 {
|
2 |
+
padding: 1em 0;
|
3 |
+
}
|
4 |
+
|
5 |
+
div.wpcf7-mail-sent-ok {
|
6 |
+
border: 1px solid #398f14;
|
7 |
+
padding: 0.2em 1em;
|
8 |
+
}
|
9 |
+
|
10 |
+
div.wpcf7-mail-sent-ng {
|
11 |
+
border: 1px solid #ff0000;
|
12 |
+
padding: 0.2em 1em;
|
13 |
+
}
|
14 |
+
|
15 |
+
div.wpcf7-validation-errors {
|
16 |
+
border: 1px solid #f7e700;
|
17 |
+
padding: 0.2em 1em;
|
18 |
+
}
|
wp-contact-form-7.php
ADDED
@@ -0,0 +1,410 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
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.1
|
8 |
+
Author URI: http://ideasilo.wordpress.com/
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* Copyright 2007 Takayuki Miyoshi (email: takayukister at gmail.com)
|
12 |
+
|
13 |
+
This program is free software; you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation; either version 2 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
|
18 |
+
This program is distributed in the hope that it will be useful,
|
19 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
+
GNU General Public License for more details.
|
22 |
+
|
23 |
+
You should have received a copy of the GNU General Public License
|
24 |
+
along with this program; if not, write to the Free Software
|
25 |
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
26 |
+
*/
|
27 |
+
|
28 |
+
class tam_contact_form_seven {
|
29 |
+
|
30 |
+
var $contact_forms;
|
31 |
+
|
32 |
+
function tam_contact_form_seven() {
|
33 |
+
add_action('activate_' . strtr(plugin_basename(__FILE__), '\\', '/'), array(&$this, 'set_initial'));
|
34 |
+
add_action('plugins_loaded', array(&$this, 'load_plugin_textdomain'), 20);
|
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))
|
44 |
+
$wpcf7 = array();
|
45 |
+
|
46 |
+
$contact_forms = $wpcf7['contact_forms'];
|
47 |
+
if (! is_array($contact_forms))
|
48 |
+
$contact_forms = array();
|
49 |
+
|
50 |
+
if (0 == count($contact_forms))
|
51 |
+
$contact_forms[1] = $this->default_pack(__('Contact form', 'wpcf7') . ' 1');
|
52 |
+
|
53 |
+
$wpcf7['contact_forms'] = $contact_forms;
|
54 |
+
update_option('wpcf7', $wpcf7);
|
55 |
+
}
|
56 |
+
|
57 |
+
function load_plugin_textdomain() { // l10n
|
58 |
+
load_plugin_textdomain('wpcf7', 'wp-content/plugins/contact-form-7/languages');
|
59 |
+
}
|
60 |
+
|
61 |
+
function contact_forms() {
|
62 |
+
if (is_array($this->contact_forms))
|
63 |
+
return $this->contact_forms;
|
64 |
+
$wpcf7 = get_option('wpcf7');
|
65 |
+
$this->contact_forms = $wpcf7['contact_forms'];
|
66 |
+
if (! is_array($this->contact_forms))
|
67 |
+
$this->contact_forms = array();
|
68 |
+
return $this->contact_forms;
|
69 |
+
}
|
70 |
+
|
71 |
+
function update_contact_forms($contact_forms) {
|
72 |
+
$wpcf7 = get_option('wpcf7');
|
73 |
+
$wpcf7['contact_forms'] = $contact_forms;
|
74 |
+
update_option('wpcf7', $wpcf7);
|
75 |
+
}
|
76 |
+
|
77 |
+
/* Admin panel */
|
78 |
+
|
79 |
+
function add_pages() {
|
80 |
+
add_options_page(__('Contact Form 7', 'wpcf7'), __('Contact Form 7', 'wpcf7'), 'manage_options', __FILE__, array(&$this, 'option_page'));
|
81 |
+
}
|
82 |
+
|
83 |
+
function admin_page_stylesheet() {
|
84 |
+
global $plugin_page;
|
85 |
+
|
86 |
+
if (isset($plugin_page) && $plugin_page == plugin_basename(__FILE__)) {
|
87 |
+
$admin_stylesheet_url = get_option('siteurl') . '/wp-content/plugins/contact-form-7/admin-stylesheet.css';
|
88 |
+
echo '<link rel="stylesheet" href="' . $admin_stylesheet_url . '" type="text/css" />';
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
function option_page() {
|
93 |
+
$base_url = $_SERVER['PHP_SELF'] . '?page=' . plugin_basename(__FILE__);
|
94 |
+
$contact_forms = $this->contact_forms();
|
95 |
+
|
96 |
+
$id = $_POST['wpcf7-id'];
|
97 |
+
|
98 |
+
if (isset($_POST['wpcf7-delete'])) {
|
99 |
+
check_admin_referer('wpcf7-delete_' . $id);
|
100 |
+
$updated_message = sprintf(__('Contact form "%s" deleted. ', 'wpcf7'), $contact_forms[$id]['title']);
|
101 |
+
unset($contact_forms[$id]);
|
102 |
+
$this->update_contact_forms($contact_forms);
|
103 |
+
} elseif (isset($_POST['wpcf7-save'])) {
|
104 |
+
check_admin_referer('wpcf7-save_' . $id);
|
105 |
+
$title = trim($_POST['wpcf7-title']);
|
106 |
+
$form = trim($_POST['wpcf7-form']);
|
107 |
+
$mail_subject = trim($_POST['wpcf7-mail-subject']);
|
108 |
+
$mail_sender = trim($_POST['wpcf7-mail-sender']);
|
109 |
+
$mail_body = trim($_POST['wpcf7-mail-body']);
|
110 |
+
$options_recipient = trim($_POST['wpcf7-options-recipient']);
|
111 |
+
|
112 |
+
$mail = array('subject' => $mail_subject, 'sender' => $mail_sender, 'body' => $mail_body);
|
113 |
+
$options = array('recipient' => $options_recipient);
|
114 |
+
|
115 |
+
$contact_forms[$id] = compact('title', 'form', 'mail', 'options');
|
116 |
+
$updated_message = sprintf(__('Contact form "%s" saved. ', 'wpcf7'), $contact_forms[$id]['title']);
|
117 |
+
$this->update_contact_forms($contact_forms);
|
118 |
+
}
|
119 |
+
|
120 |
+
if ('new' == $_GET['contactform'] || 0 == count($contact_forms)) {
|
121 |
+
$initial = true;
|
122 |
+
$contact_forms[] = array();
|
123 |
+
$current = max(array_keys($contact_forms));
|
124 |
+
$contact_forms[$current] = $this->default_pack(__('Contact form', 'wpcf7') . ' ' . $current, true);
|
125 |
+
} else {
|
126 |
+
$current = (int) $_GET['contactform'];
|
127 |
+
if (! array_key_exists($current, $contact_forms))
|
128 |
+
$current = min(array_keys($contact_forms));
|
129 |
+
}
|
130 |
+
|
131 |
+
include 'includes/admin-panel.php';
|
132 |
+
}
|
133 |
+
|
134 |
+
function default_pack($title, $initial = false) {
|
135 |
+
$cf = array('title' => $title,
|
136 |
+
'form' => $this->default_form_template(),
|
137 |
+
'mail' => $this->default_mail_template(),
|
138 |
+
'options' => $this->default_options_template());
|
139 |
+
if ($initial)
|
140 |
+
$cf['initial'] = true;
|
141 |
+
return $cf;
|
142 |
+
}
|
143 |
+
|
144 |
+
function default_form_template() {
|
145 |
+
$template .= '<p><label>' . __('Your Name', 'wpcf7') . ' ' . __('(required)', 'wpcf7') . '<br />' . "\n";
|
146 |
+
$template .= ' [text* your-name "' . __('Your Name', 'wpcf7') . '"] </label></p>' . "\n\n";
|
147 |
+
$template .= '<p><label>' . __('Your Email', 'wpcf7') . ' ' . __('(required)', 'wpcf7') . '<br />' . "\n";
|
148 |
+
$template .= ' [email* your-email "' . __('Your Email', 'wpcf7') . '"] </label></p>' . "\n\n";
|
149 |
+
$template .= '<p><label>' . __('Subject', 'wpcf7') . '<br />' . "\n";
|
150 |
+
$template .= ' [text your-subject "' . __('Subject', 'wpcf7') . '"] </label></p>' . "\n\n";
|
151 |
+
$template .= '<p><label>' . __('Your Message', 'wpcf7') . '<br />' . "\n";
|
152 |
+
$template .= ' [textarea your-message "' . __('Your Message', 'wpcf7') . '"] </label></p>' . "\n\n";
|
153 |
+
$template .= '[submit "' . __('Send', 'wpcf7') . '"]';
|
154 |
+
return $template;
|
155 |
+
}
|
156 |
+
|
157 |
+
function default_mail_template() {
|
158 |
+
$subject = '[your-subject]';
|
159 |
+
$sender = '[your-name] <[your-email]>';
|
160 |
+
$body = '[your-message]';
|
161 |
+
return compact('subject', 'sender', 'body');
|
162 |
+
}
|
163 |
+
|
164 |
+
function default_options_template() {
|
165 |
+
$recipient = get_option('admin_email');
|
166 |
+
return compact('recipient');
|
167 |
+
}
|
168 |
+
|
169 |
+
/* Post content filtering */
|
170 |
+
|
171 |
+
function the_content_filter($content) {
|
172 |
+
// Form submitted?
|
173 |
+
if (isset($_POST['_wpcf7'])) {
|
174 |
+
$id = (int) $_POST['_wpcf7'];
|
175 |
+
$contact_forms = $this->contact_forms();
|
176 |
+
if ($cf = $contact_forms[$id]) {
|
177 |
+
$cf = stripslashes_deep($cf);
|
178 |
+
$fes = $this->form_elements($cf['form'], false);
|
179 |
+
$validation = $this->validate_form_elements($fes);
|
180 |
+
if ($validation['valid']) {
|
181 |
+
$regex = '/\[\s*([a-zA-Z][0-9a-zA-Z:._-]*)\s*\]/';
|
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));
|
193 |
+
}
|
194 |
+
} else {
|
195 |
+
$_POST['_wpcf7_validation_errors'] = array('id' => $id, 'messages' => $validation['reason']);
|
196 |
+
}
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
$regex = '/\[\s*contact-form\s+(\d+)(?:\s+.*?)?\s*\]/';
|
201 |
+
return preg_replace_callback($regex, array(&$this, 'the_content_filter_callback'), $content);
|
202 |
+
}
|
203 |
+
|
204 |
+
function the_content_filter_callback($matches) {
|
205 |
+
$contact_forms = $this->contact_forms();
|
206 |
+
|
207 |
+
$id = (int) $matches[1];
|
208 |
+
if (! ($cf = $contact_forms[$id])) return $matches[0];
|
209 |
+
|
210 |
+
if (isset($_POST['_wpcf7'])) {
|
211 |
+
if ((int) $_POST['_wpcf7'] == $id)
|
212 |
+
$_POST['_wpcf7_submitted'] = 1;
|
213 |
+
else
|
214 |
+
unset($_POST['_wpcf7_submitted']);
|
215 |
+
}
|
216 |
+
|
217 |
+
$cf = stripslashes_deep($cf);
|
218 |
+
|
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 |
+
$form .= '<div class="wpcf7-mail-sent-ok"><ul><li>' . $_POST['_wpcf7_mail_sent']['message'] . '</li></ul></div>';
|
225 |
+
else
|
226 |
+
$form .= '<div class="wpcf7-mail-sent-ng"><ul><li>' . $_POST['_wpcf7_mail_sent']['message'] . '</li></ul></div>';
|
227 |
+
} elseif (isset($_POST['_wpcf7_validation_errors']) && $_POST['_wpcf7_validation_errors']['id'] == $id) {
|
228 |
+
$form .= '<div class="wpcf7-validation-errors"><ul>';
|
229 |
+
foreach ($_POST['_wpcf7_validation_errors']['messages'] as $err) {
|
230 |
+
$form .= '<li>' . $err . '</li>';
|
231 |
+
}
|
232 |
+
$form .= '</ul></div>';
|
233 |
+
}
|
234 |
+
$form .= '<form action="' . get_permalink() . '#wpcf7_' . $id . '" method="post">';
|
235 |
+
$form .= '<input type="hidden" name="_wpcf7" value="' . $id . '" />';
|
236 |
+
$form .= $form_content;
|
237 |
+
$form .= '</form></div>';
|
238 |
+
return $form;
|
239 |
+
}
|
240 |
+
|
241 |
+
function validate_form_elements($form_elements) {
|
242 |
+
$valid = true;
|
243 |
+
$reason = array();
|
244 |
+
|
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)) {
|
252 |
+
if (empty($_POST[$name])) {
|
253 |
+
$valid = false;
|
254 |
+
$reason[] = sprintf(__('Please fill the required field: %s ', 'wpcf7'), $title);
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
if (preg_match('/^email[*]?$/', $type)) {
|
259 |
+
if ('*' == substr($type, -1) && empty($_POST[$name])) {
|
260 |
+
$valid = false;
|
261 |
+
$reason[] = sprintf(__('Please fill the required field: %s ', 'wpcf7'), $title);
|
262 |
+
} elseif (! is_email($_POST[$name])) {
|
263 |
+
$valid = false;
|
264 |
+
$reason[] = sprintf(__('Email address seems invalid: %s ', 'wpcf7'), $title);
|
265 |
+
}
|
266 |
+
}
|
267 |
+
}
|
268 |
+
return compact('valid', 'reason');
|
269 |
+
}
|
270 |
+
|
271 |
+
function default_mail_result_message($ok = true) {
|
272 |
+
if ($ok)
|
273 |
+
return __('Your message was sent successfully. Thanks.', 'wpcf7');
|
274 |
+
else
|
275 |
+
return __('Failed to send your message. Please try later or contact administrator by other way.', 'wpcf7');
|
276 |
+
}
|
277 |
+
|
278 |
+
function stylesheet() {
|
279 |
+
$stylesheet_url = get_option('siteurl') . '/wp-content/plugins/contact-form-7/admin-stylesheet.css';
|
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
|
290 |
+
$form = preg_replace_callback('/\[\s*submit(\s+(?:"[^"]*"|\'[^\']*\'))?\s*\]/', array(&$this, 'submit_replace_callback'), $form);
|
291 |
+
return $form;
|
292 |
+
} else {
|
293 |
+
$results = array();
|
294 |
+
preg_match_all($regex, $form, $matches, PREG_SET_ORDER);
|
295 |
+
foreach ($matches as $match) {
|
296 |
+
$results[] = (array) $this->form_element_parse($match);
|
297 |
+
}
|
298 |
+
return $results;
|
299 |
+
}
|
300 |
+
}
|
301 |
+
|
302 |
+
function form_element_replace_callback($matches) {
|
303 |
+
extract((array) $this->form_element_parse($matches));
|
304 |
+
$atts = '';
|
305 |
+
if (is_array($options)) {
|
306 |
+
$id_array = preg_grep('%^id:[-0-9a-zA-Z_]+$%', $options);
|
307 |
+
if ($id = array_shift($id_array)) {
|
308 |
+
preg_match('%^id:([-0-9a-zA-Z_]+)$%', $id, $id_matches);
|
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) {
|
315 |
+
preg_match('%^class:([-0-9a-zA-Z_]+)$%', $class, $class_matches);
|
316 |
+
if ($class = $class_matches[1])
|
317 |
+
$class_att .= ' ' . $class;
|
318 |
+
}
|
319 |
+
if ($class_att)
|
320 |
+
$atts .= ' class="' . trim($class_att) . '"';
|
321 |
+
}
|
322 |
+
$type = preg_replace('/[*]$/', '', $type);
|
323 |
+
switch ($type) {
|
324 |
+
case 'text':
|
325 |
+
case 'email':
|
326 |
+
if (is_array($options)) {
|
327 |
+
$size_maxlength_array = preg_grep('%^[0-9]*/[0-9]*$%', $options);
|
328 |
+
if ($size_maxlength = array_shift($size_maxlength_array)) {
|
329 |
+
preg_match('%^([0-9]*)/([0-9]*)$%', $size_maxlength, $sm_matches);
|
330 |
+
if ($size = (int) $sm_matches[1])
|
331 |
+
$atts .= ' size="' . $size . '"';
|
332 |
+
if ($maxlength = (int) $sm_matches[2])
|
333 |
+
$atts .= ' maxlength="' . $maxlength . '"';
|
334 |
+
}
|
335 |
+
}
|
336 |
+
if (isset($_POST['_wpcf7_mail_sent']) && $_POST['_wpcf7_mail_sent']['ok']) {
|
337 |
+
$value = '';
|
338 |
+
} elseif (isset($_POST['_wpcf7_submitted'])) {
|
339 |
+
$value = $_POST[$name];
|
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)) {
|
347 |
+
$cols_rows_array = preg_grep('%^[0-9]*x[0-9]*$%', $options);
|
348 |
+
if ($cols_rows = array_shift($cols_rows_array)) {
|
349 |
+
preg_match('%^([0-9]*)x([0-9]*)$%', $cols_rows, $cr_matches);
|
350 |
+
if ($cols = (int) $cr_matches[1])
|
351 |
+
$atts .= ' cols="' . $cols . '"';
|
352 |
+
if ($rows = (int) $cr_matches[2])
|
353 |
+
$atts .= ' rows="' . $rows . '"';
|
354 |
+
}
|
355 |
+
}
|
356 |
+
if (isset($_POST['_wpcf7_mail_sent']) && $_POST['_wpcf7_mail_sent']['ok']) {
|
357 |
+
$value = '';
|
358 |
+
} elseif (isset($_POST['_wpcf7_submitted'])) {
|
359 |
+
$value = $_POST[$name];
|
360 |
+
} else {
|
361 |
+
$value = array_shift($values);
|
362 |
+
}
|
363 |
+
return '<textarea name="' . $name . '"' . $atts . '>' . $value . '</textarea>';
|
364 |
+
break;
|
365 |
+
}
|
366 |
+
}
|
367 |
+
|
368 |
+
function submit_replace_callback($matches) {
|
369 |
+
if ($matches[1])
|
370 |
+
$value = $this->strip_quote($matches[1]);
|
371 |
+
if (empty($value))
|
372 |
+
$value = __('Send', 'wpcf7');
|
373 |
+
return '<input type="submit" value="' . $value . '" />';
|
374 |
+
}
|
375 |
+
|
376 |
+
function form_element_parse($element) {
|
377 |
+
$type = trim($element[1]);
|
378 |
+
$name = trim($element[2]);
|
379 |
+
$title = $this->strip_quote($element[3]);
|
380 |
+
$options = preg_split('/[\s]+/', trim($element[4]));
|
381 |
+
$values = $this->strip_quote_deep(array_slice($element, 5));
|
382 |
+
return compact('type', 'name', 'title', 'options', 'values');
|
383 |
+
}
|
384 |
+
|
385 |
+
function strip_quote($text) {
|
386 |
+
$text = trim($text);
|
387 |
+
if (preg_match('/^"(.*)"$/', $text, $matches))
|
388 |
+
$text = $matches[1];
|
389 |
+
elseif (preg_match("/^'(.*)'$/", $text, $matches))
|
390 |
+
$text = $matches[1];
|
391 |
+
return $text;
|
392 |
+
}
|
393 |
+
|
394 |
+
function strip_quote_deep($arr) {
|
395 |
+
if (is_string($arr))
|
396 |
+
return $this->strip_quote($arr);
|
397 |
+
if (is_array($arr)) {
|
398 |
+
$result = array();
|
399 |
+
foreach ($arr as $key => $text) {
|
400 |
+
$result[$key] = $this->strip_quote($text);
|
401 |
+
}
|
402 |
+
return $result;
|
403 |
+
}
|
404 |
+
}
|
405 |
+
|
406 |
+
}
|
407 |
+
|
408 |
+
new tam_contact_form_seven();
|
409 |
+
|
410 |
+
?>
|