Visual Form Builder - Version 3.0.4

Version Description

Download this release

Release Info

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

Code changes from version 3.0.3 to 3.0.4

Files changed (4) hide show
  1. admin/class-forms-edit.php +316 -316
  2. admin/class-save.php +28 -28
  3. readme.txt +14 -10
  4. visual-form-builder.php +21 -21
admin/class-forms-edit.php CHANGED
@@ -28,11 +28,11 @@ class Visual_Form_Builder_Forms_Edit {
28
  wp_die( 'You must select a form' );
29
 
30
  $form_id = $form->form_id;
31
- $form_title = stripslashes( $form->form_title );
32
- $form_subject = stripslashes( $form->form_email_subject );
33
- $form_email_from_name = stripslashes( $form->form_email_from_name );
34
- $form_email_from = stripslashes( $form->form_email_from);
35
- $form_email_from_override = stripslashes( $form->form_email_from_override);
36
  $form_email_from_name_override = stripslashes( $form->form_email_from_name_override);
37
  $form_email_to = ( is_array( unserialize( $form->form_email_to ) ) ) ? unserialize( $form->form_email_to ) : explode( ',', unserialize( $form->form_email_to ) );
38
  $form_success_type = stripslashes( $form->form_success_type );
@@ -105,9 +105,9 @@ class Visual_Form_Builder_Forms_Edit {
105
  <div class="vfb-accordion-section-content">
106
  <p><?php _e( 'Add forms to your Posts or Pages by locating the <strong>Add Form</strong> button in the area above your post/page editor.', 'visual-form-builder' ); ?></p>
107
  <p>
108
- <?php _e( 'Shortcode', 'visual-form-builder' ); ?>
109
- <input value="[vfb id=<?php echo $form_nav_selected_id; ?>]" readonly="readonly" />
110
- </p>
111
  </div> <!-- .vfb-accordion-section-content -->
112
  </li>
113
  </ul>
@@ -115,24 +115,24 @@ class Visual_Form_Builder_Forms_Edit {
115
  </div> <!-- .meta-box-sortables -->
116
  </div> <!-- .vfb-postbox-container -->
117
 
118
- <div id="vfb-postbox-container-2" class='vfb-postbox-container'>
119
- <div id="vfb-form-builder-main">
120
- <div id="vfb-form-builder-management">
121
- <div class="form-edit">
122
  <form method="post" id="visual-form-builder-update" action="">
123
  <input name="action" type="hidden" value="update_form" />
124
  <input name="form_id" type="hidden" value="<?php echo $form_nav_selected_id; ?>" />
125
- <?php wp_nonce_field( 'vfb_update_form' ); ?>
126
  <div id="form-editor-header">
127
- <div id="submitpost" class="submitbox">
128
- <div class="vfb-major-publishing-actions">
129
- <label for="form-name" class="menu-name-label howto open-label">
130
- <span class="sender-labels"><?php _e( 'Form Name' , 'visual-form-builder'); ?></span>
131
- <input type="text" value="<?php echo ( isset( $form_title ) ) ? $form_title : ''; ?>" placeholder="<?php _e( 'Enter form name here' , 'visual-form-builder'); ?>" class="menu-name regular-text menu-item-textbox required" id="form-name" name="form_title" />
132
- </label>
133
- <br class="clear" />
134
-
135
- <?php
136
  // Get the Form Setting drop down and accordion settings, if any
137
  $user_form_settings = get_user_meta( $user_id, 'vfb-form-settings' );
138
 
@@ -154,308 +154,308 @@ class Visual_Form_Builder_Forms_Edit {
154
  ?>
155
 
156
 
157
- <div class="vfb-button-group">
158
  <a href="#form-settings" id="form-settings-button" class="vfb-button vfb-settings <?php echo $opened_tab; ?>">
159
  <?php _e( 'Settings' , 'visual-form-builder'); ?>
160
  <span class="vfb-interface-icon vfb-interface-settings"></span>
161
  </a>
162
- <a href="<?php echo esc_url( wp_nonce_url( admin_url('admin.php?page=visual-form-builder&amp;action=copy_form&amp;form=' . $form_nav_selected_id ), 'copy-form-' . $form_nav_selected_id ) ); ?>" class="vfb-button vfb-duplicate">
163
- <?php _e( 'Duplicate' , 'visual-form-builder'); ?>
164
- <span class="vfb-interface-icon vfb-interface-duplicate"></span>
165
- </a>
166
- <a href="<?php echo esc_url( wp_nonce_url( admin_url('admin.php?page=visual-form-builder&amp;action=delete_form&amp;form=' . $form_nav_selected_id ), 'delete-form-' . $form_nav_selected_id ) ); ?>" class="vfb-button vfb-delete vfb-last menu-delete">
167
- <?php _e( 'Delete' , 'visual-form-builder'); ?>
168
- <span class="vfb-interface-icon vfb-interface-trash"></span>
169
- </a>
170
-
171
- <?php submit_button( __( 'Save', 'visual-form-builder' ), 'primary', 'save_form', false ); ?>
172
- </div>
173
-
174
- <div id="form-settings" class="<?php echo $opened_tab; ?>">
175
- <!-- General settings section -->
176
- <a href="#general-settings" class="settings-links<?php echo ( $settings_accordion == 'general-settings' ) ? ' on' : ''; ?>"><?php _e( 'General', 'visual-form-builder' ); ?><span class="vfb-large-arrow"></span></a>
177
- <div id="general-settings" class="form-details<?php echo ( $settings_accordion == 'general-settings' ) ? ' on' : ''; ?>">
178
- <!-- Label Alignment -->
179
- <p class="description description-wide">
180
- <label for="form-label-alignment">
181
- <?php _e( 'Label Alignment' , 'visual-form-builder'); ?>
182
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Label Alignment', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Set the field labels for this form to be aligned either on top, to the left, or to the right. By default, all labels are aligned on top of the inputs.' ); ?>">(?)</span>
183
- <br />
184
- </label>
185
- <select name="form_label_alignment" id="form-label-alignment" class="widefat">
186
- <option value="" <?php selected( $form_label_alignment, '' ); ?>><?php _e( 'Top Aligned' , 'visual-form-builder'); ?></option>
187
- <option value="left-label" <?php selected( $form_label_alignment, 'left-label' ); ?>><?php _e( 'Left Aligned' , 'visual-form-builder'); ?></option>
188
- <option value="right-label" <?php selected( $form_label_alignment, 'right-label' ); ?>><?php _e( 'Right Aligned' , 'visual-form-builder'); ?></option>
189
- </select>
190
- </p>
191
- <br class="clear" />
192
- </div> <!-- #general-settings -->
193
-
194
-
195
- <!-- Email section -->
196
- <a href="#email-details" class="settings-links<?php echo ( $settings_accordion == 'email-details' ) ? ' on' : ''; ?>"><?php _e( 'Email', 'visual-form-builder' ); ?><span class="vfb-large-arrow"></span></a>
197
- <div id="email-details" class="form-details<?php echo ( $settings_accordion == 'email-details' ) ? ' on' : ''; ?>">
198
-
199
- <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>
200
-
201
- <!-- E-mail Subject -->
202
- <p class="description description-wide">
203
- <label for="form-email-subject">
204
- <?php _e( 'E-mail Subject' , 'visual-form-builder'); ?>
205
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About E-mail Subject', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'This option sets the subject of the email that is sent to the emails you have set in the E-mail(s) To field.', 'visual-form-builder' ); ?>">(?)</span>
206
- <br />
207
- <input type="text" value="<?php echo stripslashes( $form_subject ); ?>" class="widefat" id="form-email-subject" name="form_email_subject" />
208
- </label>
209
- </p>
210
- <br class="clear" />
211
-
212
- <!-- Sender Name -->
213
- <p class="description description-thin">
214
- <label for="form-email-sender-name">
215
- <?php _e( 'Your Name or Company' , 'visual-form-builder'); ?>
216
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Your Name or Company', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'This option sets the From display name of the email that is sent to the emails you have set in the E-mail(s) To field.', 'visual-form-builder' ); ?>">(?)</span>
217
- <br />
218
- <input type="text" value="<?php echo $form_email_from_name; ?>" class="widefat" id="form-email-sender-name" name="form_email_from_name"<?php echo ( $form_email_from_name_override != '' ) ? ' readonly="readonly"' : ''; ?> />
219
- </label>
220
- </p>
221
- <p class="description description-thin">
222
- <label for="form_email_from_name_override">
223
- <?php _e( "User's Name (optional)" , 'visual-form-builder'); ?>
224
- <span class="vfb-tooltip" title="<?php esc_attr_e( "About User's Name", 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Select a required text field from your form to use as the From display name in the email.', 'visual-form-builder' ); ?>">(?)</span>
225
- <br />
226
- <?php if ( empty( $senders ) ) : ?>
227
- <span><?php _e( 'No required text fields detected', 'visual-form-builder' ); ?></span>
228
- <?php else : ?>
229
- <select name="form_email_from_name_override" id="form_email_from_name_override" class="widefat">
230
- <option value="" <?php selected( $form_email_from_name_override, '' ); ?>></option>
231
- <?php
232
- foreach( $senders as $sender ) {
233
- echo sprintf( '<option value="%1$d"%2$s>%3$s</option>',
234
- $sender->field_id,
235
- selected( $form_email_from_name_override, $sender->field_id, 0 ),
236
- stripslashes( $sender->field_name )
237
- );
238
- }
239
- ?>
240
- </select>
241
- <?php endif; ?>
242
- </label>
243
- </p>
244
- <br class="clear" />
245
-
246
- <!-- Sender E-mail -->
247
- <p class="description description-thin">
248
- <label for="form-email-sender">
249
- <?php _e( 'Reply-To E-mail' , 'visual-form-builder'); ?>
250
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Reply-To Email', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Manually set the email address that users will reply to.', 'visual-form-builder' ); ?>">(?)</span>
251
- <br />
252
- <input type="text" value="<?php echo $form_email_from; ?>" class="widefat" id="form-email-sender" name="form_email_from"<?php echo ( $form_email_from_override != '' ) ? ' readonly="readonly"' : ''; ?> />
253
- </label>
254
- </p>
255
- <p class="description description-thin">
256
- <label for="form_email_from_override">
257
- <?php _e( "User's E-mail (optional)" , 'visual-form-builder'); ?>
258
- <span class="vfb-tooltip" title="<?php esc_attr_e( "About User's Email", 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Select a required email field from your form to use as the Reply-To email.', 'visual-form-builder' ); ?>">(?)</span>
259
- <br />
260
- <?php if ( empty( $emails ) ) : ?>
261
- <span><?php _e( 'No required email fields detected', 'visual-form-builder' ); ?></span>
262
- <?php else : ?>
263
- <select name="form_email_from_override" id="form_email_from_override" class="widefat">
264
- <option value="" <?php selected( $form_email_from_override, '' ); ?>></option>
265
- <?php
266
- foreach( $emails as $email ) {
267
- echo sprintf( '<option value="%1$d"%2$s>%3$s</option>',
268
- $email->field_id,
269
- selected( $form_email_from_override, $email->field_id, 0 ),
270
- stripslashes( $email->field_name )
271
- );
272
- }
273
- ?>
274
- </select>
275
- <?php endif; ?>
276
- </label>
277
- </p>
278
- <br class="clear" />
279
-
280
- <!-- E-mail(s) To -->
281
- <?php
282
- // Basic count to keep track of multiple options
283
- $count = 1;
284
-
285
- // Loop through the options
286
- foreach ( $form_email_to as $email_to ) :
287
- ?>
288
- <div id="clone-email-<?php echo $count; ?>" class="option">
289
- <p class="description description-wide">
290
- <label for="form-email-to-<?php echo "$count"; ?>" class="clonedOption">
291
- <?php _e( 'E-mail(s) To' , 'visual-form-builder'); ?>
292
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About E-mail(s) To', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'This option sets single or multiple emails to send the submitted form data to. At least one email is required.', 'visual-form-builder' ); ?>">(?)</span>
293
- <br />
294
- <input type="text" value="<?php echo stripslashes( $email_to ); ?>" name="form_email_to[]" class="widefat" id="form-email-to-<?php echo "$count"; ?>" />
295
- </label>
296
-
297
- <a href="#" class="addEmail vfb-interface-icon vfb-interface-plus" title="<?php esc_attr_e( 'Add an Email', 'visua-form-builder' ); ?>">
298
- <?php _e( 'Add', 'visual-form-builder' ); ?>
299
- </a>
300
- <a href="#" class="deleteEmail vfb-interface-icon vfb-interface-minus" title="<?php esc_attr_e( 'Delete Email', 'visual-form-builder' ); ?>">
301
- <?php _e( 'Delete', 'visual-form-builder' ); ?>
302
- </a>
303
-
304
- </p>
305
- <br class="clear" />
306
- </div>
307
- <?php
308
- $count++;
309
- endforeach;
310
- ?>
311
- <div class="clear"></div>
312
- </div>
313
-
314
- <!-- Confirmation section -->
315
- <a href="#confirmation" class="settings-links<?php echo ( $settings_accordion == 'confirmation' ) ? ' on' : ''; ?>"><?php _e( 'Confirmation', 'visual-form-builder' ); ?><span class="vfb-large-arrow"></span></a>
316
- <div id="confirmation-message" class="form-details<?php echo ( $settings_accordion == 'confirmation' ) ? ' on' : ''; ?>">
317
- <p><em><?php _e( "After someone submits a form, you can control what is displayed. By default, it's a message but you can send them to another WordPress Page or a custom URL." , 'visual-form-builder'); ?></em></p>
318
- <label for="form-success-type-text" class="menu-name-label open-label">
319
- <input type="radio" value="text" id="form-success-type-text" class="form-success-type" name="form_success_type" <?php checked( $form_success_type, 'text' ); ?> />
320
- <span><?php _e( 'Text' , 'visual-form-builder'); ?></span>
321
- </label>
322
- <label for="form-success-type-page" class="menu-name-label open-label">
323
- <input type="radio" value="page" id="form-success-type-page" class="form-success-type" name="form_success_type" <?php checked( $form_success_type, 'page' ); ?>/>
324
- <span><?php _e( 'Page' , 'visual-form-builder'); ?></span>
325
- </label>
326
- <label for="form-success-type-redirect" class="menu-name-label open-label">
327
- <input type="radio" value="redirect" id="form-success-type-redirect" class="form-success-type" name="form_success_type" <?php checked( $form_success_type, 'redirect' ); ?>/>
328
- <span><?php _e( 'Redirect' , 'visual-form-builder'); ?></span>
329
- </label>
330
- <br class="clear" />
331
- <p class="description description-wide">
332
- <?php
333
- $default_text = '';
334
-
335
- /* If there's no text message, make sure there is something displayed by setting a default */
336
- if ( $form_success_message === '' )
337
- $default_text = sprintf( '<p id="form_success">%s</p>', __( 'Your form was successfully submitted. Thank you for contacting us.' , 'visual-form-builder') );
338
- ?>
339
- <textarea id="form-success-message-text" class="form-success-message<?php echo ( 'text' == $form_success_type ) ? ' active' : ''; ?>" name="form_success_message_text"><?php echo $default_text; ?><?php echo ( 'text' == $form_success_type ) ? $form_success_message : ''; ?></textarea>
340
-
341
- <?php
342
- /* Display all Pages */
343
- wp_dropdown_pages( array(
344
- 'name' => 'form_success_message_page',
345
- 'id' => 'form-success-message-page',
346
- 'class' => 'widefat',
347
- 'show_option_none' => __( 'Select a Page' , 'visual-form-builder'),
348
- 'selected' => $form_success_message
349
- ));
350
- ?>
351
- <input type="text" value="<?php echo ( 'redirect' == $form_success_type ) ? $form_success_message : ''; ?>" id="form-success-message-redirect" class="form-success-message regular-text<?php echo ( 'redirect' == $form_success_type ) ? ' active' : ''; ?>" name="form_success_message_redirect" placeholder="http://" />
352
- </p>
353
- <br class="clear" />
354
-
355
- </div>
356
-
357
- <!-- Notification section -->
358
- <a href="#notification" class="settings-links<?php echo ( $settings_accordion == 'notification' ) ? ' on' : ''; ?>"><?php _e( 'Notification', 'visual-form-builder' ); ?><span class="vfb-large-arrow"></span></a>
359
- <div id="notification" class="form-details<?php echo ( $settings_accordion == 'notification' ) ? ' on' : ''; ?>">
360
- <p><em><?php _e( "When a user submits their entry, you can send a customizable notification email." , 'visual-form-builder'); ?></em></p>
361
- <label for="form-notification-setting">
362
- <input type="checkbox" value="1" id="form-notification-setting" class="form-notification" name="form_notification_setting" <?php checked( $form_notification_setting, '1' ); ?> style="margin-top:-1px;margin-left:0;"/>
363
- <?php _e( 'Send Confirmation Email to User' , 'visual-form-builder'); ?>
364
- </label>
365
- <br class="clear" />
366
- <div id="notification-email">
367
- <p class="description description-wide">
368
- <label for="form-notification-email-name">
369
- <?php _e( 'Sender Name or Company' , 'visual-form-builder'); ?>
370
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Sender Name or Company', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Enter the name you would like to use for the email notification.', 'visual-form-builder' ); ?>">(?)</span>
371
- <br />
372
- <input type="text" value="<?php echo $form_notification_email_name; ?>" class="widefat" id="form-notification-email-name" name="form_notification_email_name" />
373
- </label>
374
- </p>
375
- <br class="clear" />
376
- <p class="description description-wide">
377
- <label for="form-notification-email-from">
378
- <?php _e( 'Reply-To E-mail' , 'visual-form-builder'); ?>
379
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Reply-To Email', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Manually set the email address that users will reply to.', 'visual-form-builder' ); ?>">(?)</span>
380
- <br />
381
- <input type="text" value="<?php echo $form_notification_email_from; ?>" class="widefat" id="form-notification-email-from" name="form_notification_email_from" />
382
- </label>
383
- </p>
384
- <br class="clear" />
385
- <p class="description description-wide">
386
- <label for="form-notification-email">
387
- <?php _e( 'E-mail To' , 'visual-form-builder'); ?>
388
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About E-mail To', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Select a required email field from your form to send the notification email to.', 'visual-form-builder' ); ?>">(?)</span>
389
- <br />
390
- <?php if ( empty( $emails ) ) : ?>
391
- <span><?php _e( 'No required email fields detected', 'visual-form-builder' ); ?></span>
392
- <?php else : ?>
393
- <select name="form_notification_email" id="form-notification-email" class="widefat">
394
- <option value="" <?php selected( $form_notification_email, '' ); ?>></option>
395
- <?php
396
- foreach( $emails as $email ) {
397
- echo sprintf( '<option value="%1$d"%2$s>%3$s</option>',
398
- $email->field_id,
399
- selected( $form_notification_email, $email->field_id, 0 ),
400
- $email->field_name
401
- );
402
- }
403
- ?>
404
- </select>
405
- <?php endif; ?>
406
- </label>
407
- </p>
408
- <br class="clear" />
409
- <p class="description description-wide">
410
- <label for="form-notification-subject">
411
- <?php _e( 'E-mail Subject' , 'visual-form-builder'); ?>
412
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About E-mail Subject', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'This option sets the subject of the email that is sent to the emails you have set in the E-mail To field.', 'visual-form-builder' ); ?>">(?)</span>
413
- <br />
414
- <input type="text" value="<?php echo $form_notification_subject; ?>" class="widefat" id="form-notification-subject" name="form_notification_subject" />
415
- </label>
416
- </p>
417
- <br class="clear" />
418
- <p class="description description-wide">
419
- <label for="form-notification-message"><?php _e( 'Message' , 'visual-form-builder'); ?></label>
420
- <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Message', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Insert a message to the user. This will be inserted into the beginning of the email body.', 'visual-form-builder' ); ?>">(?)</span>
421
- <br />
422
- <textarea id="form-notification-message" class="form-notification-message widefat" name="form_notification_message"><?php echo $form_notification_message; ?></textarea>
423
- </p>
424
- <br class="clear" />
425
- <label for="form-notification-entry">
426
- <input type="checkbox" value="1" id="form-notification-entry" class="form-notification" name="form_notification_entry" <?php checked( $form_notification_entry, '1' ); ?> style="margin-top:-1px;margin-left:0;"/>
427
- <?php _e( "Include a Copy of the User's Entry" , 'visual-form-builder'); ?>
428
- </label>
429
- <br class="clear" />
430
- </div>
431
- </div>
432
- </div>
433
- </div>
434
- </div>
435
- </div>
436
- <div id="post-body">
437
- <div id="post-body-content">
438
- <div id="vfb-fieldset-first-warning" class="error"><?php printf( '<p><strong>%1$s </strong><br>%2$s</p>', __( 'Warning &mdash; Missing Fieldset', 'visual-form-builder' ), __( 'Your form may not function or display correctly. Please be sure to add or move a Fieldset to the beginning of your form.' , 'visual-form-builder') ); ?></div>
439
- <!-- !Field Items output -->
440
  <ul id="vfb-menu-to-edit" class="menu ui-sortable droppable">
441
  <?php echo $this->edit_field( $form_nav_selected_id ); ?>
442
  </ul>
443
- </div>
444
- <br class="clear" />
445
- </div>
446
- <br class="clear" />
447
- <div id="form-editor-footer">
448
- <div class="vfb-major-publishing-actions">
449
- <div class="publishing-action">
450
- <?php submit_button( __( 'Save Form', 'visual-form-builder' ), 'primary', 'save_form', false ); ?>
451
- </div> <!-- .publishing-action -->
452
- </div> <!-- .vfb-major-publishing-actions -->
453
- </div> <!-- #form-editor-footer -->
454
  </form>
455
- </div> <!-- .form-edit -->
456
- </div> <!-- #vfb-form-builder-management -->
457
- </div> <!-- vfb-form-builder-main -->
458
- </div> <!-- .vfb-postbox-container -->
459
  </div> <!-- #vfb-form-builder-frame -->
460
  </div> <!-- .wrap -->
461
  <?php
28
  wp_die( 'You must select a form' );
29
 
30
  $form_id = $form->form_id;
31
+ $form_title = esc_html( $form->form_title );
32
+ $form_subject = esc_html( $form->form_email_subject );
33
+ $form_email_from_name = esc_html( $form->form_email_from_name );
34
+ $form_email_from = esc_html( $form->form_email_from);
35
+ $form_email_from_override = esc_html( $form->form_email_from_override);
36
  $form_email_from_name_override = stripslashes( $form->form_email_from_name_override);
37
  $form_email_to = ( is_array( unserialize( $form->form_email_to ) ) ) ? unserialize( $form->form_email_to ) : explode( ',', unserialize( $form->form_email_to ) );
38
  $form_success_type = stripslashes( $form->form_success_type );
105
  <div class="vfb-accordion-section-content">
106
  <p><?php _e( 'Add forms to your Posts or Pages by locating the <strong>Add Form</strong> button in the area above your post/page editor.', 'visual-form-builder' ); ?></p>
107
  <p>
108
+ <?php _e( 'Shortcode', 'visual-form-builder' ); ?>
109
+ <input value="[vfb id=<?php echo $form_nav_selected_id; ?>]" readonly="readonly" />
110
+ </p>
111
  </div> <!-- .vfb-accordion-section-content -->
112
  </li>
113
  </ul>
115
  </div> <!-- .meta-box-sortables -->
116
  </div> <!-- .vfb-postbox-container -->
117
 
118
+ <div id="vfb-postbox-container-2" class='vfb-postbox-container'>
119
+ <div id="vfb-form-builder-main">
120
+ <div id="vfb-form-builder-management">
121
+ <div class="form-edit">
122
  <form method="post" id="visual-form-builder-update" action="">
123
  <input name="action" type="hidden" value="update_form" />
124
  <input name="form_id" type="hidden" value="<?php echo $form_nav_selected_id; ?>" />
125
+ <?php wp_nonce_field( 'vfb_update_form' ); ?>
126
  <div id="form-editor-header">
127
+ <div id="submitpost" class="submitbox">
128
+ <div class="vfb-major-publishing-actions">
129
+ <label for="form-name" class="menu-name-label howto open-label">
130
+ <span class="sender-labels"><?php _e( 'Form Name' , 'visual-form-builder'); ?></span>
131
+ <input type="text" value="<?php echo ( isset( $form_title ) ) ? $form_title : ''; ?>" placeholder="<?php _e( 'Enter form name here' , 'visual-form-builder'); ?>" class="menu-name regular-text menu-item-textbox required" id="form-name" name="form_title" />
132
+ </label>
133
+ <br class="clear" />
134
+
135
+ <?php
136
  // Get the Form Setting drop down and accordion settings, if any
137
  $user_form_settings = get_user_meta( $user_id, 'vfb-form-settings' );
138
 
154
  ?>
155
 
156
 
157
+ <div class="vfb-button-group">
158
  <a href="#form-settings" id="form-settings-button" class="vfb-button vfb-settings <?php echo $opened_tab; ?>">
159
  <?php _e( 'Settings' , 'visual-form-builder'); ?>
160
  <span class="vfb-interface-icon vfb-interface-settings"></span>
161
  </a>
162
+ <a href="<?php echo esc_url( wp_nonce_url( admin_url('admin.php?page=visual-form-builder&amp;action=copy_form&amp;form=' . $form_nav_selected_id ), 'copy-form-' . $form_nav_selected_id ) ); ?>" class="vfb-button vfb-duplicate">
163
+ <?php _e( 'Duplicate' , 'visual-form-builder'); ?>
164
+ <span class="vfb-interface-icon vfb-interface-duplicate"></span>
165
+ </a>
166
+ <a href="<?php echo esc_url( wp_nonce_url( admin_url('admin.php?page=visual-form-builder&amp;action=delete_form&amp;form=' . $form_nav_selected_id ), 'delete-form-' . $form_nav_selected_id ) ); ?>" class="vfb-button vfb-delete vfb-last menu-delete">
167
+ <?php _e( 'Delete' , 'visual-form-builder'); ?>
168
+ <span class="vfb-interface-icon vfb-interface-trash"></span>
169
+ </a>
170
+
171
+ <?php submit_button( __( 'Save', 'visual-form-builder' ), 'primary', 'save_form', false ); ?>
172
+ </div>
173
+
174
+ <div id="form-settings" class="<?php echo $opened_tab; ?>">
175
+ <!-- General settings section -->
176
+ <a href="#general-settings" class="settings-links<?php echo ( $settings_accordion == 'general-settings' ) ? ' on' : ''; ?>"><?php _e( 'General', 'visual-form-builder' ); ?><span class="vfb-large-arrow"></span></a>
177
+ <div id="general-settings" class="form-details<?php echo ( $settings_accordion == 'general-settings' ) ? ' on' : ''; ?>">
178
+ <!-- Label Alignment -->
179
+ <p class="description description-wide">
180
+ <label for="form-label-alignment">
181
+ <?php _e( 'Label Alignment' , 'visual-form-builder'); ?>
182
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Label Alignment', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Set the field labels for this form to be aligned either on top, to the left, or to the right. By default, all labels are aligned on top of the inputs.' ); ?>">(?)</span>
183
+ <br />
184
+ </label>
185
+ <select name="form_label_alignment" id="form-label-alignment" class="widefat">
186
+ <option value="" <?php selected( $form_label_alignment, '' ); ?>><?php _e( 'Top Aligned' , 'visual-form-builder'); ?></option>
187
+ <option value="left-label" <?php selected( $form_label_alignment, 'left-label' ); ?>><?php _e( 'Left Aligned' , 'visual-form-builder'); ?></option>
188
+ <option value="right-label" <?php selected( $form_label_alignment, 'right-label' ); ?>><?php _e( 'Right Aligned' , 'visual-form-builder'); ?></option>
189
+ </select>
190
+ </p>
191
+ <br class="clear" />
192
+ </div> <!-- #general-settings -->
193
+
194
+
195
+ <!-- Email section -->
196
+ <a href="#email-details" class="settings-links<?php echo ( $settings_accordion == 'email-details' ) ? ' on' : ''; ?>"><?php _e( 'Email', 'visual-form-builder' ); ?><span class="vfb-large-arrow"></span></a>
197
+ <div id="email-details" class="form-details<?php echo ( $settings_accordion == 'email-details' ) ? ' on' : ''; ?>">
198
+
199
+ <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>
200
+
201
+ <!-- E-mail Subject -->
202
+ <p class="description description-wide">
203
+ <label for="form-email-subject">
204
+ <?php _e( 'E-mail Subject' , 'visual-form-builder'); ?>
205
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About E-mail Subject', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'This option sets the subject of the email that is sent to the emails you have set in the E-mail(s) To field.', 'visual-form-builder' ); ?>">(?)</span>
206
+ <br />
207
+ <input type="text" value="<?php echo stripslashes( $form_subject ); ?>" class="widefat" id="form-email-subject" name="form_email_subject" />
208
+ </label>
209
+ </p>
210
+ <br class="clear" />
211
+
212
+ <!-- Sender Name -->
213
+ <p class="description description-thin">
214
+ <label for="form-email-sender-name">
215
+ <?php _e( 'Your Name or Company' , 'visual-form-builder'); ?>
216
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Your Name or Company', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'This option sets the From display name of the email that is sent to the emails you have set in the E-mail(s) To field.', 'visual-form-builder' ); ?>">(?)</span>
217
+ <br />
218
+ <input type="text" value="<?php echo $form_email_from_name; ?>" class="widefat" id="form-email-sender-name" name="form_email_from_name"<?php echo ( $form_email_from_name_override != '' ) ? ' readonly="readonly"' : ''; ?> />
219
+ </label>
220
+ </p>
221
+ <p class="description description-thin">
222
+ <label for="form_email_from_name_override">
223
+ <?php _e( "User's Name (optional)" , 'visual-form-builder'); ?>
224
+ <span class="vfb-tooltip" title="<?php esc_attr_e( "About User's Name", 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Select a required text field from your form to use as the From display name in the email.', 'visual-form-builder' ); ?>">(?)</span>
225
+ <br />
226
+ <?php if ( empty( $senders ) ) : ?>
227
+ <span><?php _e( 'No required text fields detected', 'visual-form-builder' ); ?></span>
228
+ <?php else : ?>
229
+ <select name="form_email_from_name_override" id="form_email_from_name_override" class="widefat">
230
+ <option value="" <?php selected( $form_email_from_name_override, '' ); ?>></option>
231
+ <?php
232
+ foreach( $senders as $sender ) {
233
+ echo sprintf( '<option value="%1$d"%2$s>%3$s</option>',
234
+ $sender->field_id,
235
+ selected( $form_email_from_name_override, $sender->field_id, 0 ),
236
+ stripslashes( $sender->field_name )
237
+ );
238
+ }
239
+ ?>
240
+ </select>
241
+ <?php endif; ?>
242
+ </label>
243
+ </p>
244
+ <br class="clear" />
245
+
246
+ <!-- Sender E-mail -->
247
+ <p class="description description-thin">
248
+ <label for="form-email-sender">
249
+ <?php _e( 'Reply-To E-mail' , 'visual-form-builder'); ?>
250
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Reply-To Email', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Manually set the email address that users will reply to.', 'visual-form-builder' ); ?>">(?)</span>
251
+ <br />
252
+ <input type="text" value="<?php echo $form_email_from; ?>" class="widefat" id="form-email-sender" name="form_email_from"<?php echo ( $form_email_from_override != '' ) ? ' readonly="readonly"' : ''; ?> />
253
+ </label>
254
+ </p>
255
+ <p class="description description-thin">
256
+ <label for="form_email_from_override">
257
+ <?php _e( "User's E-mail (optional)" , 'visual-form-builder'); ?>
258
+ <span class="vfb-tooltip" title="<?php esc_attr_e( "About User's Email", 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Select a required email field from your form to use as the Reply-To email.', 'visual-form-builder' ); ?>">(?)</span>
259
+ <br />
260
+ <?php if ( empty( $emails ) ) : ?>
261
+ <span><?php _e( 'No required email fields detected', 'visual-form-builder' ); ?></span>
262
+ <?php else : ?>
263
+ <select name="form_email_from_override" id="form_email_from_override" class="widefat">
264
+ <option value="" <?php selected( $form_email_from_override, '' ); ?>></option>
265
+ <?php
266
+ foreach( $emails as $email ) {
267
+ echo sprintf( '<option value="%1$d"%2$s>%3$s</option>',
268
+ $email->field_id,
269
+ selected( $form_email_from_override, $email->field_id, 0 ),
270
+ stripslashes( $email->field_name )
271
+ );
272
+ }
273
+ ?>
274
+ </select>
275
+ <?php endif; ?>
276
+ </label>
277
+ </p>
278
+ <br class="clear" />
279
+
280
+ <!-- E-mail(s) To -->
281
+ <?php
282
+ // Basic count to keep track of multiple options
283
+ $count = 1;
284
+
285
+ // Loop through the options
286
+ foreach ( $form_email_to as $email_to ) :
287
+ ?>
288
+ <div id="clone-email-<?php echo $count; ?>" class="option">
289
+ <p class="description description-wide">
290
+ <label for="form-email-to-<?php echo "$count"; ?>" class="clonedOption">
291
+ <?php _e( 'E-mail(s) To' , 'visual-form-builder'); ?>
292
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About E-mail(s) To', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'This option sets single or multiple emails to send the submitted form data to. At least one email is required.', 'visual-form-builder' ); ?>">(?)</span>
293
+ <br />
294
+ <input type="text" value="<?php echo stripslashes( $email_to ); ?>" name="form_email_to[]" class="widefat" id="form-email-to-<?php echo "$count"; ?>" />
295
+ </label>
296
+
297
+ <a href="#" class="addEmail vfb-interface-icon vfb-interface-plus" title="<?php esc_attr_e( 'Add an Email', 'visua-form-builder' ); ?>">
298
+ <?php _e( 'Add', 'visual-form-builder' ); ?>
299
+ </a>
300
+ <a href="#" class="deleteEmail vfb-interface-icon vfb-interface-minus" title="<?php esc_attr_e( 'Delete Email', 'visual-form-builder' ); ?>">
301
+ <?php _e( 'Delete', 'visual-form-builder' ); ?>
302
+ </a>
303
+
304
+ </p>
305
+ <br class="clear" />
306
+ </div>
307
+ <?php
308
+ $count++;
309
+ endforeach;
310
+ ?>
311
+ <div class="clear"></div>
312
+ </div>
313
+
314
+ <!-- Confirmation section -->
315
+ <a href="#confirmation" class="settings-links<?php echo ( $settings_accordion == 'confirmation' ) ? ' on' : ''; ?>"><?php _e( 'Confirmation', 'visual-form-builder' ); ?><span class="vfb-large-arrow"></span></a>
316
+ <div id="confirmation-message" class="form-details<?php echo ( $settings_accordion == 'confirmation' ) ? ' on' : ''; ?>">
317
+ <p><em><?php _e( "After someone submits a form, you can control what is displayed. By default, it's a message but you can send them to another WordPress Page or a custom URL." , 'visual-form-builder'); ?></em></p>
318
+ <label for="form-success-type-text" class="menu-name-label open-label">
319
+ <input type="radio" value="text" id="form-success-type-text" class="form-success-type" name="form_success_type" <?php checked( $form_success_type, 'text' ); ?> />
320
+ <span><?php _e( 'Text' , 'visual-form-builder'); ?></span>
321
+ </label>
322
+ <label for="form-success-type-page" class="menu-name-label open-label">
323
+ <input type="radio" value="page" id="form-success-type-page" class="form-success-type" name="form_success_type" <?php checked( $form_success_type, 'page' ); ?>/>
324
+ <span><?php _e( 'Page' , 'visual-form-builder'); ?></span>
325
+ </label>
326
+ <label for="form-success-type-redirect" class="menu-name-label open-label">
327
+ <input type="radio" value="redirect" id="form-success-type-redirect" class="form-success-type" name="form_success_type" <?php checked( $form_success_type, 'redirect' ); ?>/>
328
+ <span><?php _e( 'Redirect' , 'visual-form-builder'); ?></span>
329
+ </label>
330
+ <br class="clear" />
331
+ <p class="description description-wide">
332
+ <?php
333
+ $default_text = '';
334
+
335
+ /* If there's no text message, make sure there is something displayed by setting a default */
336
+ if ( $form_success_message === '' )
337
+ $default_text = sprintf( '<p id="form_success">%s</p>', __( 'Your form was successfully submitted. Thank you for contacting us.' , 'visual-form-builder') );
338
+ ?>
339
+ <textarea id="form-success-message-text" class="form-success-message<?php echo ( 'text' == $form_success_type ) ? ' active' : ''; ?>" name="form_success_message_text"><?php echo $default_text; ?><?php echo ( 'text' == $form_success_type ) ? $form_success_message : ''; ?></textarea>
340
+
341
+ <?php
342
+ /* Display all Pages */
343
+ wp_dropdown_pages( array(
344
+ 'name' => 'form_success_message_page',
345
+ 'id' => 'form-success-message-page',
346
+ 'class' => 'widefat',
347
+ 'show_option_none' => __( 'Select a Page' , 'visual-form-builder'),
348
+ 'selected' => $form_success_message
349
+ ));
350
+ ?>
351
+ <input type="text" value="<?php echo ( 'redirect' == $form_success_type ) ? $form_success_message : ''; ?>" id="form-success-message-redirect" class="form-success-message regular-text<?php echo ( 'redirect' == $form_success_type ) ? ' active' : ''; ?>" name="form_success_message_redirect" placeholder="http://" />
352
+ </p>
353
+ <br class="clear" />
354
+
355
+ </div>
356
+
357
+ <!-- Notification section -->
358
+ <a href="#notification" class="settings-links<?php echo ( $settings_accordion == 'notification' ) ? ' on' : ''; ?>"><?php _e( 'Notification', 'visual-form-builder' ); ?><span class="vfb-large-arrow"></span></a>
359
+ <div id="notification" class="form-details<?php echo ( $settings_accordion == 'notification' ) ? ' on' : ''; ?>">
360
+ <p><em><?php _e( "When a user submits their entry, you can send a customizable notification email." , 'visual-form-builder'); ?></em></p>
361
+ <label for="form-notification-setting">
362
+ <input type="checkbox" value="1" id="form-notification-setting" class="form-notification" name="form_notification_setting" <?php checked( $form_notification_setting, '1' ); ?> style="margin-top:-1px;margin-left:0;"/>
363
+ <?php _e( 'Send Confirmation Email to User' , 'visual-form-builder'); ?>
364
+ </label>
365
+ <br class="clear" />
366
+ <div id="notification-email">
367
+ <p class="description description-wide">
368
+ <label for="form-notification-email-name">
369
+ <?php _e( 'Sender Name or Company' , 'visual-form-builder'); ?>
370
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Sender Name or Company', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Enter the name you would like to use for the email notification.', 'visual-form-builder' ); ?>">(?)</span>
371
+ <br />
372
+ <input type="text" value="<?php echo $form_notification_email_name; ?>" class="widefat" id="form-notification-email-name" name="form_notification_email_name" />
373
+ </label>
374
+ </p>
375
+ <br class="clear" />
376
+ <p class="description description-wide">
377
+ <label for="form-notification-email-from">
378
+ <?php _e( 'Reply-To E-mail' , 'visual-form-builder'); ?>
379
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Reply-To Email', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Manually set the email address that users will reply to.', 'visual-form-builder' ); ?>">(?)</span>
380
+ <br />
381
+ <input type="text" value="<?php echo $form_notification_email_from; ?>" class="widefat" id="form-notification-email-from" name="form_notification_email_from" />
382
+ </label>
383
+ </p>
384
+ <br class="clear" />
385
+ <p class="description description-wide">
386
+ <label for="form-notification-email">
387
+ <?php _e( 'E-mail To' , 'visual-form-builder'); ?>
388
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About E-mail To', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Select a required email field from your form to send the notification email to.', 'visual-form-builder' ); ?>">(?)</span>
389
+ <br />
390
+ <?php if ( empty( $emails ) ) : ?>
391
+ <span><?php _e( 'No required email fields detected', 'visual-form-builder' ); ?></span>
392
+ <?php else : ?>
393
+ <select name="form_notification_email" id="form-notification-email" class="widefat">
394
+ <option value="" <?php selected( $form_notification_email, '' ); ?>></option>
395
+ <?php
396
+ foreach( $emails as $email ) {
397
+ echo sprintf( '<option value="%1$d"%2$s>%3$s</option>',
398
+ $email->field_id,
399
+ selected( $form_notification_email, $email->field_id, 0 ),
400
+ $email->field_name
401
+ );
402
+ }
403
+ ?>
404
+ </select>
405
+ <?php endif; ?>
406
+ </label>
407
+ </p>
408
+ <br class="clear" />
409
+ <p class="description description-wide">
410
+ <label for="form-notification-subject">
411
+ <?php _e( 'E-mail Subject' , 'visual-form-builder'); ?>
412
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About E-mail Subject', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'This option sets the subject of the email that is sent to the emails you have set in the E-mail To field.', 'visual-form-builder' ); ?>">(?)</span>
413
+ <br />
414
+ <input type="text" value="<?php echo $form_notification_subject; ?>" class="widefat" id="form-notification-subject" name="form_notification_subject" />
415
+ </label>
416
+ </p>
417
+ <br class="clear" />
418
+ <p class="description description-wide">
419
+ <label for="form-notification-message"><?php _e( 'Message' , 'visual-form-builder'); ?></label>
420
+ <span class="vfb-tooltip" title="<?php esc_attr_e( 'About Message', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Insert a message to the user. This will be inserted into the beginning of the email body.', 'visual-form-builder' ); ?>">(?)</span>
421
+ <br />
422
+ <textarea id="form-notification-message" class="form-notification-message widefat" name="form_notification_message"><?php echo $form_notification_message; ?></textarea>
423
+ </p>
424
+ <br class="clear" />
425
+ <label for="form-notification-entry">
426
+ <input type="checkbox" value="1" id="form-notification-entry" class="form-notification" name="form_notification_entry" <?php checked( $form_notification_entry, '1' ); ?> style="margin-top:-1px;margin-left:0;"/>
427
+ <?php _e( "Include a Copy of the User's Entry" , 'visual-form-builder'); ?>
428
+ </label>
429
+ <br class="clear" />
430
+ </div>
431
+ </div>
432
+ </div>
433
+ </div>
434
+ </div>
435
+ </div>
436
+ <div id="post-body">
437
+ <div id="post-body-content">
438
+ <div id="vfb-fieldset-first-warning" class="error"><?php printf( '<p><strong>%1$s </strong><br>%2$s</p>', __( 'Warning &mdash; Missing Fieldset', 'visual-form-builder' ), __( 'Your form may not function or display correctly. Please be sure to add or move a Fieldset to the beginning of your form.' , 'visual-form-builder') ); ?></div>
439
+ <!-- !Field Items output -->
440
  <ul id="vfb-menu-to-edit" class="menu ui-sortable droppable">
441
  <?php echo $this->edit_field( $form_nav_selected_id ); ?>
442
  </ul>
443
+ </div>
444
+ <br class="clear" />
445
+ </div>
446
+ <br class="clear" />
447
+ <div id="form-editor-footer">
448
+ <div class="vfb-major-publishing-actions">
449
+ <div class="publishing-action">
450
+ <?php submit_button( __( 'Save Form', 'visual-form-builder' ), 'primary', 'save_form', false ); ?>
451
+ </div> <!-- .publishing-action -->
452
+ </div> <!-- .vfb-major-publishing-actions -->
453
+ </div> <!-- #form-editor-footer -->
454
  </form>
455
+ </div> <!-- .form-edit -->
456
+ </div> <!-- #vfb-form-builder-management -->
457
+ </div> <!-- vfb-form-builder-main -->
458
+ </div> <!-- .vfb-postbox-container -->
459
  </div> <!-- #vfb-form-builder-frame -->
460
  </div> <!-- .wrap -->
461
  <?php
admin/class-save.php CHANGED
@@ -34,15 +34,15 @@ class Visual_Form_Builder_Admin_Save {
34
  return;
35
 
36
  if ( !current_user_can( 'manage_options' ) )
37
- wp_die( __( 'You do not have sufficient permissions to create a new form.', 'visual-form-builder' ) );
38
 
39
  check_admin_referer( 'create_form' );
40
 
41
  $form_key = sanitize_title( $_POST['form_title'] );
42
- $form_title = esc_html( $_POST['form_title'] );
43
- $form_from_name = esc_html( $_POST['form_email_from_name'] );
44
- $form_subject = esc_html( $_POST['form_email_subject'] );
45
- $form_from = esc_html( $_POST['form_email_from'] );
46
  $form_to = serialize( $_POST['form_email_to'] );
47
 
48
  $newdata = array(
@@ -140,22 +140,22 @@ class Visual_Form_Builder_Admin_Save {
140
 
141
  $form_id = absint( $_POST['form_id'] );
142
  $form_key = sanitize_title( $_POST['form_title'], $form_id );
143
- $form_title = $_POST['form_title'];
144
- $form_subject = $_POST['form_email_subject'];
145
  $form_to = serialize( array_map( 'sanitize_email', $_POST['form_email_to'] ) );
146
  $form_from = sanitize_email( $_POST['form_email_from'] );
147
- $form_from_name = $_POST['form_email_from_name'];
148
- $form_from_override = isset( $_POST['form_email_from_override'] ) ? $_POST['form_email_from_override'] : '';
149
- $form_from_name_override = isset( $_POST['form_email_from_name_override'] ) ? $_POST['form_email_from_name_override'] : '';
150
- $form_success_type = $_POST['form_success_type'];
151
- $form_notification_setting = isset( $_POST['form_notification_setting'] ) ? $_POST['form_notification_setting'] : '';
152
- $form_notification_email_name = isset( $_POST['form_notification_email_name'] ) ? $_POST['form_notification_email_name'] : '';
153
- $form_notification_email_from = isset( $_POST['form_notification_email_from'] ) ? sanitize_email( $_POST['form_notification_email_from'] ) : '';
154
- $form_notification_email = isset( $_POST['form_notification_email'] ) ? $_POST['form_notification_email'] : '';
155
- $form_notification_subject = isset( $_POST['form_notification_subject'] ) ? $_POST['form_notification_subject'] : '';
156
  $form_notification_message = isset( $_POST['form_notification_message'] ) ? format_for_editor( $_POST['form_notification_message'] ) : '';
157
- $form_notification_entry = isset( $_POST['form_notification_entry'] ) ? $_POST['form_notification_entry'] : '';
158
- $form_label_alignment = $_POST['form_label_alignment'];
159
 
160
  // Add confirmation based on which type was selected
161
  switch ( $form_success_type ) {
@@ -163,10 +163,10 @@ class Visual_Form_Builder_Admin_Save {
163
  $form_success_message = format_for_editor( $_POST['form_success_message_text'] );
164
  break;
165
  case 'page' :
166
- $form_success_message = $_POST['form_success_message_page'];
167
  break;
168
  case 'redirect' :
169
- $form_success_message = $_POST['form_success_message_redirect'];
170
  break;
171
  }
172
 
@@ -211,14 +211,14 @@ class Visual_Form_Builder_Admin_Save {
211
 
212
  $field_name = isset( $_POST['field_name-' . $id] ) ? trim( $_POST['field_name-' . $id] ) : '';
213
  $field_key = sanitize_key( sanitize_title( $field_name, $id ) );
214
- $field_desc = isset( $_POST['field_description-' . $id] ) ? trim( $_POST['field_description-' . $id] ) : '';
215
- $field_options = isset( $_POST['field_options-' . $id] ) ? serialize( array_map( 'trim', $_POST['field_options-' . $id] ) ) : '';
216
- $field_validation = isset( $_POST['field_validation-' . $id] ) ? $_POST['field_validation-' . $id] : '';
217
- $field_required = isset( $_POST['field_required-' . $id] ) ? $_POST['field_required-' . $id] : '';
218
- $field_size = isset( $_POST['field_size-' . $id] ) ? $_POST['field_size-' . $id] : '';
219
- $field_css = isset( $_POST['field_css-' . $id] ) ? $_POST['field_css-' . $id] : '';
220
- $field_layout = isset( $_POST['field_layout-' . $id] ) ? $_POST['field_layout-' . $id] : '';
221
- $field_default = isset( $_POST['field_default-' . $id] ) ? trim( $_POST['field_default-' . $id] ) : '';
222
 
223
  $field_data = array(
224
  'field_key' => $field_key,
34
  return;
35
 
36
  if ( !current_user_can( 'manage_options' ) )
37
+ wp_die( __( 'You do not have sufficient permissions to create a new form.', 'visual-form-builder' ) );
38
 
39
  check_admin_referer( 'create_form' );
40
 
41
  $form_key = sanitize_title( $_POST['form_title'] );
42
+ $form_title = sanitize_text_field( $_POST['form_title'] );
43
+ $form_from_name = sanitize_text_field( $_POST['form_email_from_name'] );
44
+ $form_subject = sanitize_text_field( $_POST['form_email_subject'] );
45
+ $form_from = sanitize_email( $_POST['form_email_from'] );
46
  $form_to = serialize( $_POST['form_email_to'] );
47
 
48
  $newdata = array(
140
 
141
  $form_id = absint( $_POST['form_id'] );
142
  $form_key = sanitize_title( $_POST['form_title'], $form_id );
143
+ $form_title = sanitize_text_field( $_POST['form_title'] );
144
+ $form_subject = sanitize_text_field( $_POST['form_email_subject'] );
145
  $form_to = serialize( array_map( 'sanitize_email', $_POST['form_email_to'] ) );
146
  $form_from = sanitize_email( $_POST['form_email_from'] );
147
+ $form_from_name = sanitize_text_field( $_POST['form_email_from_name'] );
148
+ $form_from_override = isset( $_POST['form_email_from_override'] ) ? absint( $_POST['form_email_from_override'] ) : '';
149
+ $form_from_name_override = isset( $_POST['form_email_from_name_override'] ) ? absint( $_POST['form_email_from_name_override'] ) : '';
150
+ $form_success_type = sanitize_text_field( $_POST['form_success_type'] );
151
+ $form_notification_setting = isset( $_POST['form_notification_setting'] ) ? absint( $_POST['form_notification_setting'] ) : '';
152
+ $form_notification_email_name = isset( $_POST['form_notification_email_name'] ) ? sanitize_text_field( $_POST['form_notification_email_name'] ) : '';
153
+ $form_notification_email_from = isset( $_POST['form_notification_email_from'] ) ? sanitize_email( $_POST['form_notification_email_from'] ) : '';
154
+ $form_notification_email = isset( $_POST['form_notification_email'] ) ? absint( $_POST['form_notification_email'] ) : '';
155
+ $form_notification_subject = isset( $_POST['form_notification_subject'] ) ? sanitize_text_field( $_POST['form_notification_subject'] ) : '';
156
  $form_notification_message = isset( $_POST['form_notification_message'] ) ? format_for_editor( $_POST['form_notification_message'] ) : '';
157
+ $form_notification_entry = isset( $_POST['form_notification_entry'] ) ? absint( $_POST['form_notification_entry'] ) : '';
158
+ $form_label_alignment = sanitize_text_field( $_POST['form_label_alignment'] );
159
 
160
  // Add confirmation based on which type was selected
161
  switch ( $form_success_type ) {
163
  $form_success_message = format_for_editor( $_POST['form_success_message_text'] );
164
  break;
165
  case 'page' :
166
+ $form_success_message = absint( $_POST['form_success_message_page'] );
167
  break;
168
  case 'redirect' :
169
+ $form_success_message = esc_url_raw( $_POST['form_success_message_redirect'] );
170
  break;
171
  }
172
 
211
 
212
  $field_name = isset( $_POST['field_name-' . $id] ) ? trim( $_POST['field_name-' . $id] ) : '';
213
  $field_key = sanitize_key( sanitize_title( $field_name, $id ) );
214
+ $field_desc = isset( $_POST['field_description-' . $id] ) ? sanitize_textarea_field( trim( $_POST['field_description-' . $id] ) ) : '';
215
+ $field_options = isset( $_POST['field_options-' . $id] ) ? serialize( array_map( 'sanitize_text_field', $_POST['field_options-' . $id] ) ) : '';
216
+ $field_validation = isset( $_POST['field_validation-' . $id] ) ? sanitize_text_field( $_POST['field_validation-' . $id] ) : '';
217
+ $field_required = isset( $_POST['field_required-' . $id] ) ? sanitize_text_field( $_POST['field_required-' . $id] ) : '';
218
+ $field_size = isset( $_POST['field_size-' . $id] ) ? sanitize_text_field( $_POST['field_size-' . $id] ) : '';
219
+ $field_css = isset( $_POST['field_css-' . $id] ) ? sanitize_text_field( $_POST['field_css-' . $id] ) : '';
220
+ $field_layout = isset( $_POST['field_layout-' . $id] ) ? sanitize_text_field( $_POST['field_layout-' . $id] ) : '';
221
+ $field_default = isset( $_POST['field_default-' . $id] ) ? sanitize_text_field( trim( $_POST['field_default-' . $id] ) ) : '';
222
 
223
  $field_data = array(
224
  'field_key' => $field_key,
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mmuro
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=G87A9UN9CLPH4&lc=US&item_name=Visual%20Form%20Builder&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
4
  Tags: form, forms, contact form, contact forms, form, forms, form to email, email form, email, input, validation, jquery, shortcode, form builder, contact form builder, form manager, form creator
5
  Requires at least: 4.7
6
- Tested up to: 5.7.2
7
- Stable tag: 3.0.3
8
  License: GPLv2 or later
9
 
10
  Build beautiful, fully functional contact forms in only a few minutes without writing PHP, CSS, or HTML.
@@ -203,10 +203,10 @@ Follow these instructions:
203
  In your theme folder, create a JavaScript file. In this example, I'm using `myjs.js`. Add the following code to it and customize the language to what you need:
204
 
205
  `jQuery(document).ready(function($) {
206
- $.extend($.validator.messages, {
207
- required: "Eingabe nötig",
208
- email: "Bitte eine gültige E-Mail-Adresse eingeben"
209
- });
210
  });`
211
 
212
  Now, in your functions.php file, add the following piece of code:
@@ -214,10 +214,10 @@ Now, in your functions.php file, add the following piece of code:
214
  `add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
215
  function my_scripts_method() {
216
  wp_register_script( 'my-vfb-validation',
217
- get_template_directory_uri() . '/js/my-js.js',
218
- array( 'jquery', 'jquery-form-validation' ),
219
- '1.0',
220
- false );
221
 
222
  wp_enqueue_script( 'my-vfb-validation' );
223
  }`
@@ -231,6 +231,10 @@ function my_scripts_method() {
231
 
232
  == Changelog ==
233
 
 
 
 
 
234
  **Version 3.0.3 - Jun 08, 2021**
235
 
236
  * Update HTML field to use wp_editor
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=G87A9UN9CLPH4&lc=US&item_name=Visual%20Form%20Builder&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
4
  Tags: form, forms, contact form, contact forms, form, forms, form to email, email form, email, input, validation, jquery, shortcode, form builder, contact form builder, form manager, form creator
5
  Requires at least: 4.7
6
+ Tested up to: 5.8.1
7
+ Stable tag: 3.0.4
8
  License: GPLv2 or later
9
 
10
  Build beautiful, fully functional contact forms in only a few minutes without writing PHP, CSS, or HTML.
203
  In your theme folder, create a JavaScript file. In this example, I'm using `myjs.js`. Add the following code to it and customize the language to what you need:
204
 
205
  `jQuery(document).ready(function($) {
206
+ $.extend($.validator.messages, {
207
+ required: "Eingabe nötig",
208
+ email: "Bitte eine gültige E-Mail-Adresse eingeben"
209
+ });
210
  });`
211
 
212
  Now, in your functions.php file, add the following piece of code:
214
  `add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
215
  function my_scripts_method() {
216
  wp_register_script( 'my-vfb-validation',
217
+ get_template_directory_uri() . '/js/my-js.js',
218
+ array( 'jquery', 'jquery-form-validation' ),
219
+ '1.0',
220
+ false );
221
 
222
  wp_enqueue_script( 'my-vfb-validation' );
223
  }`
231
 
232
  == Changelog ==
233
 
234
+ **Version 3.0.4 - Sep 21, 2021**
235
+
236
+ * Fix security vulnerability when saving Form Name
237
+
238
  **Version 3.0.3 - Jun 08, 2021**
239
 
240
  * Update HTML field to use wp_editor
visual-form-builder.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Visual Form Builder
4
  Plugin URI: https://wordpress.org/plugins/visual-form-builder/
5
  Description: Dynamically build forms using a simple interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
6
- Version: 3.0.3
7
  Author: Matthew Muro
8
  Author URI: http://vfbpro.com
9
  Text Domain: visual-form-builder
@@ -26,7 +26,7 @@ class Visual_Form_Builder {
26
  * The current version of the plugin.
27
  * @var [type]
28
  */
29
- protected $version = '3.0.3';
30
 
31
  /**
32
  * The current DB version. Used if we need to update the DB later.
@@ -41,29 +41,29 @@ class Visual_Form_Builder {
41
  private static $instance = null;
42
 
43
  /**
44
- * Protected constructor to prevent creating a new instance of Visual_Form_Builder
45
- * via the 'new' operator from outside of this class.
46
- *
47
- * @return void
48
- */
49
  protected function __construct() {
50
  }
51
 
52
  /**
53
- * Private clone method to prevent cloning of the instance.
54
- *
55
- * @return void
56
- */
57
- private function __clone() {
58
- }
59
-
60
- /**
61
- * Private unserialize method to prevent unserializing of the instance.
62
- *
63
- * @return void
64
- */
65
- private function __wakeup() {
66
- }
67
 
68
  /**
69
  * Create a single Visual_Form_Builder instance
3
  Plugin Name: Visual Form Builder
4
  Plugin URI: https://wordpress.org/plugins/visual-form-builder/
5
  Description: Dynamically build forms using a simple interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
6
+ Version: 3.0.4
7
  Author: Matthew Muro
8
  Author URI: http://vfbpro.com
9
  Text Domain: visual-form-builder
26
  * The current version of the plugin.
27
  * @var [type]
28
  */
29
+ protected $version = '3.0.4';
30
 
31
  /**
32
  * The current DB version. Used if we need to update the DB later.
41
  private static $instance = null;
42
 
43
  /**
44
+ * Protected constructor to prevent creating a new instance of Visual_Form_Builder
45
+ * via the 'new' operator from outside of this class.
46
+ *
47
+ * @return void
48
+ */
49
  protected function __construct() {
50
  }
51
 
52
  /**
53
+ * Private clone method to prevent cloning of the instance.
54
+ *
55
+ * @return void
56
+ */
57
+ private function __clone() {
58
+ }
59
+
60
+ /**
61
+ * Private unserialize method to prevent unserializing of the instance.
62
+ *
63
+ * @return void
64
+ */
65
+ private function __wakeup() {
66
+ }
67
 
68
  /**
69
  * Create a single Visual_Form_Builder instance