Visual Form Builder - Version 2.4

Version Description

Update spam bot check, fixed bug where label alignment option was not being saved

Download this release

Release Info

Developer mmuro
Plugin Icon 128x128 Visual Form Builder
Version 2.4
Comparing to
See all releases

Code changes from version 2.3.3 to 2.4

Files changed (2) hide show
  1. readme.txt +10 -1
  2. visual-form-builder.php +92 -77
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=G87A9
4
  Tags: form, forms, contact form, form to email, email form, email, input, validation, jquery, shortcode
5
  Requires at least: 3.3
6
  Tested up to: 3.4
7
- Stable tag: 2.3.3
8
 
9
  Build contact forms using a simple, clean interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
10
 
@@ -169,6 +169,12 @@ To Export Selected:
169
 
170
  == Changelog ==
171
 
 
 
 
 
 
 
172
  **Version 2.3.3**
173
 
174
  * Fix bug for missing media button image
@@ -326,6 +332,9 @@ To Export Selected:
326
 
327
  == Upgrade Notice ==
328
 
 
 
 
329
  = 2.3.3 =
330
  Fixed missing media button image
331
 
4
  Tags: form, forms, contact form, form to email, email form, email, input, validation, jquery, shortcode
5
  Requires at least: 3.3
6
  Tested up to: 3.4
7
+ Stable tag: 2.4
8
 
9
  Build contact forms using a simple, clean interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
10
 
169
 
170
  == Changelog ==
171
 
172
+ **Version 2.4**
173
+
174
+ * Fix bug where label alignment option was not being saved
175
+ * Update spam bot check to only execute when form is submitted
176
+ * Update list of spam bots
177
+
178
  **Version 2.3.3**
179
 
180
  * Fix bug for missing media button image
332
 
333
  == Upgrade Notice ==
334
 
335
+ = 2.4 =
336
+ Update spam bot check, fixed bug where label alignment option was not being saved
337
+
338
  = 2.3.3 =
339
  Fixed missing media button image
340
 
visual-form-builder.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Visual Form Builder
4
  Description: Dynamically build forms using a simple interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
5
  Author: Matthew Muro
6
  Author URI: http://matthewmuro.com
7
- Version: 2.3.3
8
  */
9
 
10
  /*
@@ -28,7 +28,7 @@ $visual_form_builder = new Visual_Form_Builder();
28
  /* Restrict Categories class */
29
  class Visual_Form_Builder{
30
 
31
- protected $vfb_db_version = '2.3.3';
32
 
33
  public $countries = array( "", "Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Central African Republic", "Chad", "Chile", "China", "Colombi", "Comoros", "Congo (Brazzaville)", "Congo", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor (Timor Timur)", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Fiji", "Finland", "France", "Gabon", "Gambia, The", "Georgia", "Germany", "Ghana", "Greece", "Grenada", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, North", "Korea, South", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepa", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Qatar", "Romania", "Russia", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States of America", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Yemen", "Zambia", "Zimbabwe" );
34
 
@@ -1038,8 +1038,7 @@ class Visual_Form_Builder{
1038
 
1039
  $field_where = ( isset( $field_id ) && !is_null( $field_id ) ) ? "AND field_id = $field_id" : '';
1040
  /* Display all fields for the selected form */
1041
- $query_fields = "SELECT * FROM $this->field_table_name WHERE form_id = $form_nav_selected_id $field_where ORDER BY field_sequence ASC";
1042
- $fields = $wpdb->get_results( $query_fields );
1043
 
1044
  $depth = 1;
1045
  $parent = $last = 0;
@@ -1403,10 +1402,7 @@ class Visual_Form_Builder{
1403
 
1404
  /* Query to get all forms */
1405
  $order = sanitize_sql_orderby( 'form_id DESC' );
1406
- $query = "SELECT * FROM $this->form_table_name ORDER BY $order";
1407
-
1408
- /* Build our forms as an object */
1409
- $forms = $wpdb->get_results( $query );
1410
 
1411
  /* Loop through each form and assign a form id, if any */
1412
  foreach ( $forms as $form ) {
@@ -1467,7 +1463,7 @@ class Visual_Form_Builder{
1467
  /* Disable the left box if there's no active form selected */
1468
  $disabled = ( empty( $form_nav_selected_id ) ) ? ' disabled="disabled"' : '';
1469
  ?>
1470
- <div class="postbox">
1471
  <h3 class="hndle"><span><?php _e( 'Form Items' , 'visual-form-builder'); ?></span></h3>
1472
  <div class="inside" >
1473
  <div class="taxonomydiv">
@@ -1496,7 +1492,7 @@ class Visual_Form_Builder{
1496
  </div>
1497
  </div>
1498
  </form>
1499
- <div class="postbox">
1500
  <h3 class="hndle"><span><?php _e( 'Form Output' , 'visual-form-builder'); ?></span></h3>
1501
  <div class="inside">
1502
  <div id="customlinkdiv" class="customlinkdiv">
@@ -1518,9 +1514,9 @@ class Visual_Form_Builder{
1518
  <div id="menu-management-liquid">
1519
  <div id="menu-management">
1520
  <div class="nav-tabs-nav">
1521
- <div class="nav-tabs-arrow nav-tabs-arrow-left"><a>&laquo;</a></div>
1522
  <div class="nav-tabs-wrapper">
1523
- <div class="nav-tabs">
1524
  <?php
1525
  /* Loop through each for and build the tabs */
1526
  foreach ( $forms as $form ) {
@@ -1546,13 +1542,13 @@ class Visual_Form_Builder{
1546
  $form_notification_message = stripslashes( $form->form_notification_message );
1547
  $form_notification_entry = stripslashes( $form->form_notification_entry );
1548
 
 
 
1549
  /* Only show required text fields for the sender name override */
1550
- $sender_query = "SELECT * FROM $this->field_table_name WHERE form_id = $form_nav_selected_id AND field_type='text' AND field_validation = '' AND field_required = 'yes'";
1551
- $senders = $wpdb->get_results( $sender_query );
1552
 
1553
  /* Only show required email fields for the email override */
1554
- $email_query = "SELECT * FROM $this->field_table_name WHERE (form_id = $form_nav_selected_id AND field_type='text' AND field_validation = 'email' AND field_required = 'yes') OR (form_id = $form_nav_selected_id AND field_type='email' AND field_validation = 'email' AND field_required = 'yes')";
1555
- $emails = $wpdb->get_results( $email_query );
1556
 
1557
  else :
1558
  echo '<a href="' . esc_url( add_query_arg( array( 'form' => $form->form_id ), admin_url( 'options-general.php?page=visual-form-builder' ) ) ) . '" class="nav-tab" id="' . $form->form_key . '">' . stripslashes( $form->form_title ) . '</a>';
@@ -1569,7 +1565,7 @@ class Visual_Form_Builder{
1569
  <?php endif; ?>
1570
  </div>
1571
  </div>
1572
- <div class="nav-tabs-arrow nav-tabs-arrow-right"><a>&raquo;</a></div>
1573
  </div>
1574
 
1575
  <div class="menu-edit">
@@ -1625,10 +1621,10 @@ class Visual_Form_Builder{
1625
  </div>
1626
 
1627
  <div id="form-settings" class="<?php echo $opened_tab; ?>">
1628
- <!-- General settings section -->
1629
  <a href="#general-settings" class="settings-links<?php echo ( $settings_accordion == 'general-settings' ) ? ' on' : ''; ?>">1. General<span class="arrow"></span></a>
1630
  <div id="general-settings" class="form-details<?php echo ( $settings_accordion == 'general-settings' ) ? ' on' : ''; ?>">
1631
- <!-- Label Alignment -->
1632
  <p class="description description-wide">
1633
  <label for="form-label-alignment">
1634
  <?php _e( 'Label Alignment' , 'visual-form-builder'); ?>
@@ -1645,13 +1641,13 @@ class Visual_Form_Builder{
1645
  </div>
1646
 
1647
 
1648
- <!-- Email section -->
1649
  <a href="#email-details" class="settings-links<?php echo ( $settings_accordion == 'email-details' ) ? ' on' : ''; ?>">2. Email<span class="arrow"></span></a>
1650
  <div id="email-details" class="form-details<?php echo ( $settings_accordion == 'email-details' ) ? ' on' : ''; ?>">
1651
 
1652
  <p><em><?php _e( 'The forms you build here will send information to one or more email addresses when submitted by a user on your site. Use the fields below to customize the details of that email.' , 'visual-form-builder'); ?></em></p>
1653
 
1654
- <!-- E-mail Subject -->
1655
  <p class="description description-wide">
1656
  <label for="form-email-subject">
1657
  <?php _e( 'E-mail Subject' , 'visual-form-builder'); ?>
@@ -1662,7 +1658,7 @@ class Visual_Form_Builder{
1662
  </p>
1663
  <br class="clear" />
1664
 
1665
- <!-- Sender Name -->
1666
  <p class="description description-thin">
1667
  <label for="form-email-sender-name">
1668
  <?php _e( 'Your Name or Company' , 'visual-form-builder'); ?>
@@ -1688,7 +1684,7 @@ class Visual_Form_Builder{
1688
  </p>
1689
  <br class="clear" />
1690
 
1691
- <!-- Sender E-mail -->
1692
  <p class="description description-thin">
1693
  <label for="form-email-sender">
1694
  <?php _e( 'Reply-To E-mail' , 'visual-form-builder'); ?>
@@ -1714,7 +1710,7 @@ class Visual_Form_Builder{
1714
  </p>
1715
  <br class="clear" />
1716
 
1717
- <!-- E-mail(s) To -->
1718
  <?php
1719
  /* Basic count to keep track of multiple options */
1720
  $count = 1;
@@ -1888,11 +1884,12 @@ class Visual_Form_Builder{
1888
  </li>
1889
  </ul>
1890
  </div>
1891
- <div class="vfb-pro-upgrade">
1892
  <h3>Upgrade to <a href="http://vfb.matthewmuro.com">Visual Form Builder Pro</a> for only $10</h3>
1893
  <p>Attention Visual Form Builder users! I am happy to announce <a href="http://vfb.matthewmuro.com">Visual Form Builder Pro</a>, available now for only <strong>$10</strong>.</p>
1894
  <h3><?php _e( 'New Features of Visual Form Builder Pro' , 'visual-form-builder'); ?></h3>
1895
  <ul>
 
1896
  <li><?php _e( 'Drag and Drop to add new form fields' , 'visual-form-builder'); ?></li>
1897
  <li><?php _e( '10 new Form Fields (Username, Password, Color Picker, Autocomplete, Hidden, and more)' , 'visual-form-builder'); ?></li>
1898
  <li><?php _e( 'Edit and Update Entries' , 'visual-form-builder'); ?></li>
@@ -1903,6 +1900,7 @@ class Visual_Form_Builder{
1903
  <li><?php _e( 'Data &amp; Form Migration' , 'visual-form-builder'); ?></li>
1904
  <li><?php _e( 'PayPal Integration' , 'visual-form-builder'); ?></li>
1905
  <li><?php _e( 'Form Paging' , 'visual-form-builder'); ?></li>
 
1906
  <li><?php _e( 'No License Key' , 'visual-form-builder'); ?></li>
1907
  <li><?php _e( 'Unlimited Use' , 'visual-form-builder'); ?></li>
1908
  <li><?php _e( 'Automatic Updates' , 'visual-form-builder'); ?></li>
@@ -1960,10 +1958,8 @@ class Visual_Form_Builder{
1960
 
1961
  if ( isset( $_REQUEST['visual-form-builder-submit'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'visual-form-builder-nonce' ) ) {
1962
  /* Get forms */
1963
- $order = sanitize_sql_orderby( 'form_id DESC' );
1964
- $query = "SELECT * FROM $this->form_table_name WHERE form_id = $form_id ORDER BY $order";
1965
-
1966
- $forms = $wpdb->get_results( $query );
1967
 
1968
  foreach ( $forms as $form ) {
1969
  /* If text, return output and format the HTML for display */
@@ -2013,15 +2009,11 @@ class Visual_Form_Builder{
2013
  else {
2014
  /* Get forms */
2015
  $order = sanitize_sql_orderby( 'form_id DESC' );
2016
- $query = "SELECT * FROM $this->form_table_name WHERE form_id = $form_id ORDER BY $order";
2017
-
2018
- $forms = $wpdb->get_results( $query );
2019
 
2020
  /* Get fields */
2021
  $order_fields = sanitize_sql_orderby( 'field_sequence ASC' );
2022
- $query_fields = "SELECT * FROM $this->field_table_name WHERE form_id = $form_id ORDER BY $order_fields";
2023
-
2024
- $fields = $wpdb->get_results( $query_fields );
2025
 
2026
  /* Setup count for fieldset and ul/section class names */
2027
  $count = 1;
@@ -2086,7 +2078,7 @@ class Visual_Form_Builder{
2086
  elseif ( in_array( $field->field_type, array( 'verification', 'secret' ) ) ) {
2087
 
2088
  if ( $field->field_type == 'verification' )
2089
- $verification .= '<fieldset class="fieldset fieldset-' . $count . ' ' . $field->field_key . $css . $page . '"><div class="legend"><h3>' . stripslashes( $field->field_name ) . '</h3></div><ul class="section section-' . $count . '">';
2090
 
2091
  if ( $field->field_type == 'secret' ) {
2092
  /* Default logged in values */
@@ -2241,7 +2233,7 @@ class Visual_Form_Builder{
2241
  <option selected="selected" value=""></option>';
2242
 
2243
  foreach ( $this->countries as $country ) {
2244
- $output .= "<option value='$country' " . selected( $default, $country, 0 ) . ">$country</option>";
2245
  }
2246
 
2247
  $output .= '</select>
@@ -2266,6 +2258,8 @@ class Visual_Form_Builder{
2266
 
2267
  /* Get the time format (12 or 24) */
2268
  $time_format = str_replace( 'time-', '', $validation );
 
 
2269
  /* Set whether we start with 0 or 1 and how many total hours */
2270
  $hour_start = ( $time_format == '12' ) ? 1 : 0;
2271
  $hour_total = ( $time_format == '12' ) ? 12 : 23;
@@ -2281,7 +2275,11 @@ class Visual_Form_Builder{
2281
 
2282
  /* Minute */
2283
  $output .= '<span class="time"><select name="vfb-'. $field->field_key . '-' . $field->field_id . '[min]" id="vfb-'. $field->field_key . '-' . $field->field_id . '-min" class="select' . $required . $css . '">';
2284
- for ( $i = 0; $i <= 55; $i+=5 ) {
 
 
 
 
2285
  /* Add the leading zero */
2286
  $min = ( $i < 10 ) ? "0$i" : $i;
2287
  $output .= "<option value='$min'>$min</option>";
@@ -2323,7 +2321,7 @@ class Visual_Form_Builder{
2323
 
2324
  break;
2325
 
2326
- case 'submit' :
2327
 
2328
  $submit = stripslashes( $field->field_name );
2329
 
@@ -2337,6 +2335,7 @@ class Visual_Form_Builder{
2337
  $output .= ( !in_array( $field->field_type , array( 'verification', 'secret', 'submit', 'fieldset', 'section' ) ) ) ? '</li>' : '';
2338
  }
2339
 
 
2340
  /* Close user-added fields */
2341
  $output .= '</ul><br /></fieldset>';
2342
 
@@ -2368,7 +2367,7 @@ class Visual_Form_Builder{
2368
  </li>
2369
  </ul>
2370
  </fieldset></form>';
2371
-
2372
  endforeach;
2373
  }
2374
 
@@ -2392,10 +2391,6 @@ class Visual_Form_Builder{
2392
  if ( !is_numeric( $_REQUEST[ $secret_field ] ) && strlen( $_REQUEST[ $secret_field ] ) !== 2 )
2393
  wp_die( __( 'Security check: failed secret question. Please try again!' , 'visual-form-builder') );
2394
 
2395
- /* Test if it's a known SPAM bot */
2396
- if ( $this->isBot() )
2397
- wp_die( __( 'Security check: looks like you are a SPAM bot. If you think this is an error, please email the site owner.' , 'visual-form-builder') );
2398
-
2399
  /* Basic security check before moving any further */
2400
  if ( isset( $_REQUEST['visual-form-builder-submit'] ) && $_REQUEST['vfb-spam'] == '' ) :
2401
  $nonce = $_REQUEST['_wpnonce'];
@@ -2404,6 +2399,10 @@ class Visual_Form_Builder{
2404
  if ( ! wp_verify_nonce( $nonce, 'visual-form-builder-nonce' ) )
2405
  wp_die( __( 'Security check: unable to verify nonce value.' , 'visual-form-builder') );
2406
 
 
 
 
 
2407
  /* Set submitted action to display success message */
2408
  $this->submitted = true;
2409
 
@@ -2418,18 +2417,22 @@ class Visual_Form_Builder{
2418
 
2419
  /* Get sender and email details */
2420
  foreach ( $forms as $form ) {
2421
- $form_title = stripslashes( html_entity_decode( $form->form_title, ENT_QUOTES, 'UTF-8' ) );
2422
- $form_subject = stripslashes( html_entity_decode( $form->form_email_subject, ENT_QUOTES, 'UTF-8' ) );
2423
- $form_to = ( is_array( unserialize( $form->form_email_to ) ) ) ? unserialize( $form->form_email_to ) : explode( ',', unserialize( $form->form_email_to ) );
2424
- $form_from = stripslashes( $form->form_email_from );
2425
- $form_from_name = stripslashes( $form->form_email_from_name );
2426
- $form_notification_setting = stripslashes( $form->form_notification_setting );
2427
- $form_notification_email_name = stripslashes( $form->form_notification_email_name );
2428
- $form_notification_email_from = stripslashes( $form->form_notification_email_from );
2429
- $form_notification_email = stripslashes( $form->form_notification_email );
2430
- $form_notification_subject = stripslashes( $form->form_notification_subject );
2431
- $form_notification_message = stripslashes( $form->form_notification_message );
2432
- $form_notification_entry = stripslashes( $form->form_notification_entry );
 
 
 
 
2433
  }
2434
 
2435
  /* Sender name override query */
@@ -2441,16 +2444,22 @@ class Visual_Form_Builder{
2441
  /* Notification send to email override query */
2442
  $notification = $wpdb->get_results( "SELECT fields.field_id, fields.field_key FROM $this->form_table_name AS forms LEFT JOIN $this->field_table_name AS fields ON forms.form_notification_email = fields.field_id WHERE forms.form_id = $form_id" );
2443
 
 
 
 
 
2444
  /* Loop through name results and assign sender name to override, if needed */
2445
  foreach( $senders as $sender ) {
2446
  if ( !empty( $sender->field_key ) )
2447
- $form_from_name = $_POST[ 'vfb-' . $sender->field_key . '-' . $sender->field_id ];
 
2448
  }
2449
 
2450
  /* Loop through email results and assign sender email to override, if needed */
2451
  foreach ( $emails as $email ) {
2452
  if ( !empty( $email->field_key ) )
2453
- $form_from = $_POST[ 'vfb-' . $email->field_key . '-' . $email->field_id ];
 
2454
  }
2455
 
2456
  /* Loop through email results and assign as blind carbon copy, if needed */
@@ -2487,7 +2496,8 @@ class Visual_Form_Builder{
2487
 
2488
  if ( $value['size'] > 0 ) {
2489
  /* 25MB is the max size allowed */
2490
- $max_attach_size = 25 * 1048576;
 
2491
 
2492
  /* Display error if file size has been exceeded */
2493
  if ( $value['size'] > $max_attach_size )
@@ -2586,7 +2596,7 @@ class Visual_Form_Builder{
2586
  if ( !empty( $address ) && ( empty( $value['city'] ) && empty( $value['state'] ) ) )
2587
  $address .= '<br>';
2588
  else if ( !empty( $address ) && ( !empty( $value['city'] ) || !empty( $value['state'] ) ) )
2589
- $address .= '. ';
2590
  $address .= $value['zip'];
2591
  }
2592
  if ( !empty( $value['country'] ) ) {
@@ -2646,10 +2656,10 @@ class Visual_Form_Builder{
2646
  $entry = array(
2647
  'form_id' => $form_id,
2648
  'data' => serialize( $data ),
2649
- 'subject' => $form_subject,
2650
- 'sender_name' => $form_from_name,
2651
- 'sender_email' => $form_from,
2652
- 'emails_to' => serialize( $form_to ),
2653
  'date_submitted' => date_i18n( 'Y-m-d G:i:s' ),
2654
  'ip_address' => $_SERVER['REMOTE_ADDR']
2655
  );
@@ -2664,8 +2674,8 @@ class Visual_Form_Builder{
2664
  $message = $header . $body . $footer;
2665
 
2666
  /* Initialize header filter vars */
2667
- $this->header_from_name = stripslashes( $form_from_name );
2668
- $this->header_from = $form_from;
2669
  $this->header_content_type = 'text/html';
2670
 
2671
  /* Set wp_mail header filters to send an HTML email */
@@ -2673,9 +2683,15 @@ class Visual_Form_Builder{
2673
  add_filter( 'wp_mail_from', array( &$this, 'mail_header_from' ) );
2674
  add_filter( 'wp_mail_content_type', array( &$this, 'mail_header_content_type' ) );
2675
 
 
 
 
 
 
 
2676
  /* Send the mail */
2677
  foreach ( $form_to as $email ) {
2678
- wp_mail( $email, esc_html( $form_subject ), $message, '', $attachments );
2679
  }
2680
 
2681
  /* Kill the values stored for header name and email */
@@ -2687,30 +2703,29 @@ class Visual_Form_Builder{
2687
  remove_filter( 'wp_mail_from', array( &$this, 'mail_header_from' ) );
2688
 
2689
  /* Send auto-responder email */
2690
- if ( $form_notification_setting !== '' ) :
2691
 
2692
  /* Assign notify header filter vars */
2693
- $this->header_from_name = stripslashes( $form_notification_email_name );
2694
- $this->header_from = $form_notification_email_from;
2695
 
2696
  /* Set the wp_mail header filters for notification email */
2697
  add_filter( 'wp_mail_from_name', array( &$this, 'mail_header_from_name' ) );
2698
  add_filter( 'wp_mail_from', array( &$this, 'mail_header_from' ) );
2699
 
2700
  /* Decode HTML for message so it outputs properly */
2701
- $notify_message = ( $form_notification_message !== '' ) ? html_entity_decode( $form_notification_message ) : '';
2702
 
2703
- /* Either prepend the notification message to the submitted entry, or send by itself */
2704
  /* Either prepend the notification message to the submitted entry, or send by itself */
2705
- if ( $form_notification_entry !== '' )
2706
  $auto_response_email = $header . '<p style="font-size: 12px; font-weight: normal; margin: 14px 0 14px 0; color: black; padding: 0;">' . $notify_message . '</p>' . $body . $footer;
2707
  else
2708
  $auto_response_email = $header . '<table cellspacing="0" border="0" cellpadding="0" width="100%"><tr><td colspan="2" class="mainbar" align="left" valign="top" width="600"><p style="font-size: 12px; font-weight: normal; margin: 14px 0 14px 0; color: black; padding: 0;">' . $notify_message . '</p></td></tr>' . $footer;
2709
 
2710
- $attachments = ( $form_notification_entry !== '' ) ? $attachments : '';
2711
 
2712
  /* Send the mail */
2713
- wp_mail( $copy_email, esc_html( $form_notification_subject ), $auto_response_email, '', $attachments );
2714
  endif;
2715
 
2716
  elseif ( isset( $_REQUEST['visual-form-builder-submit'] ) ) :
@@ -2765,12 +2780,12 @@ class Visual_Form_Builder{
2765
  * @since 1.3
2766
  */
2767
  public function isBot() {
2768
- $bots = array( 'Indy', 'Blaiz', 'Java', 'libwww-perl', 'Python', 'OutfoxBot', 'User-Agent', 'PycURL', 'AlphaServer', 'T8Abot', 'Syntryx', 'WinHttp', 'WebBandit', 'nicebot');
2769
 
2770
  $isBot = false;
2771
 
2772
  foreach ( $bots as $bot ) {
2773
- if ( strpos( $_SERVER['HTTP_USER_AGENT'], $bot ) !== false )
2774
  $isBot = true;
2775
  }
2776
 
4
  Description: Dynamically build forms using a simple interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
5
  Author: Matthew Muro
6
  Author URI: http://matthewmuro.com
7
+ Version: 2.4
8
  */
9
 
10
  /*
28
  /* Restrict Categories class */
29
  class Visual_Form_Builder{
30
 
31
+ protected $vfb_db_version = '2.4';
32
 
33
  public $countries = array( "", "Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Central African Republic", "Chad", "Chile", "China", "Colombi", "Comoros", "Congo (Brazzaville)", "Congo", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor (Timor Timur)", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Fiji", "Finland", "France", "Gabon", "Gambia, The", "Georgia", "Germany", "Ghana", "Greece", "Grenada", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, North", "Korea, South", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepa", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Qatar", "Romania", "Russia", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States of America", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Yemen", "Zambia", "Zimbabwe" );
34
 
1038
 
1039
  $field_where = ( isset( $field_id ) && !is_null( $field_id ) ) ? "AND field_id = $field_id" : '';
1040
  /* Display all fields for the selected form */
1041
+ $fields = $wpdb->get_results( "SELECT * FROM $this->field_table_name WHERE form_id = $form_nav_selected_id $field_where ORDER BY field_sequence ASC" );
 
1042
 
1043
  $depth = 1;
1044
  $parent = $last = 0;
1402
 
1403
  /* Query to get all forms */
1404
  $order = sanitize_sql_orderby( 'form_id DESC' );
1405
+ $forms = $wpdb->get_results( "SELECT * FROM $this->form_table_name ORDER BY $order" );
 
 
 
1406
 
1407
  /* Loop through each form and assign a form id, if any */
1408
  foreach ( $forms as $form ) {
1463
  /* Disable the left box if there's no active form selected */
1464
  $disabled = ( empty( $form_nav_selected_id ) ) ? ' disabled="disabled"' : '';
1465
  ?>
1466
+ <div class="postbox"><!-- !Form Items -->
1467
  <h3 class="hndle"><span><?php _e( 'Form Items' , 'visual-form-builder'); ?></span></h3>
1468
  <div class="inside" >
1469
  <div class="taxonomydiv">
1492
  </div>
1493
  </div>
1494
  </form>
1495
+ <div class="postbox"><!-- !Form Output -->
1496
  <h3 class="hndle"><span><?php _e( 'Form Output' , 'visual-form-builder'); ?></span></h3>
1497
  <div class="inside">
1498
  <div id="customlinkdiv" class="customlinkdiv">
1514
  <div id="menu-management-liquid">
1515
  <div id="menu-management">
1516
  <div class="nav-tabs-nav">
1517
+ <div class="nav-tabs-arrow nav-tabs-arrow-left"><a>&laquo;</a></div><!-- !Form Tab Nav - Left Arrow -->
1518
  <div class="nav-tabs-wrapper">
1519
+ <div class="nav-tabs"><!-- !Form Tabs -->
1520
  <?php
1521
  /* Loop through each for and build the tabs */
1522
  foreach ( $forms as $form ) {
1542
  $form_notification_message = stripslashes( $form->form_notification_message );
1543
  $form_notification_entry = stripslashes( $form->form_notification_entry );
1544
 
1545
+ $form_label_alignment = stripslashes( $form->form_label_alignment );
1546
+
1547
  /* Only show required text fields for the sender name override */
1548
+ $senders = $wpdb->get_results( "SELECT * FROM $this->field_table_name WHERE form_id = $form_nav_selected_id AND field_type='text' AND field_validation = '' AND field_required = 'yes'" );
 
1549
 
1550
  /* Only show required email fields for the email override */
1551
+ $emails = $wpdb->get_results( "SELECT * FROM $this->field_table_name WHERE (form_id = $form_nav_selected_id AND field_type='text' AND field_validation = 'email' AND field_required = 'yes') OR (form_id = $form_nav_selected_id AND field_type='email' AND field_validation = 'email' AND field_required = 'yes')" );
 
1552
 
1553
  else :
1554
  echo '<a href="' . esc_url( add_query_arg( array( 'form' => $form->form_id ), admin_url( 'options-general.php?page=visual-form-builder' ) ) ) . '" class="nav-tab" id="' . $form->form_key . '">' . stripslashes( $form->form_title ) . '</a>';
1565
  <?php endif; ?>
1566
  </div>
1567
  </div>
1568
+ <div class="nav-tabs-arrow nav-tabs-arrow-right"><a>&raquo;</a></div><!-- !Form Tab Nav - Right Arrow -->
1569
  </div>
1570
 
1571
  <div class="menu-edit">
1621
  </div>
1622
 
1623
  <div id="form-settings" class="<?php echo $opened_tab; ?>">
1624
+ <!-- !General settings section -->
1625
  <a href="#general-settings" class="settings-links<?php echo ( $settings_accordion == 'general-settings' ) ? ' on' : ''; ?>">1. General<span class="arrow"></span></a>
1626
  <div id="general-settings" class="form-details<?php echo ( $settings_accordion == 'general-settings' ) ? ' on' : ''; ?>">
1627
+ <!-- !Label Alignment -->
1628
  <p class="description description-wide">
1629
  <label for="form-label-alignment">
1630
  <?php _e( 'Label Alignment' , 'visual-form-builder'); ?>
1641
  </div>
1642
 
1643
 
1644
+ <!-- !Email section -->
1645
  <a href="#email-details" class="settings-links<?php echo ( $settings_accordion == 'email-details' ) ? ' on' : ''; ?>">2. Email<span class="arrow"></span></a>
1646
  <div id="email-details" class="form-details<?php echo ( $settings_accordion == 'email-details' ) ? ' on' : ''; ?>">
1647
 
1648
  <p><em><?php _e( 'The forms you build here will send information to one or more email addresses when submitted by a user on your site. Use the fields below to customize the details of that email.' , 'visual-form-builder'); ?></em></p>
1649
 
1650
+ <!-- !E-mail Subject -->
1651
  <p class="description description-wide">
1652
  <label for="form-email-subject">
1653
  <?php _e( 'E-mail Subject' , 'visual-form-builder'); ?>
1658
  </p>
1659
  <br class="clear" />
1660
 
1661
+ <!-- !Sender Name -->
1662
  <p class="description description-thin">
1663
  <label for="form-email-sender-name">
1664
  <?php _e( 'Your Name or Company' , 'visual-form-builder'); ?>
1684
  </p>
1685
  <br class="clear" />
1686
 
1687
+ <!-- !Sender E-mail -->
1688
  <p class="description description-thin">
1689
  <label for="form-email-sender">
1690
  <?php _e( 'Reply-To E-mail' , 'visual-form-builder'); ?>
1710
  </p>
1711
  <br class="clear" />
1712
 
1713
+ <!-- !E-mail(s) To -->
1714
  <?php
1715
  /* Basic count to keep track of multiple options */
1716
  $count = 1;
1884
  </li>
1885
  </ul>
1886
  </div>
1887
+ <div class="vfb-pro-upgrade"><!-- !VFB Pro Upgrade -->
1888
  <h3>Upgrade to <a href="http://vfb.matthewmuro.com">Visual Form Builder Pro</a> for only $10</h3>
1889
  <p>Attention Visual Form Builder users! I am happy to announce <a href="http://vfb.matthewmuro.com">Visual Form Builder Pro</a>, available now for only <strong>$10</strong>.</p>
1890
  <h3><?php _e( 'New Features of Visual Form Builder Pro' , 'visual-form-builder'); ?></h3>
1891
  <ul>
1892
+ <li><?php _e( 'Optional SPAM Verification' , 'visual-form-builder'); ?></li>
1893
  <li><?php _e( 'Drag and Drop to add new form fields' , 'visual-form-builder'); ?></li>
1894
  <li><?php _e( '10 new Form Fields (Username, Password, Color Picker, Autocomplete, Hidden, and more)' , 'visual-form-builder'); ?></li>
1895
  <li><?php _e( 'Edit and Update Entries' , 'visual-form-builder'); ?></li>
1900
  <li><?php _e( 'Data &amp; Form Migration' , 'visual-form-builder'); ?></li>
1901
  <li><?php _e( 'PayPal Integration' , 'visual-form-builder'); ?></li>
1902
  <li><?php _e( 'Form Paging' , 'visual-form-builder'); ?></li>
1903
+ <li><?php _e( 'Custom Capabilities' , 'visual-form-builder'); ?></li>
1904
  <li><?php _e( 'No License Key' , 'visual-form-builder'); ?></li>
1905
  <li><?php _e( 'Unlimited Use' , 'visual-form-builder'); ?></li>
1906
  <li><?php _e( 'Automatic Updates' , 'visual-form-builder'); ?></li>
1958
 
1959
  if ( isset( $_REQUEST['visual-form-builder-submit'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'visual-form-builder-nonce' ) ) {
1960
  /* Get forms */
1961
+ $order = sanitize_sql_orderby( 'form_id DESC' );
1962
+ $forms = $wpdb->get_results( "SELECT * FROM $this->form_table_name WHERE form_id = $form_id ORDER BY $order" );
 
 
1963
 
1964
  foreach ( $forms as $form ) {
1965
  /* If text, return output and format the HTML for display */
2009
  else {
2010
  /* Get forms */
2011
  $order = sanitize_sql_orderby( 'form_id DESC' );
2012
+ $forms = $wpdb->get_results( "SELECT * FROM $this->form_table_name WHERE form_id = $form_id ORDER BY $order" );
 
 
2013
 
2014
  /* Get fields */
2015
  $order_fields = sanitize_sql_orderby( 'field_sequence ASC' );
2016
+ $fields = $wpdb->get_results( "SELECT * FROM $this->field_table_name WHERE form_id = $form_id ORDER BY $order_fields" );
 
 
2017
 
2018
  /* Setup count for fieldset and ul/section class names */
2019
  $count = 1;
2078
  elseif ( in_array( $field->field_type, array( 'verification', 'secret' ) ) ) {
2079
 
2080
  if ( $field->field_type == 'verification' )
2081
+ $verification .= '<fieldset class="fieldset fieldset-' . $count . ' ' . $field->field_key . $css . '"><div class="legend"><h3>' . stripslashes( $field->field_name ) . '</h3></div><ul class="section section-' . $count . '">';
2082
 
2083
  if ( $field->field_type == 'secret' ) {
2084
  /* Default logged in values */
2233
  <option selected="selected" value=""></option>';
2234
 
2235
  foreach ( $this->countries as $country ) {
2236
+ $output .= "<option value=\"$country\" " . selected( $default, $country, 0 ) . ">$country</option>";
2237
  }
2238
 
2239
  $output .= '</select>
2258
 
2259
  /* Get the time format (12 or 24) */
2260
  $time_format = str_replace( 'time-', '', $validation );
2261
+ $time_format = apply_filters( 'vfb_time_format', $time_format );
2262
+
2263
  /* Set whether we start with 0 or 1 and how many total hours */
2264
  $hour_start = ( $time_format == '12' ) ? 1 : 0;
2265
  $hour_total = ( $time_format == '12' ) ? 12 : 23;
2275
 
2276
  /* Minute */
2277
  $output .= '<span class="time"><select name="vfb-'. $field->field_key . '-' . $field->field_id . '[min]" id="vfb-'. $field->field_key . '-' . $field->field_id . '-min" class="select' . $required . $css . '">';
2278
+
2279
+ $total_mins = apply_filters( 'vfb_time_min_total', 55 );
2280
+ $min_interval = apply_filters( 'vfb_time_min_interval', 5 );
2281
+
2282
+ for ( $i = 0; $i <= $total_mins; $i += $min_interval ) {
2283
  /* Add the leading zero */
2284
  $min = ( $i < 10 ) ? "0$i" : $i;
2285
  $output .= "<option value='$min'>$min</option>";
2321
 
2322
  break;
2323
 
2324
+ case 'submit' :
2325
 
2326
  $submit = stripslashes( $field->field_name );
2327
 
2335
  $output .= ( !in_array( $field->field_type , array( 'verification', 'secret', 'submit', 'fieldset', 'section' ) ) ) ? '</li>' : '';
2336
  }
2337
 
2338
+
2339
  /* Close user-added fields */
2340
  $output .= '</ul><br /></fieldset>';
2341
 
2367
  </li>
2368
  </ul>
2369
  </fieldset></form>';
2370
+
2371
  endforeach;
2372
  }
2373
 
2391
  if ( !is_numeric( $_REQUEST[ $secret_field ] ) && strlen( $_REQUEST[ $secret_field ] ) !== 2 )
2392
  wp_die( __( 'Security check: failed secret question. Please try again!' , 'visual-form-builder') );
2393
 
 
 
 
 
2394
  /* Basic security check before moving any further */
2395
  if ( isset( $_REQUEST['visual-form-builder-submit'] ) && $_REQUEST['vfb-spam'] == '' ) :
2396
  $nonce = $_REQUEST['_wpnonce'];
2399
  if ( ! wp_verify_nonce( $nonce, 'visual-form-builder-nonce' ) )
2400
  wp_die( __( 'Security check: unable to verify nonce value.' , 'visual-form-builder') );
2401
 
2402
+ /* Test if it's a known SPAM bot */
2403
+ if ( $this->isBot() )
2404
+ wp_die( __( 'Security check: looks like you are a SPAM bot. If you think this is an error, please email the site owner.' , 'visual-form-builder') );
2405
+
2406
  /* Set submitted action to display success message */
2407
  $this->submitted = true;
2408
 
2417
 
2418
  /* Get sender and email details */
2419
  foreach ( $forms as $form ) {
2420
+ $form_settings = (object) array(
2421
+ 'form_title' => stripslashes( html_entity_decode( $form->form_title, ENT_QUOTES, 'UTF-8' ) ),
2422
+ 'form_subject' => stripslashes( html_entity_decode( $form->form_email_subject, ENT_QUOTES, 'UTF-8' ) ),
2423
+ 'form_to' => ( is_array( unserialize( $form->form_email_to ) ) ) ? unserialize( $form->form_email_to ) : explode( ',', unserialize( $form->form_email_to ) ),
2424
+ 'form_from' => stripslashes( $form->form_email_from ),
2425
+ 'form_from_name' => stripslashes( $form->form_email_from_name ),
2426
+ 'form_notification_setting' => stripslashes( $form->form_notification_setting ),
2427
+ 'form_notification_email_name' => stripslashes( $form->form_notification_email_name ),
2428
+ 'form_notification_email_from' => stripslashes( $form->form_notification_email_from ),
2429
+ 'form_notification_subject' => stripslashes( html_entity_decode( $form->form_notification_subject, ENT_QUOTES, 'UTF-8' ) ),
2430
+ 'form_notification_message' => stripslashes( $form->form_notification_message ),
2431
+ 'form_notification_entry' => stripslashes( $form->form_notification_entry )
2432
+ );
2433
+
2434
+ /* Allow the form settings to be filtered (ex: return $form_settings->'form_title' = 'Hello World';) */
2435
+ $form_settings = (object) apply_filters_ref_array( 'vfb_email_form_settings', array( $form_settings, $form_id ) );
2436
  }
2437
 
2438
  /* Sender name override query */
2444
  /* Notification send to email override query */
2445
  $notification = $wpdb->get_results( "SELECT fields.field_id, fields.field_key FROM $this->form_table_name AS forms LEFT JOIN $this->field_table_name AS fields ON forms.form_notification_email = fields.field_id WHERE forms.form_id = $form_id" );
2446
 
2447
+ /* Load initial Reply-To settings */
2448
+ $reply_to_name = stripslashes( $form_settings->form_from_name );
2449
+ $reply_to_email = $form_settings->form_from;
2450
+
2451
  /* Loop through name results and assign sender name to override, if needed */
2452
  foreach( $senders as $sender ) {
2453
  if ( !empty( $sender->field_key ) )
2454
+ $form_settings->form_from_name = $_POST[ 'vfb-' . $sender->field_key . '-' . $sender->field_id ];
2455
+ $reply_to_name = $form_settings->form_from_name;
2456
  }
2457
 
2458
  /* Loop through email results and assign sender email to override, if needed */
2459
  foreach ( $emails as $email ) {
2460
  if ( !empty( $email->field_key ) )
2461
+ $form_settings->form_from = $_POST[ 'vfb-' . $email->field_key . '-' . $email->field_id ];
2462
+ $reply_to_email = $form_settings->form_from;
2463
  }
2464
 
2465
  /* Loop through email results and assign as blind carbon copy, if needed */
2496
 
2497
  if ( $value['size'] > 0 ) {
2498
  /* 25MB is the max size allowed */
2499
+ $size = apply_filters( 'vfb_max_file_size', 25 );
2500
+ $max_attach_size = $size * 1048576;
2501
 
2502
  /* Display error if file size has been exceeded */
2503
  if ( $value['size'] > $max_attach_size )
2596
  if ( !empty( $address ) && ( empty( $value['city'] ) && empty( $value['state'] ) ) )
2597
  $address .= '<br>';
2598
  else if ( !empty( $address ) && ( !empty( $value['city'] ) || !empty( $value['state'] ) ) )
2599
+ $address .= ' ';
2600
  $address .= $value['zip'];
2601
  }
2602
  if ( !empty( $value['country'] ) ) {
2656
  $entry = array(
2657
  'form_id' => $form_id,
2658
  'data' => serialize( $data ),
2659
+ 'subject' => $form_settings->form_subject,
2660
+ 'sender_name' => $form_settings->form_from_name,
2661
+ 'sender_email' => $form_settings->form_from,
2662
+ 'emails_to' => serialize( $form_settings->form_to ),
2663
  'date_submitted' => date_i18n( 'Y-m-d G:i:s' ),
2664
  'ip_address' => $_SERVER['REMOTE_ADDR']
2665
  );
2674
  $message = $header . $body . $footer;
2675
 
2676
  /* Initialize header filter vars */
2677
+ $this->header_from_name = stripslashes( $form_settings->form_from_name );
2678
+ $this->header_from = $form_settings->form_from;
2679
  $this->header_content_type = 'text/html';
2680
 
2681
  /* Set wp_mail header filters to send an HTML email */
2683
  add_filter( 'wp_mail_from', array( &$this, 'mail_header_from' ) );
2684
  add_filter( 'wp_mail_content_type', array( &$this, 'mail_header_content_type' ) );
2685
 
2686
+ /* Setup headers */
2687
+ $from_name = ( $this->header_from_name == '' ) ? 'WordPress' : $this->header_from_name;
2688
+ $from_email = 'wordpress@' . $_SERVER['SERVER_NAME'];
2689
+ $reply_to = "\"$this->header_from_name\" <$this->header_from>";
2690
+ $headers = "From: \"$from_name\" <$from_email>\n" . "Reply-To: $reply_to\n" . "Content-Type: $this->header_content_type; charset=\"" . get_option('blog_charset') . "\"\n";
2691
+
2692
  /* Send the mail */
2693
  foreach ( $form_to as $email ) {
2694
+ wp_mail( $email, esc_html( $form_settings->form_subject ), $message, $headers, $attachments );
2695
  }
2696
 
2697
  /* Kill the values stored for header name and email */
2703
  remove_filter( 'wp_mail_from', array( &$this, 'mail_header_from' ) );
2704
 
2705
  /* Send auto-responder email */
2706
+ if ( $form_settings->form_notification_setting !== '' ) :
2707
 
2708
  /* Assign notify header filter vars */
2709
+ $this->header_from_name = stripslashes( $form_settings->form_notification_email_name );
2710
+ $this->header_from = $form_settings->form_notification_email_from;
2711
 
2712
  /* Set the wp_mail header filters for notification email */
2713
  add_filter( 'wp_mail_from_name', array( &$this, 'mail_header_from_name' ) );
2714
  add_filter( 'wp_mail_from', array( &$this, 'mail_header_from' ) );
2715
 
2716
  /* Decode HTML for message so it outputs properly */
2717
+ $notify_message = ( $form_settings->form_notification_message !== '' ) ? html_entity_decode( $form_settings->form_notification_message ) : '';
2718
 
 
2719
  /* Either prepend the notification message to the submitted entry, or send by itself */
2720
+ if ( $form_settings->form_notification_entry !== '' )
2721
  $auto_response_email = $header . '<p style="font-size: 12px; font-weight: normal; margin: 14px 0 14px 0; color: black; padding: 0;">' . $notify_message . '</p>' . $body . $footer;
2722
  else
2723
  $auto_response_email = $header . '<table cellspacing="0" border="0" cellpadding="0" width="100%"><tr><td colspan="2" class="mainbar" align="left" valign="top" width="600"><p style="font-size: 12px; font-weight: normal; margin: 14px 0 14px 0; color: black; padding: 0;">' . $notify_message . '</p></td></tr>' . $footer;
2724
 
2725
+ $attachments = ( $form_settings->form_notification_entry !== '' ) ? $attachments : '';
2726
 
2727
  /* Send the mail */
2728
+ wp_mail( $copy_email, esc_html( $form_settings->form_notification_subject ), $auto_response_email, '', $attachments );
2729
  endif;
2730
 
2731
  elseif ( isset( $_REQUEST['visual-form-builder-submit'] ) ) :
2780
  * @since 1.3
2781
  */
2782
  public function isBot() {
2783
+ $bots = apply_filters( 'vfb_blocked_spam_bots', array( 'archiver', 'binlar', 'casper', 'checkprivacy', 'clshttp', 'cmsworldmap', 'comodo', 'curl', 'diavol', 'dotbot', 'email', 'extract', 'feedfinder', 'flicky', 'grab', 'harvest', 'httrack', 'ia_archiver', 'jakarta', 'kmccrew', 'libwww', 'loader', 'miner', 'nikto', 'nutch', 'planetwork', 'purebot', 'pycurl', 'python', 'scan', 'skygrid', 'sucker', 'turnit', 'vikspider', 'wget', 'winhttp', 'youda', 'zmeu', 'zune' ) );
2784
 
2785
  $isBot = false;
2786
 
2787
  foreach ( $bots as $bot ) {
2788
+ if ( stripos( $_SERVER['HTTP_USER_AGENT'], $bot ) !== false )
2789
  $isBot = true;
2790
  }
2791