Custom Contact Forms - Version 1.0.0

Version Description

Download this release

Release Info

Developer tlovett1
Plugin Icon 128x128 Custom Contact Forms
Version 1.0.0
Comparing to
See all releases

Version 1.0.0

custom-contact-forms-db.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Custom Contact Forms DB class is a parent to the Custom Contact Forms Class
4
+ By Taylor Lovett - http://www.taylorlovett.com
5
+ Plugin URL: http://www.taylorlovett.com/wordpress-plugins
6
+ @version 1.0.0
7
+ */
8
+ if (!class_exists('CustomContactFormsDB')) {
9
+ class CustomContactFormsDB {
10
+ var $forms_table;
11
+ var $fields_table;
12
+
13
+ function CustomContactFormsDB() {
14
+ global $wpdb;
15
+ $this->forms_table = $wpdb->prefix . 'customcontactforms_forms';
16
+ $this->fields_table = $wpdb->prefix . 'customcontactforms_fields';
17
+ $this->createTables();
18
+ }
19
+
20
+ function encodeOption($option) {
21
+ return htmlspecialchars(stripslashes($option), ENT_QUOTES);
22
+ }
23
+
24
+ function decodeOption($option, $strip_slashes = 1, $decode_html_chars = 1) {
25
+ if ($strip_slashes == 1) $option = stripslashes($option);
26
+ if ($decode_html_chars == 1) $option = htmlspecialchars_decode($option);
27
+ return $option;
28
+ }
29
+
30
+ function createTables() {
31
+ global $wpdb;
32
+ require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
33
+ if(!$this->formsTableExists()) {
34
+ $sql1 = " CREATE TABLE `".$this->forms_table."` (
35
+ `id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
36
+ `form_slug` VARCHAR( 100 ) NOT NULL ,
37
+ `form_title` VARCHAR( 200 ) NOT NULL ,
38
+ `form_action` TEXT NOT NULL ,
39
+ `form_method` VARCHAR( 4 ) NOT NULL ,
40
+ `form_fields` VARCHAR( 200 ) NOT NULL ,
41
+ `submit_button_text` VARCHAR( 200 ) NOT NULL ,
42
+ `custom_code` TEXT NOT NULL ,
43
+ PRIMARY KEY ( `id` )
44
+ ) ENGINE = MYISAM AUTO_INCREMENT=1 ";
45
+ dbDelta($sql1);
46
+ } if(!$this->fieldsTableExists()) {
47
+ $sql2 = "CREATE TABLE `".$this->fields_table."` (
48
+ `id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
49
+ `field_slug` VARCHAR( 50 ) NOT NULL ,
50
+ `field_label` VARCHAR( 100 ) NOT NULL ,
51
+ `field_type` VARCHAR( 25 ) NOT NULL ,
52
+ `field_value` TEXT NOT NULL ,
53
+ `field_maxlength` INT ( 5 ) NOT NULL DEFAULT '0',
54
+ PRIMARY KEY ( `id` )
55
+ ) ENGINE = MYISAM AUTO_INCREMENT=1 ";
56
+ dbDelta($sql2);
57
+ }
58
+ return true;
59
+ }
60
+
61
+ function insertForm($form_slug, $form_title, $form_action, $form_method, $submit_button_text, $custom_code) {
62
+ global $wpdb;
63
+ $test = $this->selectForm('', $form_slug);
64
+ if (empty($test)) {
65
+ $wpdb->insert($this->forms_table, array('form_slug' => $this->formatSlug($form_slug), 'form_title' => $this->encodeOption($form_title), 'form_action' => $this->encodeOption($form_action), 'form_method' => $form_method, 'submit_button_text' => $this->encodeOption($submit_button_text), 'custom_code' => $this->encodeOption($custom_code)));
66
+ return true;
67
+ }
68
+ return false;
69
+ }
70
+
71
+ function insertField($field_slug, $field_label, $field_type, $field_value, $field_maxlength) {
72
+ global $wpdb;
73
+ $test = $this->selectField('', $field_slug);
74
+
75
+ if (empty($test)) {
76
+ $wpdb->insert($this->fields_table, array('field_slug' => $this->formatSlug($field_slug), 'field_label' => $this->encodeOption($field_label), 'field_type' => $field_type, 'field_value' => $this->encodeOption($field_value), 'field_maxlength' => $this->encodeOption($field_maxlength)));
77
+ return true;
78
+ }
79
+ return false;
80
+ }
81
+
82
+ function fieldsTableExists() {
83
+ global $wpdb;
84
+ return ($wpdb->get_var("show tables like '". $this->fields_table . "'") == $this->fields_table);
85
+ }
86
+
87
+ function formsTableExists() {
88
+ global $wpdb;
89
+ return ($wpdb->get_var("show tables like '". $this->forms_table . "'") == $this->forms_table);
90
+ }
91
+
92
+ function updateForm($form_slug, $form_title, $form_action, $form_method, $submit_button_text, $custom_code, $fid) {
93
+ global $wpdb;
94
+ if (empty($form_slug)) return false;
95
+ $test = $this->selectForm('', $form_slug);
96
+ if (!empty($test) and $test->id != $fid) // if form_slug is different then make sure it is unique
97
+ return false;
98
+ $wpdb->update($this->forms_table, array('form_slug' => $this->formatSlug($form_slug), 'form_title' => $this->encodeOption($form_title), 'form_action' => $this->encodeOption($form_action), 'form_method' => $form_method, 'submit_button_text' => $this->encodeOption($submit_button_text), 'custom_code' => $this->encodeOption($custom_code)), array('id' => $fid));
99
+ return true;
100
+ }
101
+
102
+ function updateField($field_slug, $field_label, $field_type, $field_value, $field_maxlength, $fid) {
103
+ global $wpdb;
104
+ if (empty($field_slug)) return false;
105
+ $test = $this->selectField('', $field_slug);
106
+ if (!empty($test) and $test->id != $fid) // if form_slug is different then make sure it is unique
107
+ return false;
108
+ $wpdb->update($this->fields_table, array('field_slug' => $this->formatSlug($field_slug), 'field_label' => $this->encodeOption($field_label), 'field_type' => $field_type, 'field_value' => $this->encodeOption($field_value), 'field_maxlength' => $this->encodeOption($field_maxlength)), array('id' => $fid));
109
+ return true;
110
+ }
111
+
112
+ function deleteForm($fid) {
113
+ global $wpdb;
114
+ $wpdb->query("DELETE FROM " . $this->forms_table . " WHERE id='$fid'");
115
+ return true;
116
+ }
117
+
118
+ function deleteField($fid) {
119
+ global $wpdb;
120
+ $wpdb->query("DELETE FROM " . $this->fields_table . " WHERE id='$fid'");
121
+ return true;
122
+ }
123
+
124
+ function selectAllForms() {
125
+ global $wpdb;
126
+ return $wpdb->get_results("SELECT * FROM " . $this->forms_table . " ORDER BY form_slug ASC");
127
+ }
128
+
129
+ function selectAllFields() {
130
+ global $wpdb;
131
+ return $wpdb->get_results("SELECT * FROM " . $this->fields_table . " ORDER BY field_slug ASC");
132
+ }
133
+
134
+ function selectForm($fid, $form_slug) {
135
+ global $wpdb;
136
+ $extra = (!empty($field_slug)) ? " or form_slug = '$form_slug'" : '';
137
+ return $wpdb->get_row("SELECT * FROM " . $this->forms_table . " WHERE id='$fid' $extra");
138
+ }
139
+
140
+ function selectField($fid, $field_slug) {
141
+ global $wpdb;
142
+ $extra = (!empty($field_slug)) ? " or field_slug = '$field_slug'" : '';
143
+ return $wpdb->get_row("SELECT * FROM " . $this->fields_table . " WHERE id='$fid'" . $extra);
144
+ }
145
+
146
+ function addFieldToForm($field_id, $form_id) {
147
+ global $wpdb;
148
+ $form = $this->selectForm($form_id, '');
149
+ $fields = $this->getAttachedFieldsArray($form_id);
150
+ if (!in_array($field_id, $fields)) {
151
+ $newfields = $form->form_fields . $field_id . ',';
152
+ $wpdb->update($this->forms_table, array('form_fields' => $newfields), array('id' => $form_id));
153
+ return true;
154
+ }
155
+ return false;
156
+ }
157
+
158
+ function getAttachedFieldsArray($form_id) {
159
+ $form = $this->selectForm($form_id, '');
160
+ $out = explode(',', $form->form_fields);
161
+ if (!empty($out)) array_pop($out);
162
+ return $out;
163
+ }
164
+
165
+ function disattachField($field_id, $form_id) {
166
+ global $wpdb;
167
+ $fields = $this->getAttachedFieldsArray($form_id);
168
+ if (!empty($fields) && in_array($field_id, $fields)) {
169
+ $form = $this->selectForm($form_id, '');
170
+ $newfields = str_replace($field_id . ',', '', $form->form_fields);
171
+ $wpdb->update($this->forms_table, array('form_fields' => $newfields), array('id' => $form_id));
172
+ return true;
173
+ }
174
+ return false;
175
+ }
176
+
177
+ function formatSlug($slug) {
178
+ $slug = preg_replace('/[^a-zA-Z0-9\s]/', '', $slug);
179
+ return str_replace(' ', '_', $slug);
180
+ }
181
+ }
182
+ }
183
+ ?>
custom-contact-forms-mailer.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Custom Contact Forms Mailer class handles all form email
4
+ By Taylor Lovett - http://www.taylorlovett.com
5
+ Plugin URL: http://www.taylorlovett.com/wordpress-plugins
6
+ @version 1.0.0
7
+ */
8
+ if (!class_exists('CustomContactFormsMailer')) {
9
+ class CustomContactFormsMailer {
10
+ var $to;
11
+ var $from;
12
+ var $subject;
13
+ var $body;
14
+ var $headers;
15
+
16
+ function CustomContactFormsMailer($to, $from, $subject, $body){
17
+ $this->to = $to;
18
+ $this->from = $from;
19
+ $this->subject = $subject;
20
+ $this->body = $body;
21
+ }
22
+
23
+ function send(){
24
+ $this->addHeader('From: '.$this->from."\r\n");
25
+ $this->addHeader('Reply-To: '.$this->from."\r\n");
26
+ $this->addHeader('Return-Path: '.$this->from."\r\n");
27
+ $this->addHeader('X-mailer: ZFmail 1.0'."\r\n");
28
+ mail($this->to, $this->subject, $this->body, $this->headers);
29
+ }
30
+
31
+ function addHeader($header){
32
+ $this->headers .= $header;
33
+ }
34
+ }
35
+ }
36
+ ?>
custom-contact-forms.css ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Custom Contact Forms CSS */
2
+ /* main infusion form */
3
+ form.customcontactform {
4
+ border:1px solid #ccc;
5
+ margin:8px;
6
+ width:95%;
7
+ max-width:500px;
8
+ font-size:1em;
9
+ padding:4px;
10
+ color:#333333;
11
+ }
12
+ form.customcontactform-sidebar {
13
+ width:100%;
14
+ max-width:500px;
15
+ padding:4px;
16
+ color:#333333;
17
+ font-size:.9em;
18
+ }
19
+ form.customcontactform ul, form.customcontactform-sidebar ul {
20
+ list-style-type:none;
21
+ }
22
+ form.customcontactform ul li, form.customcontactform-sidebar ul li {
23
+ margin:.3em 0 0 0;
24
+ padding:0;
25
+ }
26
+ form.customcontactform h4, form.customcontactform-sidebar h4 {
27
+ font-size:1.4em;
28
+ font-weight:bold;
29
+ }
30
+ form.customcontactform ul li label, form.customcontactform-sidebar ul li label {
31
+ display:block;
32
+ padding:0;
33
+ }
34
+ form.customcontactform ul li label.checkbox, form.customcontactform-sidebar ul li label.checkbox {
35
+ display:inline;
36
+ }
37
+ form.customcontactform ul li input[type=text], form.customcontactform ul li textarea, form.customcontactform-sidebar ul li input[type=text], form.customcontactform-sidebar ul li textarea {
38
+ border-width:1px;
39
+ border-style:solid;
40
+ border-spacing:0;
41
+ font-weight:normal;
42
+ width:16em;
43
+ padding:2px;
44
+ clear:both;
45
+ margin:0;
46
+ -moz-border-radius:4px;
47
+ -khtml-border-radius:4px;
48
+ -webkit-border-radius:4px;
49
+ border-radius:4px;
50
+ word-wrap:break-word;
51
+ font-size:.9em;
52
+ }
53
+ form.customcontactform p, form.customcontactform-sidebar p { padding:0 0 4px 17px; margin:0; }
54
+ form.customcontactform ul li input[type=submit], form.customcontactform ul li .submit, form.customcontactform-sidebar ul li .submit {
55
+ font-size:1em; margin-left:8px;
56
+ }
57
+ form.customcontactform ul li input[type=checkbox], form.customcontactform-sidebar ul li input[type=checkbox] {
58
+ width:20px;
59
+ padding:0;
60
+ margin:0;
61
+ }
62
+ form.customcontactform-sidebar ul li input[type=text], form.customcontactform-sidebar ul li textarea {
63
+ width:90%;
64
+ }
65
+ /* infusion admin panel */
66
+ #customcontactforms-admin {
67
+ vertical-align:top;
68
+ margin:1em 0 30px 25px;
69
+ }
70
+ #customcontactforms-admin .icon32 {
71
+ margin:-6px 6px 9px 5px;
72
+ }
73
+ #customcontactforms-admin .inside {
74
+ padding:5px 10px 10px 10px;
75
+ }
76
+ #customcontactforms-admin h3 {
77
+ margin:0 0 7px 0;
78
+ height:25px;
79
+ padding: 7px 0 0 9px;
80
+ }
81
+ #customcontactforms-admin #instructions {
82
+ float:left;
83
+ height:28em;
84
+ width:29em;
85
+ margin:20px 1em 1em 5px;
86
+ }
87
+ #customcontactforms-admin #instructions p:first-child {
88
+ padding-top:0;
89
+ margin-top:0;
90
+ }
91
+ #customcontactforms-admin #general-settings {
92
+ float:left;
93
+ clear:both;
94
+ height:36em;
95
+ width:29em;
96
+ margin:20px 1em 1em 5px;
97
+ }
98
+ #customcontactforms-admin #general-settings form ul li.descrip {
99
+ font-style:italic;
100
+ padding-left:20px;
101
+ }
102
+ #customcontactforms-admin #general-settings form ul li.show-widget {
103
+ margin-top:1em;
104
+ padding-top:.4em;
105
+ border-top:1px solid #ccc;
106
+ }
107
+ #customcontactforms-admin #create-fields {
108
+ float:left;
109
+ height:22em;
110
+ clear:left;
111
+ width:450px;
112
+ margin:0 1em 1em 5px;
113
+ }
114
+ #customcontactforms-admin #create-forms {
115
+ float:left;
116
+ width:500px;
117
+ height:22em;
118
+ border-left:1px solid #ccc;
119
+ margin:0 1em 1em 1em;
120
+ }
121
+ #customcontactforms-admin #create-forms .inside ul li {
122
+ font-size:.8em;
123
+ }
124
+ #customcontactforms-admin .manage-h3 {
125
+ clear:both;
126
+ margin-top:20px;
127
+ }
128
+ #customcontactforms-admin #manage-fields {
129
+ width:1000px;
130
+ }
131
+ #customcontactforms-admin .evenrow {
132
+ background-color:#f5f5f5;
133
+ }
134
+ #customcontactforms-admin .nobordertop {
135
+ border-top:none;
136
+ }
137
+ #customcontactforms-admin .borderbottom {
138
+ border-bottom:2px solid black;
139
+ }
140
+ #customcontactforms-admin .attached_fields {
141
+ float:left;
142
+ width:600px;
143
+ }
144
+ #customcontactforms-admin .attach_field {
145
+ float:right;
146
+ width:360px;
147
+ }
148
+ #customcontactforms-admin label span {
149
+ font-weight:bold;
150
+ }
151
+ .width25 {
152
+ width:25px;
153
+ }
154
+ .width50 {
155
+ width:50px;
156
+ }
157
+ .width75 {
158
+ width:75px;
159
+ }
160
+ .width100 {
161
+ width:100px;
162
+ }
163
+ .width125 {
164
+ width:125px;
165
+ }
166
+ .width150 {
167
+ width:150px;
168
+ }
169
+ .width175 {
170
+ width:175px;
171
+ }
172
+ .width200 {
173
+ width:200px;
174
+ }
175
+ .red { color:#F00; }
176
+ .bold { font-weight:bold; }
177
+ .italic { font-style:italic; }
custom-contact-forms.php ADDED
@@ -0,0 +1,522 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Custom Contact Forms
4
+ Plugin URI: http://taylorlovett.com/wordpress-plugins
5
+ Description: Custom Contact Forms is a plugin for handling and displaying custom web forms [customcontact form=1] in any page, post, category, or archive in which you want the form to show. This plugin allows you to create fields with a variety of options and to attach them to specific forms you create; definitely allows for more customization than any other Wordpress Contact Form plugin out there today. Also comes with a web form widget to drag-and-drop in to your sidebar. <a href="options-general.php?page=custom-contact-forms" title="Maryland Wordpress Developer">Plugin Settings</a>
6
+ Version: 1.0.0
7
+ Author: <a href="http://www.taylorlovett.com" title="Maryland Wordpress Developer">Taylor Lovett</a>
8
+ Author URI: http://www.taylorlovett.com
9
+ */
10
+
11
+ /*
12
+ Copyright (C) 2010-2011 Taylor Lovett, taylorlovett.com (admin@taylorlovett.com)
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 3 of the License, or
16
+ (at your option) any later version.
17
+ This program is distributed in the hope that it will be useful,
18
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ GNU General Public License for more details.
21
+ You should have received a copy of the GNU General Public License
22
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+
25
+ require('custom-contact-forms-db.php');
26
+ require_once('custom-contact-forms-mailer.php');
27
+ if (!class_exists('CustomContactForms')) {
28
+ class CustomContactForms extends CustomContactFormsDB {
29
+ var $adminOptionsName = 'customContactFormsAdminOptions';
30
+ var $widgetOptionsName = 'widget_customContactForms';
31
+ var $version = '1.0.0';
32
+
33
+ function CustomContactForms() {
34
+ parent::CustomContactFormsDB();
35
+ }
36
+
37
+ function getAdminOptions() {
38
+ $admin_email = get_option('admin_email');
39
+ $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!', 'default_thank_you' => ''); // defaults
40
+ $customcontactOptions = get_option($this->adminOptionsName);
41
+ if (!empty($customcontactOptions)) {
42
+ foreach ($customcontactOptions as $key => $option)
43
+ $customcontactAdminOptions[$key] = $option;
44
+ }
45
+ update_option($this->adminOptionsName, $customcontactAdminOptions);
46
+ return $customcontactAdminOptions;
47
+ }
48
+ function init() {
49
+ $this->getAdminOptions();
50
+ $this->registerSidebar();
51
+ }
52
+ function registerSidebar() {
53
+ register_sidebar_widget(__('Custom Contact Form'), array($this, 'widget_customContactForms'));
54
+ register_widget_control('Custom Contact Form', array($this, 'customContactForms_control'), 300, 200);
55
+ }
56
+ function customContactForms_control() {
57
+ $option = get_option($this->widgetOptionsName);
58
+ if (empty($option)) $option = array('widget_form_id' => '0');
59
+ if ($_POST[widget_form_id]) {
60
+ $option[widget_form_id] = $_POST[widget_form_id];
61
+ update_option($this->widgetOptionsName, $option);
62
+ $option = get_option($this->widgetOptionsName);
63
+ }
64
+ $forms = parent::selectAllForms();
65
+
66
+ $form_options = '';
67
+ foreach ($forms as $form) {
68
+ $sel = ($option[widget_form_id] == $form->id) ? ' selected="selected"' : '';
69
+ $form_options .= '<option value="'.$form->id.'"'.$sel.'>'.$form->form_slug.'</option>';
70
+ }
71
+ if (empty($form_options)) { ?>
72
+ <p>Create a form in the Custom Contact Forms settings page.</p>
73
+ <?php
74
+ } else {
75
+ ?>
76
+ <p>
77
+ <label for="widget_form_id">Show Form:</label>
78
+ <select name="widget_form_id">
79
+ <?php echo $form_options; ?>
80
+ </select>
81
+ </p>
82
+ <?php
83
+ }
84
+ }
85
+ function widget_customContactForms($args) {
86
+ extract($args);
87
+ $admin_option = $this->getAdminOptions();
88
+ if ((is_front_page() and $admin_option[show_widget_home] != 1) or (is_single() and $admin_option[show_widget_singles] != 1) or
89
+ (is_page() and $admin_option[show_widget_pages] != 1) or (is_category() and $admin_option[show_widget_categories] != 1) or
90
+ (is_archive() and $admin_option[show_widget_archives] != 1))
91
+ return false;
92
+ $option = get_option($this->widgetOptionsName);
93
+ if (empty($option) or $option[widget_form_id] < 1) return false;
94
+ echo $before_widget . $this->getFormCode($option[widget_form_id], true, $args) . $after_widget;
95
+ }
96
+ function addHeaderCode() {
97
+ ?>
98
+ <!-- WP Infusionsoft -->
99
+ <link rel="stylesheet" href="<?php echo get_option('siteurl'); ?>/wp-content/plugins/custom-contact-forms/custom-contact-forms.css" type="text/css" media="screen" />
100
+ <?php
101
+ }
102
+ function printAdminPage() {
103
+ parent::encodeOption('sfsfd');
104
+ $admin_options = $this->getAdminOptions();
105
+ if ($_POST[form_create]) {
106
+ parent::insertForm($_POST[form_slug], $_POST[form_title], $_POST[form_action], $_POST[form_method], $_POST[submit_button_text], $_POST[custom_code]);
107
+ } elseif ($_POST[field_create]) {
108
+ parent::insertField($_POST[field_slug], $_POST[field_label], $_POST[field_type], $_POST[field_value], $_POST[field_maxlength]);
109
+ } elseif ($_POST[general_settings]) {
110
+ $admin_options[default_to_email] = $_POST[default_to_email];
111
+ $admin_options[default_from_email] = $_POST[default_from_email];
112
+ $admin_options[default_form_subject] = $_POST[default_form_subject];
113
+ $admin_options[show_widget_categories] = $_POST[show_widget_categories];
114
+ $admin_options[show_widget_singles] = $_POST[show_widget_singles];
115
+ $admin_options[show_widget_pages] = $_POST[show_widget_pages];
116
+ $admin_options[show_widget_archives] = $_POST[show_widget_archives];
117
+ $admin_options[show_widget_home] = $_POST[show_widget_home];
118
+ $admin_options[default_thank_you] = $_POST[default_thank_you];
119
+ update_option($this->adminOptionsName, $admin_options);
120
+ } elseif ($_POST[field_edit]) {
121
+ parent::updateField($_POST[field_slug], $_POST[field_label], $_POST[field_type], $_POST[field_value], $_POST[field_maxlength], $_POST[fid]);
122
+ } elseif ($_POST[field_delete]) {
123
+ parent::deleteField($_POST[fid]);
124
+ } elseif ($_POST[form_delete]) {
125
+ parent::deleteForm($_POST[fid]);
126
+ } elseif ($_POST[form_edit]) {
127
+ parent::updateForm($_POST[form_slug], $_POST[form_title], $_POST[form_action], $_POST[form_method], $_POST[submit_button_text], $_POST[custom_code], $_POST[fid]);
128
+ } elseif ($_POST[form_add_field]) {
129
+ parent::addFieldToForm($_POST[field_id], $_POST[fid]);
130
+ } elseif ($_POST[disattach_field]) {
131
+ parent::disattachField($_POST[disattach_field_id], $_POST[fid]);
132
+ }
133
+ ?>
134
+ <div id="customcontactforms-admin">
135
+ <div id="icon-themes" class="icon32"></div>
136
+ <h2>Custom Contact Forms</h2>
137
+ <div id="create-fields" class="postbox">
138
+ <h3 class="hndle"><span>Create A Form Field</span></h3>
139
+ <div class="inside">
140
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
141
+ <ul>
142
+ <li>
143
+ <label for="field_slug">* Slug (Name):</label>
144
+ <input name="field_slug" type="text" maxlength="50" />
145
+ (Must be unique)</li>
146
+ <li>
147
+ <label for="field_label">Field Label:</label>
148
+ <input name="field_label" type="text" maxlength="100" />
149
+ </li>
150
+ <li>
151
+ <label for="field_type">* Field Type:</label>
152
+ <select name="field_type">
153
+ <option>Text</option>
154
+ <option>Textarea</option>
155
+ <option>Hidden</option>
156
+ <option>Checkbox</option>
157
+ </select>
158
+ </li>
159
+ <li>
160
+ <label for="field_value">Initial Value:</label>
161
+ <input name="field_value" type="text" maxlength="50" />
162
+ </li>
163
+ <li>
164
+ <label for="field_maxlength">Max Length:</label>
165
+ <input class="width50" size="10" name="field_maxlength" type="text" maxlength="4" />
166
+ (0 for no limit; only applies to Text fields)</li>
167
+ <li>
168
+ <input type="submit" value="Create Field" name="field_create" />
169
+ </li>
170
+ </ul>
171
+ </form>
172
+ </div>
173
+ </div>
174
+ <div id="create-forms" class="postbox">
175
+ <h3 class="hndle"><span>Create A Form</span></h3>
176
+ <div class="inside">
177
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
178
+ <ul>
179
+ <li>
180
+ <label for="form_name">Form Slug:</label>
181
+ <input type="text" maxlength="100" name="form_slug" />
182
+ (Must be unique)</li>
183
+ <li>
184
+ <label for="form_title">Form Title:</label>
185
+ <input type="text" maxlength="200" name="form_title" />
186
+ (The form header text)</li>
187
+ <li>
188
+ <label for="form_method">Form Method:</label>
189
+ <select name="form_method">
190
+ <option>Post</option>
191
+ <option>Get</option>
192
+ </select>
193
+ (If unsure, leave as is.)</li>
194
+ <li>
195
+ <label for="form_action">Form Action:</label>
196
+ <input type="text" name="form_action" value="" />
197
+ (If unsure, leave blank.)</li>
198
+ <li>
199
+ <label for="submit_button_text">Submit Button Text:</label>
200
+ <input type="text" maxlength="200" name="submit_button_text" />
201
+ </li>
202
+ <li>
203
+ <label for="custom_code">Custom Code:</label>
204
+ <input type="text" name="custom_code" />
205
+ (If unsure, leave blank.)</li>
206
+ <li>
207
+ <input type="submit" value="Create Form" name="form_create" />
208
+ </li>
209
+ </ul>
210
+ </form>
211
+ </div>
212
+ </div>
213
+ <h3 class="manage-h3">Manage Fields</h3>
214
+ <table class="widefat post" id="manage-fields" cellspacing="0">
215
+ <thead>
216
+ <tr>
217
+ <th scope="col" class="manage-column field-slug">Slug</th>
218
+ <th scope="col" class="manage-column field-label">Label</th>
219
+ <th scope="col" class="manage-column field-type">Type</th>
220
+ <th scope="col" class="manage-column field-value">Initial Value</th>
221
+ <th scope="col" class="manage-column field-maxlength">Maxlength</th>
222
+ <th scope="col" class="manage-column field-action">Action</th>
223
+ </tr>
224
+ </thead>
225
+ <tbody>
226
+ <?php
227
+ $fields = parent::selectAllFields();
228
+ for ($i = 0; $i < count($fields); $i++) {
229
+ $field_types = '<option>Text</option><option>Textarea</option><option>Hidden</option><option>Checkbox</option>';
230
+ $field_types = str_replace('<option>'.$fields[$i]->field_type.'</option>', '<option selected="selected">'.$fields[$i]->field_type.'</option>', $field_types);
231
+
232
+ ?>
233
+ <tr<?php if ($i % 2 == 0) echo ' class="evenrow"'; ?>>
234
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
235
+ <td><input type="text" name="field_slug" maxlength="50" value="<?php echo $fields[$i]->field_slug; ?>" /></td>
236
+ <td><input type="text" name="field_label" maxlength="100" value="<?php echo $fields[$i]->field_label; ?>" /></td>
237
+ <td><select name="field_type">
238
+ <?php echo $field_types; ?>
239
+ </select></td>
240
+ <td><input type="text" name="field_value" maxlength="50" value="<?php echo $fields[$i]->field_value; ?>" /></td>
241
+ <td><input type="text" class="width50" name="field_maxlength" value="<?php echo $fields[$i]->field_maxlength; ?>" /></td>
242
+ <td><input type="hidden" name="fid" value="<?php echo $fields[$i]->id; ?>" />
243
+ <input type="submit" name="field_edit" value="Edit" />
244
+ <input type="submit" name="field_delete" value="Delete" /></td>
245
+ </form>
246
+ </tr>
247
+ <?php
248
+ }
249
+ ?>
250
+ </tbody>
251
+ <tfoot>
252
+ <tr>
253
+ <th scope="col" class="manage-column field-slug">Slug</th>
254
+ <th scope="col" class="manage-column field-label">Label</th>
255
+ <th scope="col" class="manage-column field-type">Type</th>
256
+ <th scope="col" class="manage-column field-value">Initial Value</th>
257
+ <th scope="col" class="manage-column field-maxlength">Maxlength</th>
258
+ <th scope="col" class="manage-column field-action">Action</th>
259
+ </tr>
260
+ </tfoot>
261
+ </table>
262
+ <h3 class="manage-h3">Manage Forms</h3>
263
+ <table class="widefat post" id="manage-fields" cellspacing="0">
264
+ <thead>
265
+ <tr>
266
+ <th scope="col" class="manage-column form-slug">Slug</th>
267
+ <th scope="col" class="manage-column form-title">Title</th>
268
+ <th scope="col" class="manage-column form-method">Method</th>
269
+ <th scope="col" class="manage-column form-action">Form Action</th>
270
+ <th scope="col" class="manage-column form-submit">Button Text</th>
271
+ <th scope="col" class="manage-column form-submit">Custom Code</th>
272
+ <th scope="col" class="manage-column field-action">Action</th>
273
+ </tr>
274
+ </thead>
275
+ <tbody>
276
+ <?php
277
+ $forms = parent::selectAllForms();
278
+ for ($i = 0; $i < count($forms); $i++) {
279
+ $form_methods = '<option>Post</option><option>Get</option>';
280
+ $form_methods = str_replace('<option>'.$forms[$i]->form_method.'</option>', '<option selected="selected">'.$forms[$i]->form_method.'</option>', $form_methods);
281
+ $add_fields = $this->getFieldsForm();
282
+ ?>
283
+ <tr class="<?php if ($i % 2 == 0) echo 'evenrow'; ?>">
284
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
285
+ <td><input type="text" class="width75" name="form_slug" value="<?php echo $forms[$i]->form_slug; ?>" /></td>
286
+ <td><input type="text" class="width125" name="form_title" value="<?php echo $forms[$i]->form_title; ?>" /></td>
287
+ <td><select name="form_method">
288
+ <?php echo $form_methods; ?>
289
+ </select></td>
290
+ <td><input class="width125" type="text" name="form_action" value="<?php echo $forms[$i]->form_action; ?>" /></td>
291
+ <td><input class="width125" type="text" name="submit_button_text" value="<?php echo $forms[$i]->submit_button_text; ?>" /></td>
292
+ <td><input type="text" class="width125" name="custom_code" value="<?php echo $forms[$i]->custom_code; ?>" /></td>
293
+ <td style="text-align:right"><input type="hidden" name="fid" value="<?php echo $forms[$i]->id; ?>" />
294
+ <input type="submit" name="form_edit" value="Edit" />
295
+ <input type="submit" name="form_delete" value="Delete" /></td>
296
+ </form>
297
+ </tr>
298
+ <tr class="<?php if ($i % 2 == 0) echo 'evenrow'; ?>">
299
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
300
+ <td colspan="7"><div class="attached_fields">
301
+ <label><span>Attached Fields:</span></label>
302
+ <?php
303
+ $attached_fields = parent::getAttachedFieldsArray($forms[$i]->id);
304
+ if (empty($attached_fields)) echo 'None ';
305
+ else {
306
+ echo '<select name="disattach_field_id">';
307
+ foreach($attached_fields as $attached_field) {
308
+ $this_field = parent::selectField($attached_field, '');
309
+ echo $this_field->field_slug . ' <option value="'.$this_field->id.'">'.$this_field->field_slug.'</option>';
310
+ ?>
311
+ <?php
312
+ }
313
+ echo '</select> <input type="submit" value="Disattach Field" name="disattach_field" />';
314
+ }
315
+ ?>
316
+ <br />
317
+ <span class="red bold">*</span> Code to Display Form: <b>[customcontact form=<?php echo $forms[$i]->id ?>]</b> </div>
318
+ <div class="attach_field">
319
+ <label for="field_id"><span>Attach Field:</span></label>
320
+ <select name="field_id">
321
+ <?php echo $add_fields; ?>
322
+ </select>
323
+ <input type="submit" name="form_add_field" value="Attach" />
324
+ <input type="hidden" name="fid" value="<?php echo $forms[$i]->id; ?>" /><br />
325
+ <span class="red bold">*</span> Attach in the order you want fields to display.
326
+ </div></td>
327
+ </form>
328
+ </tr>
329
+ <?php
330
+ }
331
+ ?>
332
+ </tbody>
333
+ <tfoot>
334
+ <tr>
335
+ <tr>
336
+ <th scope="col" class="manage-column form-slug">Slug</th>
337
+ <th scope="col" class="manage-column form-title">Title</th>
338
+ <th scope="col" class="manage-column form-method">Method</th>
339
+ <th scope="col" class="manage-column form-action">Form Action</th>
340
+ <th scope="col" class="manage-column form-submit">Button Text</th>
341
+ <th scope="col" class="manage-column form-submit">Custom Code</th>
342
+ <th scope="col" class="manage-column field-action">Action</th>
343
+ </tr>
344
+ </tr>
345
+
346
+ </tfoot>
347
+ </table>
348
+ <div id="general-settings" class="postbox">
349
+ <h3 class="hndle"><span>General Settings</span></h3>
350
+ <div class="inside">
351
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
352
+ <ul>
353
+ <li>
354
+ <label for="default_to_email">Default Email:</label>
355
+ <input name="default_to_email" value="<?php echo $admin_options[default_to_email]; ?>" type="text" maxlength="100" />
356
+ </li>
357
+ <li class="descrip">Form emails will be sent <span>to</span> this address.</li>
358
+ <li>
359
+ <label for="default_from_email">Default From Email:</label>
360
+ <input name="default_from_email" value="<?php echo $admin_options[default_from_email]; ?>" type="text" maxlength="100" />
361
+ </li>
362
+ <li class="descrip">Form emails will be sent <span>from</span> this address.</li>
363
+ <li>
364
+ <label for="default_form_subject">Default Email Subject:</label>
365
+ <input name="default_form_subject" value="<?php echo $admin_options[default_form_subject]; ?>" type="text" maxlength="150" />
366
+ </li>
367
+ <li class="descrip">Default subject to be included in all form emails.</li>
368
+ <li>
369
+ <label for="default_thank_you">Default Thank You Page:</label>
370
+ <input name="default_thank_you" value="<?php echo $admin_options[default_thank_you]; ?>" type="text" maxlength="150" />
371
+ </li>
372
+ <li class="descrip">Leaving this blank will bring visitors back to where they filled out the form.</li>
373
+ <li class="show-widget">Show Sidebar Widget:</li>
374
+ <li>
375
+ <label>
376
+ <input value="1" type="checkbox" name="show_widget_home" <?php if ($admin_options[show_widget_home] == 1) echo 'checked="checked"'; ?> />
377
+ On Homepage</label>
378
+ </li>
379
+ <li>
380
+ <label>
381
+ <input value="1" type="checkbox" name="show_widget_pages" <?php if ($admin_options[show_widget_pages] == 1) echo 'checked="checked"'; ?> />
382
+ On Pages</label>
383
+ </li>
384
+ <li>
385
+ <label>
386
+ <input value="1" type="checkbox" name="show_widget_singles" <?php if ($admin_options[show_widget_singles] == 1) echo 'checked="checked"'; ?> />
387
+ On Single Posts</label>
388
+ </li>
389
+ <li>
390
+ <label>
391
+ <input value="1" type="checkbox" name="show_widget_categories" <?php if ($admin_options[show_widget_categories] == 1) echo 'checked="checked"'; ?> />
392
+ On Categories</label>
393
+ </li>
394
+ <li>
395
+ <label>
396
+ <input value="1" type="checkbox" name="show_widget_archives" <?php if ($admin_options[show_widget_archives] == 1) echo 'checked="checked"'; ?> />
397
+ On Archives</label>
398
+ </li>
399
+ <li>
400
+ <input type="submit" value="Update" name="general_settings" />
401
+ </li>
402
+ </ul>
403
+ </form>
404
+ </div>
405
+ </div>
406
+ <div id="instructions" class="postbox">
407
+ <h3 class="hndle"><span>Instructions</span></h3>
408
+ <div class="inside">
409
+ <p>1. Create a form.</p>
410
+ <p>2. Create fields and attach those fields to the forms of your choice. <b>* 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.</b></p>
411
+ <p>3. Display those forms in posts and pages by inserting the code: [customcontact form=<b>FORMID</b>]. Replace <b>FORMID</b> with the id listed to the left of the form slug next to the form of your choice above.</p>
412
+ <p>4. Add a form to your sidebar, by dragging the Custom Contact Form widget in to your sidebar.</p>
413
+ <p>5. Configure the General Settings appropriately; this is important if you want to receive your web form messages!</p>
414
+ </div>
415
+ </div>
416
+ </div>
417
+ <?php
418
+ }
419
+
420
+ function contentFilter($content) {
421
+ $matches = array();
422
+ preg_match_all('/\[customcontact form=([0-9]+)\]/si', $content, $matches);
423
+ for ($i = 0; $i < count($matches[0]); $i++) {
424
+ if (parent::selectForm($matches[1][$i], '') == false) {
425
+ $form_code = '';
426
+ } else {
427
+ $form_code = $this->getFormCode($matches[1][$i], false, '');
428
+ }
429
+ $content = str_replace($matches[0][$i], $form_code, $content);
430
+ }
431
+ return $content;
432
+ }
433
+
434
+ function getFieldsForm() {
435
+ $fields = parent::selectAllFields();
436
+ $out = '';
437
+ foreach ($fields as $field) {
438
+ $out .= '<option value="'.$field->id.'">'.$field->field_slug.'</option>';
439
+ }
440
+ return $out;
441
+ }
442
+
443
+ function getFormCode($fid, $is_sidebar, $args) {
444
+ if ($is_sidebar) extract($args);
445
+ $form = parent::selectForm($fid, '');
446
+ $class = (!$is_sidebar) ? 'customcontactform' : 'customcontactform-sidebar';
447
+ $action = (!empty($form->form_action)) ? $form->form_action : get_permalink();
448
+ $out = '<form method="'.strtolower($form->form_method).'" action="'.$action.'" class="'.$class.'">' . "\n";
449
+ $out .= parent::decodeOption($form->custom_code, 1, 1) . '<h4>' . parent::decodeOption($form->form_title, 1, 1) . '</h4>' . "\n" . '<ul>';
450
+ $fields = parent::getAttachedFieldsArray($fid);
451
+ $hiddens = '';
452
+ foreach ($fields as $field_id) {
453
+ $field = parent::selectField($field_id, '');
454
+ if ($field->field_type == 'Text') {
455
+ $maxlength = (empty($field->field_maxlength) or $field->field_maxlength <= 0) ? '' : ' maxlength="'.$field->field_maxlength.'"';
456
+ $out .= '<li><label for="'.parent::decodeOption($field->field_slug, 1, 1).'">'.parent::decodeOption($field->field_label, 1, 1).'</label><input type="text" name="'.parent::decodeOption($field->field_slug, 1, 1).'" value="'.parent::decodeOption($field->field_value, 1, 1).'"'.$maxlength.' /></li>' . "\n";
457
+ } elseif ($field->field_type == 'Hidden') {
458
+ $hiddens .= '<li><input type="hidden" name="'.parent::decodeOption($field->field_slug, 1, 1).'" value="'.parent::decodeOption($field->field_value, 1, 1).'" /></li>' . "\n";
459
+ } elseif ($field->field_type == 'Checkbox') {
460
+ $out .= '<li><input type="checkbox" name="'.parent::decodeOption($field->field_slug, 1, 1).'" value="'.parent::decodeOption($field->field_value, 1, 1).'" /> <label class="checkbox" for="'.parent::decodeOption($field->field_slug, 1, 1).'">'.parent::decodeOption($field->field_label, 1, 1).'</label></li>' . "\n";
461
+ } elseif ($field->field_type == 'Textarea') {
462
+ $out .= '<li><label for="'.parent::decodeOption($field->field_slug, 1, 1).'">'.parent::decodeOption($field->field_label, 1, 1).'</label><textarea name="'.parent::decodeOption($field->field_slug, 1, 1).'">'.parent::decodeOption($field->field_value, 1, 1).'</textarea></li>' . "\n";
463
+ }
464
+ }
465
+ $out .= '</ul>'."\n".'<p><input type="hidden" name="fid" value="'.$form->id.'" />'."\n".$hiddens."\n".'<input type="submit" class="submit" value="' . parent::decodeOption($form->submit_button_text, 1, 0) . '" name="customcontactforms_submit" /></p>' . "\n" . '</form>';
466
+ return $out;
467
+ }
468
+
469
+ function processForms() {
470
+ if ($_POST[customcontactforms_submit]) {
471
+ $admin_options = $this->getAdminOptions();
472
+ $fields = parent::getAttachedFieldsArray($_POST[fid]);
473
+ $checks = array();
474
+ foreach ($fields as $field_id) {
475
+ $field = parent::selectField($field_id, '');
476
+ if ($field->field_type == 'Checkbox')
477
+ $checks[] = $field->field_slug;
478
+ }
479
+ $body = '';
480
+ foreach ($_POST as $key => $value) {
481
+ $field = parent::selectField('', $key);
482
+ if ($key != 'customcontactforms_submit' && $key != 'fid')
483
+ $body .= $field->field_label . ': ' . $value . "\n";
484
+ if (in_array($key, $checks)) {
485
+ $checks_key = array_search($key, $checks);
486
+ unset($checks[$checks_key]);
487
+ }
488
+ } foreach ($checks as $check_key) {
489
+ $field = parent::selectField('', $check_key);
490
+ $body .= ucwords(str_replace('_', ' ', $field->field_label)) . ': 0' . "\n";
491
+ }
492
+ $body .= 'Sender IP: ' . $_SERVER['REMOTE_ADDR'] . "\n";
493
+ $mailer = new CustomContactFormsMailer($admin_options[default_to_email], $admin_options[default_from_email], $admin_options[default_form_subject], $body);
494
+ $mailer->send();
495
+ unset($_POST);
496
+ if (!empty($admin_options[default_thank_you])) {
497
+ header("Location: " . $admin_options[default_thank_you]);
498
+ }
499
+ }
500
+ }
501
+ }
502
+ }
503
+ $customcontact = new CustomContactForms();
504
+ if (!function_exists('CustomContactForms_ap')) {
505
+ function CustomContactForms_ap() {
506
+ global $customcontact;
507
+ if (!isset($customcontact)) return;
508
+ if (function_exists('add_options_page')) {
509
+ add_options_page('Custom Contact Forms', 'Custom Contact Forms', 9, 'custom-contact-forms', array(&$customcontact, 'printAdminPage'));
510
+ }
511
+ }
512
+ }
513
+ if (isset($customcontact)) {
514
+ add_action('init', array(&$customcontact, 'processForms'), 1);
515
+ add_action('wp_head', array(&$customcontact, 'addHeaderCode'), 1);
516
+ add_action('admin_head', array(&$customcontact, 'addHeaderCode'), 1);
517
+ add_action('activate_customcontactforms/customcontactforms.php', array(&$customcontact, 'init'));
518
+ add_action('plugins_loaded', array(&$customcontact, 'init'), 1);
519
+ add_filter('the_content', array(&$customcontact, 'contentFilter'));
520
+ }
521
+ add_action('admin_menu', 'CustomContactForms_ap');
522
+ ?>
readme.txt ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Custom Contact Forms ===
2
+ Plugin Name: Custom Contact Forms
3
+ Tags: contact form, web form, custom contact form, custom forms, contact fields, form mailers
4
+ Requires at least: 2.7.1
5
+ Tested up to: 3.0
6
+ Stable tag: 1.0
7
+ Contributors: Taylor Lovett
8
+ Download link: http://www.taylorlovett.com/wordpress-plugins/
9
+ Author: Taylor Lovett
10
+ Author URI: http://www.taylorlovett.com
11
+
12
+ == Description ==
13
+ A plugin for handling and displaying custom web forms in any page, post, or sidebar. Extremely customizable!
14
+
15
+ == Installation ==
16
+ 1. Upload to /wp-content/plugins
17
+ 2. Activate the plugin from your Wordpress Admin Panel
18
+
19
+ == Configuring and Using the Plugin ==
20
+ 1. Create a form in the Custom Contact Forms setting page. To get to the settings page, click the Custom Contact Forms link in the admin panel sidebar
21
+ 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.
22
+ 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.
23
+ 4. Add a form to your sidebar, by dragging the Custom Contact Form widget in to your sidebar.
24
+ 5. Configure the General Settings appropriately; this is important if you want to receive your web form messages!
25
+
26
+ == Questions, Troubleshooting, Bug Reports ==
27
+ Email me at admin@taylorlovett.com