Version Description
Popover forms will be added in September 2010.
Download this release
Release Info
Developer | tlovett1 |
Plugin | Custom Contact Forms |
Version | 3.1.0 |
Comparing to | |
See all releases |
Code changes from version 3.0.2 to 3.1.0
- custom-contact-forms-db.php +2 -2
- custom-contact-forms-widget.php +57 -0
- custom-contact-forms.css +44 -59
- custom-contact-forms.php +104 -99
- images/success-popover-example.gif +0 -0
- js/custom-contact-forms.js +2 -5
- readme.txt +11 -5
custom-contact-forms-db.php
CHANGED
@@ -108,8 +108,8 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
108 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `field_backgroundcolor` VARCHAR( 20 ) NOT NULL DEFAULT '#efefef'");
|
109 |
if (!$this->columnExists('field_borderstyle', $this->styles_table))
|
110 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `field_borderstyle` VARCHAR( 20 ) NOT NULL DEFAULT 'solid'");
|
111 |
-
if (!$this->columnExists('
|
112 |
-
$wpdb->query("ALTER TABLE `" . $this->
|
113 |
if (!$this->columnExists('form_padding', $this->styles_table))
|
114 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `form_padding` VARCHAR( 20 ) NOT NULL DEFAULT '4px'");
|
115 |
if (!$this->columnExists('title_margin', $this->styles_table))
|
108 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `field_backgroundcolor` VARCHAR( 20 ) NOT NULL DEFAULT '#efefef'");
|
109 |
if (!$this->columnExists('field_borderstyle', $this->styles_table))
|
110 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `field_borderstyle` VARCHAR( 20 ) NOT NULL DEFAULT 'solid'");
|
111 |
+
if (!$this->columnExists('form_success_title', $this->forms_table))
|
112 |
+
$wpdb->query("ALTER TABLE `" . $this->forms_table . "` ADD `form_success_title` VARCHAR( 150 ) NOT NULL DEFAULT 'Form Success!'");
|
113 |
if (!$this->columnExists('form_padding', $this->styles_table))
|
114 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `form_padding` VARCHAR( 20 ) NOT NULL DEFAULT '4px'");
|
115 |
if (!$this->columnExists('title_margin', $this->styles_table))
|
custom-contact-forms-widget.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Custom Contact Forms Plugin
|
4 |
+
By Taylor Lovett - http://www.taylorlovett.com
|
5 |
+
Plugin URL: http://www.taylorlovett.com/wordpress-plugins
|
6 |
+
*/
|
7 |
+
if (!class_exists('CustomContactFormsWidget')) {
|
8 |
+
class CustomContactFormsWidget extends WP_Widget {
|
9 |
+
function CustomContactFormsWidget() {
|
10 |
+
$widget_ops = array('description' => 'Add a customized contact form to your sidebar.');
|
11 |
+
$this->WP_Widget('custom-contact-forms', 'Custom Contact Forms', $widget_ops);
|
12 |
+
}
|
13 |
+
|
14 |
+
|
15 |
+
function widget($args, $instance) {
|
16 |
+
global $customcontact;
|
17 |
+
$admin_option = $customcontact->getAdminOptions();
|
18 |
+
$form_id = intval($instance['form_id']);
|
19 |
+
if ((is_front_page() and $admin_option[show_widget_home] != 1) or (is_single() and $admin_option[show_widget_singles] != 1) or
|
20 |
+
(is_page() and $admin_option[show_widget_pages] != 1) or (is_category() and $admin_option[show_widget_categories] != 1) or
|
21 |
+
(is_archive() and $admin_option[show_widget_archives] != 1))
|
22 |
+
return false;
|
23 |
+
if (empty($form_id) or $form_id < 1) return false;
|
24 |
+
extract($args);
|
25 |
+
echo $before_widget.$before_form_id.$title.$after_title;
|
26 |
+
echo $customcontact->getFormCode($form_id, true);
|
27 |
+
echo $after_widget;
|
28 |
+
}
|
29 |
+
|
30 |
+
function update($new_instance, $old_instance) {
|
31 |
+
$instance = $old_instance;
|
32 |
+
$instance[form_id] = $new_instance[form_id];
|
33 |
+
return $instance;
|
34 |
+
}
|
35 |
+
|
36 |
+
function form($instance) {
|
37 |
+
global $customcontact;
|
38 |
+
$forms = $customcontact->selectAllForms();
|
39 |
+
$form_id = esc_attr($instance['form_id']);
|
40 |
+
?>
|
41 |
+
<p><label for="<?php echo $this->get_field_id('form_id'); ?>">
|
42 |
+
Choose a Form:
|
43 |
+
<select id="<?php echo $this->get_field_id('form_id'); ?>" name="<?php echo $this->get_field_name('form_id'); ?>">
|
44 |
+
<?php
|
45 |
+
foreach ($forms as $form) {
|
46 |
+
?>
|
47 |
+
<option <?php if ($form_id == $form->id) echo 'selected="selected"'?> value="<?php echo $form->id; ?>"><?php echo $form->form_slug; ?></option>
|
48 |
+
<?php
|
49 |
+
}
|
50 |
+
?>
|
51 |
+
</select>
|
52 |
+
</label></p>
|
53 |
+
<?php
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
?>
|
custom-contact-forms.css
CHANGED
@@ -1,85 +1,61 @@
|
|
1 |
/* Custom Contact Forms CSS */
|
2 |
-
form.customcontactform {
|
3 |
margin:8px;
|
4 |
width:95%;
|
5 |
max-width:600px;
|
6 |
font-size:1em;
|
7 |
padding:4px;
|
8 |
-
color:#333333;
|
9 |
-
}
|
10 |
-
form.customcontactform-sidebar {
|
11 |
-
width:100%;
|
12 |
-
max-width:600px;
|
13 |
-
padding:4px;
|
14 |
-
color:#333333;
|
15 |
-
font-size:1em;
|
16 |
-
}
|
17 |
-
form.customcontactform div, form.customcontactform-sidebar div {
|
18 |
-
list-style-type:none;
|
19 |
-
}
|
20 |
-
form.customcontactform div p, form.customcontactform-sidebar div p {
|
21 |
-
margin:0;
|
22 |
-
padding:4px 0 4px 0;
|
23 |
-
}
|
24 |
-
form.customcontactform div p {
|
25 |
-
border-bottom:1px dashed #999;
|
26 |
}
|
|
|
27 |
form.customcontactform h4, form.customcontactform-sidebar h4 {
|
28 |
-
font-size:1.
|
29 |
font-weight:bold;
|
30 |
}
|
31 |
-
form.customcontactform div
|
32 |
-
|
33 |
-
|
|
|
|
|
34 |
width:100%;
|
|
|
35 |
}
|
36 |
-
form.customcontactform-sidebar div
|
37 |
-
form.customcontactform div
|
38 |
-
display:inline;
|
39 |
-
width:20%;
|
40 |
-
}
|
41 |
-
form.customcontactform div .show-field-instructions, form.customcontactform-sidebar div .show-field-instructions {
|
42 |
-
|
43 |
-
}
|
44 |
-
form.customcontactform div span.field-instructions, form.customcontactform-sidebar div span.field-instructions {
|
45 |
-
display:none;
|
46 |
-
}
|
47 |
-
form.customcontactform div p input[type=text], form.customcontactform div p textarea, form.customcontactform-sidebar div p input[type=text], form.customcontactform-sidebar div p textarea {
|
48 |
-
border-width:1px;
|
49 |
-
border-style:solid;
|
50 |
-
border-spacing:0;
|
51 |
-
font-weight:normal;
|
52 |
width:16em;
|
53 |
padding:2px;
|
54 |
-
clear:both;
|
55 |
margin:0;
|
56 |
-
font-size:1.
|
57 |
font-family:Verdana, Arial, Helvetica, sans-serif;
|
58 |
-moz-border-radius:4px;
|
59 |
-khtml-border-radius:4px;
|
60 |
-webkit-border-radius:4px;
|
61 |
border-radius:4px;
|
62 |
-
word-wrap:break-word;
|
63 |
-
}
|
64 |
-
form.customcontactform p, form.customcontactform-sidebar p { padding:0 0 0px 17px; margin:0; }
|
65 |
-
form.customcontactform div p input[type=submit], form.customcontactform div p .submit, form.customcontactform-sidebar div p .submit {
|
66 |
-
font-size:1em; margin-left:2px;
|
67 |
}
|
68 |
-
form.customcontactform div
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
form.customcontactform-sidebar div p input[type=text], form.customcontactform-sidebar div p textarea {
|
74 |
-
width:90%;
|
75 |
-
font-size:12px;
|
76 |
margin:0;
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
/* ------------------ custom contact forms admin panel ---------------- */
|
79 |
#customcontactforms-admin {
|
80 |
vertical-align:top;
|
81 |
margin:1em 0 30px 25px;
|
82 |
}
|
|
|
83 |
#customcontactforms-admin input, textarea, select {
|
84 |
font-size:1em;
|
85 |
}
|
@@ -128,6 +104,7 @@ form.customcontactform-sidebar div p input[type=text], form.customcontactform-si
|
|
128 |
width:500px;
|
129 |
margin:20px 1em 1em 5px;
|
130 |
}
|
|
|
131 |
#customcontactforms-admin #style-example {
|
132 |
background:url(images/style-example.gif) no-repeat top left;
|
133 |
width:405px;
|
@@ -136,9 +113,17 @@ form.customcontactform-sidebar div p input[type=text], form.customcontactform-si
|
|
136 |
margin:10px 0 0 10px;
|
137 |
border:0;
|
138 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
#customcontactforms-admin #create-styles {
|
140 |
clear:both;
|
141 |
-
height:
|
142 |
width:1000px;
|
143 |
margin:20px 1em 1em 5px;
|
144 |
}
|
@@ -284,7 +269,7 @@ form.customcontactform-sidebar div p input[type=text], form.customcontactform-si
|
|
284 |
display:none;
|
285 |
border: 9px solid #efefef;
|
286 |
border-spacing:0;
|
287 |
-
width:
|
288 |
height:200px
|
289 |
padding:0px;
|
290 |
margin:0;
|
@@ -299,9 +284,9 @@ form.customcontactform-sidebar div p input[type=text], form.customcontactform-si
|
|
299 |
}
|
300 |
|
301 |
#ccf-form-success h5 {
|
302 |
-
background-color:#efefef; margin:0 0 15px
|
303 |
text-align:left;
|
304 |
-
padding:9px;
|
305 |
font-size:1.5em;
|
306 |
font-weight:bold;
|
307 |
}
|
1 |
/* Custom Contact Forms CSS */
|
2 |
+
form.customcontactform, form.customcontactform-sidebar {
|
3 |
margin:8px;
|
4 |
width:95%;
|
5 |
max-width:600px;
|
6 |
font-size:1em;
|
7 |
padding:4px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
}
|
9 |
+
form.customcontactform-sidebar { width:100%; }
|
10 |
form.customcontactform h4, form.customcontactform-sidebar h4 {
|
11 |
+
font-size:1.3em;
|
12 |
font-weight:bold;
|
13 |
}
|
14 |
+
form.customcontactform div label, form.customcontactform-sidebar div label { display:block; width:100%; }
|
15 |
+
form.customcontactform div label.checkbox, form.customcontactform-sidebar div label.checkbox { display:inline; }
|
16 |
+
form.customcontactform div, form.customcontactform-sidebar div {
|
17 |
+
border-bottom: 1px dashed #666;
|
18 |
+
padding:.4em 0 .3em 0;
|
19 |
width:100%;
|
20 |
+
margin:0 0 4px 0;
|
21 |
}
|
22 |
+
form.customcontactform div div, form.customcontactform-sidebar div div { border-bottom:none; padding:0; }
|
23 |
+
form.customcontactform div input, form.customcontactform div select, form.customcontactform-sidebar div input, form.customcontactform-sidebar div select {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
width:16em;
|
25 |
padding:2px;
|
|
|
26 |
margin:0;
|
27 |
+
font-size:1.3em;
|
28 |
font-family:Verdana, Arial, Helvetica, sans-serif;
|
29 |
-moz-border-radius:4px;
|
30 |
-khtml-border-radius:4px;
|
31 |
-webkit-border-radius:4px;
|
32 |
border-radius:4px;
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
+
form.customcontactform div input[type=checkbox], form.customcontactform-sidebar div input[type=checkbox] { width:30px; margin:0 6px 0 0; }
|
35 |
+
form.customcontactform input, form.customcontactform-sidebar input { margin: 7px 0 0 0; }
|
36 |
+
form.customcontactform div textarea, form.customcontactform-sidebar div textarea {
|
37 |
+
width:16em;
|
38 |
+
padding:4px;
|
|
|
|
|
|
|
39 |
margin:0;
|
40 |
+
font-size:1.3em;
|
41 |
+
font-family:Verdana, Arial, Helvetica, sans-serif;
|
42 |
+
-moz-border-radius:6px;
|
43 |
+
-khtml-border-radius:6px;
|
44 |
+
-webkit-border-radius:6px;
|
45 |
+
border-radius:6px;
|
46 |
+
height:5em;
|
47 |
+
}
|
48 |
+
form.customcontactform-sidebar div input[type=text],
|
49 |
+
form.customcontactform-sidebar div select,
|
50 |
+
form.customcontactform-sidebar div textarea { width:95%; max-width:16em; margin:2px 0 4px 0; }
|
51 |
+
|
52 |
+
|
53 |
/* ------------------ custom contact forms admin panel ---------------- */
|
54 |
#customcontactforms-admin {
|
55 |
vertical-align:top;
|
56 |
margin:1em 0 30px 25px;
|
57 |
}
|
58 |
+
#customcontactforms-admin label { font-weight:bold; }
|
59 |
#customcontactforms-admin input, textarea, select {
|
60 |
font-size:1em;
|
61 |
}
|
104 |
width:500px;
|
105 |
margin:20px 1em 1em 5px;
|
106 |
}
|
107 |
+
#customcontactforms-admin #general-settings label { font-weight:bold; }
|
108 |
#customcontactforms-admin #style-example {
|
109 |
background:url(images/style-example.gif) no-repeat top left;
|
110 |
width:405px;
|
113 |
margin:10px 0 0 10px;
|
114 |
border:0;
|
115 |
}
|
116 |
+
#customcontactforms-admin #success-popover-example {
|
117 |
+
background:url(images/success-popover-example.gif) no-repeat top left;
|
118 |
+
width:405px;
|
119 |
+
height:135px;
|
120 |
+
padding-left:20px;
|
121 |
+
margin:10px 0 0 10px;
|
122 |
+
border:0;
|
123 |
+
}
|
124 |
#customcontactforms-admin #create-styles {
|
125 |
clear:both;
|
126 |
+
height:42em;
|
127 |
width:1000px;
|
128 |
margin:20px 1em 1em 5px;
|
129 |
}
|
269 |
display:none;
|
270 |
border: 9px solid #efefef;
|
271 |
border-spacing:0;
|
272 |
+
width:480px;
|
273 |
height:200px
|
274 |
padding:0px;
|
275 |
margin:0;
|
284 |
}
|
285 |
|
286 |
#ccf-form-success h5 {
|
287 |
+
background-color:#efefef; margin:0 0 15px 0px;
|
288 |
text-align:left;
|
289 |
+
padding:9px 9px 9px 20px;
|
290 |
font-size:1.5em;
|
291 |
font-weight:bold;
|
292 |
}
|
custom-contact-forms.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Custom Contact Forms
|
4 |
Plugin URI: http://taylorlovett.com/wordpress-plugins
|
5 |
Description: Guaranteed to be 1000X more customizable and intuitive than Fast Secure Contact Forms or Contact Form 7. Customize every aspect of your forms without any knowledge of CSS: borders, padding, sizes, colors. Ton's of great features. Required fields, captchas, tooltip popovers, unlimited fields/forms/form styles, use a custom thank you page or built-in popover with a custom success message set for each form. <a href="options-general.php?page=custom-contact-forms">Settings</a>
|
6 |
-
Version: 3.0
|
7 |
Author: Taylor Lovett
|
8 |
Author URI: http://www.taylorlovett.com
|
9 |
*/
|
@@ -28,11 +28,12 @@ if (!class_exists('CustomContactForms')) {
|
|
28 |
class CustomContactForms extends CustomContactFormsDB {
|
29 |
var $adminOptionsName = 'customContactFormsAdminOptions';
|
30 |
var $widgetOptionsName = 'widget_customContactForms';
|
31 |
-
var $version = '
|
32 |
var $form_errors;
|
33 |
var $error_return;
|
34 |
var $gets;
|
35 |
var $current_thank_you_message;
|
|
|
36 |
var $fixed_fields = array('customcontactforms_submit' => '',
|
37 |
'fid' => '',
|
38 |
'fixedEmail' => 'Use this field if you want the plugin to throw an error on fake emails.',
|
@@ -49,7 +50,7 @@ if (!class_exists('CustomContactForms')) {
|
|
49 |
function getAdminOptions() {
|
50 |
$admin_email = get_option('admin_email');
|
51 |
$customcontactAdminOptions = array('show_widget_home' => 1, 'show_widget_pages' => 1, 'show_widget_singles' => 1, 'show_widget_categories' => 1, 'show_widget_archives' => 1, 'default_to_email' => $admin_email, 'default_from_email' => $admin_email, 'default_form_subject' => 'Someone Filled Out Your Contact Form!',
|
52 |
-
'remember_field_values' => 0, 'author_link' => 1, 'enable_widget_tooltips' => 1, 'wp_mail_function' => 1, 'form_success_message' => 'Thank you for filling out our web form. We will get back to you ASAP.'); // default general settings
|
53 |
$customcontactOptions = get_option($this->adminOptionsName);
|
54 |
if (!empty($customcontactOptions)) {
|
55 |
foreach ($customcontactOptions as $key => $option)
|
@@ -62,76 +63,34 @@ if (!class_exists('CustomContactForms')) {
|
|
62 |
$this->storeGets();
|
63 |
$this->getAdminOptions();
|
64 |
if (!is_admin()) {
|
65 |
-
wp_enqueue_script('jquery');
|
66 |
$this->startSession();
|
67 |
$this->processForms();
|
68 |
}
|
69 |
-
$this->registerSidebar();
|
70 |
}
|
71 |
|
72 |
-
function
|
73 |
-
|
74 |
-
|
75 |
-
}
|
76 |
-
|
77 |
-
function customContactForms_control() {
|
78 |
-
$option = get_option($this->widgetOptionsName);
|
79 |
-
if (empty($option)) $option = array('widget_form_id' => '0');
|
80 |
-
if ($_POST[widget_form_id]) {
|
81 |
-
$option[widget_form_id] = $_POST[widget_form_id];
|
82 |
-
update_option($this->widgetOptionsName, $option);
|
83 |
-
$option = get_option($this->widgetOptionsName);
|
84 |
-
}
|
85 |
-
$forms = parent::selectAllForms();
|
86 |
-
|
87 |
-
$form_options = '';
|
88 |
-
foreach ($forms as $form) {
|
89 |
-
$sel = ($option[widget_form_id] == $form->id) ? ' selected="selected"' : '';
|
90 |
-
$form_options .= '<option value="'.$form->id.'"'.$sel.'>'.$form->form_slug.'</option>';
|
91 |
-
}
|
92 |
-
if (empty($form_options)) { ?>
|
93 |
-
<p>Create a form in the Custom Contact Forms settings page.</p>
|
94 |
-
<?php
|
95 |
-
} else {
|
96 |
-
?>
|
97 |
-
<p>
|
98 |
-
<label for="widget_form_id">Show Form:</label>
|
99 |
-
<select name="widget_form_id">
|
100 |
-
<?php echo $form_options; ?>
|
101 |
-
</select>
|
102 |
-
</p>
|
103 |
-
<?php
|
104 |
-
}
|
105 |
-
}
|
106 |
-
function widget_customContactForms($args) {
|
107 |
-
extract($args);
|
108 |
-
$admin_option = $this->getAdminOptions();
|
109 |
-
if ((is_front_page() and $admin_option[show_widget_home] != 1) or (is_single() and $admin_option[show_widget_singles] != 1) or
|
110 |
-
(is_page() and $admin_option[show_widget_pages] != 1) or (is_category() and $admin_option[show_widget_categories] != 1) or
|
111 |
-
(is_archive() and $admin_option[show_widget_archives] != 1))
|
112 |
-
return false;
|
113 |
-
$option = get_option($this->widgetOptionsName);
|
114 |
-
if (empty($option) or $option[widget_form_id] < 1) return false;
|
115 |
-
echo $before_widget . $this->getFormCode($option[widget_form_id], true) . $after_widget;
|
116 |
-
}
|
117 |
-
function addHeaderCode() {
|
118 |
-
?>
|
119 |
-
<!-- Custom Contact Forms by Taylor Lovett - http://www.taylorlovett.com -->
|
120 |
-
<link rel="stylesheet" href="<?php echo get_option('siteurl'); ?>/wp-content/plugins/custom-contact-forms/custom-contact-forms.css" type="text/css" media="screen" />
|
121 |
-
<?php
|
122 |
}
|
123 |
|
124 |
function insertAdminScripts() {
|
|
|
125 |
wp_enqueue_script('ccf-main', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/custom-contact-forms-admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-tabs'/*, 'jquery-ui-draggable', 'jquery-ui-resizable', 'jquery-ui-dialog'*/), '1.0');
|
126 |
}
|
127 |
|
128 |
function insertFrontEndScripts() {
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
}
|
136 |
|
137 |
function setFormError($key, $message) {
|
@@ -169,7 +128,10 @@ if (!class_exists('CustomContactForms')) {
|
|
169 |
$admin_options[show_widget_home] = $_POST[show_widget_home];
|
170 |
$admin_options[custom_thank_you] = $_POST[custom_thank_you];
|
171 |
$admin_options[author_link] = $_POST[author_link];
|
|
|
|
|
172 |
$admin_options[form_success_message] = $_POST[form_success_message];
|
|
|
173 |
$admin_options[wp_mail_function] = $_POST[wp_mail_function];
|
174 |
$admin_options[enable_widget_tooltips] = $_POST[enable_widget_tooltips];
|
175 |
$admin_options[remember_field_values] = $_POST[remember_field_values];
|
@@ -227,10 +189,11 @@ if (!class_exists('CustomContactForms')) {
|
|
227 |
<li>
|
228 |
<label for="field_slug">* Slug (Name):</label>
|
229 |
<input name="field[field_slug]" type="text" maxlength="50" />
|
230 |
-
(
|
231 |
<li>
|
232 |
<label for="field_label">Field Label:</label>
|
233 |
-
<input name="field[field_label]" type="text" maxlength="100" />
|
|
|
234 |
</li>
|
235 |
<li>
|
236 |
<label for="field_type">* Field Type:</label>
|
@@ -243,15 +206,17 @@ if (!class_exists('CustomContactForms')) {
|
|
243 |
</li>
|
244 |
<li>
|
245 |
<label for="field_value">Initial Value:</label>
|
246 |
-
<input name="field[field_value]" type="text" maxlength="50" />
|
|
|
247 |
</li>
|
248 |
<li>
|
249 |
<label for="field_maxlength">Max Length:</label>
|
250 |
<input class="width50" size="10" name="field[field_maxlength]" type="text" maxlength="4" />
|
251 |
-
(0 for no limit; only applies to Text fields)</li>
|
252 |
<li>
|
253 |
<label for="field_required">Required Field:</label>
|
254 |
-
<select name="field[field_required]"><option value="0">No</option><option value="1">Yes</option></select
|
|
|
255 |
<li>
|
256 |
<label for="field_value">Field Instructions:</label>
|
257 |
<input name="field[field_instructions]" type="text" /><br />
|
@@ -308,6 +273,10 @@ if (!class_exists('CustomContactForms')) {
|
|
308 |
<label for="form[form_success_message]">Form Success Message:</label>
|
309 |
<input type="text" name="form[form_success_message]" /><br />
|
310 |
(Will be displayed in a popover when the form is filled out successfully when no custom success page is specified; if left blank it will use the default specified in general settings.)</li>
|
|
|
|
|
|
|
|
|
311 |
<li>
|
312 |
<label for="form[form_thank_you_page]">Custom Success URL:</label>
|
313 |
<input type="text" name="form[form_thank_you_page]" /><br />
|
@@ -491,18 +460,18 @@ if (!class_exists('CustomContactForms')) {
|
|
491 |
<table class="form-extra-options-table">
|
492 |
<tbody>
|
493 |
<tr>
|
494 |
-
<td class="bold">
|
495 |
<td class="bold">Form Action</td>
|
496 |
<td class="bold">Destination Email</td>
|
497 |
-
<td class="bold">
|
498 |
<td class="bold">Success Message</td>
|
499 |
<td class="bold">Custom Success URL</td>
|
500 |
</tr>
|
501 |
<tr>
|
502 |
<td><select name="form[form_method]"><?php echo $form_methods; ?></select></td>
|
503 |
-
<td><input type="text" name="form[form_action]" value="<?php echo $forms[$i]->form_action; ?>" /></td>
|
504 |
-
<td><input type="text" name="form[form_email]" value="<?php echo $forms[$i]->form_email; ?>" /></td>
|
505 |
-
<td><input type="text" name="form[
|
506 |
<td><input type="text" name="form[form_success_message]" value="<?php echo $forms[$i]->form_success_message; ?>" /></td>
|
507 |
<td><input type="text" class="width125" name="form[form_thank_you_page]" value="<?php echo $forms[$i]->form_thank_you_page; ?>" /></td>
|
508 |
</tr>
|
@@ -530,7 +499,7 @@ if (!class_exists('CustomContactForms')) {
|
|
530 |
</td>
|
531 |
</tr>
|
532 |
<tr>
|
533 |
-
<td colspan="6"><label for="theme_code_<?php echo $forms[$i]->id; ?>"><span>Code to Display Form in Theme Files:</span></label> <input type="text" class="width225" value="<?php if (function_exists('serveCustomContactForm')) { serveCustomContactForm(<?php echo $forms[$i]->id; ?>); } ?>" name="theme_code_<?php echo $
|
534 |
</tr>
|
535 |
</tbody>
|
536 |
</table>
|
@@ -571,6 +540,13 @@ if (!class_exists('CustomContactForms')) {
|
|
571 |
<input name="default_to_email" value="<?php echo $admin_options[default_to_email]; ?>" type="text" maxlength="100" />
|
572 |
</li>
|
573 |
<li class="descrip">Form emails will be sent <span>to</span> this address, if no destination email is specified by the form.</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
574 |
<li>
|
575 |
<label for="default_from_email">Default From Email:</label>
|
576 |
<input name="default_from_email" value="<?php echo $admin_options[default_from_email]; ?>" type="text" maxlength="100" />
|
@@ -582,7 +558,13 @@ if (!class_exists('CustomContactForms')) {
|
|
582 |
</li>
|
583 |
<li class="descrip">Default subject to be included in all form emails.</li>
|
584 |
<li>
|
585 |
-
<label for="
|
|
|
|
|
|
|
|
|
|
|
|
|
586 |
<input name="form_success_message" value="<?php echo $admin_options[form_success_message]; ?>" type="text"/>
|
587 |
</li>
|
588 |
<li class="descrip">If someone fills out a form for which a success message is not provided and a custom success page is not provided, the plugin will show a popover containing this message.</li>
|
@@ -601,6 +583,11 @@ if (!class_exists('CustomContactForms')) {
|
|
601 |
<label for="author_link">Hide Plugin Author Link in Code:</label>
|
602 |
<select name="author_link"><option value="1">Yes</option><option <?php if ($admin_options[author_link] == 0) echo 'selected="selected"'; ?> value="0">No</option></select>
|
603 |
</li>
|
|
|
|
|
|
|
|
|
|
|
604 |
<li>
|
605 |
<label for="wp_mail_function">Use Wordpress Mail Function:</label>
|
606 |
<select name="wp_mail_function"><option value="1">Yes</option><option <?php if ($admin_options[wp_mail_function] == 0) echo 'selected="selected"'; ?> value="0">No</option></select>
|
@@ -651,6 +638,7 @@ if (!class_exists('CustomContactForms')) {
|
|
651 |
<p>7. Create form styles to change your forms appearances. The image below explains how each style field can change the look of your forms.</p>
|
652 |
<p>8. (advanced) If you are confident in your HTML and CSS skills, you can use the <a href="#custom-html">Custom HTML Forms feature</a> as a framework and write your forms from scratch. This allows you to use this plugin simply to process your form requests. The Custom HTML Forms feature will process and email any form variables sent to it regardless of whether they are created in the fields manager.</p>
|
653 |
<div id="style-example"></div>
|
|
|
654 |
</div>
|
655 |
</div>
|
656 |
<a name="create-styles"></a>
|
@@ -715,6 +703,10 @@ if (!class_exists('CustomContactForms')) {
|
|
715 |
<label for="label_margin">Label Margin:</label>
|
716 |
<input type="text" maxlength="20" value="4px" name="style[label_margin]" />
|
717 |
(ex: 5px or 1em)</li>
|
|
|
|
|
|
|
|
|
718 |
</ul>
|
719 |
<ul class="style_right">
|
720 |
<li>
|
@@ -769,10 +761,7 @@ if (!class_exists('CustomContactForms')) {
|
|
769 |
<label for="title_margin">Title Margin:</label>
|
770 |
<input type="text" maxlength="20" value="2px" name="style[title_margin]" />
|
771 |
(ex: 5px or 1em)</li>
|
772 |
-
|
773 |
-
<label for="textarea_backgroundcolor">Textarea Background Color:</label>
|
774 |
-
<input type="text" maxlength="20" value="#efefef" name="style[textarea_backgroundcolor]" />
|
775 |
-
(ex: #FF0000 or red)</li>
|
776 |
<li>
|
777 |
<input type="submit" value="Create Style" name="style_create" />
|
778 |
</li>
|
@@ -879,9 +868,9 @@ if (!class_exists('CustomContactForms')) {
|
|
879 |
<input id="name" type="text" name="name" maxlength="100" /></li>
|
880 |
<li><label for="email">Your Email:</label>
|
881 |
<input id="email" type="text" value="<?php echo get_option('admin_email'); ?>" name="email" maxlength="100" /></li>
|
882 |
-
<li><label for="message"
|
883 |
<textarea id="message" name="message"></textarea></li>
|
884 |
-
<li><label for="type"
|
885 |
</ul>
|
886 |
<p><input type="submit" name="contact_author" value="Send Message" /></p>
|
887 |
</form>
|
@@ -1033,12 +1022,13 @@ the field names you want required by commas. Remember to use underscores instead
|
|
1033 |
}
|
1034 |
$action = (!empty($form->form_action)) ? $form->form_action : get_permalink();
|
1035 |
$out .= '<form id="'.$form_id.'" method="'.strtolower($form->form_method).'" action="'.$action.'" class="'.$style_class.'">' . "\n";
|
1036 |
-
$out .= parent::decodeOption($form->custom_code, 1, 1) . '<h4 id="h4-' . $form->id . '-'.$form_key.'">' . parent::decodeOption($form->form_title, 1, 1) . '</h4>' . "\n"
|
1037 |
$fields = parent::getAttachedFieldsArray($fid);
|
1038 |
$hiddens = '';
|
|
|
1039 |
foreach ($fields as $field_id) {
|
1040 |
$field = parent::selectField($field_id, '');
|
1041 |
-
$req = ($field->field_required == 1) ? '* ' : '';
|
1042 |
$req_long = ($field->field_required == 1) ? ' (required)' : '';
|
1043 |
$input_id = 'id="'.parent::decodeOption($field->field_slug, 1, 1).'"';
|
1044 |
$field_value = parent::decodeOption($field->field_value, 1, 1);
|
@@ -1050,26 +1040,26 @@ the field names you want required by commas. Remember to use underscores instead
|
|
1050 |
}
|
1051 |
|
1052 |
if ($field->user_field == 0 && $field->field_slug == 'captcha') {
|
1053 |
-
$out .= '<
|
1054 |
} elseif ($field->field_type == 'Text') {
|
1055 |
$maxlength = (empty($field->field_maxlength) or $field->field_maxlength <= 0) ? '' : ' maxlength="'.$field->field_maxlength.'"';
|
1056 |
-
$out .= '<
|
1057 |
} elseif ($field->field_type == 'Hidden') {
|
1058 |
-
$hiddens .= '<
|
1059 |
} elseif ($field->field_type == 'Checkbox') {
|
1060 |
-
$out .= '<
|
1061 |
} elseif ($field->field_type == 'Textarea') {
|
1062 |
-
$out .= '<
|
1063 |
}
|
1064 |
}
|
1065 |
$submit_text = (!empty($form->submit_button_text)) ? parent::decodeOption($form->submit_button_text, 1, 0) : 'Submit';
|
1066 |
-
$out .= '
|
1067 |
-
if ($admin_options[author_link] == 1) $out .= '<a class="hide" href="http://www.taylorlovett.com" title="Rockville Web Developer, Wordpress Plugins">Wordpress plugin expert and Rockville Web Developer Taylor Lovett</a>';
|
1068 |
|
1069 |
if ($form->form_style != 0) {
|
1070 |
$form_styles .= '<style type="text/css">' . "\n";
|
1071 |
$form_styles .= '#' . $form_id . " { width: ".$style->form_width."; padding:".$style->form_padding."; margin:".$style->form_margin."; border:".$style->form_borderwidth." ".$style->form_borderstyle." ".$style->form_bordercolor."; font-family:".$style->form_fontfamily."; }\n";
|
1072 |
-
|
1073 |
$form_styles .= '#' . $form_id . " h4 { padding:0; margin:".$style->title_margin." ".$style->title_margin." ".$style->title_margin." 0; color:".$style->title_fontcolor."; font-size:".$style->title_fontsize."; } \n";
|
1074 |
$form_styles .= '#' . $form_id . " label { padding:0; margin:".$style->label_margin." ".$style->label_margin." ".$style->label_margin." 0; display:block; color:".$style->label_fontcolor."; width:".$style->label_width."; font-size:".$style->label_fontsize."; } \n";
|
1075 |
$form_styles .= '#' . $form_id . " label.checkbox { display:inline; } \n";
|
@@ -1083,10 +1073,12 @@ the field names you want required by commas. Remember to use underscores instead
|
|
1083 |
}
|
1084 |
|
1085 |
function getCaptchaCode($form_id) {
|
|
|
|
|
1086 |
$captcha = parent::selectField('', 'captcha');
|
1087 |
$instructions = (empty($captcha->field_instructions)) ? '' : 'title="'.$captcha->field_instructions.'" class="tooltip-field"';
|
1088 |
-
$out = '<img id="captcha-image" src="' . get_bloginfo('wpurl') . '/wp-content/plugins/custom-contact-forms/image.php?fid='.$form_id.'"
|
1089 |
-
<
|
1090 |
return $out;
|
1091 |
}
|
1092 |
|
@@ -1095,6 +1087,7 @@ the field names you want required by commas. Remember to use underscores instead
|
|
1095 |
}
|
1096 |
|
1097 |
function contactAuthor($name, $email, $website, $message, $type) {
|
|
|
1098 |
$admin_options = $this->getAdminOptions();
|
1099 |
$body = "Name: $name\n";
|
1100 |
$body .= "Email: $email\n";
|
@@ -1104,12 +1097,13 @@ the field names you want required by commas. Remember to use underscores instead
|
|
1104 |
$body .= 'Sender IP: ' . $_SERVER['REMOTE_ADDR'] . "\n";
|
1105 |
$mailer = new CustomContactFormsMailer('admin@taylorlovett.com', $email, "CCF Message: $type", stripslashes($body), $admin_options[wp_mail_function]);
|
1106 |
$mailer->send();
|
|
|
1107 |
}
|
1108 |
|
1109 |
function insertFormSuccessCode() {
|
1110 |
?>
|
1111 |
<div id="ccf-form-success">
|
1112 |
-
<h5
|
1113 |
<p><?php echo $this->current_thank_you_message; ?></p>
|
1114 |
<a href="javascript:void(0)" class="close">[close]</a>
|
1115 |
</div>
|
@@ -1201,6 +1195,7 @@ the field names you want required by commas. Remember to use underscores instead
|
|
1201 |
header("Location: " . $form->form_thank_you_page);
|
1202 |
}
|
1203 |
$this->current_thank_you_message = (!empty($form->form_success_message)) ? $form->form_success_message : $admin_options[form_success_message];
|
|
|
1204 |
add_action('wp_footer', array(&$this, 'insertFormSuccessCode'), 1);
|
1205 |
}
|
1206 |
unset($_POST);
|
@@ -1208,6 +1203,7 @@ the field names you want required by commas. Remember to use underscores instead
|
|
1208 |
}
|
1209 |
}
|
1210 |
}
|
|
|
1211 |
$customcontact = new CustomContactForms();
|
1212 |
if (!function_exists('CustomContactForms_ap')) {
|
1213 |
function CustomContactForms_ap() {
|
@@ -1226,15 +1222,24 @@ if (!function_exists('serveCustomContactForm')) {
|
|
1226 |
}
|
1227 |
}
|
1228 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1229 |
if (isset($customcontact)) {
|
1230 |
add_action('init', array(&$customcontact, 'init'), 1);
|
1231 |
-
add_action('
|
1232 |
-
add_action('wp_head', array(&$customcontact, 'insertFrontEndScripts'), 1);
|
1233 |
-
add_action('admin_head', array(&$customcontact, 'addHeaderCode'), 1);
|
1234 |
-
add_filter('the_content', array(&$customcontact, 'contentFilter'));
|
1235 |
add_action('admin_print_scripts', array(&$customcontact, 'insertAdminScripts'), 1);
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
|
|
|
|
|
|
|
|
|
|
1239 |
|
|
|
1240 |
?>
|
3 |
Plugin Name: Custom Contact Forms
|
4 |
Plugin URI: http://taylorlovett.com/wordpress-plugins
|
5 |
Description: Guaranteed to be 1000X more customizable and intuitive than Fast Secure Contact Forms or Contact Form 7. Customize every aspect of your forms without any knowledge of CSS: borders, padding, sizes, colors. Ton's of great features. Required fields, captchas, tooltip popovers, unlimited fields/forms/form styles, use a custom thank you page or built-in popover with a custom success message set for each form. <a href="options-general.php?page=custom-contact-forms">Settings</a>
|
6 |
+
Version: 3.1.0
|
7 |
Author: Taylor Lovett
|
8 |
Author URI: http://www.taylorlovett.com
|
9 |
*/
|
28 |
class CustomContactForms extends CustomContactFormsDB {
|
29 |
var $adminOptionsName = 'customContactFormsAdminOptions';
|
30 |
var $widgetOptionsName = 'widget_customContactForms';
|
31 |
+
var $version = '2.1.0';
|
32 |
var $form_errors;
|
33 |
var $error_return;
|
34 |
var $gets;
|
35 |
var $current_thank_you_message;
|
36 |
+
var $current_thank_you_message_title;
|
37 |
var $fixed_fields = array('customcontactforms_submit' => '',
|
38 |
'fid' => '',
|
39 |
'fixedEmail' => 'Use this field if you want the plugin to throw an error on fake emails.',
|
50 |
function getAdminOptions() {
|
51 |
$admin_email = get_option('admin_email');
|
52 |
$customcontactAdminOptions = array('show_widget_home' => 1, 'show_widget_pages' => 1, 'show_widget_singles' => 1, 'show_widget_categories' => 1, 'show_widget_archives' => 1, 'default_to_email' => $admin_email, 'default_from_email' => $admin_email, 'default_form_subject' => 'Someone Filled Out Your Contact Form!',
|
53 |
+
'remember_field_values' => 0, 'author_link' => 1, 'enable_widget_tooltips' => 1, 'wp_mail_function' => 1, 'form_success_message_title' => 'Form Success!', 'form_success_message' => 'Thank you for filling out our web form. We will get back to you ASAP.', 'enable_jquery' => 1, 'code_type' => 'XHTML'); // default general settings
|
54 |
$customcontactOptions = get_option($this->adminOptionsName);
|
55 |
if (!empty($customcontactOptions)) {
|
56 |
foreach ($customcontactOptions as $key => $option)
|
63 |
$this->storeGets();
|
64 |
$this->getAdminOptions();
|
65 |
if (!is_admin()) {
|
|
|
66 |
$this->startSession();
|
67 |
$this->processForms();
|
68 |
}
|
|
|
69 |
}
|
70 |
|
71 |
+
function insertStyleSheets() {
|
72 |
+
wp_register_style('customContactFormsStyleSheet', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/custom-contact-forms.css');
|
73 |
+
wp_enqueue_style('customContactFormsStyleSheet');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
|
76 |
function insertAdminScripts() {
|
77 |
+
wp_enqueue_script('jquery');
|
78 |
wp_enqueue_script('ccf-main', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/custom-contact-forms-admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-tabs'/*, 'jquery-ui-draggable', 'jquery-ui-resizable', 'jquery-ui-dialog'*/), '1.0');
|
79 |
}
|
80 |
|
81 |
function insertFrontEndScripts() {
|
82 |
+
if (!is_admin()) {
|
83 |
+
$admin_options = $this->getAdminOptions();
|
84 |
+
if ($admin_options[enable_jquery] == 1) {
|
85 |
+
wp_enqueue_script('jquery');
|
86 |
+
wp_enqueue_script('jquery-tools', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/jquery.tools.min.js');
|
87 |
+
//wp_enqueue_script('jquery-ui-position', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/jquery.ui.position.js');
|
88 |
+
//wp_enqueue_script('jquery-ui-widget', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/jquery.ui.widget.js');
|
89 |
+
//wp_enqueue_script('jquery-bgiframe', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/jquery.bgiframe-2.1.1.js');
|
90 |
+
wp_enqueue_script('ccf-main', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/custom-contact-forms.js', array('jquery', 'jquery-ui-core', 'jquery-ui-tabs', 'jquery-ui-resizable'/*, 'jquery-ui-draggable', 'jquery-ui-dialog'*/), '1.0');
|
91 |
+
//jquery-ui-position
|
92 |
+
}
|
93 |
+
}
|
94 |
}
|
95 |
|
96 |
function setFormError($key, $message) {
|
128 |
$admin_options[show_widget_home] = $_POST[show_widget_home];
|
129 |
$admin_options[custom_thank_you] = $_POST[custom_thank_you];
|
130 |
$admin_options[author_link] = $_POST[author_link];
|
131 |
+
$admin_options[enable_jquery] = $_POST[enable_jquery];
|
132 |
+
$admin_options[code_type] = $_POST[code_type];
|
133 |
$admin_options[form_success_message] = $_POST[form_success_message];
|
134 |
+
$admin_options[form_success_message_title] = $_POST[form_success_message_title];
|
135 |
$admin_options[wp_mail_function] = $_POST[wp_mail_function];
|
136 |
$admin_options[enable_widget_tooltips] = $_POST[enable_widget_tooltips];
|
137 |
$admin_options[remember_field_values] = $_POST[remember_field_values];
|
189 |
<li>
|
190 |
<label for="field_slug">* Slug (Name):</label>
|
191 |
<input name="field[field_slug]" type="text" maxlength="50" />
|
192 |
+
(A slug is simply a way to identify your form. It can only contain underscores, letters, and numbers and must be unique.)</li>
|
193 |
<li>
|
194 |
<label for="field_label">Field Label:</label>
|
195 |
+
<input name="field[field_label]" type="text" maxlength="100" /><br />
|
196 |
+
(The field label is displayed next to the field and is visible to the user.)
|
197 |
</li>
|
198 |
<li>
|
199 |
<label for="field_type">* Field Type:</label>
|
206 |
</li>
|
207 |
<li>
|
208 |
<label for="field_value">Initial Value:</label>
|
209 |
+
<input name="field[field_value]" type="text" maxlength="50" /><br />
|
210 |
+
(This is the initial value of the field. If you set the type as checkbox, it is recommend you set this to what the checkbox is implying. For example if I were creating the checkbox "Are you human?", I would set the initial value to "Yes".)
|
211 |
</li>
|
212 |
<li>
|
213 |
<label for="field_maxlength">Max Length:</label>
|
214 |
<input class="width50" size="10" name="field[field_maxlength]" type="text" maxlength="4" />
|
215 |
+
<br />(0 for no limit; only applies to Text fields)</li>
|
216 |
<li>
|
217 |
<label for="field_required">Required Field:</label>
|
218 |
+
<select name="field[field_required]"><option value="0">No</option><option value="1">Yes</option></select><br />
|
219 |
+
(If a field is required and a user leaves it blank, the plugin will display an error message explainging the problem.)</li>
|
220 |
<li>
|
221 |
<label for="field_value">Field Instructions:</label>
|
222 |
<input name="field[field_instructions]" type="text" /><br />
|
273 |
<label for="form[form_success_message]">Form Success Message:</label>
|
274 |
<input type="text" name="form[form_success_message]" /><br />
|
275 |
(Will be displayed in a popover when the form is filled out successfully when no custom success page is specified; if left blank it will use the default specified in general settings.)</li>
|
276 |
+
<li>
|
277 |
+
<label for="form[form_success_title]">Form Success Message Title:</label>
|
278 |
+
<input type="text" name="form[form_success_title]" /><br />
|
279 |
+
(Will be displayed in a popover when the form is filled out successfully when no custom success page is specified; if left blank it will use the default specified in general settings.)</li>
|
280 |
<li>
|
281 |
<label for="form[form_thank_you_page]">Custom Success URL:</label>
|
282 |
<input type="text" name="form[form_thank_you_page]" /><br />
|
460 |
<table class="form-extra-options-table">
|
461 |
<tbody>
|
462 |
<tr>
|
463 |
+
<td class="bold">Method</td>
|
464 |
<td class="bold">Form Action</td>
|
465 |
<td class="bold">Destination Email</td>
|
466 |
+
<td class="bold">Success Message Title</td>
|
467 |
<td class="bold">Success Message</td>
|
468 |
<td class="bold">Custom Success URL</td>
|
469 |
</tr>
|
470 |
<tr>
|
471 |
<td><select name="form[form_method]"><?php echo $form_methods; ?></select></td>
|
472 |
+
<td><input class="width100" type="text" name="form[form_action]" value="<?php echo $forms[$i]->form_action; ?>" /></td>
|
473 |
+
<td><input class="width100" type="text" name="form[form_email]" value="<?php echo $forms[$i]->form_email; ?>" /></td>
|
474 |
+
<td><input type="text" name="form[form_success_title]" value="<?php echo $forms[$i]->form_success_title; ?>" /></td>
|
475 |
<td><input type="text" name="form[form_success_message]" value="<?php echo $forms[$i]->form_success_message; ?>" /></td>
|
476 |
<td><input type="text" class="width125" name="form[form_thank_you_page]" value="<?php echo $forms[$i]->form_thank_you_page; ?>" /></td>
|
477 |
</tr>
|
499 |
</td>
|
500 |
</tr>
|
501 |
<tr>
|
502 |
+
<td colspan="6"><label for="theme_code_<?php echo $forms[$i]->id; ?>"><span>Code to Display Form in Theme Files:</span></label> <input type="text" class="width225" value="<?php if (function_exists('serveCustomContactForm')) { serveCustomContactForm(<?php echo $forms[$i]->id; ?>); } ?>" name="theme_code_<?php echo $forms[$i]->id; ?>" /> <label for="form[custom_code]">Custom Code</label> <input name="form[custom_code]" type="text" value="<?php echo $forms[$i]->custom_code; ?>" /></td>
|
503 |
</tr>
|
504 |
</tbody>
|
505 |
</table>
|
540 |
<input name="default_to_email" value="<?php echo $admin_options[default_to_email]; ?>" type="text" maxlength="100" />
|
541 |
</li>
|
542 |
<li class="descrip">Form emails will be sent <span>to</span> this address, if no destination email is specified by the form.</li>
|
543 |
+
|
544 |
+
<li>
|
545 |
+
<label for="enable_jquery">Emable JQuery:</label>
|
546 |
+
<select name="enable_jquery"><option value="1">Yes</option><option <?php if ($admin_options[enable_jquery] != 1) echo 'selected="selected"'; ?> value="0">No</option></select>
|
547 |
+
</li>
|
548 |
+
<li class="descrip">Some plugins don't setup JQuery correctly, so when any other plugin uses JQuery (whether correctly or not), JQuery works for neither plugin. This plugin uses JQuery correctly. If another plugin isn't using JQuery correctly but is more important to you than this one: disable this option. 99% of this plugin's functionality will work without JQuery, just no field instruction tooltips.</li>
|
549 |
+
|
550 |
<li>
|
551 |
<label for="default_from_email">Default From Email:</label>
|
552 |
<input name="default_from_email" value="<?php echo $admin_options[default_from_email]; ?>" type="text" maxlength="100" />
|
558 |
</li>
|
559 |
<li class="descrip">Default subject to be included in all form emails.</li>
|
560 |
<li>
|
561 |
+
<label for="form_success_message_title">Default Form Success Message Title:</label>
|
562 |
+
<input name="form_success_message_title" value="<?php echo $admin_options[form_success_message_title]; ?>" type="text"/>
|
563 |
+
</li>
|
564 |
+
<li class="descrip">If someone fills out a form for which a success message title is not provided and a custom success page is not provided, the plugin will show a popover using this field as the window title.</li>
|
565 |
+
|
566 |
+
<li>
|
567 |
+
<label for="form_success_message">Default Form Success Message:</label>
|
568 |
<input name="form_success_message" value="<?php echo $admin_options[form_success_message]; ?>" type="text"/>
|
569 |
</li>
|
570 |
<li class="descrip">If someone fills out a form for which a success message is not provided and a custom success page is not provided, the plugin will show a popover containing this message.</li>
|
583 |
<label for="author_link">Hide Plugin Author Link in Code:</label>
|
584 |
<select name="author_link"><option value="1">Yes</option><option <?php if ($admin_options[author_link] == 0) echo 'selected="selected"'; ?> value="0">No</option></select>
|
585 |
</li>
|
586 |
+
<li>
|
587 |
+
<label for="code_type">Use Code Type:</label>
|
588 |
+
<select name="code_type"><option>XHTML</option><option <?php if ($admin_options[code_type] == 'HTML') echo 'selected="selected"'; ?>>HTML</option></select>
|
589 |
+
</li>
|
590 |
+
<li class="descrip">This lets you switch the form code between HTML and XHTML.</li>
|
591 |
<li>
|
592 |
<label for="wp_mail_function">Use Wordpress Mail Function:</label>
|
593 |
<select name="wp_mail_function"><option value="1">Yes</option><option <?php if ($admin_options[wp_mail_function] == 0) echo 'selected="selected"'; ?> value="0">No</option></select>
|
638 |
<p>7. Create form styles to change your forms appearances. The image below explains how each style field can change the look of your forms.</p>
|
639 |
<p>8. (advanced) If you are confident in your HTML and CSS skills, you can use the <a href="#custom-html">Custom HTML Forms feature</a> as a framework and write your forms from scratch. This allows you to use this plugin simply to process your form requests. The Custom HTML Forms feature will process and email any form variables sent to it regardless of whether they are created in the fields manager.</p>
|
640 |
<div id="style-example"></div>
|
641 |
+
<div id="success-popover-example"></div>
|
642 |
</div>
|
643 |
</div>
|
644 |
<a name="create-styles"></a>
|
703 |
<label for="label_margin">Label Margin:</label>
|
704 |
<input type="text" maxlength="20" value="4px" name="style[label_margin]" />
|
705 |
(ex: 5px or 1em)</li>
|
706 |
+
<li>
|
707 |
+
<label for="textarea_backgroundcolor">Textarea Background Color:</label>
|
708 |
+
<input type="text" maxlength="20" value="#efefef" name="style[textarea_backgroundcolor]" />
|
709 |
+
(ex: #FF0000 or red)</li>
|
710 |
</ul>
|
711 |
<ul class="style_right">
|
712 |
<li>
|
761 |
<label for="title_margin">Title Margin:</label>
|
762 |
<input type="text" maxlength="20" value="2px" name="style[title_margin]" />
|
763 |
(ex: 5px or 1em)</li>
|
764 |
+
|
|
|
|
|
|
|
765 |
<li>
|
766 |
<input type="submit" value="Create Style" name="style_create" />
|
767 |
</li>
|
868 |
<input id="name" type="text" name="name" maxlength="100" /></li>
|
869 |
<li><label for="email">Your Email:</label>
|
870 |
<input id="email" type="text" value="<?php echo get_option('admin_email'); ?>" name="email" maxlength="100" /></li>
|
871 |
+
<li><label for="message">* Your Message:</label>
|
872 |
<textarea id="message" name="message"></textarea></li>
|
873 |
+
<li><label for="type">* Purpose of this message:</label> <select id="type" name="type"><option>Bug Report</option><option>Suggest a Feature</option></select></li>
|
874 |
</ul>
|
875 |
<p><input type="submit" name="contact_author" value="Send Message" /></p>
|
876 |
</form>
|
1022 |
}
|
1023 |
$action = (!empty($form->form_action)) ? $form->form_action : get_permalink();
|
1024 |
$out .= '<form id="'.$form_id.'" method="'.strtolower($form->form_method).'" action="'.$action.'" class="'.$style_class.'">' . "\n";
|
1025 |
+
$out .= parent::decodeOption($form->custom_code, 1, 1) . '<h4 id="h4-' . $form->id . '-'.$form_key.'">' . parent::decodeOption($form->form_title, 1, 1) . '</h4>' . "\n";
|
1026 |
$fields = parent::getAttachedFieldsArray($fid);
|
1027 |
$hiddens = '';
|
1028 |
+
$code_type = ($admin_options[code_type] == 'XHTML') ? ' /' : '';
|
1029 |
foreach ($fields as $field_id) {
|
1030 |
$field = parent::selectField($field_id, '');
|
1031 |
+
$req = ($field->field_required == 1 or $field->field_slug == 'ishuman') ? '* ' : '';
|
1032 |
$req_long = ($field->field_required == 1) ? ' (required)' : '';
|
1033 |
$input_id = 'id="'.parent::decodeOption($field->field_slug, 1, 1).'"';
|
1034 |
$field_value = parent::decodeOption($field->field_value, 1, 1);
|
1040 |
}
|
1041 |
|
1042 |
if ($field->user_field == 0 && $field->field_slug == 'captcha') {
|
1043 |
+
$out .= '<div>' . "\n" . $this->getCaptchaCode($form->id) . "\n" . '</div>' . "\n";
|
1044 |
} elseif ($field->field_type == 'Text') {
|
1045 |
$maxlength = (empty($field->field_maxlength) or $field->field_maxlength <= 0) ? '' : ' maxlength="'.$field->field_maxlength.'"';
|
1046 |
+
$out .= '<div>'."\n".'<label for="'.parent::decodeOption($field->field_slug, 1, 1).'">'. $req .parent::decodeOption($field->field_label, 1, 1).'</label>'."\n".'<input '.$instructions.' '.$input_id.' type="text" name="'.parent::decodeOption($field->field_slug, 1, 1).'" value="'.$field_value.'"'.$maxlength.''.$code_type.'>'."\n".'</div>' . "\n";
|
1047 |
} elseif ($field->field_type == 'Hidden') {
|
1048 |
+
$hiddens .= '<input type="hidden" name="'.parent::decodeOption($field->field_slug, 1, 1).'" value="'.$field_value.'" '.$input_id.''.$code_type.'>' . "\n";
|
1049 |
} elseif ($field->field_type == 'Checkbox') {
|
1050 |
+
$out .= '<div>'."\n".'<input '.$instructions.' type="checkbox" name="'.parent::decodeOption($field->field_slug, 1, 1).'" value="'.parent::decodeOption($field->field_value, 1, 1).'" '.$input_id.''.$code_type.'> '."\n".'<label class="checkbox" for="'.parent::decodeOption($field->field_slug, 1, 1).'">' . $req .parent::decodeOption($field->field_label, 1, 1).'</label>'."\n".'</div>' . "\n";
|
1051 |
} elseif ($field->field_type == 'Textarea') {
|
1052 |
+
$out .= '<div>'."\n".'<label for="'.parent::decodeOption($field->field_slug, 1, 1).'">'. $req .parent::decodeOption($field->field_label, 1, 1).'</label>'."\n".'<textarea '.$instructions.' '.$input_id.' rows="5" cols="40" name="'.parent::decodeOption($field->field_slug, 1, 1).'">'.$field_value.'</textarea>'."\n".'</div>' . "\n";
|
1053 |
}
|
1054 |
}
|
1055 |
$submit_text = (!empty($form->submit_button_text)) ? parent::decodeOption($form->submit_button_text, 1, 0) : 'Submit';
|
1056 |
+
$out .= '<input name="form_page" value="'.$_SERVER['REQUEST_URI'].'" type="hidden"'.$code_type.'>'."\n".'<input type="hidden" name="fid" value="'.$form->id.'"'.$code_type.'>'."\n".$hiddens."\n".'<input type="submit" id="submit-' . $form->id . '-'.$form_key.'" class="submit" value="' . $submit_text . '" name="customcontactforms_submit"'.$code_type.'>' . "\n" . '</form>';
|
1057 |
+
if ($admin_options[author_link] == 1) $out .= "\n".'<a class="hide" href="http://www.taylorlovett.com" title="Rockville Web Developer, Wordpress Plugins">Wordpress plugin expert and Rockville Web Developer Taylor Lovett</a>';
|
1058 |
|
1059 |
if ($form->form_style != 0) {
|
1060 |
$form_styles .= '<style type="text/css">' . "\n";
|
1061 |
$form_styles .= '#' . $form_id . " { width: ".$style->form_width."; padding:".$style->form_padding."; margin:".$style->form_margin."; border:".$style->form_borderwidth." ".$style->form_borderstyle." ".$style->form_bordercolor."; font-family:".$style->form_fontfamily."; }\n";
|
1062 |
+
//$form_styles .= '#' . $form_id . " div { padding:0; margin:0; }\n";
|
1063 |
$form_styles .= '#' . $form_id . " h4 { padding:0; margin:".$style->title_margin." ".$style->title_margin." ".$style->title_margin." 0; color:".$style->title_fontcolor."; font-size:".$style->title_fontsize."; } \n";
|
1064 |
$form_styles .= '#' . $form_id . " label { padding:0; margin:".$style->label_margin." ".$style->label_margin." ".$style->label_margin." 0; display:block; color:".$style->label_fontcolor."; width:".$style->label_width."; font-size:".$style->label_fontsize."; } \n";
|
1065 |
$form_styles .= '#' . $form_id . " label.checkbox { display:inline; } \n";
|
1073 |
}
|
1074 |
|
1075 |
function getCaptchaCode($form_id) {
|
1076 |
+
$admin_options = $this->getAdminOptions();
|
1077 |
+
$code_type = ($admin_options[code_type] == 'XHTML') ? ' /' : '';
|
1078 |
$captcha = parent::selectField('', 'captcha');
|
1079 |
$instructions = (empty($captcha->field_instructions)) ? '' : 'title="'.$captcha->field_instructions.'" class="tooltip-field"';
|
1080 |
+
$out = '<img width="63" height="18" alt="Captcha image for a contact form" id="captcha-image" src="' . get_bloginfo('wpurl') . '/wp-content/plugins/custom-contact-forms/image.php?fid='.$form_id.'"'.$code_type.'>
|
1081 |
+
<div><label for="captcha'.$form_id.'">* '.$captcha->field_label.'</label> <input type="text" '.$instructions.' name="captcha" id="captcha'.$form_id.'" maxlength="20"'.$code_type.'></div>';
|
1082 |
return $out;
|
1083 |
}
|
1084 |
|
1087 |
}
|
1088 |
|
1089 |
function contactAuthor($name, $email, $website, $message, $type) {
|
1090 |
+
if (empty($message)) return false;
|
1091 |
$admin_options = $this->getAdminOptions();
|
1092 |
$body = "Name: $name\n";
|
1093 |
$body .= "Email: $email\n";
|
1097 |
$body .= 'Sender IP: ' . $_SERVER['REMOTE_ADDR'] . "\n";
|
1098 |
$mailer = new CustomContactFormsMailer('admin@taylorlovett.com', $email, "CCF Message: $type", stripslashes($body), $admin_options[wp_mail_function]);
|
1099 |
$mailer->send();
|
1100 |
+
return true;
|
1101 |
}
|
1102 |
|
1103 |
function insertFormSuccessCode() {
|
1104 |
?>
|
1105 |
<div id="ccf-form-success">
|
1106 |
+
<h5><?php echo $this->current_thank_you_message_title; ?></h5>
|
1107 |
<p><?php echo $this->current_thank_you_message; ?></p>
|
1108 |
<a href="javascript:void(0)" class="close">[close]</a>
|
1109 |
</div>
|
1195 |
header("Location: " . $form->form_thank_you_page);
|
1196 |
}
|
1197 |
$this->current_thank_you_message = (!empty($form->form_success_message)) ? $form->form_success_message : $admin_options[form_success_message];
|
1198 |
+
$this->current_thank_you_message_title = (!empty($form->form_success_title)) ? $form->form_success_title : $admin_options[form_success_message_title];
|
1199 |
add_action('wp_footer', array(&$this, 'insertFormSuccessCode'), 1);
|
1200 |
}
|
1201 |
unset($_POST);
|
1203 |
}
|
1204 |
}
|
1205 |
}
|
1206 |
+
require_once('custom-contact-forms-widget.php');
|
1207 |
$customcontact = new CustomContactForms();
|
1208 |
if (!function_exists('CustomContactForms_ap')) {
|
1209 |
function CustomContactForms_ap() {
|
1222 |
}
|
1223 |
}
|
1224 |
|
1225 |
+
if (!function_exists('CCFWidgetInit')) {
|
1226 |
+
function CCFWidgetInit() {
|
1227 |
+
register_widget('CustomContactFormsWidget');
|
1228 |
+
}
|
1229 |
+
}
|
1230 |
+
|
1231 |
if (isset($customcontact)) {
|
1232 |
add_action('init', array(&$customcontact, 'init'), 1);
|
1233 |
+
add_action('wp_print_scripts', array(&$customcontact, 'insertFrontEndScripts'), 1);
|
|
|
|
|
|
|
1234 |
add_action('admin_print_scripts', array(&$customcontact, 'insertAdminScripts'), 1);
|
1235 |
+
add_action('wp_print_styles', array(&$customcontact, 'insertStyleSheets'), 1);
|
1236 |
+
add_action('admin_print_styles', array(&$customcontact, 'insertStyleSheets'), 1);
|
1237 |
+
add_filter('the_content', array(&$customcontact, 'contentFilter'));
|
1238 |
+
/*add_action('wp_footer', array(&$customcontact, 'insertPopoverCode'));*/
|
1239 |
+
add_action('widgets_init', 'CCFWidgetInit');
|
1240 |
+
add_action('admin_menu', 'CustomContactForms_ap');
|
1241 |
+
}
|
1242 |
+
//add_action('wp_footer', array(&$customcontact, 'insertFormSuccessCode'), 1);
|
1243 |
|
1244 |
+
|
1245 |
?>
|
images/success-popover-example.gif
ADDED
Binary file
|
js/custom-contact-forms.js
CHANGED
@@ -29,14 +29,10 @@ $j(document).ready(function(){
|
|
29 |
|
30 |
});
|
31 |
|
32 |
-
$j(".tooltip-field").tooltip({
|
33 |
-
// place tooltip on the right edge
|
34 |
position: "center right",
|
35 |
-
// a little tweaking of the position
|
36 |
offset: [-2, 10],
|
37 |
-
// use the built-in fadeIn/fadeOut effect
|
38 |
effect: "fade",
|
39 |
-
// custom opacity setting
|
40 |
opacity: 0.7
|
41 |
|
42 |
});
|
@@ -45,4 +41,5 @@ $j(document).ready(function(){
|
|
45 |
$j("#ccf-form-success .close").click(function() {
|
46 |
$j("#ccf-form-success").fadeOut();
|
47 |
});
|
|
|
48 |
});
|
29 |
|
30 |
});
|
31 |
|
32 |
+
$j(".customcontactform .tooltip-field").tooltip({
|
|
|
33 |
position: "center right",
|
|
|
34 |
offset: [-2, 10],
|
|
|
35 |
effect: "fade",
|
|
|
36 |
opacity: 0.7
|
37 |
|
38 |
});
|
41 |
$j("#ccf-form-success .close").click(function() {
|
42 |
$j("#ccf-form-success").fadeOut();
|
43 |
});
|
44 |
+
|
45 |
});
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.taylorlovett.com
|
|
4 |
Tags: contact form, web form, custom contact form, custom forms, captcha form, contact fields, form mailers
|
5 |
Requires at least: 2.7.1
|
6 |
Tested up to: 3.1
|
7 |
-
Stable tag: 3.0
|
8 |
|
9 |
Gauranteed to be the most customizable and intuitive contact form plugin for Wordpress.
|
10 |
|
@@ -34,11 +34,12 @@ Special Features:
|
|
34 |
* Script in constant development - new version released every week
|
35 |
* Easily process your forms with 3rd party sites like Infusionsoft or Aweber
|
36 |
* Set a __custom thank you page__ for each form or use the built in thank you page popover with a custom thank you message
|
37 |
-
*
|
38 |
* No javascript required
|
39 |
* Stylish field tooltips powered by jquery
|
40 |
* Popover forms with Jquery (Coming soon!)
|
41 |
* Free unlimited support
|
|
|
42 |
|
43 |
== Installation ==
|
44 |
1. Upload to /wp-content/plugins
|
@@ -51,7 +52,7 @@ Special Features:
|
|
51 |
2. Create fields and attach those fields to the forms of your choice. Attach the fields in the order that you want them to show up in the form. If you mess up you can detach and reattach them.
|
52 |
3. Display those forms in posts and pages by inserting the code: __[customcontact form=FORMID]__. Replace __FORMID__ with the id listed to the left of the form slug next to the form of your choice above. You can also __display forms in theme files__; the code for this is provided within each forms admin section.
|
53 |
4. Prevent spam by attaching the fixed field, captcha or ishuman. Captcha requires users to type in a number shown on an image. Ishuman requires users to check a box to prove they aren't a spam bot.
|
54 |
-
5. Add a form to your sidebar, by dragging the Custom Contact Form widget in to your sidebar.
|
55 |
6. Configure the General Settings appropriately; this is important if you want to receive your web form messages!
|
56 |
7. Create form styles to change your forms appearances. The image below explains how each style field can change the look of your forms.
|
57 |
8. (advanced) If you are confident in your HTML and CSS skills, you can use the Custom HTML Forms feature as a framework and write your forms from scratch. This allows you to use this plugin simply to process your form requests. The Custom HTML Forms feature will process and email any form variables sent to it regardless of whether they are created in the fields manager.
|
@@ -143,7 +144,12 @@ Visit http://www.taylorlovett.com/wordpress-plugins for screenshots.
|
|
143 |
* custom-contact-forms.css - New styles added and old ones modified
|
144 |
|
145 |
= 3.0.1 =
|
146 |
-
* custom-contact-forms.php -
|
147 |
|
148 |
= 3.0.2 =
|
149 |
-
*
|
|
|
|
|
|
|
|
|
|
4 |
Tags: contact form, web form, custom contact form, custom forms, captcha form, contact fields, form mailers
|
5 |
Requires at least: 2.7.1
|
6 |
Tested up to: 3.1
|
7 |
+
Stable tag: 3.1.0
|
8 |
|
9 |
Gauranteed to be the most customizable and intuitive contact form plugin for Wordpress.
|
10 |
|
34 |
* Script in constant development - new version released every week
|
35 |
* Easily process your forms with 3rd party sites like Infusionsoft or Aweber
|
36 |
* Set a __custom thank you page__ for each form or use the built in thank you page popover with a custom thank you message
|
37 |
+
* Choose between XHTML or HTML. All code is clean and valid!
|
38 |
* No javascript required
|
39 |
* Stylish field tooltips powered by jquery
|
40 |
* Popover forms with Jquery (Coming soon!)
|
41 |
* Free unlimited support
|
42 |
+
* Ability to disable JQuery if it is conflicting with other plugins.
|
43 |
|
44 |
== Installation ==
|
45 |
1. Upload to /wp-content/plugins
|
52 |
2. Create fields and attach those fields to the forms of your choice. Attach the fields in the order that you want them to show up in the form. If you mess up you can detach and reattach them.
|
53 |
3. Display those forms in posts and pages by inserting the code: __[customcontact form=FORMID]__. Replace __FORMID__ with the id listed to the left of the form slug next to the form of your choice above. You can also __display forms in theme files__; the code for this is provided within each forms admin section.
|
54 |
4. Prevent spam by attaching the fixed field, captcha or ishuman. Captcha requires users to type in a number shown on an image. Ishuman requires users to check a box to prove they aren't a spam bot.
|
55 |
+
5. Add a form to your sidebar, by dragging the Custom Contact Form reusable widget in to your sidebar.
|
56 |
6. Configure the General Settings appropriately; this is important if you want to receive your web form messages!
|
57 |
7. Create form styles to change your forms appearances. The image below explains how each style field can change the look of your forms.
|
58 |
8. (advanced) If you are confident in your HTML and CSS skills, you can use the Custom HTML Forms feature as a framework and write your forms from scratch. This allows you to use this plugin simply to process your form requests. The Custom HTML Forms feature will process and email any form variables sent to it regardless of whether they are created in the fields manager.
|
144 |
* custom-contact-forms.css - New styles added and old ones modified
|
145 |
|
146 |
= 3.0.1 =
|
147 |
+
* custom-contact-forms.php - Php tags added to theme form display code
|
148 |
|
149 |
= 3.0.2 =
|
150 |
+
* custom-contact-forms.php - Bugs fixed
|
151 |
+
|
152 |
+
= 3.1.0 =
|
153 |
+
* custom-contact-forms.php - Success message title, disable jquery, choose between xhmtl and html, and more
|
154 |
+
* custom-contact-forms-db.php - Success message title added
|
155 |
+
* custom-contact-forms.css - Form styles rewritten
|