Custom Contact Forms - Version 3.5.2

Version Description

  • custom-contact-forms.php - Plugin Usage popover added, insert default content button
  • custom-contact-forms-db.php - Insert default content function
Download this release

Release Info

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

Code changes from version 3.5.1 to 3.5.2

css/custom-contact-forms-admin.css CHANGED
@@ -125,7 +125,7 @@
125
  #customcontactforms-admin #field-options .evenrow-field-options div { background-color:#f9f9f9; }
126
  #customcontactforms-admin #field-options .evenrow-field-options { background-color:#f9f9f9; }
127
  #customcontactforms-admin #general-settings label { font-weight:bold; }
128
- #customcontactforms-admin #style-example {
129
  background:url(../images/style-example.gif) no-repeat top left;
130
  width:405px;
131
  height:135px;
@@ -133,7 +133,7 @@
133
  margin:10px 0 0 10px;
134
  border:0;
135
  }
136
- #customcontactforms-admin #success-popover-example {
137
  background:url(../images/success-popover-example.gif) no-repeat top left;
138
  width:405px;
139
  height:135px;
@@ -255,12 +255,11 @@
255
  border-right:none;
256
  }
257
  /* CCF Install Popover -------------------------------- */
258
- #ccf-install-popover {
259
  display:none;
260
  border: 9px solid #efefef;
261
  border-spacing:0;
262
  width:680px;
263
- height:400px;
264
  padding:0px;
265
  margin:0;
266
  -moz-border-radius:10px;
@@ -268,26 +267,53 @@
268
  -webkit-border-radius:10px;
269
  border-radius:15px;
270
  position:fixed;
271
- left:30%;
272
  background-color:white;
273
  top:20px;
 
274
  }
275
- #ccf-install-popover div {
276
  background-color:#efefef;
277
  padding:9px 9px 9px 20px;
278
  margin:0 0 15px 0px;
279
  height:1.3em;
280
  }
281
- #ccf-install-popover div h5 {
282
  text-align:left;
283
  float:left;
284
  margin:0;
285
  font-size:1.5em;
286
  font-weight:bold;
287
  }
288
- #ccf-install-popover p { padding:8px; clear:both; font-size:1.1em; text-align:center; }
289
- #ccf-install-popover div a.close {
290
  float:right;
291
  display:block;
292
  font-size:12px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  }
125
  #customcontactforms-admin #field-options .evenrow-field-options div { background-color:#f9f9f9; }
126
  #customcontactforms-admin #field-options .evenrow-field-options { background-color:#f9f9f9; }
127
  #customcontactforms-admin #general-settings label { font-weight:bold; }
128
+ .ccf-style-example {
129
  background:url(../images/style-example.gif) no-repeat top left;
130
  width:405px;
131
  height:135px;
133
  margin:10px 0 0 10px;
134
  border:0;
135
  }
136
+ .ccf-success-popover-example {
137
  background:url(../images/success-popover-example.gif) no-repeat top left;
138
  width:405px;
139
  height:135px;
255
  border-right:none;
256
  }
257
  /* CCF Install Popover -------------------------------- */
258
+ #ccf-usage-popover {
259
  display:none;
260
  border: 9px solid #efefef;
261
  border-spacing:0;
262
  width:680px;
 
263
  padding:0px;
264
  margin:0;
265
  -moz-border-radius:10px;
267
  -webkit-border-radius:10px;
268
  border-radius:15px;
269
  position:fixed;
270
+ left:20%;
271
  background-color:white;
272
  top:20px;
273
+ bottom:20px;
274
  }
275
+ #ccf-usage-popover div.popover-header {
276
  background-color:#efefef;
277
  padding:9px 9px 9px 20px;
278
  margin:0 0 15px 0px;
279
  height:1.3em;
280
  }
281
+ #ccf-usage-popover div.popover-header h5 {
282
  text-align:left;
283
  float:left;
284
  margin:0;
285
  font-size:1.5em;
286
  font-weight:bold;
287
  }
288
+ #ccf-usage-popover div.popover-header a.close {
 
289
  float:right;
290
  display:block;
291
  font-size:12px;
292
+ }
293
+ #ccf-usage-popover div.popover-body span { font-weight:bold; }
294
+ #ccf-usage-popover div.popover-body {
295
+ text-align:left;
296
+ overflow:scroll;
297
+ position:absolute;
298
+ bottom:0px;
299
+ top:2.4em;
300
+ padding:3px;
301
+ }
302
+ #ccf-usage-popover div.popover-body ul { margin:5px 0px 5px 8px; padding:0; border-top:1px solid #efefef; }
303
+ #ccf-usage-popover div.popover-body ul ul { margin:0px 0px 2px 30px; padding:0; list-style-type:disc; border-top:none; }
304
+ #ccf-usage-popover div.popover-body ul li { margin-left:20px; }
305
+ #ccf-usage-popover div.popover-body p { padding:8px; font-size:1em; text-align:left; }
306
+ #ccf-usage-popover div.popover-body form { width:100%; text-align:center; }
307
+ #ccf-usage-popover div.popover-body .insert-default-content-button {
308
+ width:auto;
309
+ padding:8px;
310
+ margin:5px auto 5px auto;
311
+ font-size:1.5em;
312
+ font-weight:bold;
313
+ background-color:#f0f0f0;
314
+ font-family:Verdana, Arial, Helvetica, sans-serif;
315
+ -moz-border-radius:6px;
316
+ -khtml-border-radius:6px;
317
+ -webkit-border-radius:6px;
318
+ border-radius:6px;
319
  }
css/custom-contact-forms.css CHANGED
@@ -15,7 +15,7 @@ form.customcontactform div label, form.customcontactform-sidebar div label { dis
15
  form.customcontactform div label.checkbox, form.customcontactform-sidebar div label.checkbox { display:inline; }
16
  form.customcontactform div label.select, form.customcontactform-sidebar div label.select { display:inline; margin-right:8px; }
17
  form.customcontactform div, form.customcontactform-sidebar div {
18
- border-bottom: 1px dashed #e1e1e1;
19
  padding:.4em 0 .3em 0;
20
  width:100%;
21
  margin:0 0 6px 0;
15
  form.customcontactform div label.checkbox, form.customcontactform-sidebar div label.checkbox { display:inline; }
16
  form.customcontactform div label.select, form.customcontactform-sidebar div label.select { display:inline; margin-right:8px; }
17
  form.customcontactform div, form.customcontactform-sidebar div {
18
+ /*border-bottom: 1px dashed #e1e1e1;*/
19
  padding:.4em 0 .3em 0;
20
  width:100%;
21
  margin:0 0 6px 0;
custom-contact-forms-db.php CHANGED
@@ -174,7 +174,7 @@ if (!class_exists('CustomContactFormsDB')) {
174
  $form[form_slug] = $this->formatSlug($form[form_slug]);
175
  $form = array_map(array(&$this, 'encodeOption'), $form);
176
  $wpdb->insert($this->forms_table, $form);
177
- return true;
178
  }
179
 
180
  function insertField($field) {
@@ -186,7 +186,7 @@ if (!class_exists('CustomContactFormsDB')) {
186
  $field[$key] = $this->encodeOption($value);
187
  }
188
  $wpdb->insert($this->fields_table, $field);
189
- return true;
190
  }
191
 
192
  function insertFieldOption($option) {
@@ -195,7 +195,7 @@ if (!class_exists('CustomContactFormsDB')) {
195
  $option[option_slug] = $this->formatSlug($option[option_slug]);
196
  $option = array_map(array(&$this, 'encodeOption'), $option);
197
  $wpdb->insert($this->field_options_table, $option);
198
- return true;
199
  }
200
 
201
  function insertStyle($style) {
@@ -207,7 +207,7 @@ if (!class_exists('CustomContactFormsDB')) {
207
  $style[$key] = $this->formatStyle($this->encodeOption($value));
208
  }
209
  $wpdb->insert($this->styles_table, $style);
210
- return true;
211
  }
212
 
213
 
@@ -284,30 +284,34 @@ if (!class_exists('CustomContactFormsDB')) {
284
  return true;
285
  }
286
 
287
- function deleteForm($fid) {
288
  global $wpdb;
289
- $wpdb->query("DELETE FROM " . $this->forms_table . " WHERE id='$fid'");
 
290
  return true;
291
  }
292
 
293
- function deleteField($fid) {
294
  global $wpdb;
295
  $this->dettachFieldAll($fid);
296
- $wpdb->query("DELETE FROM " . $this->fields_table . " WHERE id='$fid'");
 
297
  return false;
298
  }
299
 
300
- function deleteStyle($sid) {
301
  global $wpdb;
302
  $this->dettachStyleAll($sid);
303
- $wpdb->query("DELETE FROM " . $this->styles_table . " WHERE id='$sid'");
 
304
  return true;
305
  }
306
 
307
- function deleteFieldOption($oid) {
308
  global $wpdb;
309
  $this->dettachFieldOptionAll($oid);
310
- $wpdb->query("DELETE FROM " . $this->field_options_table . " WHERE id='$oid'");
 
311
  return true;
312
  }
313
 
@@ -435,7 +439,7 @@ if (!class_exists('CustomContactFormsDB')) {
435
  }
436
 
437
  function formatSlug($slug) {
438
- $slug = preg_replace('/[^a-zA-Z0-9\s]/', '', $slug);
439
  return str_replace(' ', '_', $slug);
440
  }
441
 
@@ -458,6 +462,66 @@ if (!class_exists('CustomContactFormsDB')) {
458
  $test = $this->selectFieldOption('', $slug);
459
  return (!empty($test));
460
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  }
462
  }
463
  ?>
174
  $form[form_slug] = $this->formatSlug($form[form_slug]);
175
  $form = array_map(array(&$this, 'encodeOption'), $form);
176
  $wpdb->insert($this->forms_table, $form);
177
+ return $wpdb->insert_id;
178
  }
179
 
180
  function insertField($field) {
186
  $field[$key] = $this->encodeOption($value);
187
  }
188
  $wpdb->insert($this->fields_table, $field);
189
+ return $wpdb->insert_id;
190
  }
191
 
192
  function insertFieldOption($option) {
195
  $option[option_slug] = $this->formatSlug($option[option_slug]);
196
  $option = array_map(array(&$this, 'encodeOption'), $option);
197
  $wpdb->insert($this->field_options_table, $option);
198
+ return $wpdb->insert_id;
199
  }
200
 
201
  function insertStyle($style) {
207
  $style[$key] = $this->formatStyle($this->encodeOption($value));
208
  }
209
  $wpdb->insert($this->styles_table, $style);
210
+ return $wpdb->insert_id;
211
  }
212
 
213
 
284
  return true;
285
  }
286
 
287
+ function deleteForm($fid, $slug = NULL) {
288
  global $wpdb;
289
+ $where_params = ($slug == NULL) ? "id='$fid'" : "form_slug='$slug'";
290
+ $wpdb->query("DELETE FROM " . $this->forms_table . ' WHERE ' . $where_params);
291
  return true;
292
  }
293
 
294
+ function deleteField($fid, $slug = NULL) {
295
  global $wpdb;
296
  $this->dettachFieldAll($fid);
297
+ $where_params = ($slug == NULL) ? "id='$fid'" : "field_slug='$slug'";
298
+ $wpdb->query("DELETE FROM " . $this->fields_table . ' WHERE ' . $where_params);
299
  return false;
300
  }
301
 
302
+ function deleteStyle($sid, $slug = NULL) {
303
  global $wpdb;
304
  $this->dettachStyleAll($sid);
305
+ $where_params = ($slug == NULL) ? "id='$sid'" : "style_slug='$slug'";
306
+ $wpdb->query("DELETE FROM " . $this->styles_table . ' WHERE ' . $where_params);
307
  return true;
308
  }
309
 
310
+ function deleteFieldOption($oid, $slug = NULL) {
311
  global $wpdb;
312
  $this->dettachFieldOptionAll($oid);
313
+ $where_params = ($slug == NULL) ? "id='$oid'" : "option_slug='$slug'";
314
+ $wpdb->query("DELETE FROM " . $this->field_options_table . ' WHERE ' . $where_params);
315
  return true;
316
  }
317
 
439
  }
440
 
441
  function formatSlug($slug) {
442
+ $slug = preg_replace('/[^a-z_ A-Z0-9\s]/', '', $slug);
443
  return str_replace(' ', '_', $slug);
444
  }
445
 
462
  $test = $this->selectFieldOption('', $slug);
463
  return (!empty($test));
464
  }
465
+
466
+ function insertDefaultContent($overwrite = false) {
467
+ $field_slugs = array('name' => 'ccf_name', 'message' => 'ccf_message',
468
+ 'website' => 'ccf_website', 'phone' => 'ccf_phone', 'google' => 'ccf_google',
469
+ 'contact_method' => 'ccf_contact_method');
470
+ $option_slugs = array('email' => 'ccf_email', 'phone' => 'ccf_phone', 'nocontact' => 'ccf_no_contact');
471
+ $form_slugs = array('contact_form' => 'ccf_contact_form');
472
+ if ($overwrite) {
473
+ foreach($field_slugs as $slug) $this->deleteField(0, $slug);
474
+ foreach($option_slugs as $slug) $this->deleteFieldOption(0, $slug);
475
+ foreach($form_slugs as $slug) $this->deleteForm(0, $slug);
476
+ }
477
+ $name_field = array('field_slug' => $field_slugs[name], 'field_label' => 'Your Name:',
478
+ 'field_required' => 1, 'field_instructions' => 'Please enter your full name.',
479
+ 'field_maxlength' => '100', 'field_type' => 'Text');
480
+ $message_field = array('field_slug' => $field_slugs[message], 'field_label' => 'Your Message:',
481
+ 'field_required' => 0, 'field_instructions' => 'Enter any message or comment.',
482
+ 'field_maxlength' => 0, 'field_type' => 'Textarea');
483
+ $website_field = array('field_slug' => $field_slugs[website], 'field_label' => 'Your Website:',
484
+ 'field_required' => 0, 'field_instructions' => 'If you have a website, please enter it here.',
485
+ 'field_maxlength' => 200, 'field_type' => 'Text');
486
+ $phone_field = array('field_slug' => $field_slugs[phone], 'field_label' => 'Your Phone Number:',
487
+ 'field_required' => 0, 'field_instructions' => 'Please enter your phone number.',
488
+ 'field_maxlength' => 30, 'field_type' => 'Text');
489
+ $google_field = array('field_slug' => $field_slugs[google], 'field_label' => 'Did you find my website through Google?',
490
+ 'field_required' => 0, 'field_instructions' => 'If you found my website through Google, check this box.',
491
+ 'field_maxlength' => 0, 'field_type' => 'Checkbox');
492
+ $contact_method_field = array('field_slug' => $field_slugs[contact_method], 'field_label' => 'How should we contact you?',
493
+ 'field_required' => 1, 'field_instructions' => 'By which method we should contact you?',
494
+ 'field_maxlength' => 0, 'field_type' => 'Dropdown');
495
+ $email_field = $this->selectField(0, 'fixedEmail');
496
+ $captcha_field = $this->selectField(0, 'captcha');
497
+ $email_option = array('option_slug' => $option_slugs[email], 'option_label' => 'By Email');
498
+ $phone_option = array('option_slug' => $option_slugs[phone], 'option_label' => 'By Phone');
499
+ $nocontact_option = array('option_slug' => $option_slugs[nocontact], 'option_label' => 'Do Not Contact Me');
500
+ $contact_form = array('form_slug' => $form_slugs[contact_form], 'form_title' => 'Contact Form', 'form_method' => 'Post',
501
+ 'submit_button_text' => 'Send Message', 'form_email' => get_option('admin_email'), 'form_success_message' => 'Thank you for filling out our contact form. We will contact you very soon by the way you specified.',
502
+ 'form_success_title' => 'Thank You!', 'form_style' => 0);
503
+ $name_field_id = $this->insertField($name_field);
504
+ $message_field_id = $this->insertField($message_field);
505
+ $website_field_id = $this->insertField($website_field);
506
+ $phone_field_id = $this->insertField($phone_field);
507
+ $google_field_id = $this->insertField($google_field);
508
+ $contact_method_field_id = $this->insertField($contact_method_field);
509
+ $email_option_id = $this->insertFieldOption($email_option);
510
+ $phone_option_id = $this->insertFieldOption($phone_option);
511
+ $nocontact_option_id = $this->insertFieldOption($nocontact_option);
512
+ $contact_form_id = $this->insertForm($contact_form);
513
+ $this->addFieldOptionToField($email_option_id, $contact_method_field_id);
514
+ $this->addFieldOptionToField($phone_option_id, $contact_method_field_id);
515
+ $this->addFieldOptionToField($nocontact_option_id, $contact_method_field_id);
516
+ $this->addFieldToForm($name_field_id, $contact_form_id);
517
+ $this->addFieldToForm($website_field_id, $contact_form_id);
518
+ $this->addFieldToForm($email_field->id, $contact_form_id);
519
+ $this->addFieldToForm($phone_field_id, $contact_form_id);
520
+ $this->addFieldToForm($google_field_id, $contact_form_id);
521
+ $this->addFieldToForm($contact_method_field_id, $contact_form_id);
522
+ $this->addFieldToForm($message_field_id, $contact_form_id);
523
+ $this->addFieldToForm($captcha_field->id, $contact_form_id);
524
+ }
525
  }
526
  }
527
  ?>
custom-contact-forms-images.php CHANGED
@@ -1,22 +1,23 @@
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('CustomContactFormsImages')) {
8
- class CustomContactFormsImages {
9
- function createImageWithText($str){
10
- $image = imagecreate(96,24);
11
- $src = imagecreatefrompng('images/gd' . rand(1, 4) . '.png');
12
- $textcolor = imagecolorallocate($src, 10, 0, 0);
13
- imagestring($src, 14, 5, 1, $str, $textcolor);
14
- imagecopyresampled($image, $src, 0, 0, 0, 0, 96, 24, 63, 18);
15
- imagepng($image);
16
- imagedestroy($image);
17
- imagedestroy($src);
18
- return $str;
19
- }
20
- }
21
- }
 
22
  ?>
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
+
8
+ if (!class_exists('CustomContactFormsImages')) {
9
+ class CustomContactFormsImages {
10
+ function createImageWithText($str){
11
+ $image = imagecreate(96,24);
12
+ $src = imagecreatefrompng('images/gd' . rand(1, 4) . '.png');
13
+ $textcolor = imagecolorallocate($src, 10, 0, 0);
14
+ imagestring($src, 14, 5, 1, $str, $textcolor);
15
+ imagecopyresampled($image, $src, 0, 0, 0, 0, 96, 24, 63, 18);
16
+ imagepng($image);
17
+ imagedestroy($image);
18
+ imagedestroy($src);
19
+ return $str;
20
+ }
21
+ }
22
+ }
23
  ?>
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.5.1
7
  Author: Taylor Lovett
8
  Author URI: http://www.taylorlovett.com
9
  */
@@ -22,16 +22,12 @@
22
  along with this program. If not, see <http://www.gnu.org/licenses/>.
23
  */
24
  require_once('custom-contact-forms-db.php');
25
- require_once('custom-contact-forms-mailer.php');
26
- require_once('custom-contact-forms-images.php');
27
  if (!class_exists('CustomContactForms')) {
28
  class CustomContactForms extends CustomContactFormsDB {
29
  var $adminOptionsName = 'customContactFormsAdminOptions';
30
- var $widgetOptionsName = 'widget_customContactForms';
31
  var $version = '3.5.1';
32
  var $form_errors;
33
  var $error_return;
34
- var $gets;
35
  var $current_form;
36
  var $current_thank_you_message;
37
  var $fixed_fields = array('customcontactforms_submit' => '',
@@ -70,7 +66,6 @@ if (!class_exists('CustomContactForms')) {
70
  return $customcontactAdminOptions;
71
  }
72
  function init() {
73
- $this->storeGets();
74
  if (!is_admin()) {
75
  $this->startSession();
76
  $this->processForms();
@@ -122,12 +117,6 @@ if (!class_exists('CustomContactForms')) {
122
  $this->form_errors[$key] = $message;
123
  }
124
 
125
- function storeGets() {
126
- foreach ($_GET as $k => $v) {
127
- $this->gets[$k] = $v;
128
- }
129
- }
130
-
131
  function getFormError($key) {
132
  return $this->form_errors[$key];
133
  }
@@ -136,23 +125,115 @@ if (!class_exists('CustomContactForms')) {
136
  return $this->form_errors;
137
  }
138
 
139
- function insertInstallPopover() {
140
  ?>
141
- <div id="ccf-install-popover">
142
- <div>
143
- <h5>Welcome to Custom Contact Forms</h5>
144
  <a href="javascript:void(0)" class="close">[close]</a>
145
  </div>
146
- <p>herrro!</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  </div>
148
  <?php
149
  }
150
 
151
  function printAdminPage() {
152
  $admin_options = $this->getAdminOptions();
153
- //if ($admin_options[show_install_popover] == 1)
154
- //add_action('admin_footer', array(&$this, 'insertInstallPopover'));
155
- if ($_POST[form_create]) {
 
 
 
 
 
 
 
 
156
  parent::insertForm($_POST[form]);
157
  } elseif ($_POST[field_create]) {
158
  parent::insertField($_POST[field]);
@@ -179,6 +260,8 @@ if (!class_exists('CustomContactForms')) {
179
  parent::updateField($_POST[field], $_POST[fid]);
180
  } elseif ($_POST[field_delete]) {
181
  parent::deleteField($_POST[fid]);
 
 
182
  } elseif ($_POST[form_delete]) {
183
  parent::deleteForm($_POST[fid]);
184
  } elseif ($_POST[form_edit]) {
@@ -208,7 +291,7 @@ if (!class_exists('CustomContactForms')) {
208
  parent::insertFieldOption($_POST[option]);
209
  }
210
  $styles = parent::selectAllStyles();
211
- $style_options = '<option value="0">None</option>';
212
  foreach ($styles as $style)
213
  $style_options .= '<option value="'.$style->id.'">'.$style->style_slug.'</option>';
214
  ?>
@@ -239,7 +322,7 @@ if (!class_exists('CustomContactForms')) {
239
  <li>
240
  <label for="field_slug">* Slug (Name):</label>
241
  <input name="field[field_slug]" type="text" maxlength="50" /><br />
242
- (A slug is simply a way to identify your form. It can only contain underscores, letters, and numbers and must be unique.)</li>
243
  <li>
244
  <label for="field_label">Field Label:</label>
245
  <input name="field[field_label]" type="text" maxlength="100" /><br />
@@ -289,7 +372,7 @@ if (!class_exists('CustomContactForms')) {
289
  <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
290
  <ul>
291
  <li>
292
- <label for="form[form_name]">* Form Slug:</label>
293
  <input type="text" maxlength="100" name="form[form_slug]" /><br />
294
  (Must be unique and contain only underscores and alphanumeric characters.)</li>
295
  <li>
@@ -785,16 +868,26 @@ if (!class_exists('CustomContactForms')) {
785
  <div id="instructions" class="postbox">
786
  <h3 class="hndle"><span>Instructions</span></h3>
787
  <div class="inside">
 
 
 
 
 
 
788
  <p>1. Create a form.</p>
789
- <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>
790
  <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. You can also display forms in theme files; the code for this is provided within each forms admin section.</p>
791
  <p>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.</p>
792
  <p>5. Add a form to your sidebar, by dragging the Custom Contact Form widget in to your sidebar.</p>
793
  <p>6. Configure the General Settings appropriately; this is important if you want to receive your web form messages!</p>
794
  <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>
795
  <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>
796
- <div id="style-example"></div>
797
- <div id="success-popover-example"></div>
 
 
 
 
798
  </div>
799
  </div>
800
  <a name="create-styles"></a>
@@ -1309,6 +1402,7 @@ the field names you want required by commas. Remember to use underscores instead
1309
 
1310
  function contactAuthor($name, $email, $website, $message, $type) {
1311
  if (empty($message)) return false;
 
1312
  $admin_options = $this->getAdminOptions();
1313
  $body = "Name: $name\n";
1314
  $body .= "Email: $email\n";
@@ -1383,6 +1477,7 @@ the field names you want required by commas. Remember to use underscores instead
1383
  $this->setFormError($err, 'You left the "' . $err . '" field blank.');
1384
  $errors = $this->getAllFormErrors();
1385
  if (empty($errors)) {
 
1386
  $body .= "\n" . 'Sender IP: ' . $_SERVER['REMOTE_ADDR'] . "\n";
1387
  $mailer = new CustomContactFormsMailer($_POST[destination_email], $admin_options[default_from_email], $admin_options[default_form_subject], stripslashes($body), $admin_options[wp_mail_function]);
1388
  $mailer->send();
@@ -1435,6 +1530,7 @@ the field names you want required by commas. Remember to use underscores instead
1435
  }
1436
  $errors = $this->getAllFormErrors();
1437
  if (empty($errors)) {
 
1438
  unset($_SESSION['captcha_' . $_POST[fid]]);
1439
  unset($_SESSION[fields]);
1440
  $body .= 'Sender IP: ' . $_SERVER['REMOTE_ADDR'] . "\n";
@@ -1487,5 +1583,6 @@ if (isset($customcontact)) {
1487
  add_filter('the_content', array(&$customcontact, 'contentFilter'));
1488
  add_action('widgets_init', 'CCFWidgetInit');
1489
  add_action('admin_menu', 'CustomContactForms_ap');
1490
- }
 
1491
  ?>
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.5.2
7
  Author: Taylor Lovett
8
  Author URI: http://www.taylorlovett.com
9
  */
22
  along with this program. If not, see <http://www.gnu.org/licenses/>.
23
  */
24
  require_once('custom-contact-forms-db.php');
 
 
25
  if (!class_exists('CustomContactForms')) {
26
  class CustomContactForms extends CustomContactFormsDB {
27
  var $adminOptionsName = 'customContactFormsAdminOptions';
 
28
  var $version = '3.5.1';
29
  var $form_errors;
30
  var $error_return;
 
31
  var $current_form;
32
  var $current_thank_you_message;
33
  var $fixed_fields = array('customcontactforms_submit' => '',
66
  return $customcontactAdminOptions;
67
  }
68
  function init() {
 
69
  if (!is_admin()) {
70
  $this->startSession();
71
  $this->processForms();
117
  $this->form_errors[$key] = $message;
118
  }
119
 
 
 
 
 
 
 
120
  function getFormError($key) {
121
  return $this->form_errors[$key];
122
  }
125
  return $this->form_errors;
126
  }
127
 
128
+ function insertUsagePopover() {
129
  ?>
130
+ <div id="ccf-usage-popover">
131
+ <div class="popover-header">
132
+ <h5>How to Use Custom Contact Forms</h5>
133
  <a href="javascript:void(0)" class="close">[close]</a>
134
  </div>
135
+ <div class="popover-body">
136
+ <p>CCF is an extremely intuitive plugin allowing you to create any type of contact form you can image. CCF is very user friendly but with possibilities comes completexity. It is recommend that you click the button below to add default fields, field options, and forms.
137
+ The default content will help you get a feel for the amazing things you can accomplish with this plugin. This popover only shows up automatically the first time you visit the admin page; <b>if you want to view this popover again, click the "Show Plugin Usage Popover"</b> in the instruction area of the admin page.</p>
138
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
139
+ <input type="submit" class="insert-default-content-button" value="Insert Default Content" name="insert_default_content" />
140
+ </form>
141
+ <p>Below is a basic usage outline of the four pillars of this plugin: fields, field options, styles, and forms. Also explained below is the Custom HTML Feature which allows you to write the form HTML yourself and use the plugin simply as a form processor; this is great if you are a web developer with HTML experience.</p>
142
+ <ul>
143
+ <li>
144
+ <h3>Fields</h3>
145
+ <p>Fields are the actual input boxes that users enter their information inside. There are six types of fields that you can attach to your forms.</p>
146
+ <ul>
147
+ <li><span>Text:</span>
148
+ <div><input type="text" class="width200" value="This is a text field" /></div></li>
149
+ <li><span>Textarea:</span>
150
+ <div><textarea class="width2000">This is a text field</textarea></div></li>
151
+ <li><span>Dropdown:</span>
152
+ <div><select><option>This is a dropdown field</option><option>Field Option 2!</option><option>Field Option 3!</option><option>Field Option 4!</option><option>Unlimited # of options allowed</option></select></div></li>
153
+ <li><span>Radio:</span>
154
+ <div><input type="radio" selected="selected" /> A radio field <input type="radio" selected="selected" /> Field Option 2 <input type="radio" selected="selected" /> Field Option 3</div></li>
155
+ <li><span>Checkbox:</span>
156
+ <div><input type="checkbox" value="1" /> This is a checkbox field</div></li>
157
+ <li><span>(advanced) Hidden:</span> These fields are hidden (obviously), they allow you to pass hidden information with your forms. Great for using other form processors like Aweber or InfusionSoft.</li>
158
+ </ul>
159
+ <p>There are a bunch of different options that you can use when creating a field, <span class="red">*</span> denotes something required:</p>
160
+ <ul>
161
+ <li><span class="red">*</span> <span>Slug:</span> A slug is simply a way to identify your field. It can only contain underscores, letters, and numbers and must be unique.</li>
162
+ <li><span>Field Label:</span> The field label is displayed next to the field and is visible to the user.</li>
163
+ <li><span class="red">*</span> <span>Field Type:</span> The six field types you can choose from are explained above.</li>
164
+ <li><span>Initial Value:</span> 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". If you set the field type as "Dropdown" or "Radio", you should enter the slug of the field option you would like initially selected.</li>
165
+ <li><span>Max Length:</span> If a field is required and a user leaves it blank, the plugin will display an error message explainging the problem.</li>
166
+ <li><span>Required Field:</span> If a field is required and a user leaves it blank, the plugin will display an error message explainging the problem. The user will then have to go back and fill in the field.</li>
167
+ <li><span>Field Instructions:</span> If this is filled out, a stylish tooltip popover displaying this text will show when the field is selected. This will only work if JQuery is enabled in general options.</li>
168
+ <li><span>Field Options:</span> After you create a field, if it's type is radio or dropdown, you can attach field options to the field. Field options are explained next.
169
+ </ul>
170
+ <p>The last important thing related to fields are <span>Fixed Fields</span>. Fixed Fields are special fields that come already created within the plugin such as a captcha spam blockers and email field. Fixed Fields do special things that you wouldn't be able to accomplish with normal fields; they cannot be deleted or created. If you use the fixedEmail fixed field, as opposed to creating your own email field. the uesrs email will be checked to make sure it is valid, if it isn't a form error will be displayed.</p>
171
+ </li>
172
+ <li>
173
+ <h3>Field Options</h3>
174
+ <p>In the field section above, look at the radio or dropdown fields. See how they have multiple options within the field? Those are called Field Options. Field Options have their own manager. There are only three things you must fill in to create a field option.</p>
175
+ <ul>
176
+ <li><span class="red">*</span> <span>Slug:</span> Used to identify this option, solely for admin purposes; must be unique, and contain only letters, numbers, and underscores. Example: "slug_one".</li>
177
+ <li><span class="red">*</span> <span>Option Label:</span> This is what is shown to the user in the dropdown or radio field.</li>
178
+ <li><span>Option Value:</span> This is the actual value of the option which isn't shown to the user. This can be the same thing as the label. An example pairing of label => value is: "The color green" => "green" or "Yes" => "1". The option value is behind the scences; unseen by the user, but when a user fills out the form, the option value is what is actually sent in the email to you. For dropdown fields the option value is optional, <span>for radio fields it is required</span>.</li>
179
+ </ul>
180
+ <p>Once you create field options, you can attach them (in the field manager) to radio and dropdown fields (that are already created). It is important to remember that after you create a dropdown or radio field, they will not work until you attach one or more field options.</p>
181
+ </li>
182
+ <li>
183
+ <h3>Forms</h3>
184
+ <p>Forms bring everything together. Each form you create in the form manager shows a code to display that form in posts/pages as well has theme files. The post/page form display code looks like: [customcontact id=FORMID]. There are a number of parameters that you can fill out when creating and managing each of your forms.</p>
185
+ <ul>
186
+ <li><span class="red">*</span> <span>Slug:</span> A slug is simply a way to identify your form. It can only contain underscores, letters, and numbers and must be unique. Example "my_contact_form"</li>
187
+ <li><span>Form Title:</span>The form title is heading text shown at the top of the form to users. Here's an example: "My Contact Form".</li>
188
+ <li><span class="red">*</span> <span>Form Method:</span> If you don't know what this is leave it as Post. This allows you to change the way a form sends user information.</li>
189
+ <li><span>Form Action:</span> This allows you to process your forms using 3rd party services or your own scripts. If you don't know what this is, then leave it blank. This is useful if you use a service like Aweber or InfusionSoft.</li>
190
+ <li><span>Form Style:</span> This allows you to apply styles you create in the style manager to your forms. If you haven't created a custom style yet, just choose "Default".</li>
191
+ <li><span>Submit Button Text:</span> Here, you can specify the text that shows on the submit button.</li>
192
+ <li><span>Custom Code:</span> If unsure, leave blank. This field allows you to insert custom HTML directly after the starting form tag.</li>
193
+ <li><span>Form Destination Email:</span> Specify the email that should receive all form submissions. If you leave this blank it will revert to the default specified in general settings.</li>
194
+ <li><span>Form Success Message:</span> Will be displayed in a popover after 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>
195
+ <li><span>Form Success Message Title:</span> 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>
196
+ <li><span>Custom Success URL:</span> If this is filled out, users will be sent to this page when they successfully fill out the specified form. If it is left blank, a popover showing the form's "success message" will be displayed on form success.</li>
197
+ </ul>
198
+ <p>The form success message and success title apply to a popover that fades in after someone successfully completes a form (that does not have a custom success URL provided). The image below will help to give you a feel to how the popover will look and where the title and message actually show up.</p>
199
+ <div class="ccf-success-popover-example"></div>
200
+ <p>After creating a form you are given the option to attach fields to that specific form. Forms are useless until you attach fields.</p>
201
+ </li>
202
+ <li>
203
+ <h3>Style Manager</h3>
204
+ <p>The style manager allows you to customize the appearance of forms without any knowledge of CSS. There are a ton of parameters you can fill out with each style and all of them are pretty self-explanitory. After you create a style, you need to go to the form manager and set the form style to the new style you created (the slug will be what shows in the Form Style dropdown).</p>
205
+ <p>The image below will help you better understand how each style option will change your forms.</p>
206
+ <div class="ccf-style-example"></div>
207
+ </li>
208
+ <li>
209
+ <h3>Custom HTML Forms Feature (advanced)</h3>
210
+ <p>If you know HTML and simply want to use this plugin to process form requests, this feature is for you. The following HTML is a the framework to which you must adhere. In order for your form to work you MUST do the following:</p>
211
+ <ul>
212
+ <li>Keep the form action/method the same (yes the action is supposed to be empty)</li>
213
+ <li>Include all the hidden fields shown below</li>
214
+ <li>Provide a hidden field with a success message or thank you page (both hidden fields are included below, you must choose one or the other and fill in the value part of the input field appropriately)</li>
215
+ </ul>
216
+ <p>Just to be clear, you don't edit the code in the Custom HTML Forms feature within the admin panel. Instead, you copy the code in to the page, post, or theme file you want to display a form, then edit the code to look how you want following the guidelines above.</p>
217
+ </li>
218
+ </ul>
219
+ </div>
220
  </div>
221
  <?php
222
  }
223
 
224
  function printAdminPage() {
225
  $admin_options = $this->getAdminOptions();
226
+ if ($admin_options[show_install_popover] == 1) {
227
+ $admin_options[show_install_popover] = 0;
228
+ ?>
229
+ <script type="text/javascript" language="javascript">
230
+ $j(document).ready(function() {
231
+ showCCFUsagePopover();
232
+ });
233
+ </script>
234
+ <?php
235
+ update_option($this->adminOptionsName, $admin_options);
236
+ } if ($_POST[form_create]) {
237
  parent::insertForm($_POST[form]);
238
  } elseif ($_POST[field_create]) {
239
  parent::insertField($_POST[field]);
260
  parent::updateField($_POST[field], $_POST[fid]);
261
  } elseif ($_POST[field_delete]) {
262
  parent::deleteField($_POST[fid]);
263
+ } elseif ($_POST[insert_default_content]) {
264
+ parent::insertDefaultContent();
265
  } elseif ($_POST[form_delete]) {
266
  parent::deleteForm($_POST[fid]);
267
  } elseif ($_POST[form_edit]) {
291
  parent::insertFieldOption($_POST[option]);
292
  }
293
  $styles = parent::selectAllStyles();
294
+ $style_options = '<option value="0">Default</option>';
295
  foreach ($styles as $style)
296
  $style_options .= '<option value="'.$style->id.'">'.$style->style_slug.'</option>';
297
  ?>
322
  <li>
323
  <label for="field_slug">* Slug (Name):</label>
324
  <input name="field[field_slug]" type="text" maxlength="50" /><br />
325
+ (A slug is simply a way to identify your field. It can only contain underscores, letters, and numbers and must be unique.)</li>
326
  <li>
327
  <label for="field_label">Field Label:</label>
328
  <input name="field[field_label]" type="text" maxlength="100" /><br />
372
  <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
373
  <ul>
374
  <li>
375
+ <label for="form[form_slug]">* Form Slug:</label>
376
  <input type="text" maxlength="100" name="form[form_slug]" /><br />
377
  (Must be unique and contain only underscores and alphanumeric characters.)</li>
378
  <li>
868
  <div id="instructions" class="postbox">
869
  <h3 class="hndle"><span>Instructions</span></h3>
870
  <div class="inside">
871
+ <p><b>The default content will help you get a better feel of ways this plugin can be used and is the best way to learn.</b></p>
872
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
873
+ <div class="ccf-center">
874
+ <input type="submit" value="Insert Default Content" name="insert_default_content" />
875
+ </div>
876
+ </form>
877
  <p>1. Create a form.</p>
878
+ <p>2. Create fields and attach those fields to the forms of your choice. <span class="red bold">*</span> 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. Create field options in the field option manager; field options should be attached to radio and dropdown fields.</p>
879
  <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. You can also display forms in theme files; the code for this is provided within each forms admin section.</p>
880
  <p>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.</p>
881
  <p>5. Add a form to your sidebar, by dragging the Custom Contact Form widget in to your sidebar.</p>
882
  <p>6. Configure the General Settings appropriately; this is important if you want to receive your web form messages!</p>
883
  <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>
884
  <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>
885
+ <p><span class="red bold">*</span> These instructions briefly tell you in which order you should use forms, fields, field options, and styles. <b>If you want to read in detail about using forms, fields, field options, styles and the rest of this plugin, click the button below.</b></p>
886
+ <div class="ccf-center">
887
+ <input type="button" class="usage-popover-button" value="View Plugin Usage Popover" />
888
+ </div>
889
+ <div class="ccf-style-example"></div>
890
+ <div class="ccf-success-popover-example"></div>
891
  </div>
892
  </div>
893
  <a name="create-styles"></a>
1402
 
1403
  function contactAuthor($name, $email, $website, $message, $type) {
1404
  if (empty($message)) return false;
1405
+ require_once('custom-contact-forms-mailer.php');
1406
  $admin_options = $this->getAdminOptions();
1407
  $body = "Name: $name\n";
1408
  $body .= "Email: $email\n";
1477
  $this->setFormError($err, 'You left the "' . $err . '" field blank.');
1478
  $errors = $this->getAllFormErrors();
1479
  if (empty($errors)) {
1480
+ require_once('custom-contact-forms-mailer.php');
1481
  $body .= "\n" . 'Sender IP: ' . $_SERVER['REMOTE_ADDR'] . "\n";
1482
  $mailer = new CustomContactFormsMailer($_POST[destination_email], $admin_options[default_from_email], $admin_options[default_form_subject], stripslashes($body), $admin_options[wp_mail_function]);
1483
  $mailer->send();
1530
  }
1531
  $errors = $this->getAllFormErrors();
1532
  if (empty($errors)) {
1533
+ require_once('custom-contact-forms-mailer.php');
1534
  unset($_SESSION['captcha_' . $_POST[fid]]);
1535
  unset($_SESSION[fields]);
1536
  $body .= 'Sender IP: ' . $_SERVER['REMOTE_ADDR'] . "\n";
1583
  add_filter('the_content', array(&$customcontact, 'contentFilter'));
1584
  add_action('widgets_init', 'CCFWidgetInit');
1585
  add_action('admin_menu', 'CustomContactForms_ap');
1586
+ add_action('admin_footer', array(&$customcontact, 'insertUsagePopover'));
1587
+ }
1588
  ?>
js/custom-contact-forms-admin.js CHANGED
@@ -1,5 +1,8 @@
 
 
 
 
1
  var $j = jQuery.noConflict();
2
- //alert('shit');
3
  $j(document).ready(function(){
4
  $j('.form-extra-options').hide();
5
  $j('.form-options-expand').prepend('<input type="button" class="form-options-expand-link" value="More Options" />');
@@ -36,8 +39,10 @@ $j(document).ready(function(){
36
  .find(".fields-extra-options:first")
37
  .toggle();
38
  });
39
- $j("#ccf-install-popover").delay(500).fadeIn('slow');
40
- $j("#ccf-install-popover .close").click(function() {
41
- $j("#ccf-install-popover").fadeOut();
 
 
42
  });
43
  });
1
+ function showCCFUsagePopover() {
2
+ $j("#ccf-usage-popover").delay(500).fadeIn('slow');
3
+ }
4
+
5
  var $j = jQuery.noConflict();
 
6
  $j(document).ready(function(){
7
  $j('.form-extra-options').hide();
8
  $j('.form-options-expand').prepend('<input type="button" class="form-options-expand-link" value="More Options" />');
39
  .find(".fields-extra-options:first")
40
  .toggle();
41
  });
42
+ $j('.usage-popover-button').click(function() {
43
+ showCCFUsagePopover();
44
+ });
45
+ $j("#ccf-usage-popover .close").click(function() {
46
+ $j("#ccf-usage-popover").fadeOut();
47
  });
48
  });
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.8.1
6
  Tested up to: 3.0.1
7
- Stable tag: 3.5.1
8
 
9
  Gauranteed to be the most customizable and intuitive contact form plugin for Wordpress.
10
 
@@ -37,6 +37,7 @@ Special Features:
37
  * Set a __custom thank you page__ for each form or use the built in thank you page popover with a custom thank you message
38
  * Choose between XHTML or HTML. All code is clean and valid!
39
  * No javascript required
 
40
  * Stylish field tooltips powered by jquery
41
  * Manage options for your dropdowns and radio fields in an easy to use manager
42
  * Popover forms with Jquery (Coming soon!)
@@ -72,6 +73,10 @@ Visit http://www.taylorlovett.com/wordpress-plugins for screenshots. Right now a
72
 
73
  == Changelog ==
74
 
 
 
 
 
75
  = 3.5.1 =
76
  * custom-contact-forms.php - Style options added, color picker added, success popover styling bugs fixed
77
  * custom-contact-forms-db.php - Style format changed, new style fields added to tables
4
  Tags: contact form, web form, custom contact form, custom forms, captcha form, contact fields, form mailers
5
  Requires at least: 2.8.1
6
  Tested up to: 3.0.1
7
+ Stable tag: 3.5.2
8
 
9
  Gauranteed to be the most customizable and intuitive contact form plugin for Wordpress.
10
 
37
  * Set a __custom thank you page__ for each form or use the built in thank you page popover with a custom thank you message
38
  * Choose between XHTML or HTML. All code is clean and valid!
39
  * No javascript required
40
+ * Detailed guide for using the plugin as well as default content to help you understand how to use Custom COntact Forms
41
  * Stylish field tooltips powered by jquery
42
  * Manage options for your dropdowns and radio fields in an easy to use manager
43
  * Popover forms with Jquery (Coming soon!)
73
 
74
  == Changelog ==
75
 
76
+ = 3.5.2 =
77
+ * custom-contact-forms.php - Plugin Usage popover added, insert default content button
78
+ * custom-contact-forms-db.php - Insert default content function
79
+
80
  = 3.5.1 =
81
  * custom-contact-forms.php - Style options added, color picker added, success popover styling bugs fixed
82
  * custom-contact-forms-db.php - Style format changed, new style fields added to tables