Version Description
Added media button, Entries search and default values
Download this release
Release Info
Developer | mmuro |
Plugin | Visual Form Builder |
Version | 2.3 |
Comparing to | |
See all releases |
Code changes from version 2.2 to 2.3
- class-entries-detail.php +2 -3
- class-entries-list.php +53 -37
- css/nav-menu.css +1 -1
- css/vfb_icon.png +0 -0
- js/visual-form-builder.js +1 -1
- readme.txt +20 -2
- visual-form-builder.php +174 -56
class-entries-detail.php
CHANGED
@@ -79,8 +79,7 @@ class VisualFormBuilder_Entries_Detail{
|
|
79 |
</div>
|
80 |
</div>
|
81 |
</div>
|
82 |
-
|
83 |
-
<div id="post-body-content">
|
84 |
<?php
|
85 |
$count = 0;
|
86 |
$open_fieldset = $open_section = false;
|
@@ -154,7 +153,7 @@ class VisualFormBuilder_Entries_Detail{
|
|
154 |
if ( $count > 0 )
|
155 |
echo '</div></div>';
|
156 |
|
157 |
-
echo '</div></div></div
|
158 |
}
|
159 |
|
160 |
echo '<br class="clear"></div>';
|
79 |
</div>
|
80 |
</div>
|
81 |
</div>
|
82 |
+
<div id="vfb-entries-body-content">
|
|
|
83 |
<?php
|
84 |
$count = 0;
|
85 |
$open_fieldset = $open_section = false;
|
153 |
if ( $count > 0 )
|
154 |
echo '</div></div>';
|
155 |
|
156 |
+
echo '</div></div></div>';
|
157 |
}
|
158 |
|
159 |
echo '<br class="clear"></div>';
|
class-entries-list.php
CHANGED
@@ -34,7 +34,7 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
34 |
* @since 1.2
|
35 |
* @returns $item string Column name
|
36 |
*/
|
37 |
-
function column_default($item, $column_name){
|
38 |
switch ( $column_name ) {
|
39 |
case 'subject':
|
40 |
case 'sender_name':
|
@@ -51,25 +51,15 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
51 |
*
|
52 |
* @since 1.2
|
53 |
*/
|
54 |
-
function column_form($item){
|
55 |
|
56 |
/* Build row actions */
|
57 |
$actions = array(
|
58 |
'view' => sprintf( '<a href="?page=%s&view=%s&action=%s&entry=%s" id="%4$s" class="view-entry">View</a>', $_REQUEST['page'], $_REQUEST['view'], 'view', $item['entry_id'] ),
|
59 |
'delete' => sprintf( '<a href="?page=%s&view=%s&action=%s&entry=%s">Delete</a>', $_REQUEST['page'], $_REQUEST['view'], 'delete', $item['entry_id'] ),
|
60 |
);
|
61 |
-
|
62 |
-
/* Build the form's data for display only */
|
63 |
-
$data = '<fieldset class="visual-form-builder-inline-edit"><div class="visual-form-builder-inline-edit-col">';
|
64 |
-
foreach ( $item['data'] as $k => $v ) {
|
65 |
-
$data .= '<label><span class="title">' . ucwords( $k ) . '</span><span class="input-text-wrap"><input class="ptitle" type="text" value="' . $v . '" readonly="readonly" /></span></label>';
|
66 |
-
}
|
67 |
-
$data .= '</div></fieldset><p class="submit"><a id="' . $item['entry_id'] . '" class="button-secondary alignleft visual-form-builder-inline-edit-cancel">' . __( 'Cancel' , 'visual-form-builder') . '</a></p>';
|
68 |
-
|
69 |
-
/* Hide the data intially */
|
70 |
-
$hidden_div = '<div id="entry-' . $item['entry_id'] . '" class="hidden">' . $data . '</div>';
|
71 |
|
72 |
-
return sprintf( '%1$s %2$s
|
73 |
}
|
74 |
|
75 |
/**
|
@@ -77,7 +67,7 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
77 |
*
|
78 |
* @since 1.2
|
79 |
*/
|
80 |
-
function column_cb($item){
|
81 |
return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_args['singular'], $item['entry_id'] );
|
82 |
}
|
83 |
|
@@ -86,7 +76,7 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
86 |
*
|
87 |
* @since 1.2
|
88 |
*/
|
89 |
-
function get_columns(){
|
90 |
$columns = array(
|
91 |
'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
|
92 |
'form' => __( 'Form' , 'visual-form-builder'),
|
@@ -107,10 +97,13 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
107 |
* @since 1.2
|
108 |
* @returns array() $cols SQL results
|
109 |
*/
|
110 |
-
function get_entries( $orderby = 'date', $order = 'ASC' ){
|
111 |
global $wpdb;
|
112 |
|
113 |
-
|
|
|
|
|
|
|
114 |
case 'date':
|
115 |
$order_col = 'date_submitted';
|
116 |
break;
|
@@ -132,7 +125,7 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
132 |
$where = 'WHERE forms.form_id = ' . $this->current_filter_action();
|
133 |
|
134 |
$sql_order = sanitize_sql_orderby( "$order_col $order" );
|
135 |
-
$query = "SELECT forms.form_title, entries
|
136 |
|
137 |
$cols = $wpdb->get_results( $query );
|
138 |
|
@@ -178,8 +171,8 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
178 |
*
|
179 |
* @since 1.2
|
180 |
*/
|
181 |
-
function process_bulk_action() {
|
182 |
-
$entry_id = ( is_array( $_REQUEST['entry'] ) ) ? $_REQUEST['entry'] : array( $_REQUEST['entry'] );
|
183 |
|
184 |
if ( 'delete' === $this->current_action() ) {
|
185 |
global $wpdb;
|
@@ -274,9 +267,10 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
274 |
/* Loop through our submitted data */
|
275 |
foreach ( $fields as $field_key => $field_value ) {
|
276 |
if ( !is_array( $field_value ) ) {
|
|
|
277 |
/* Replace quotes for the header */
|
278 |
$header = str_replace( '"', '""', ucwords( $field_key ) );
|
279 |
-
|
280 |
/* Replace all spaces for each form field name */
|
281 |
$field_key = preg_replace( '/(\s)/i', '', $field_key );
|
282 |
|
@@ -297,7 +291,7 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
297 |
else {
|
298 |
/* Cast each array as an object */
|
299 |
$obj = (object) $field_value;
|
300 |
-
|
301 |
switch ( $obj->type ) {
|
302 |
case 'fieldset' :
|
303 |
case 'section' :
|
@@ -308,9 +302,10 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
308 |
default :
|
309 |
/* Replace quotes for the header */
|
310 |
$header = str_replace( '"', '""', $obj->name );
|
311 |
-
|
312 |
/* Find new field names and make a new column with a header */
|
313 |
if ( !array_key_exists( $obj->name, $cols ) ) {
|
|
|
314 |
$cols[$obj->name] = array(
|
315 |
'header' => $header,
|
316 |
'data' => array()
|
@@ -338,7 +333,7 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
338 |
/* Setup our CSV vars */
|
339 |
$csv_headers = NULL;
|
340 |
$csv_rows = array();
|
341 |
-
|
342 |
/* Loop through each column */
|
343 |
foreach ( $cols as $data ) {
|
344 |
/* End our header row, if needed */
|
@@ -391,9 +386,8 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
391 |
*/
|
392 |
function extra_tablenav( $which ) {
|
393 |
global $wpdb;
|
394 |
-
$query = "SELECT DISTINCT forms.form_title, forms.form_id FROM $this->form_table_name AS forms ORDER BY forms.form_title ASC";
|
395 |
|
396 |
-
$cols = $wpdb->get_results( $
|
397 |
|
398 |
/* Only display the dropdown on the top of the table */
|
399 |
if ( 'top' == $which ) {
|
@@ -424,6 +418,16 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
424 |
return false;
|
425 |
}
|
426 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
/**
|
428 |
* Prepares our data for display
|
429 |
*
|
@@ -442,6 +446,12 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
442 |
/* How many to show per page */
|
443 |
$per_page = $options['per_page'];
|
444 |
|
|
|
|
|
|
|
|
|
|
|
|
|
445 |
/* Get column headers */
|
446 |
$columns = $this->get_columns();
|
447 |
$hidden = array();
|
@@ -454,13 +464,26 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
454 |
|
455 |
/* Handle our bulk actions */
|
456 |
$this->process_bulk_action();
|
457 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
/* Set our ORDER BY and ASC/DESC to sort the entries */
|
459 |
$orderby = ( !empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'date';
|
460 |
$order = ( !empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'desc';
|
461 |
|
462 |
/* Get the sorted entries */
|
463 |
-
$entries = $this->get_entries( $orderby, $order );
|
464 |
|
465 |
$data = array();
|
466 |
|
@@ -475,19 +498,12 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
475 |
'sender_email' => stripslashes( $entry->sender_email ),
|
476 |
'emails_to' => implode( ',', unserialize( stripslashes( $entry->emails_to ) ) ),
|
477 |
'date' => date( "$date_format $time_format", strtotime( $entry->date_submitted ) ),
|
478 |
-
'ip_address' => $entry->ip_address
|
479 |
-
'data' => unserialize( $entry->data )
|
480 |
);
|
481 |
}
|
482 |
-
|
483 |
-
/* What page are we looking at? */
|
484 |
-
$current_page = $this->get_pagenum();
|
485 |
|
486 |
/* How many entries do we have? */
|
487 |
-
$total_items =
|
488 |
-
|
489 |
-
/* Calculate pagination */
|
490 |
-
$data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ), $per_page );
|
491 |
|
492 |
/* Add sorted data to the items property */
|
493 |
$this->items = $data;
|
34 |
* @since 1.2
|
35 |
* @returns $item string Column name
|
36 |
*/
|
37 |
+
function column_default( $item, $column_name ){
|
38 |
switch ( $column_name ) {
|
39 |
case 'subject':
|
40 |
case 'sender_name':
|
51 |
*
|
52 |
* @since 1.2
|
53 |
*/
|
54 |
+
function column_form( $item ){
|
55 |
|
56 |
/* Build row actions */
|
57 |
$actions = array(
|
58 |
'view' => sprintf( '<a href="?page=%s&view=%s&action=%s&entry=%s" id="%4$s" class="view-entry">View</a>', $_REQUEST['page'], $_REQUEST['view'], 'view', $item['entry_id'] ),
|
59 |
'delete' => sprintf( '<a href="?page=%s&view=%s&action=%s&entry=%s">Delete</a>', $_REQUEST['page'], $_REQUEST['view'], 'delete', $item['entry_id'] ),
|
60 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
+
return sprintf( '%1$s %2$s', $item['form'], $this->row_actions( $actions ) );
|
63 |
}
|
64 |
|
65 |
/**
|
67 |
*
|
68 |
* @since 1.2
|
69 |
*/
|
70 |
+
function column_cb( $item ){
|
71 |
return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_args['singular'], $item['entry_id'] );
|
72 |
}
|
73 |
|
76 |
*
|
77 |
* @since 1.2
|
78 |
*/
|
79 |
+
function get_columns(){
|
80 |
$columns = array(
|
81 |
'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
|
82 |
'form' => __( 'Form' , 'visual-form-builder'),
|
97 |
* @since 1.2
|
98 |
* @returns array() $cols SQL results
|
99 |
*/
|
100 |
+
function get_entries( $orderby = 'date', $order = 'ASC', $per_page, $offset = 0, $search = '' ){
|
101 |
global $wpdb;
|
102 |
|
103 |
+
/* Set OFFSET for pagination */
|
104 |
+
$offset = ( $offset > 0 ) ? "OFFSET $offset" : '';
|
105 |
+
|
106 |
+
switch ( $orderby ) {
|
107 |
case 'date':
|
108 |
$order_col = 'date_submitted';
|
109 |
break;
|
125 |
$where = 'WHERE forms.form_id = ' . $this->current_filter_action();
|
126 |
|
127 |
$sql_order = sanitize_sql_orderby( "$order_col $order" );
|
128 |
+
$query = "SELECT forms.form_title, entries.entries_id, entries.form_id, entries.subject, entries.sender_name, entries.sender_email, entries.emails_to, entries.date_submitted, entries.ip_address FROM $this->form_table_name AS forms INNER JOIN $this->entries_table_name AS entries ON entries.form_id = forms.form_id $where $search ORDER BY $sql_order LIMIT $per_page $offset";
|
129 |
|
130 |
$cols = $wpdb->get_results( $query );
|
131 |
|
171 |
*
|
172 |
* @since 1.2
|
173 |
*/
|
174 |
+
function process_bulk_action() {
|
175 |
+
$entry_id = ( isset( $_REQUEST['entry'] ) && is_array( $_REQUEST['entry'] ) ) ? $_REQUEST['entry'] : array( $_REQUEST['entry'] );
|
176 |
|
177 |
if ( 'delete' === $this->current_action() ) {
|
178 |
global $wpdb;
|
267 |
/* Loop through our submitted data */
|
268 |
foreach ( $fields as $field_key => $field_value ) {
|
269 |
if ( !is_array( $field_value ) ) {
|
270 |
+
|
271 |
/* Replace quotes for the header */
|
272 |
$header = str_replace( '"', '""', ucwords( $field_key ) );
|
273 |
+
|
274 |
/* Replace all spaces for each form field name */
|
275 |
$field_key = preg_replace( '/(\s)/i', '', $field_key );
|
276 |
|
291 |
else {
|
292 |
/* Cast each array as an object */
|
293 |
$obj = (object) $field_value;
|
294 |
+
|
295 |
switch ( $obj->type ) {
|
296 |
case 'fieldset' :
|
297 |
case 'section' :
|
302 |
default :
|
303 |
/* Replace quotes for the header */
|
304 |
$header = str_replace( '"', '""', $obj->name );
|
305 |
+
|
306 |
/* Find new field names and make a new column with a header */
|
307 |
if ( !array_key_exists( $obj->name, $cols ) ) {
|
308 |
+
|
309 |
$cols[$obj->name] = array(
|
310 |
'header' => $header,
|
311 |
'data' => array()
|
333 |
/* Setup our CSV vars */
|
334 |
$csv_headers = NULL;
|
335 |
$csv_rows = array();
|
336 |
+
|
337 |
/* Loop through each column */
|
338 |
foreach ( $cols as $data ) {
|
339 |
/* End our header row, if needed */
|
386 |
*/
|
387 |
function extra_tablenav( $which ) {
|
388 |
global $wpdb;
|
|
|
389 |
|
390 |
+
$cols = $wpdb->get_results( "SELECT DISTINCT forms.form_title, forms.form_id FROM $this->form_table_name AS forms ORDER BY forms.form_title ASC" );
|
391 |
|
392 |
/* Only display the dropdown on the top of the table */
|
393 |
if ( 'top' == $which ) {
|
418 |
return false;
|
419 |
}
|
420 |
|
421 |
+
/**
|
422 |
+
* Display Search box
|
423 |
+
*
|
424 |
+
* @since 1.4
|
425 |
+
* @returns html Search Form
|
426 |
+
*/
|
427 |
+
function search_box( $text, $input_id ) {
|
428 |
+
parent::search_box( $text, $input_id );
|
429 |
+
}
|
430 |
+
|
431 |
/**
|
432 |
* Prepares our data for display
|
433 |
*
|
446 |
/* How many to show per page */
|
447 |
$per_page = $options['per_page'];
|
448 |
|
449 |
+
/* What page are we looking at? */
|
450 |
+
$current_page = $this->get_pagenum();
|
451 |
+
|
452 |
+
/* Use offset for pagination */
|
453 |
+
$offset = ( $current_page - 1 ) * $per_page;
|
454 |
+
|
455 |
/* Get column headers */
|
456 |
$columns = $this->get_columns();
|
457 |
$hidden = array();
|
464 |
|
465 |
/* Handle our bulk actions */
|
466 |
$this->process_bulk_action();
|
467 |
+
|
468 |
+
/* Get entries search terms */
|
469 |
+
$search_terms = ( !empty( $_REQUEST['s'] ) ) ? explode( ' ', $_REQUEST['s'] ) : array();
|
470 |
+
|
471 |
+
/* Loop through search terms and build query */
|
472 |
+
foreach( $search_terms as $term ) {
|
473 |
+
$term = esc_sql( like_escape( $term ) );
|
474 |
+
|
475 |
+
$search .= "{$searchand}((entries.subject LIKE '%{$term}%') OR (entries.sender_name LIKE '%{$term}%') OR (entries.sender_email LIKE '%{$term}%') OR (entries.emails_to LIKE '%{$term}%') OR (entries.data LIKE '%{$term}%'))";
|
476 |
+
$searchand = ' AND ';
|
477 |
+
}
|
478 |
+
|
479 |
+
$search = ( !empty($search) ) ? " AND ({$search}) " : '';
|
480 |
+
|
481 |
/* Set our ORDER BY and ASC/DESC to sort the entries */
|
482 |
$orderby = ( !empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'date';
|
483 |
$order = ( !empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'desc';
|
484 |
|
485 |
/* Get the sorted entries */
|
486 |
+
$entries = $this->get_entries( $orderby, $order, $per_page, $offset, $search );
|
487 |
|
488 |
$data = array();
|
489 |
|
498 |
'sender_email' => stripslashes( $entry->sender_email ),
|
499 |
'emails_to' => implode( ',', unserialize( stripslashes( $entry->emails_to ) ) ),
|
500 |
'date' => date( "$date_format $time_format", strtotime( $entry->date_submitted ) ),
|
501 |
+
'ip_address' => $entry->ip_address
|
|
|
502 |
);
|
503 |
}
|
|
|
|
|
|
|
504 |
|
505 |
/* How many entries do we have? */
|
506 |
+
$total_items = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $this->entries_table_name" ) );
|
|
|
|
|
|
|
507 |
|
508 |
/* Add sorted data to the items property */
|
509 |
$this->items = $data;
|
css/nav-menu.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
html,body{min-width:950px}#nav-menus-frame{margin-left:300px}#wpbody-content #menu-settings-column{display:inline;width:281px;margin-left:-300px;clear:both;float:left;padding-top:24px}.no-js #wpbody-content #menu-settings-column{padding-top:31px}#menu-settings-column .inside{clear:both}.metabox-holder-disabled .postbox{opacity:.5;filter:alpha(opacity=50)}.metabox-holder-disabled .button-controls .select-all{display:none}#wpbody{position:relative}#menu-management-liquid{float:left;min-width:100%}#menu-management{position:relative;margin-right:20px;margin-top:-3px;width:100%}#menu-management .menu-edit{border:1px solid;-moz-border-radius:3px;-webkit-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;margin-bottom:20px}#post-body{padding:10px;border-width:1px 0;border-style:solid}#nav-menu-header,#nav-menu-footer{padding:0 10px}#nav-menu-header{border-bottom:1px solid}#nav-menu-footer{border-top:1px solid}#post-body div.updated,#post-body div.error{margin:0}#post-body-content{position:relative}#menu-management .menu-add-new abbr{font-weight:bold}#menu-management .nav-tabs-nav{margin:0 20px}#menu-management .nav-tabs-arrow{width:10px;padding:0 5px 4px;cursor:pointer;position:absolute;top:0;line-height:22px;font-size:18px;text-shadow:0 1px 0 #fff}#menu-management .nav-tabs-arrow-left{left:0}#menu-management .nav-tabs-arrow-right{right:0;text-align:right}#menu-management .nav-tabs-wrapper{width:100%;height:28px;margin-bottom:-1px;overflow:hidden}#menu-management .nav-tabs{padding-left:20px;padding-right:10px}.js #menu-management .nav-tabs{float:left;margin-left:0;margin-right:-400px}#menu-management .nav-tab{margin-bottom:0;font-size:14px;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif}#select-nav-menu-container{text-align:right;padding:0 10px 3px 10px;margin-bottom:5px}#select-nav-menu{width:100px;display:inline}#menu-name-label{margin-top:-2px}#wpbody .open-label{display:block;float:left}#wpbody .open-label span{padding-right:10px}.js .input-with-default-title{font-style:italic}#menu-management .inside{padding:0 10px}.postbox .howto input{width:180px;float:right}.customlinkdiv .howto input{width:200px}#nav-menu-theme-locations .howto select{width:100%}#nav-menu-theme-locations .button-controls{text-align:right}.add-menu-item-view-all{height:400px}#menu-container .submit{margin:0 0 10px;padding:0}.meta-sep,.submitdelete,.submitcancel{display:block;float:left;font-size:12px;margin:4px 0;line-height:15px}.meta-sep{padding:0 2px}#cancel-save{text-decoration:underline;font-size:12px;margin-left:20px;margin-top:5px}.list-controls{float:left;margin-top:5px}.add-to-menu{float:right}.postbox img.waiting{display:none;vertical-align:middle}.button-controls{clear:both;margin:10px 0}.show-all,.hide-all{cursor:pointer}.hide-all{display:none}#menu-name{width:270px}#manage-menu .inside{padding:0}#available-links dt{display:block}#add-custom-link .howto{font-size:12px}#add-custom-link label span{display:block;float:left;margin-top:5px;padding-right:5px}.menu-item-textbox{width:180px}.howto span{margin-top:4px;display:block;float:left}.quick-search{width:190px}.list-wrap{display:none;clear:both;margin-bottom:10px}.list-container{max-height:200px;overflow-y:auto;padding:10px 10px 5px;border:1px solid;-moz-border-radius:3px}.postbox p.submit{margin-bottom:0}.list li{display:none;margin:0;margin-bottom:5px}.list li .menu-item-title{cursor:pointer;display:block}.list li .menu-item-title input{margin-right:3px;margin-top:-3px}#menu-container .inside{padding-bottom:10px}.menu{padding-top:1em}#menu-to-edit{padding:1em 0;width:465px}.menu ul{width:100%}.menu li{margin-bottom:0;position:relative;opacity:1.0}.menu-item-bar{clear:both;line-height:1.5em;position:relative;margin-top:13px}.menu-item-handle{border:1px solid #dfdfdf;position:relative;padding-left:10px;height:auto;width:400px;line-height:35px;text-shadow:0 1px 0 #fff;overflow:hidden;word-wrap:break-word;border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px}#menu-to-edit .menu-item-invalid .menu-item-handle{background-color:#f6c9cc;background-image:-ms-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:-moz-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:-o-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:-webkit-gradient(linear,left bottom,left top,from(#f6c9cc),to(#fdf8ff));background-image:-webkit-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:linear-gradient(bottom,#f6c9cc,#fdf8ff)}.menu-item-edit-active .menu-item-handle{-moz-border-radius:3px 3px 0 0;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:0;-khtml-border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.no-js .menu-item-edit-active .item-edit{display:none}.js .menu-item-handle{cursor:move}.menu li.deleting .menu-item-handle{background-image:none;text-shadow:0}.menu-item-handle .item-title{font-size:12px;font-weight:bold;padding:7px 0;line-height:20px;display:block;margin-right:13em}li.menu-item.ui-sortable-helper dl{margin-top:0}li.menu-item.ui-sortable-helper .menu-item-transport dl{margin-top:13px}.menu .sortable-placeholder{height:35px;min-height:35px;width:410px;margin-top:13px}.menu-item-depth-0{margin-left:0}.menu-item-depth-1{margin-left:30px}.menu-item-depth-2{margin-left:60px}.menu-item-depth-3{margin-left:90px}.menu-item-depth-4{margin-left:120px}.menu-item-depth-5{margin-left:150px}.menu-item-depth-6{margin-left:180px}.menu-item-depth-7{margin-left:210px}.menu-item-depth-8{margin-left:240px}.menu-item-depth-9{margin-left:270px}.menu-item-depth-10{margin-left:300px}.menu-item-depth-11{margin-left:330px}.menu-item-depth-0 .menu-item-transport{margin-left:0}.menu-item-depth-1 .menu-item-transport{margin-left:-30px}.menu-item-depth-2 .menu-item-transport{margin-left:-60px}.menu-item-depth-3 .menu-item-transport{margin-left:-90px}.menu-item-depth-4 .menu-item-transport{margin-left:-120px}.menu-item-depth-5 .menu-item-transport{margin-left:-150px}.menu-item-depth-6 .menu-item-transport{margin-left:-180px}.menu-item-depth-7 .menu-item-transport{margin-left:-210px}.menu-item-depth-8 .menu-item-transport{margin-left:-240px}.menu-item-depth-9 .menu-item-transport{margin-left:-270px}.menu-item-depth-10 .menu-item-transport{margin-left:-300px}.menu-item-depth-11 .menu-item-transport{margin-left:-330px}body.menu-max-depth-0{min-width:950px!important}body.menu-max-depth-1{min-width:980px!important}body.menu-max-depth-2{min-width:1010px!important}body.menu-max-depth-3{min-width:1040px!important}body.menu-max-depth-4{min-width:1070px!important}body.menu-max-depth-5{min-width:1100px!important}body.menu-max-depth-6{min-width:1130px!important}body.menu-max-depth-7{min-width:1160px!important}body.menu-max-depth-8{min-width:1190px!important}body.menu-max-depth-9{min-width:1220px!important}body.menu-max-depth-10{min-width:1250px!important}body.menu-max-depth-11{min-width:1280px!important}.item-type{font-size:12px;padding-right:10px}.item-controls{font-size:12px;position:absolute;right:20px;top:0}.item-controls a{text-decoration:none}.item-controls a:hover{cursor:pointer}.item-controls .item-order{padding-right:10px}.item-controls .item-order a{font-weight:bold}body.js .item-order{display:none}.item-edit{position:absolute;right:-20px;top:0;display:block;width:30px;height:36px;overflow:hidden;text-indent:-999em;background:url("arrows.png") no-repeat scroll 8px 10px transparent}.item-edit:hover{background:url("arrows.png") no-repeat scroll 8px 10px transparent}.item-edit.opened{background:url("arrows.png") no-repeat scroll 8px -25px transparent}.item-edit.opened:hover{background:url("arrows.png") no-repeat scroll 8px -149px transparent}.menu-instructions-inactive{display:none}.menu-item-settings{display:block;width:400px;padding:10px 0 10px 10px;border:solid;border-width:0 1px 1px 1px;-moz-border-radius:0 0 3px 3px;-webkit-border-bottom-right-radius:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-right-radius:3px;-khtml-border-bottom-left-radius:3px}.menu-item-edit-active .menu-item-settings{display:block}.menu-item-edit-inactive .menu-item-settings{display:none}.add-menu-item-pagelinks{margin:.5em auto;text-align:center}.link-to-original{display:block;margin:0 0 10px;padding:3px 5px 5px;font-size:12px;font-style:italic;border:1px solid;border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px}.link-to-original a{padding-left:4px;font-style:normal}.hidden-field{display:none}#form-settings .description-thin{margin:12px 10px 12px 0}.description-thin,.description-wide{margin-right:10px;float:left}.description-thin{width:190px;height:40px}.description-wide{width:390px}.menu-item-actions{padding-top:15px}#cancel-save{cursor:pointer}.major-publishing-actions{clear:both;padding:3px 0 5px}.major-publishing-actions .publishing-action{text-align:right;float:right;line-height:23px;margin:10px 0 1px}.major-publishing-actions .delete-action{vertical-align:middle;text-align:left;float:left;padding-right:15px;margin-top:5px}.menu-name-label span,.auto-add-pages label{font-size:12px;font-style:normal}.menu-name-label{margin-right:15px}.auto-add-pages input{margin-top:0}.auto-add-pages{margin-top:4px;float:left}.submitbox .submitcancel{border-bottom:1px solid;padding:1px 2px;text-decoration:none}.major-publishing-actions .form-invalid{padding-left:4px;margin-left:-4px;border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px}#menu-item-name-wrap:after,#menu-item-url-wrap:after,#menu-name-label:after,#menu-settings-column .inside:after,#nav-menus-frame:after,#post-body-content:after,.button-controls:after,.major-publishing-actions:after,.menu-item-settings:after{clear:both;content:".";display:block;height:0;visibility:hidden}#nav-menus-frame,.button-controls,#menu-item-url-wrap,#menu-item-name-wrap{display:block}.option .widefat{width:345px;margin:0 6px 7px 0}.addOption,.deleteOption,.addEmail,.deleteEmail{background:url('sprite.png') -12px -650px no-repeat transparent;text-indent:-9999px;width:16px;height:16px;display:inline-block}.deleteOption,.deleteEmail{background-position:-12px -677px}.addEmail,.deleteEmail{margin-top:5px}.ui-state-disabled .menu-item-handle{cursor:default}.ui-state-disabled .menu-item-handle{background-image:-moz-linear-gradient(top,#fff 0,#bbb 100%);background-image:-o-linear-gradient(top,#fff 0,#bbb 100%);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fff),color-stop(1,#bbb));background-image:linear-gradient(top,#fff 0,#bbb 100%)}
|
1 |
+
html,body{min-width:950px}#nav-menus-frame{margin-left:300px}#wpbody-content #menu-settings-column{display:inline;width:281px;margin-left:-300px;clear:both;float:left;padding-top:24px}.no-js #wpbody-content #menu-settings-column{padding-top:31px}#menu-settings-column .inside{clear:both}.metabox-holder-disabled .postbox{opacity:.5;filter:alpha(opacity=50)}.metabox-holder-disabled .button-controls .select-all{display:none}#wpbody{position:relative}#menu-management-liquid{float:left;min-width:100%}#menu-management{position:relative;margin-right:20px;margin-top:-3px;width:100%}#menu-management .menu-edit{border:1px solid;-moz-border-radius:3px;-webkit-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;margin-bottom:20px}#post-body{padding:10px;border-width:1px 0;border-style:solid}#nav-menu-header,#nav-menu-footer{padding:0 10px}#nav-menu-header{border-bottom:1px solid}#nav-menu-footer{border-top:1px solid}#post-body div.updated,#post-body div.error{margin:0}#vfb-entries-body-content{position:relative;float:none}#menu-management .menu-add-new abbr{font-weight:bold}#menu-management .nav-tabs-nav{margin:0 20px}#menu-management .nav-tabs-arrow{width:10px;padding:0 5px 4px;cursor:pointer;position:absolute;top:0;line-height:22px;font-size:18px;text-shadow:0 1px 0 #fff}#menu-management .nav-tabs-arrow-left{left:0}#menu-management .nav-tabs-arrow-right{right:0;text-align:right}#menu-management .nav-tabs-wrapper{width:100%;height:28px;margin-bottom:-1px;overflow:hidden}#menu-management .nav-tabs{padding-left:20px;padding-right:10px}.js #menu-management .nav-tabs{float:left;margin-left:0;margin-right:-400px}#menu-management .nav-tab{margin-bottom:0;font-size:14px;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif}#select-nav-menu-container{text-align:right;padding:0 10px 3px 10px;margin-bottom:5px}#select-nav-menu{width:100px;display:inline}#menu-name-label{margin-top:-2px}#wpbody .open-label{display:block;float:left}#wpbody .open-label span{padding-right:10px}.js .input-with-default-title{font-style:italic}#menu-management .inside{padding:0 10px}.postbox .howto input{width:180px;float:right}.customlinkdiv .howto input{width:200px}#nav-menu-theme-locations .howto select{width:100%}#nav-menu-theme-locations .button-controls{text-align:right}.add-menu-item-view-all{height:400px}#menu-container .submit{margin:0 0 10px;padding:0}.meta-sep,.submitdelete,.submitcancel{display:block;float:left;font-size:12px;margin:4px 0;line-height:15px}.meta-sep{padding:0 2px}#cancel-save{text-decoration:underline;font-size:12px;margin-left:20px;margin-top:5px}.list-controls{float:left;margin-top:5px}.add-to-menu{float:right}.postbox img.waiting{display:none;vertical-align:middle}.button-controls{clear:both;margin:10px 0}.show-all,.hide-all{cursor:pointer}.hide-all{display:none}#menu-name{width:270px}#manage-menu .inside{padding:0}#available-links dt{display:block}#add-custom-link .howto{font-size:12px}#add-custom-link label span{display:block;float:left;margin-top:5px;padding-right:5px}.menu-item-textbox{width:180px}.howto span{margin-top:4px;display:block;float:left}.quick-search{width:190px}.list-wrap{display:none;clear:both;margin-bottom:10px}.list-container{max-height:200px;overflow-y:auto;padding:10px 10px 5px;border:1px solid;-moz-border-radius:3px}.postbox p.submit{margin-bottom:0}.list li{display:none;margin:0;margin-bottom:5px}.list li .menu-item-title{cursor:pointer;display:block}.list li .menu-item-title input{margin-right:3px;margin-top:-3px}#menu-container .inside{padding-bottom:10px}.menu{padding-top:1em}#menu-to-edit{padding:1em 0;width:465px}.menu ul{width:100%}.menu li{margin-bottom:0;position:relative;opacity:1.0}.menu-item-bar{clear:both;line-height:1.5em;position:relative;margin-top:13px}.menu-item-handle{border:1px solid #dfdfdf;position:relative;padding-left:10px;height:auto;width:400px;line-height:35px;text-shadow:0 1px 0 #fff;overflow:hidden;word-wrap:break-word;border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px}#menu-to-edit .menu-item-invalid .menu-item-handle{background-color:#f6c9cc;background-image:-ms-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:-moz-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:-o-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:-webkit-gradient(linear,left bottom,left top,from(#f6c9cc),to(#fdf8ff));background-image:-webkit-linear-gradient(bottom,#f6c9cc,#fdf8ff);background-image:linear-gradient(bottom,#f6c9cc,#fdf8ff)}.menu-item-edit-active .menu-item-handle{-moz-border-radius:3px 3px 0 0;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-khtml-border-bottom-right-radius:0;-khtml-border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.no-js .menu-item-edit-active .item-edit{display:none}.js .menu-item-handle{cursor:move}.menu li.deleting .menu-item-handle{background-image:none;text-shadow:0}.menu-item-handle .item-title{font-size:12px;font-weight:bold;padding:7px 0;line-height:20px;display:block;margin-right:13em}li.menu-item.ui-sortable-helper dl{margin-top:0}li.menu-item.ui-sortable-helper .menu-item-transport dl{margin-top:13px}.menu .sortable-placeholder{height:35px;min-height:35px;width:410px;margin-top:13px}.menu-item-depth-0{margin-left:0}.menu-item-depth-1{margin-left:30px}.menu-item-depth-2{margin-left:60px}.menu-item-depth-3{margin-left:90px}.menu-item-depth-4{margin-left:120px}.menu-item-depth-5{margin-left:150px}.menu-item-depth-6{margin-left:180px}.menu-item-depth-7{margin-left:210px}.menu-item-depth-8{margin-left:240px}.menu-item-depth-9{margin-left:270px}.menu-item-depth-10{margin-left:300px}.menu-item-depth-11{margin-left:330px}.menu-item-depth-0 .menu-item-transport{margin-left:0}.menu-item-depth-1 .menu-item-transport{margin-left:-30px}.menu-item-depth-2 .menu-item-transport{margin-left:-60px}.menu-item-depth-3 .menu-item-transport{margin-left:-90px}.menu-item-depth-4 .menu-item-transport{margin-left:-120px}.menu-item-depth-5 .menu-item-transport{margin-left:-150px}.menu-item-depth-6 .menu-item-transport{margin-left:-180px}.menu-item-depth-7 .menu-item-transport{margin-left:-210px}.menu-item-depth-8 .menu-item-transport{margin-left:-240px}.menu-item-depth-9 .menu-item-transport{margin-left:-270px}.menu-item-depth-10 .menu-item-transport{margin-left:-300px}.menu-item-depth-11 .menu-item-transport{margin-left:-330px}body.menu-max-depth-0{min-width:950px!important}body.menu-max-depth-1{min-width:980px!important}body.menu-max-depth-2{min-width:1010px!important}body.menu-max-depth-3{min-width:1040px!important}body.menu-max-depth-4{min-width:1070px!important}body.menu-max-depth-5{min-width:1100px!important}body.menu-max-depth-6{min-width:1130px!important}body.menu-max-depth-7{min-width:1160px!important}body.menu-max-depth-8{min-width:1190px!important}body.menu-max-depth-9{min-width:1220px!important}body.menu-max-depth-10{min-width:1250px!important}body.menu-max-depth-11{min-width:1280px!important}.item-type{font-size:12px;padding-right:10px}.item-controls{font-size:12px;position:absolute;right:20px;top:0}.item-controls a{text-decoration:none}.item-controls a:hover{cursor:pointer}.item-controls .item-order{padding-right:10px}.item-controls .item-order a{font-weight:bold}body.js .item-order{display:none}.item-edit{position:absolute;right:-20px;top:0;display:block;width:30px;height:36px;overflow:hidden;text-indent:-999em;background:url("arrows.png") no-repeat scroll 8px 10px transparent}.item-edit:hover{background:url("arrows.png") no-repeat scroll 8px 10px transparent}.item-edit.opened{background:url("arrows.png") no-repeat scroll 8px -25px transparent}.item-edit.opened:hover{background:url("arrows.png") no-repeat scroll 8px -149px transparent}.menu-instructions-inactive{display:none}.menu-item-settings{display:block;width:400px;padding:10px 0 10px 10px;border:solid;border-width:0 1px 1px 1px;-moz-border-radius:0 0 3px 3px;-webkit-border-bottom-right-radius:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-right-radius:3px;-khtml-border-bottom-left-radius:3px}.menu-item-edit-active .menu-item-settings{display:block}.menu-item-edit-inactive .menu-item-settings{display:none}.add-menu-item-pagelinks{margin:.5em auto;text-align:center}.link-to-original{display:block;margin:0 0 10px;padding:3px 5px 5px;font-size:12px;font-style:italic;border:1px solid;border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px}.link-to-original a{padding-left:4px;font-style:normal}.hidden-field{display:none}#form-settings .description-thin{margin:12px 10px 12px 0}.description-thin,.description-wide{margin-right:10px;float:left}.description-thin{width:190px;height:40px}.description-wide{width:390px}.menu-item-actions{padding-top:15px}#cancel-save{cursor:pointer}.major-publishing-actions{clear:both;padding:3px 0 5px}.major-publishing-actions .publishing-action{text-align:right;float:right;line-height:23px;margin:10px 0 1px}.major-publishing-actions .delete-action{vertical-align:middle;text-align:left;float:left;padding-right:15px;margin-top:5px}.menu-name-label span,.auto-add-pages label{font-size:12px;font-style:normal}.menu-name-label{margin-right:15px}.auto-add-pages input{margin-top:0}.auto-add-pages{margin-top:4px;float:left}.submitbox .submitcancel{border-bottom:1px solid;padding:1px 2px;text-decoration:none}.major-publishing-actions .form-invalid{padding-left:4px;margin-left:-4px;border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px}.has-right-sidebar .inner-sidebar{display:block}.inner-sidebar{clear:right;float:right;position:relative;width:281px}.has-right-sidebar #vfb-entries-body-content{margin-right:300px}.inner-side #side-sortables{min-height:300px;padding:0;width:280px}#menu-item-name-wrap:after,#menu-item-url-wrap:after,#menu-name-label:after,#menu-settings-column .inside:after,#nav-menus-frame:after,#vfb-entries-body-content:after,.button-controls:after,.major-publishing-actions:after,.menu-item-settings:after{clear:both;content:".";display:block;height:0;visibility:hidden}#nav-menus-frame,.button-controls,#menu-item-url-wrap,#menu-item-name-wrap{display:block}.option .widefat{width:325px;margin:0 6px 7px 0}.addOption,.deleteOption,.addEmail,.deleteEmail{background:url('sprite.png') -12px -650px no-repeat transparent;text-indent:-9999px;width:16px;height:16px;display:inline-block}.deleteOption,.deleteEmail{background-position:-12px -677px}.addEmail,.deleteEmail{margin-top:5px}.ui-state-disabled .menu-item-handle{cursor:default}.ui-state-disabled .menu-item-handle{background-image:-moz-linear-gradient(top,#fff 0,#bbb 100%);background-image:-o-linear-gradient(top,#fff 0,#bbb 100%);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fff),color-stop(1,#bbb));background-image:linear-gradient(top,#fff 0,#bbb 100%)}
|
css/vfb_icon.png
ADDED
Binary file
|
js/visual-form-builder.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(g){var b=null;g(document).on("mouseenter mouseleave",".vfb-tooltip",function(t){if(t.type=="mouseenter"){if(b){clearTimeout(b);b=null}var q=g(this).attr("title"),s=g(this).attr("rel"),r=g(this).width();g(this).append('<div class="tooltip"><h3>'+q+'</h3><p class="text">'+s+"</p></div>");g.data(this,"title",q);this.title="";g(this).find(".tooltip").css({left:r+22});b=setTimeout(function(){g(".tooltip").fadeIn(300)},500)}else{this.title=g.data(this,"title");g(".tooltip").fadeOut(500);g(this).children().remove()}});g(document).on("click","a.addOption",function(w){w.preventDefault();var r=g(this).parent().parent().find(".clonedOption").length;var v=r+1;var x=g(this).closest("div").attr("id");var u=g(this).closest("div").children("label").attr("for");var q=u.replace(new RegExp(/(\d+)$/g),"");var t=x.replace(new RegExp(/(\d+)$/g),"");var s=g("#"+x).clone().attr("id",t+v);s.children("label").attr("for",q+v);s.find("input").attr("id",q+v);g("#"+t+r).after(s)});g(document).on("click","a.deleteOption",function(r){r.preventDefault();var q=g(this).parent().parent().find(".clonedOption").length;if(q-1==0){alert("You must have at least one option.")}else{g(this).closest("div").remove()}});g(document).on("click","a.addEmail",function(w){w.preventDefault();var r=g(this).closest("#email-details").find(".clonedOption").length;var v=r+1;var x=g(this).closest("div").attr("id");var u=g(this).closest("div").find("label").attr("for");var q=u.replace(new RegExp(/(\d+)$/g),"");var t=x.replace(new RegExp(/(\d+)$/g),"");var s=g("#"+x).clone().attr("id",t+v);s.find("label").attr("for",q+v);s.find("input").attr("id",q+v);g("#"+t+r).after(s)});g(document).on("click","a.deleteEmail",function(r){r.preventDefault();var q=g(this).closest("#email-details").find(".clonedOption").length;if(q-1==0){alert("You must have at least one option.")}else{g(this).closest("div").remove()}});g(".menu-delete, .entry-delete").click(function(){var q=(g(this).hasClass("entry-delete"))?"entry":"form";var r=confirm("You are about to permanently delete this "+q+" and all of its data.\n'Cancel' to stop, 'OK' to delete.");if(r){return true}return false});g(document).on("click","a.item-edit",function(q){q.preventDefault();g(q.target).closest("li").children(".menu-item-settings").slideToggle("fast");g(this).toggleClass("opened")});g("#form-copy-to-clipboard").focus(function(){this.select()});var f=g(".nav-tabs-wrapper"),j=f.children(".nav-tabs"),e=j.children(".nav-tab-active"),l=j.children(".nav-tab"),c=0,n,d,i={},k,a="margin-left",p="margin-right",m=2;l.each(function(){c+=g(this).outerWidth(true)});i.padding=0;i[p]=(-1*c)+"px";j.css(i);h();function h(){if(f.length){var s=f.width(),r=0,q={};d=f.offset().left;n=d+s;e.makeTabVisible(d,n,j,a,m);if(l.last().isTabVisible(d,n)){r=f.width()-c;r=r>0?0:r;q[a]=r+"px";j.animate(q,100,"linear")}if(s>c){g(".nav-tabs-arrow-right, .nav-tabs-arrow-left").hide()}else{g(".nav-tabs-arrow-right, .nav-tabs-arrow-left").show()}}}g(window).resize(function(){if(k){clearTimeout(k)}k=setTimeout(h,200)});g(".nav-tabs-arrow-right").mousedown(function(){var s=Math.abs(parseInt(j.css(a))),q=s,r={};q=Math.abs(c-f.width())-s;if(!q){return}r[a]="-="+q+"px";j.animate(r,q*m,"linear")}).mouseup(function(){j.stop(true)});g(".nav-tabs-arrow-left").mousedown(function(){var s=Math.abs(parseInt(j.css(a))),q=s,r={};if(!q){return}r[a]="+="+q+"px";j.animate(r,q*m,"linear")}).mouseup(function(){j.stop(true)});g("#menu-to-edit").nestedSortable({listType:"ul",maxLevels:3,handle:".menu-item-handle",placeholder:"sortable-placeholder",tolerance:"pointer",toleranceElement:"> dl",items:"li:not(.ui-state-disabled)",create:function(q,r){g(this).css("min-height",g(this).height())},start:function(q,r){r.placeholder.height(r.item.height())},stop:function(q,r){opts={url:ajaxurl,type:"POST",async:true,cache:false,dataType:"json",data:{action:"visual_form_builder_process_sort",order:g(this).nestedSortable("toArray")},success:function(s){g("#loading-animation").hide();return}};g.ajax(opts)}});g('#form-items input[type="submit"]').click(function(){g(this).closest("form").data("submit_value",g(this))});g(document).on("submit","#form-items",function(r){r.preventDefault();var s=g(this).serializeArray(),q=g(this).data("submit_value").attr("value");g("img.waiting").show();g.ajax({url:ajaxurl,type:"POST",async:true,cache:false,dataType:"html",data:{action:"visual_form_builder_create_field",data:s,field_type:q,page:pagenow,nonce:g("#_wpnonce").val()},success:function(t){g("img.waiting").hide();g(t).hide().insertBefore("#menu-to-edit li.ui-state-disabled:first").fadeIn();return},error:function(u,v,t){alert(u+" "+v+" "+t);return}})});g(document).on("click","a.item-delete",function(x){x.preventDefault();var v=childs=new Array(),B=0,r=g(this).attr("href"),q=r.split("&");for(var w=0;w<q.length;w++){var z=q[w].indexOf("=");var y=q[w].substring(0,z);var A=q[w].substring(z+1);v[y]=A}var s=g(this).closest(".form-item").find("ul").children();var u=s.parent().html();s.each(function(t){childs[t]=g(this).attr("id").match(new RegExp(/(\d+)$/g))[0]});var C=g(this).closest("li.form-item").parents("li.form-item");if(C.length){B=C.attr("id").match(new RegExp(/(\d+)$/g))[0]}g.ajax({url:ajaxurl,type:"POST",async:true,cache:false,dataType:"html",data:{action:"visual_form_builder_delete_field",form:v.form,field:v.field,child_ids:childs,parent_id:B,page:pagenow,nonce:v._wpnonce},success:function(t){g("#form_item_"+v.field).addClass("deleting").animate({opacity:0,height:0},350,function(){g(this).before(u).remove()});return},error:function(D,E,t){alert("There was an error loading the content");return}})});g("#form-settings-button").click(function(s){s.preventDefault();g(this).toggleClass("current");g("#form-settings").slideToggle();var q=g('input[name="form_id"]').val(),r=(g(this).hasClass("current"))?"opened":"closed";g.ajax({url:ajaxurl,type:"POST",async:true,cache:false,data:{action:"visual_form_builder_form_settings",form:q,status:r,page:pagenow},success:function(t){if(r=="closed"){g(".settings-links").removeClass("on");g(".settings-links:first").addClass("on");g(".form-details").slideUp("normal");g(".form-details:first").show("normal")}},error:function(u,v,t){alert("There was an error loading the content");return}})});g(".settings-links").click(function(s){s.preventDefault();g(".settings-links").removeClass("on");g(".form-details").slideUp("normal");if(g(this).next("div").is(":hidden")==true){g(this).addClass("on");g(this).next().slideDown("normal")}var r=g('input[name="form_id"]').val(),q=this.hash.replace(/#/g,"");g.ajax({url:ajaxurl,type:"POST",async:true,cache:false,data:{action:"visual_form_builder_form_settings",form:r,accordion:q,page:pagenow},success:function(t){},error:function(u,v,t){alert("There was an error loading the content");return}})});var o=g(".form-success-type:checked").val();g("#form-success-message-"+o).show();g(".form-success-type").change(function(){var q=g(this).val();if("text"==q){g("#form-success-message-text").show();g("#form-success-message-page, #form-success-message-redirect").hide()}else{if("page"==q){g("#form-success-message-page").show();g("#form-success-message-text, #form-success-message-redirect").hide()}else{if("redirect"==q){g("#form-success-message-redirect").show();g("#form-success-message-text, #form-success-message-page").hide()}}}});g(".vfb-field-types").click(function(r){r.preventDefault();g("#vfb-field-tabs li").removeClass("tabs");g(this).parent().addClass("tabs");g(".tabs-panel-active").removeClass("tabs-panel-active").addClass("tabs-panel-inactive");var q=this.hash;g(q).removeClass("tabs-panel-inactive").addClass("tabs-panel-active")});g("#visual-form-builder-update").validate({rules:{"form_email_to[]":{email:true},form_email_from:{email:true},form_success_message_redirect:{url:true},form_notification_email_name:{required:function(q){return g("#form-notification-setting").is(":checked")}},form_notification_email_from:{required:function(q){return g("#form-notification-setting").is(":checked")},email:true},form_notification_email:{required:function(q){return g("#form-notification-setting").is(":checked")}}},errorPlacement:function(q,r){q.insertAfter(r.parent())}});g("#form_email_from_name_override").change(function(){if(g("#form_email_from_name_override").val()==""){g("#form-email-sender-name").attr("readonly",false)}else{g("#form-email-sender-name").attr("readonly","readonly")}});g("#form_email_from_override").change(function(){if(g("#form_email_from_override").val()==""){g("#form-email-sender").attr("readonly",false)}else{g("#form-email-sender").attr("readonly","readonly")}});if(g("#form-notification-setting").is(":checked")){g("#notification-email").show()}else{g("#notification-email").hide()}g("#form-notification-setting").change(function(){var q=g(this).is(":checked");if(q){g("#notification-email").show();g("#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry").attr("disabled",false)}else{g("#notification-email").hide();g("#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry").attr("disabled","disabled")}});g.validator.addMethod("multiemail",function(s,r){if(this.optional(r)){return true}var t=s.split(new RegExp("\\s*[,|;]\\s*","gi"));valid=true;for(var q in t){s=t[q];valid=valid&&jQuery.validator.methods.email.call(this,s,r)}return valid},"One or more email addresses are invalid")});jQuery.fn.extend({makeTabVisible:function(d,h,f,b,g){var j=this.eq(0),c,i,e={},a=0;if(!j.length){return this}c=j.offset().left;i=c+j.outerWidth();if(i>h){a=h-i}else{if(c<d){a=d-c}}if(!a){return this}e[b]="+="+1*a+"px";f.animate(e,Math.abs(a)*g,"linear");return this},isTabVisible:function(e,d){var b=this.eq(0),c=b.offset().left,a=c+b.outerWidth();return(a<=d&&c>=e)?true:false}});
|
1 |
+
jQuery(document).ready(function(g){var b=null;g(document).on("mouseenter mouseleave",".vfb-tooltip",function(t){if(t.type=="mouseenter"){if(b){clearTimeout(b);b=null}var q=g(this).attr("title"),s=g(this).attr("rel"),r=g(this).width();g(this).append('<div class="tooltip"><h3>'+q+'</h3><p class="text">'+s+"</p></div>");g.data(this,"title",q);this.title="";g(this).find(".tooltip").css({left:r+22});b=setTimeout(function(){g(".tooltip").fadeIn(300)},500)}else{this.title=g.data(this,"title");g(".tooltip").fadeOut(500);g(this).children().remove()}});g(document).on("click","a.addOption",function(w){w.preventDefault();var r=g(this).parent().parent().find(".clonedOption").length;var v=r+1;var x=g(this).closest("div").attr("id");var u=g(this).closest("div").children("label").attr("for");var q=u.replace(new RegExp(/(\d+)$/g),"");var t=x.replace(new RegExp(/(\d+)$/g),"");var s=g("#"+x).clone().attr("id",t+v);s.children("label").attr("for",q+v);s.find('input[type="text"]').attr("id",q+v);s.find('input[type="radio"]').attr("value",v);g("#"+t+r).after(s)});g(document).on("click","a.deleteOption",function(r){r.preventDefault();var q=g(this).parent().parent().find(".clonedOption").length;if(q-1==0){alert("You must have at least one option.")}else{g(this).closest("div").remove()}});g(document).on("click","a.addEmail",function(w){w.preventDefault();var r=g(this).closest("#email-details").find(".clonedOption").length;var v=r+1;var x=g(this).closest("div").attr("id");var u=g(this).closest("div").find("label").attr("for");var q=u.replace(new RegExp(/(\d+)$/g),"");var t=x.replace(new RegExp(/(\d+)$/g),"");var s=g("#"+x).clone().attr("id",t+v);s.find("label").attr("for",q+v);s.find("input").attr("id",q+v);g("#"+t+r).after(s)});g(document).on("click","a.deleteEmail",function(r){r.preventDefault();var q=g(this).closest("#email-details").find(".clonedOption").length;if(q-1==0){alert("You must have at least one option.")}else{g(this).closest("div").remove()}});g(".menu-delete, .entry-delete").click(function(){var q=(g(this).hasClass("entry-delete"))?"entry":"form";var r=confirm("You are about to permanently delete this "+q+" and all of its data.\n'Cancel' to stop, 'OK' to delete.");if(r){return true}return false});g(document).on("click","a.item-edit",function(q){q.preventDefault();g(q.target).closest("li").children(".menu-item-settings").slideToggle("fast");g(this).toggleClass("opened")});g("#form-copy-to-clipboard").focus(function(){this.select()});var f=g(".nav-tabs-wrapper"),j=f.children(".nav-tabs"),e=j.children(".nav-tab-active"),l=j.children(".nav-tab"),c=0,n,d,i={},k,a="margin-left",p="margin-right",m=2;l.each(function(){c+=g(this).outerWidth(true)});i.padding=0;i[p]=(-1*c)+"px";j.css(i);h();function h(){if(f.length){var s=f.width(),r=0,q={};d=f.offset().left;n=d+s;e.makeTabVisible(d,n,j,a,m);if(l.last().isTabVisible(d,n)){r=f.width()-c;r=r>0?0:r;q[a]=r+"px";j.animate(q,100,"linear")}if(s>c){g(".nav-tabs-arrow-right, .nav-tabs-arrow-left").hide()}else{g(".nav-tabs-arrow-right, .nav-tabs-arrow-left").show()}}}g(window).resize(function(){if(k){clearTimeout(k)}k=setTimeout(h,200)});g(".nav-tabs-arrow-right").mousedown(function(){var s=Math.abs(parseInt(j.css(a))),q=s,r={};q=Math.abs(c-f.width())-s;if(!q){return}r[a]="-="+q+"px";j.animate(r,q*m,"linear")}).mouseup(function(){j.stop(true)});g(".nav-tabs-arrow-left").mousedown(function(){var s=Math.abs(parseInt(j.css(a))),q=s,r={};if(!q){return}r[a]="+="+q+"px";j.animate(r,q*m,"linear")}).mouseup(function(){j.stop(true)});g("#menu-to-edit").nestedSortable({listType:"ul",maxLevels:3,handle:".menu-item-handle",placeholder:"sortable-placeholder",tolerance:"pointer",toleranceElement:"> dl",items:"li:not(.ui-state-disabled)",create:function(q,r){g(this).css("min-height",g(this).height())},start:function(q,r){r.placeholder.height(r.item.height())},stop:function(q,r){opts={url:ajaxurl,type:"POST",async:true,cache:false,dataType:"json",data:{action:"visual_form_builder_process_sort",order:g(this).nestedSortable("toArray")},success:function(s){g("#loading-animation").hide();return}};g.ajax(opts)}});g('#form-items input[type="submit"]').click(function(){g(this).closest("form").data("submit_value",g(this))});g(document).on("submit","#form-items",function(r){r.preventDefault();var s=g(this).serializeArray(),q=g(this).data("submit_value").attr("value");g("img.waiting").show();g.ajax({url:ajaxurl,type:"POST",async:true,cache:false,dataType:"html",data:{action:"visual_form_builder_create_field",data:s,field_type:q,page:pagenow,nonce:g("#_wpnonce").val()},success:function(t){g("img.waiting").hide();g(t).hide().insertBefore("#menu-to-edit li.ui-state-disabled:first").fadeIn();return},error:function(u,v,t){alert(u+" "+v+" "+t);return}})});g(document).on("click","a.item-delete",function(x){x.preventDefault();var v=childs=new Array(),B=0,r=g(this).attr("href"),q=r.split("&");for(var w=0;w<q.length;w++){var z=q[w].indexOf("=");var y=q[w].substring(0,z);var A=q[w].substring(z+1);v[y]=A}var s=g(this).closest(".form-item").find("ul").children();var u=s.parent().html();s.each(function(t){childs[t]=g(this).attr("id").match(new RegExp(/(\d+)$/g))[0]});var C=g(this).closest("li.form-item").parents("li.form-item");if(C.length){B=C.attr("id").match(new RegExp(/(\d+)$/g))[0]}g.ajax({url:ajaxurl,type:"POST",async:true,cache:false,dataType:"html",data:{action:"visual_form_builder_delete_field",form:v.form,field:v.field,child_ids:childs,parent_id:B,page:pagenow,nonce:v._wpnonce},success:function(t){g("#form_item_"+v.field).addClass("deleting").animate({opacity:0,height:0},350,function(){g(this).before(u).remove()});return},error:function(D,E,t){alert("There was an error loading the content");return}})});g("#form-settings-button").click(function(s){s.preventDefault();g(this).toggleClass("current");g("#form-settings").slideToggle();var q=g('input[name="form_id"]').val(),r=(g(this).hasClass("current"))?"opened":"closed";g.ajax({url:ajaxurl,type:"POST",async:true,cache:false,data:{action:"visual_form_builder_form_settings",form:q,status:r,page:pagenow},success:function(t){if(r=="closed"){g(".settings-links").removeClass("on");g(".settings-links:first").addClass("on");g(".form-details").slideUp("normal");g(".form-details:first").show("normal")}},error:function(u,v,t){alert("There was an error loading the content");return}})});g(".settings-links").click(function(s){s.preventDefault();g(".settings-links").removeClass("on");g(".form-details").slideUp("normal");if(g(this).next("div").is(":hidden")==true){g(this).addClass("on");g(this).next().slideDown("normal")}var r=g('input[name="form_id"]').val(),q=this.hash.replace(/#/g,"");g.ajax({url:ajaxurl,type:"POST",async:true,cache:false,data:{action:"visual_form_builder_form_settings",form:r,accordion:q,page:pagenow},success:function(t){},error:function(u,v,t){alert("There was an error loading the content");return}})});var o=g(".form-success-type:checked").val();g("#form-success-message-"+o).show();g(".form-success-type").change(function(){var q=g(this).val();if("text"==q){g("#form-success-message-text").show();g("#form-success-message-page, #form-success-message-redirect").hide()}else{if("page"==q){g("#form-success-message-page").show();g("#form-success-message-text, #form-success-message-redirect").hide()}else{if("redirect"==q){g("#form-success-message-redirect").show();g("#form-success-message-text, #form-success-message-page").hide()}}}});g(".vfb-field-types").click(function(r){r.preventDefault();g("#vfb-field-tabs li").removeClass("tabs");g(this).parent().addClass("tabs");g(".tabs-panel-active").removeClass("tabs-panel-active").addClass("tabs-panel-inactive");var q=this.hash;g(q).removeClass("tabs-panel-inactive").addClass("tabs-panel-active")});g("#visual-form-builder-update").validate({rules:{"form_email_to[]":{email:true},form_email_from:{email:true},form_success_message_redirect:{url:true},form_notification_email_name:{required:function(q){return g("#form-notification-setting").is(":checked")}},form_notification_email_from:{required:function(q){return g("#form-notification-setting").is(":checked")},email:true},form_notification_email:{required:function(q){return g("#form-notification-setting").is(":checked")}}},errorPlacement:function(q,r){q.insertAfter(r.parent())}});g("#form_email_from_name_override").change(function(){if(g("#form_email_from_name_override").val()==""){g("#form-email-sender-name").attr("readonly",false)}else{g("#form-email-sender-name").attr("readonly","readonly")}});g("#form_email_from_override").change(function(){if(g("#form_email_from_override").val()==""){g("#form-email-sender").attr("readonly",false)}else{g("#form-email-sender").attr("readonly","readonly")}});if(g("#form-notification-setting").is(":checked")){g("#notification-email").show()}else{g("#notification-email").hide()}g("#form-notification-setting").change(function(){var q=g(this).is(":checked");if(q){g("#notification-email").show();g("#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry").attr("disabled",false)}else{g("#notification-email").hide();g("#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry").attr("disabled","disabled")}});g.validator.addMethod("multiemail",function(s,r){if(this.optional(r)){return true}var t=s.split(new RegExp("\\s*[,|;]\\s*","gi"));valid=true;for(var q in t){s=t[q];valid=valid&&jQuery.validator.methods.email.call(this,s,r)}return valid},"One or more email addresses are invalid")});jQuery.fn.extend({makeTabVisible:function(d,h,f,b,g){var j=this.eq(0),c,i,e={},a=0;if(!j.length){return this}c=j.offset().left;i=c+j.outerWidth();if(i>h){a=h-i}else{if(c<d){a=d-c}}if(!a){return this}e[b]="+="+1*a+"px";f.animate(e,Math.abs(a)*g,"linear");return this},isTabVisible:function(e,d){var b=this.eq(0),c=b.offset().left,a=c+b.outerWidth();return(a<=d&&c>=e)?true:false}});
|
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¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
|
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.
|
7 |
-
Stable tag: 2.
|
8 |
|
9 |
Build contact forms using a simple, clean interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
|
10 |
|
@@ -60,6 +60,7 @@ Build contact forms using a simple, clean interface. Forms include jQuery valida
|
|
60 |
* Bulk Export to CSV
|
61 |
* Bulk Delete
|
62 |
* Advanced Filtering
|
|
|
63 |
* Collect submitted data as well as date submitted and IP Address
|
64 |
|
65 |
= Customized Confirmation Messages =
|
@@ -168,6 +169,20 @@ To Export Selected:
|
|
168 |
|
169 |
== Changelog ==
|
170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
**Version 2.2**
|
172 |
|
173 |
* Add Label Alignment option
|
@@ -297,6 +312,9 @@ To Export Selected:
|
|
297 |
|
298 |
== Upgrade Notice ==
|
299 |
|
|
|
|
|
|
|
300 |
= 2.2 =
|
301 |
Updated Form Settings UI. Additional SPAM hardening, new inline help tooltips, file uploads now added to Media Library, and a lot more!
|
302 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=G87A9UN9CLPH4&lc=US&item_name=Visual%20Form%20Builder¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
|
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
|
8 |
|
9 |
Build contact forms using a simple, clean interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
|
10 |
|
60 |
* Bulk Export to CSV
|
61 |
* Bulk Delete
|
62 |
* Advanced Filtering
|
63 |
+
* Search across all entries
|
64 |
* Collect submitted data as well as date submitted and IP Address
|
65 |
|
66 |
= Customized Confirmation Messages =
|
169 |
|
170 |
== Changelog ==
|
171 |
|
172 |
+
**Version 2.3**
|
173 |
+
|
174 |
+
* Add media button to Posts/Pages to easily embed forms (thanks to Paul Armstrong Designs!)
|
175 |
+
* Add search feature to Entries
|
176 |
+
* Add Default Value option to fields
|
177 |
+
* Add Default Country option to Address block
|
178 |
+
* Fix bug where Required option was not being set on File Upload fields
|
179 |
+
* Fix bug where Form Name was not required on Add New page
|
180 |
+
* Update and optimize Entries query
|
181 |
+
* Update Security Check messages to be more verbose
|
182 |
+
* Update email formatting to add line breaks
|
183 |
+
* Update how the entries files are included to eliminate PHP notices
|
184 |
+
* Minor updates to CSS
|
185 |
+
|
186 |
**Version 2.2**
|
187 |
|
188 |
* Add Label Alignment option
|
312 |
|
313 |
== Upgrade Notice ==
|
314 |
|
315 |
+
= 2.3 =
|
316 |
+
Added media button, Entries search and default values
|
317 |
+
|
318 |
= 2.2 =
|
319 |
Updated Form Settings UI. Additional SPAM hardening, new inline help tooltips, file uploads now added to Media Library, and a lot more!
|
320 |
|
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.
|
8 |
*/
|
9 |
|
10 |
/*
|
@@ -28,7 +28,9 @@ $visual_form_builder = new Visual_Form_Builder();
|
|
28 |
/* Restrict Categories class */
|
29 |
class Visual_Form_Builder{
|
30 |
|
31 |
-
protected $vfb_db_version = '2.
|
|
|
|
|
32 |
|
33 |
public function __construct(){
|
34 |
global $wpdb;
|
@@ -52,8 +54,12 @@ class Visual_Form_Builder{
|
|
52 |
add_action( 'load-settings_page_visual-form-builder', array( &$this, 'add_contextual_help' ) );
|
53 |
add_action( 'admin_init', array( &$this, 'export_entries' ) );
|
54 |
|
|
|
|
|
|
|
|
|
55 |
/* Load the includes files */
|
56 |
-
add_action( '
|
57 |
|
58 |
/* Adds a Screen Options tab to the Entries screen */
|
59 |
add_action( 'admin_init', array( &$this, 'save_screen_options' ) );
|
@@ -107,6 +113,57 @@ class Visual_Form_Builder{
|
|
107 |
require_once( trailingslashit( plugin_dir_path( __FILE__ ) ) . 'class-entries-detail.php' );
|
108 |
}
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
/**
|
111 |
* Display admin notices
|
112 |
*
|
@@ -271,15 +328,17 @@ class Visual_Form_Builder{
|
|
271 |
* @since 1.4
|
272 |
*/
|
273 |
public function export_entries() {
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
$entries->
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
|
|
|
|
283 |
}
|
284 |
}
|
285 |
|
@@ -317,6 +376,7 @@ class Visual_Form_Builder{
|
|
317 |
field_size VARCHAR(25) DEFAULT 'medium',
|
318 |
field_css VARCHAR(255),
|
319 |
field_layout VARCHAR(255),
|
|
|
320 |
UNIQUE KEY (field_id)
|
321 |
) DEFAULT CHARACTER SET $charset COLLATE $collate;";
|
322 |
|
@@ -391,7 +451,7 @@ class Visual_Form_Builder{
|
|
391 |
*/
|
392 |
public function form_validation() {
|
393 |
wp_enqueue_script( 'jquery-form-validation', 'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js', array( 'jquery' ), '', true );
|
394 |
-
wp_enqueue_script( 'jquery-ui-core ', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.
|
395 |
wp_enqueue_script( 'visual-form-builder-validation', plugins_url( 'visual-form-builder' ) . '/js/visual-form-builder-validate.js' , array( 'jquery', 'jquery-form-validation' ), '', true );
|
396 |
wp_enqueue_script( 'visual-form-builder-quicktags', plugins_url( 'visual-form-builder' ) . '/js/js_quicktags.js' );
|
397 |
wp_enqueue_script( 'visual-form-builder-metadata', plugins_url( 'visual-form-builder' ) . '/js/jquery.metadata.js' , array( 'jquery', 'jquery-form-validation' ), '', true );
|
@@ -604,6 +664,7 @@ class Visual_Form_Builder{
|
|
604 |
$field_size = ( isset( $_REQUEST['field_size-' . $id] ) ) ? esc_html( $_REQUEST['field_size-' . $id] ) : '';
|
605 |
$field_css = ( isset( $_REQUEST['field_css-' . $id] ) ) ? esc_html( $_REQUEST['field_css-' . $id] ) : '';
|
606 |
$field_layout = ( isset( $_REQUEST['field_layout-' . $id] ) ) ? esc_html( $_REQUEST['field_layout-' . $id] ) : '';
|
|
|
607 |
|
608 |
$field_data = array(
|
609 |
'field_key' => $field_key,
|
@@ -615,7 +676,8 @@ class Visual_Form_Builder{
|
|
615 |
'field_size' => $field_size,
|
616 |
'field_css' => $field_css,
|
617 |
'field_layout' => $field_layout,
|
618 |
-
'field_sequence' => $field_sequence
|
|
|
619 |
);
|
620 |
|
621 |
$where = array(
|
@@ -1139,6 +1201,7 @@ class Visual_Form_Builder{
|
|
1139 |
?>
|
1140 |
<div id="clone-<?php echo $field->field_id . '-' . $count; ?>" class="option">
|
1141 |
<label for="edit-form-item-options-<?php echo $field->field_id . "-$count"; ?>" class="clonedOption">
|
|
|
1142 |
<input type="text" value="<?php echo stripslashes( $options ); ?>" name="field_options-<?php echo $field->field_id; ?>[]" class="widefat" id="edit-form-item-options-<?php echo $field->field_id . "-$count"; ?>" />
|
1143 |
</label>
|
1144 |
|
@@ -1279,6 +1342,34 @@ class Visual_Form_Builder{
|
|
1279 |
</select>
|
1280 |
</label>
|
1281 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1282 |
<p class="description description-wide">
|
1283 |
<label for="edit-form-item-css-<?php echo $field->field_id; ?>">
|
1284 |
<?php _e( 'CSS Classes' , 'visual-form-builder'); ?>
|
@@ -1348,7 +1439,12 @@ class Visual_Form_Builder{
|
|
1348 |
|
1349 |
<div class="wrap">
|
1350 |
<?php screen_icon( 'options-general' ); ?>
|
1351 |
-
<h2
|
|
|
|
|
|
|
|
|
|
|
1352 |
<ul class="subsubsub">
|
1353 |
<li><a<?php echo ( !isset( $_REQUEST['view'] ) ) ? ' class="current"' : ''; ?> href="<?php echo admin_url( 'options-general.php?page=visual-form-builder' ); ?>"><?php _e( 'Forms' , 'visual-form-builder'); ?></a> |</li>
|
1354 |
<li><a<?php echo ( isset( $_REQUEST['view'] ) && in_array( $_REQUEST['view'], array( 'entries' ) ) ) ? ' class="current"' : ''; ?> href="<?php echo add_query_arg( 'view', 'entries', admin_url( 'options-general.php?page=visual-form-builder' ) ); ?>"><?php _e( 'Entries' , 'visual-form-builder'); ?></a></li>
|
@@ -1367,7 +1463,10 @@ class Visual_Form_Builder{
|
|
1367 |
$entries_list->prepare_items();
|
1368 |
?>
|
1369 |
<form id="entries-filter" method="post" action="">
|
1370 |
-
<?php
|
|
|
|
|
|
|
1371 |
</form>
|
1372 |
<?php
|
1373 |
endif;
|
@@ -1504,7 +1603,7 @@ class Visual_Form_Builder{
|
|
1504 |
<div class="major-publishing-actions">
|
1505 |
<label for="form-name" class="menu-name-label howto open-label">
|
1506 |
<span class="sender-labels"><?php _e( 'Form Name' , 'visual-form-builder'); ?></span>
|
1507 |
-
<input type="text" value="<?php echo ( isset( $form_title ) ) ? $form_title : ''; ?>"
|
1508 |
</label>
|
1509 |
<?php
|
1510 |
/* Display sender details and confirmation message if we're on a form, otherwise just the form name */
|
@@ -1566,6 +1665,7 @@ class Visual_Form_Builder{
|
|
1566 |
<br class="clear" />
|
1567 |
</div>
|
1568 |
|
|
|
1569 |
<!-- Email section -->
|
1570 |
<a href="#email-details" class="settings-links<?php echo ( $settings_accordion == 'email-details' ) ? ' on' : ''; ?>">2. Email<span class="arrow"></span></a>
|
1571 |
<div id="email-details" class="form-details<?php echo ( $settings_accordion == 'email-details' ) ? ' on' : ''; ?>">
|
@@ -1836,7 +1936,7 @@ class Visual_Form_Builder{
|
|
1836 |
|
1837 |
if ( !empty( $form_nav_selected_id ) && $form_nav_selected_id !== '0' ) :
|
1838 |
/* Display help text for adding fields */
|
1839 |
-
printf( '<div class="post-body-plain" id="menu-instructions"><p>%s</p></div>', __( '
|
1840 |
|
1841 |
/* Output the fields for each form */
|
1842 |
echo '<ul id="menu-to-edit" class="menu ui-sortable droppable">';
|
@@ -1850,6 +1950,7 @@ class Visual_Form_Builder{
|
|
1850 |
|
1851 |
<?php endif; ?>
|
1852 |
</div>
|
|
|
1853 |
</div>
|
1854 |
<div id="nav-menu-footer">
|
1855 |
<div class="major-publishing-actions">
|
@@ -1961,6 +2062,7 @@ class Visual_Form_Builder{
|
|
1961 |
$validation = ( !empty( $field->field_validation ) ) ? " $field->field_validation" : '';
|
1962 |
$css = ( !empty( $field->field_css ) ) ? " $field->field_css" : '';
|
1963 |
$layout = ( !empty( $field->field_layout ) ) ? " $field->field_layout" : '';
|
|
|
1964 |
|
1965 |
/* Close each section */
|
1966 |
if ( $open_section == true ) {
|
@@ -1971,6 +2073,13 @@ class Visual_Form_Builder{
|
|
1971 |
}
|
1972 |
}
|
1973 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1974 |
if ( $field->field_type == 'fieldset' ) {
|
1975 |
/* Close each fieldset */
|
1976 |
if ( $open_fieldset == true )
|
@@ -2046,9 +2155,9 @@ class Visual_Form_Builder{
|
|
2046 |
case 'phone' :
|
2047 |
|
2048 |
if ( !empty( $field->field_description ) )
|
2049 |
-
$output .= '<span><input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="" class="text ' . $field->field_size . $required . $validation . $css . '" /><label>' . html_entity_decode( stripslashes( $field->field_description ) ) . '</label></span>';
|
2050 |
else
|
2051 |
-
$output .= '<input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="" class="text ' . $field->field_size . $required . $validation . $css . '" />';
|
2052 |
|
2053 |
break;
|
2054 |
|
@@ -2057,7 +2166,7 @@ class Visual_Form_Builder{
|
|
2057 |
if ( !empty( $field->field_description ) )
|
2058 |
$output .= '<span><label>' . html_entity_decode( stripslashes( $field->field_description ) ) . '</label></span>';
|
2059 |
|
2060 |
-
$output .= '<textarea name="vfb-'. esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-'. esc_html( $field->field_key ) . '-' . $field->field_id . '" class="textarea ' . $field->field_size . $required . $css . '"
|
2061 |
|
2062 |
break;
|
2063 |
|
@@ -2071,7 +2180,7 @@ class Visual_Form_Builder{
|
|
2071 |
|
2072 |
/* Loop through each option and output */
|
2073 |
foreach ( $options as $option => $value ) {
|
2074 |
-
$output .= '<option value="' . trim( stripslashes( $value ) ) . '">'. trim( stripslashes( $value ) ) . '</option>';
|
2075 |
}
|
2076 |
|
2077 |
$output .= '</select>';
|
@@ -2090,7 +2199,7 @@ class Visual_Form_Builder{
|
|
2090 |
/* Loop through each option and output */
|
2091 |
foreach ( $options as $option => $value ) {
|
2092 |
$output .= '<span>
|
2093 |
-
<input type="radio" name="vfb-'. $field->field_key . '-' . $field->field_id . '" id="vfb-'. $field->field_key . '-' . $field->field_id . '-' . $option . '" value="'. trim( stripslashes( $value ) ) . '" class="radio' . $required . $css . '" />'.
|
2094 |
' <label for="vfb-' . $field->field_key . '-' . $field->field_id . '-' . $option . '" class="choice">' . trim( stripslashes( $value ) ) . '</label>' .
|
2095 |
'</span>';
|
2096 |
}
|
@@ -2111,7 +2220,7 @@ class Visual_Form_Builder{
|
|
2111 |
/* Loop through each option and output */
|
2112 |
foreach ( $options as $option => $value ) {
|
2113 |
|
2114 |
-
$output .= '<span><input type="checkbox" name="vfb-'. $field->field_key . '-' . $field->field_id . '[]" id="vfb-'. $field->field_key . '-' . $field->field_id . '-' . $option . '" value="'. trim( stripslashes( $value ) ) . '" class="checkbox' . $required . $css . '" />'.
|
2115 |
' <label for="vfb-' . $field->field_key . '-' . $field->field_id . '-' . $option . '" class="choice">' . trim( stripslashes( $value ) ) . '</label></span>';
|
2116 |
}
|
2117 |
|
@@ -2124,7 +2233,6 @@ class Visual_Form_Builder{
|
|
2124 |
if ( !empty( $field->field_description ) )
|
2125 |
$output .= '<span><label>' . html_entity_decode( stripslashes( $field->field_description ) ) . '</label></span>';
|
2126 |
|
2127 |
-
$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" );
|
2128 |
$output .= '<div>
|
2129 |
<span class="full">
|
2130 |
|
@@ -2153,8 +2261,8 @@ class Visual_Form_Builder{
|
|
2153 |
<select class="select' . $required . $css . '" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '[country]" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-country">
|
2154 |
<option selected="selected" value=""></option>';
|
2155 |
|
2156 |
-
foreach ( $countries as $country ) {
|
2157 |
-
$output .= "<option value='$country'>$country</option>";
|
2158 |
}
|
2159 |
|
2160 |
$output .= '</select>
|
@@ -2167,7 +2275,7 @@ class Visual_Form_Builder{
|
|
2167 |
case 'date' :
|
2168 |
|
2169 |
if ( !empty( $field->field_description ) )
|
2170 |
-
$output .= '<span><input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="" class="text vfb-date-picker ' . $field->field_size . $required . $css . '" /><label>' . html_entity_decode( stripslashes( $field->field_description ) ) . '</label></span>';
|
2171 |
else
|
2172 |
$output .= '<input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="" class="text vfb-date-picker ' . $field->field_size . $required . $css . '" />';
|
2173 |
|
@@ -2220,12 +2328,12 @@ class Visual_Form_Builder{
|
|
2220 |
case 'file-upload' :
|
2221 |
|
2222 |
$options = ( is_array( unserialize( $field->field_options ) ) ) ? unserialize( $field->field_options ) : unserialize( $field->field_options );
|
2223 |
-
$accept = ( !empty( $options[0] ) ) ? "{accept:'$options[0]'}" : '';
|
2224 |
|
2225 |
if ( !empty( $field->field_description ) )
|
2226 |
-
$output .= '<span><input type="file" size="35" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="" class="text ' . $field->field_size . $required . $validation . $accept . $css . '" /><label>' . stripslashes( $field->field_description ) . '</label></span>';
|
2227 |
else
|
2228 |
-
$output .= '<input type="file" size="35" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="" class="text ' . $field->field_size . $required . $validation . $accept . $css . '" />';
|
2229 |
|
2230 |
|
2231 |
break;
|
@@ -2303,11 +2411,11 @@ class Visual_Form_Builder{
|
|
2303 |
/* If the verification is set to required, run validation check */
|
2304 |
if ( true == $required && !empty( $secret_field ) )
|
2305 |
if ( !is_numeric( $_REQUEST[ $secret_field ] ) && strlen( $_REQUEST[ $secret_field ] ) !== 2 )
|
2306 |
-
wp_die( __( 'Security check' , 'visual-form-builder') );
|
2307 |
|
2308 |
/* Test if it's a known SPAM bot */
|
2309 |
if ( $this->isBot() )
|
2310 |
-
wp_die( __( 'Security check' , 'visual-form-builder') );
|
2311 |
|
2312 |
/* Basic security check before moving any further */
|
2313 |
if ( isset( $_REQUEST['visual-form-builder-submit'] ) && $_REQUEST['vfb-spam'] == '' ) :
|
@@ -2315,7 +2423,7 @@ class Visual_Form_Builder{
|
|
2315 |
|
2316 |
/* Security check to verify the nonce */
|
2317 |
if ( ! wp_verify_nonce( $nonce, 'visual-form-builder-nonce' ) )
|
2318 |
-
wp_die( __( 'Security check' , 'visual-form-builder') );
|
2319 |
|
2320 |
/* Set submitted action to display success message */
|
2321 |
$this->submitted = true;
|
@@ -2325,10 +2433,9 @@ class Visual_Form_Builder{
|
|
2325 |
|
2326 |
/* Query to get all forms */
|
2327 |
$order = sanitize_sql_orderby( 'form_id DESC' );
|
2328 |
-
$query = "SELECT * FROM $this->form_table_name WHERE form_id = $form_id ORDER BY $order";
|
2329 |
|
2330 |
/* Build our forms as an object */
|
2331 |
-
$forms = $wpdb->get_results( $
|
2332 |
|
2333 |
/* Get sender and email details */
|
2334 |
foreach ( $forms as $form ) {
|
@@ -2347,16 +2454,13 @@ class Visual_Form_Builder{
|
|
2347 |
}
|
2348 |
|
2349 |
/* Sender name override query */
|
2350 |
-
$
|
2351 |
-
$senders = $wpdb->get_results( $sender_query );
|
2352 |
|
2353 |
/* Sender email override query */
|
2354 |
-
$
|
2355 |
-
$emails = $wpdb->get_results( $email_query );
|
2356 |
|
2357 |
/* Notification send to email override query */
|
2358 |
-
$
|
2359 |
-
$notification = $wpdb->get_results( $notification_query );
|
2360 |
|
2361 |
/* Loop through name results and assign sender name to override, if needed */
|
2362 |
foreach( $senders as $sender ) {
|
@@ -2378,16 +2482,23 @@ class Visual_Form_Builder{
|
|
2378 |
|
2379 |
/* Query to get all forms */
|
2380 |
$order = sanitize_sql_orderby( 'field_sequence ASC' );
|
2381 |
-
$query = "SELECT field_id, field_key, field_name, field_type, field_options, field_parent FROM $this->field_table_name WHERE form_id = $form_id ORDER BY $order";
|
2382 |
|
2383 |
/* Build our forms as an object */
|
2384 |
-
$fields = $wpdb->get_results( $
|
2385 |
|
2386 |
/* Setup counter for alt rows */
|
2387 |
$i = $points = 0;
|
2388 |
|
|
|
|
|
|
|
2389 |
/* Prepare the beginning of the content */
|
2390 |
-
$
|
|
|
|
|
|
|
|
|
|
|
2391 |
|
2392 |
/* Loop through each form field and build the body of the message */
|
2393 |
foreach ( $fields as $field ) {
|
@@ -2452,12 +2563,12 @@ class Visual_Form_Builder{
|
|
2452 |
'value' => $uploaded_file['url']
|
2453 |
);
|
2454 |
|
2455 |
-
$
|
2456 |
}
|
2457 |
}
|
2458 |
else {
|
2459 |
$value = $_POST[ 'vfb-' . $field->field_key . '-' . $field->field_id ];
|
2460 |
-
$
|
2461 |
}
|
2462 |
}
|
2463 |
/* Everything else */
|
@@ -2533,11 +2644,11 @@ class Visual_Form_Builder{
|
|
2533 |
//if ( $field->field_type !== 'submit' ) {
|
2534 |
if ( !in_array( $field->field_type , array( 'verification', 'secret', 'submit' ) ) ) {
|
2535 |
if ( $field->field_type == 'fieldset' )
|
2536 |
-
$
|
2537 |
elseif ( $field->field_type == 'section' )
|
2538 |
-
$
|
2539 |
else
|
2540 |
-
$
|
2541 |
}
|
2542 |
|
2543 |
$data[] = array(
|
@@ -2568,7 +2679,10 @@ class Visual_Form_Builder{
|
|
2568 |
$wpdb->insert( $this->entries_table_name, $entry );
|
2569 |
|
2570 |
/* Close out the content */
|
2571 |
-
$
|
|
|
|
|
|
|
2572 |
|
2573 |
/* Initialize header filter vars */
|
2574 |
$this->header_from_name = stripslashes( $form_from_name );
|
@@ -2608,12 +2722,16 @@ class Visual_Form_Builder{
|
|
2608 |
$notify_message = ( $form_notification_message !== '' ) ? html_entity_decode( $form_notification_message ) : '';
|
2609 |
|
2610 |
/* Either prepend the notification message to the submitted entry, or send by itself */
|
2611 |
-
|
|
|
|
|
|
|
|
|
2612 |
|
2613 |
$attachments = ( $form_notification_entry !== '' ) ? $attachments : '';
|
2614 |
|
2615 |
/* Send the mail */
|
2616 |
-
wp_mail( $copy_email, esc_html( $form_notification_subject ), $
|
2617 |
endif;
|
2618 |
|
2619 |
elseif ( isset( $_REQUEST['visual-form-builder-submit'] ) ) :
|
@@ -2637,12 +2755,12 @@ class Visual_Form_Builder{
|
|
2637 |
wp_die( __( 'Not a valid email address', 'visual-form-builder' ), '', array( 'back_link' => true ) );
|
2638 |
break;
|
2639 |
|
2640 |
-
case '
|
2641 |
if ( !is_numeric( $data ) )
|
2642 |
-
wp_die( __( 'Not a valid
|
2643 |
break;
|
2644 |
|
2645 |
-
case '
|
2646 |
if ( !is_int( $data ) )
|
2647 |
wp_die( __( 'Not a valid digit. Please enter a number without a decimal point.', 'visual-form-builder' ), '', array( 'back_link' => true ) );
|
2648 |
break;
|
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
|
8 |
*/
|
9 |
|
10 |
/*
|
28 |
/* Restrict Categories class */
|
29 |
class Visual_Form_Builder{
|
30 |
|
31 |
+
protected $vfb_db_version = '2.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 |
|
35 |
public function __construct(){
|
36 |
global $wpdb;
|
54 |
add_action( 'load-settings_page_visual-form-builder', array( &$this, 'add_contextual_help' ) );
|
55 |
add_action( 'admin_init', array( &$this, 'export_entries' ) );
|
56 |
|
57 |
+
/* Adds additional media button to insert form shortcode */
|
58 |
+
add_action( 'media_buttons_context', array( &$this, 'add_media_button' ) );
|
59 |
+
add_action( 'admin_footer', array( &$this, 'display_media_button' ) );
|
60 |
+
|
61 |
/* Load the includes files */
|
62 |
+
add_action( 'load-settings_page_visual-form-builder', array( &$this, 'includes' ) );
|
63 |
|
64 |
/* Adds a Screen Options tab to the Entries screen */
|
65 |
add_action( 'admin_init', array( &$this, 'save_screen_options' ) );
|
113 |
require_once( trailingslashit( plugin_dir_path( __FILE__ ) ) . 'class-entries-detail.php' );
|
114 |
}
|
115 |
|
116 |
+
/**
|
117 |
+
* Adds the media button image
|
118 |
+
*
|
119 |
+
* @since 2.3
|
120 |
+
*/
|
121 |
+
public function add_media_button( $context ){
|
122 |
+
$out = '<a href="#TB_inline?width=450&inlineId=vfb_form" class="thickbox" title="Add Visual Form Builder form"><img src="'. plugins_url( 'visual-form-builder-pro/css/vfb_icon.png' ) . '" alt="Add Visual Form Builder form" /></a>';
|
123 |
+
|
124 |
+
return $context . $out;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Display the additional media button
|
129 |
+
*
|
130 |
+
* Used for inserting the form shortcode with desired form ID
|
131 |
+
*
|
132 |
+
* @since 2.3
|
133 |
+
*/
|
134 |
+
public function display_media_button(){
|
135 |
+
global $wpdb;
|
136 |
+
|
137 |
+
/* Sanitize the sql orderby */
|
138 |
+
$order = sanitize_sql_orderby( 'form_id ASC' );
|
139 |
+
|
140 |
+
/* Build our forms as an object */
|
141 |
+
$forms = $wpdb->get_results( "SELECT form_id, form_title FROM $this->form_table_name ORDER BY $order" );
|
142 |
+
?>
|
143 |
+
<script type="text/javascript">
|
144 |
+
jQuery(document).ready(function($) {
|
145 |
+
$( '#add_vfb_form' ).submit(function(e){
|
146 |
+
e.preventDefault();
|
147 |
+
|
148 |
+
window.send_to_editor( '[vfb id=' + $( '#vfb_forms' ).val() + ']' );
|
149 |
+
});
|
150 |
+
});
|
151 |
+
</script>
|
152 |
+
<div id="vfb_form" style="display:none;">
|
153 |
+
<form id="add_vfb_form" class="media-upload-form type-form validate">
|
154 |
+
<h3 class="media-title">Insert Visual Form Builder Form</h3>
|
155 |
+
<p>Select a form below to insert into any Post or Page.</p>
|
156 |
+
<select id="vfb_forms" name="vfb_forms">
|
157 |
+
<?php foreach( $forms as $form ) : ?>
|
158 |
+
<option value="<?php echo $form->form_id; ?>"><?php echo $form->form_title; ?></option>
|
159 |
+
<?php endforeach; ?>
|
160 |
+
</select>
|
161 |
+
<p><input type="submit" class="button" value="Insert Form" /></p>
|
162 |
+
</form>
|
163 |
+
</div>
|
164 |
+
<?php
|
165 |
+
}
|
166 |
+
|
167 |
/**
|
168 |
* Display admin notices
|
169 |
*
|
328 |
* @since 1.4
|
329 |
*/
|
330 |
public function export_entries() {
|
331 |
+
if ( class_exists( 'VisualFormBuilder_Pro_Entries_List' ) ) {
|
332 |
+
$entries = new VisualFormBuilder_Entries_List();
|
333 |
+
|
334 |
+
/* If exporting all, don't pass the IDs */
|
335 |
+
if ( 'export-all' === $entries->current_action() )
|
336 |
+
$entries->export_entries();
|
337 |
+
/* If exporting selected, pick up the ID array and pass them */
|
338 |
+
elseif ( 'export-selected' === $entries->current_action() ) {
|
339 |
+
$entry_id = ( is_array( $_REQUEST['entry'] ) ) ? $_REQUEST['entry'] : array( $_REQUEST['entry'] );
|
340 |
+
$entries->export_entries( $entry_id );
|
341 |
+
}
|
342 |
}
|
343 |
}
|
344 |
|
376 |
field_size VARCHAR(25) DEFAULT 'medium',
|
377 |
field_css VARCHAR(255),
|
378 |
field_layout VARCHAR(255),
|
379 |
+
field_default TEXT,
|
380 |
UNIQUE KEY (field_id)
|
381 |
) DEFAULT CHARACTER SET $charset COLLATE $collate;";
|
382 |
|
451 |
*/
|
452 |
public function form_validation() {
|
453 |
wp_enqueue_script( 'jquery-form-validation', 'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js', array( 'jquery' ), '', true );
|
454 |
+
wp_enqueue_script( 'jquery-ui-core ', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js', array( 'jquery' ), '', true );
|
455 |
wp_enqueue_script( 'visual-form-builder-validation', plugins_url( 'visual-form-builder' ) . '/js/visual-form-builder-validate.js' , array( 'jquery', 'jquery-form-validation' ), '', true );
|
456 |
wp_enqueue_script( 'visual-form-builder-quicktags', plugins_url( 'visual-form-builder' ) . '/js/js_quicktags.js' );
|
457 |
wp_enqueue_script( 'visual-form-builder-metadata', plugins_url( 'visual-form-builder' ) . '/js/jquery.metadata.js' , array( 'jquery', 'jquery-form-validation' ), '', true );
|
664 |
$field_size = ( isset( $_REQUEST['field_size-' . $id] ) ) ? esc_html( $_REQUEST['field_size-' . $id] ) : '';
|
665 |
$field_css = ( isset( $_REQUEST['field_css-' . $id] ) ) ? esc_html( $_REQUEST['field_css-' . $id] ) : '';
|
666 |
$field_layout = ( isset( $_REQUEST['field_layout-' . $id] ) ) ? esc_html( $_REQUEST['field_layout-' . $id] ) : '';
|
667 |
+
$field_default = ( isset( $_REQUEST['field_default-' . $id] ) ) ? esc_html( $_REQUEST['field_default-' . $id] ) : '';
|
668 |
|
669 |
$field_data = array(
|
670 |
'field_key' => $field_key,
|
676 |
'field_size' => $field_size,
|
677 |
'field_css' => $field_css,
|
678 |
'field_layout' => $field_layout,
|
679 |
+
'field_sequence' => $field_sequence,
|
680 |
+
'field_default' => $field_default
|
681 |
);
|
682 |
|
683 |
$where = array(
|
1201 |
?>
|
1202 |
<div id="clone-<?php echo $field->field_id . '-' . $count; ?>" class="option">
|
1203 |
<label for="edit-form-item-options-<?php echo $field->field_id . "-$count"; ?>" class="clonedOption">
|
1204 |
+
<input type="radio" value="<?php echo $count; ?>" name="field_default-<?php echo $field->field_id; ?>" <?php checked( $field->field_default, $count ); ?> />
|
1205 |
<input type="text" value="<?php echo stripslashes( $options ); ?>" name="field_options-<?php echo $field->field_id; ?>[]" class="widefat" id="edit-form-item-options-<?php echo $field->field_id . "-$count"; ?>" />
|
1206 |
</label>
|
1207 |
|
1342 |
</select>
|
1343 |
</label>
|
1344 |
</p>
|
1345 |
+
<?php if ( !in_array( $field->field_type, array( 'radio', 'select', 'checkbox', 'time', 'address' ) ) ) : ?>
|
1346 |
+
<!-- Default Value -->
|
1347 |
+
<p class="description description-wide">
|
1348 |
+
<label for="edit-form-item-default-<?php echo $field->field_id; ?>">
|
1349 |
+
<?php _e( 'Default Value' , 'visual-form-builder-pro'); ?>
|
1350 |
+
<span class="vfb-tooltip" title="About Default Value" rel="Set a default value that will be inserted automatically.">(?)</span>
|
1351 |
+
<br />
|
1352 |
+
<input type="text" value="<?php echo stripslashes( htmlspecialchars_decode( $field->field_default ) ); ?>" name="field_default-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-default-<?php echo $field->field_id; ?>" maxlength="255" />
|
1353 |
+
</label>
|
1354 |
+
</p>
|
1355 |
+
<?php elseif( in_array( $field->field_type, array( 'address' ) ) ) : ?>
|
1356 |
+
<!-- Default Country -->
|
1357 |
+
<p class="description description-wide">
|
1358 |
+
<label for="edit-form-item-default-<?php echo $field->field_id; ?>">
|
1359 |
+
<?php _e( 'Default Country' , 'visual-form-builder-pro'); ?>
|
1360 |
+
<span class="vfb-tooltip" title="About Default Country" rel="Select the country you would like to be displayed by default.">(?)</span>
|
1361 |
+
<br />
|
1362 |
+
<select name="field_default-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-default-<?php echo $field->field_id; ?>">
|
1363 |
+
<?php
|
1364 |
+
foreach ( $this->countries as $country ) {
|
1365 |
+
echo '<option value="' . $country . '" ' . selected( $field->field_default, $country, 0 ) . '>' . $country . '</option>';
|
1366 |
+
}
|
1367 |
+
?>
|
1368 |
+
</select>
|
1369 |
+
</label>
|
1370 |
+
</p>
|
1371 |
+
<?php endif; ?>
|
1372 |
+
<!-- CSS Classes -->
|
1373 |
<p class="description description-wide">
|
1374 |
<label for="edit-form-item-css-<?php echo $field->field_id; ?>">
|
1375 |
<?php _e( 'CSS Classes' , 'visual-form-builder'); ?>
|
1439 |
|
1440 |
<div class="wrap">
|
1441 |
<?php screen_icon( 'options-general' ); ?>
|
1442 |
+
<h2>
|
1443 |
+
<?php
|
1444 |
+
_e('Visual Form Builder', 'visual-form-builder');
|
1445 |
+
echo ( isset( $_REQUEST['s'] ) && !empty( $_REQUEST['s'] ) && in_array( $_REQUEST['page'], array( 'visual-form-builder' ) ) ) ? '<span class="subtitle">' . sprintf( __( 'Search results for "%s"' , 'visual-form-builder'), $_REQUEST['s'] ) : '';
|
1446 |
+
?>
|
1447 |
+
</h2>
|
1448 |
<ul class="subsubsub">
|
1449 |
<li><a<?php echo ( !isset( $_REQUEST['view'] ) ) ? ' class="current"' : ''; ?> href="<?php echo admin_url( 'options-general.php?page=visual-form-builder' ); ?>"><?php _e( 'Forms' , 'visual-form-builder'); ?></a> |</li>
|
1450 |
<li><a<?php echo ( isset( $_REQUEST['view'] ) && in_array( $_REQUEST['view'], array( 'entries' ) ) ) ? ' class="current"' : ''; ?> href="<?php echo add_query_arg( 'view', 'entries', admin_url( 'options-general.php?page=visual-form-builder' ) ); ?>"><?php _e( 'Entries' , 'visual-form-builder'); ?></a></li>
|
1463 |
$entries_list->prepare_items();
|
1464 |
?>
|
1465 |
<form id="entries-filter" method="post" action="">
|
1466 |
+
<?php
|
1467 |
+
$entries_list->search_box( 'search', 'search_id' );
|
1468 |
+
$entries_list->display();
|
1469 |
+
?>
|
1470 |
</form>
|
1471 |
<?php
|
1472 |
endif;
|
1603 |
<div class="major-publishing-actions">
|
1604 |
<label for="form-name" class="menu-name-label howto open-label">
|
1605 |
<span class="sender-labels"><?php _e( 'Form Name' , 'visual-form-builder'); ?></span>
|
1606 |
+
<input type="text" value="<?php echo ( isset( $form_title ) ) ? $form_title : ''; ?>" placeholder="Enter form name here" class="menu-name regular-text menu-item-textbox required" id="form-name" name="form_title" />
|
1607 |
</label>
|
1608 |
<?php
|
1609 |
/* Display sender details and confirmation message if we're on a form, otherwise just the form name */
|
1665 |
<br class="clear" />
|
1666 |
</div>
|
1667 |
|
1668 |
+
|
1669 |
<!-- Email section -->
|
1670 |
<a href="#email-details" class="settings-links<?php echo ( $settings_accordion == 'email-details' ) ? ' on' : ''; ?>">2. Email<span class="arrow"></span></a>
|
1671 |
<div id="email-details" class="form-details<?php echo ( $settings_accordion == 'email-details' ) ? ' on' : ''; ?>">
|
1936 |
|
1937 |
if ( !empty( $form_nav_selected_id ) && $form_nav_selected_id !== '0' ) :
|
1938 |
/* Display help text for adding fields */
|
1939 |
+
printf( '<div class="post-body-plain" id="menu-instructions"><p>%s</p></div>', __( 'Note: to ensure your form displays and functions correctly, be sure a Fieldset is the first field.' , 'visual-form-builder') );
|
1940 |
|
1941 |
/* Output the fields for each form */
|
1942 |
echo '<ul id="menu-to-edit" class="menu ui-sortable droppable">';
|
1950 |
|
1951 |
<?php endif; ?>
|
1952 |
</div>
|
1953 |
+
<br class="clear" />
|
1954 |
</div>
|
1955 |
<div id="nav-menu-footer">
|
1956 |
<div class="major-publishing-actions">
|
2062 |
$validation = ( !empty( $field->field_validation ) ) ? " $field->field_validation" : '';
|
2063 |
$css = ( !empty( $field->field_css ) ) ? " $field->field_css" : '';
|
2064 |
$layout = ( !empty( $field->field_layout ) ) ? " $field->field_layout" : '';
|
2065 |
+
$default = ( !empty( $field->field_default ) ) ? html_entity_decode( stripslashes( $field->field_default ) ) : '';
|
2066 |
|
2067 |
/* Close each section */
|
2068 |
if ( $open_section == true ) {
|
2073 |
}
|
2074 |
}
|
2075 |
|
2076 |
+
/* Force an initial fieldset and display an error message to strongly encourage user to add one */
|
2077 |
+
if ( $count === 1 && $field->field_type !== 'fieldset' ) {
|
2078 |
+
$output .= '<fieldset class="fieldset"><div class="legend" style="background-color:#FFEBE8;border:1px solid #CC0000;"><h3>Oops! Missing Fieldset</h3><p style="color:black;">If you are seeing this message, it means you need to <strong>add a Fieldset to the beginning of your form</strong>. Your form may not function or display properly without one.</p></div><ul class="section section-' . $count . '">';
|
2079 |
+
|
2080 |
+
$count++;
|
2081 |
+
}
|
2082 |
+
|
2083 |
if ( $field->field_type == 'fieldset' ) {
|
2084 |
/* Close each fieldset */
|
2085 |
if ( $open_fieldset == true )
|
2155 |
case 'phone' :
|
2156 |
|
2157 |
if ( !empty( $field->field_description ) )
|
2158 |
+
$output .= '<span><input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="' . $default . '" class="text ' . $field->field_size . $required . $validation . $css . '" /><label>' . html_entity_decode( stripslashes( $field->field_description ) ) . '</label></span>';
|
2159 |
else
|
2160 |
+
$output .= '<input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="' . $default . '" class="text ' . $field->field_size . $required . $validation . $css . '" />';
|
2161 |
|
2162 |
break;
|
2163 |
|
2166 |
if ( !empty( $field->field_description ) )
|
2167 |
$output .= '<span><label>' . html_entity_decode( stripslashes( $field->field_description ) ) . '</label></span>';
|
2168 |
|
2169 |
+
$output .= '<textarea name="vfb-'. esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-'. esc_html( $field->field_key ) . '-' . $field->field_id . '" class="textarea ' . $field->field_size . $required . $css . '">' . $default . '</textarea>';
|
2170 |
|
2171 |
break;
|
2172 |
|
2180 |
|
2181 |
/* Loop through each option and output */
|
2182 |
foreach ( $options as $option => $value ) {
|
2183 |
+
$output .= '<option value="' . trim( stripslashes( $value ) ) . '"' . selected( $default, ++$option, 0 ) . '">'. trim( stripslashes( $value ) ) . '</option>';
|
2184 |
}
|
2185 |
|
2186 |
$output .= '</select>';
|
2199 |
/* Loop through each option and output */
|
2200 |
foreach ( $options as $option => $value ) {
|
2201 |
$output .= '<span>
|
2202 |
+
<input type="radio" name="vfb-'. $field->field_key . '-' . $field->field_id . '" id="vfb-'. $field->field_key . '-' . $field->field_id . '-' . $option . '" value="'. trim( stripslashes( $value ) ) . '" class="radio' . $required . $css . '"' . checked( $default, ++$option, 0 ) . ' " />'.
|
2203 |
' <label for="vfb-' . $field->field_key . '-' . $field->field_id . '-' . $option . '" class="choice">' . trim( stripslashes( $value ) ) . '</label>' .
|
2204 |
'</span>';
|
2205 |
}
|
2220 |
/* Loop through each option and output */
|
2221 |
foreach ( $options as $option => $value ) {
|
2222 |
|
2223 |
+
$output .= '<span><input type="checkbox" name="vfb-'. $field->field_key . '-' . $field->field_id . '[]" id="vfb-'. $field->field_key . '-' . $field->field_id . '-' . $option . '" value="'. trim( stripslashes( $value ) ) . '" class="checkbox' . $required . $css . '"' . checked( $default, ++$option, 0 ) . ' />'.
|
2224 |
' <label for="vfb-' . $field->field_key . '-' . $field->field_id . '-' . $option . '" class="choice">' . trim( stripslashes( $value ) ) . '</label></span>';
|
2225 |
}
|
2226 |
|
2233 |
if ( !empty( $field->field_description ) )
|
2234 |
$output .= '<span><label>' . html_entity_decode( stripslashes( $field->field_description ) ) . '</label></span>';
|
2235 |
|
|
|
2236 |
$output .= '<div>
|
2237 |
<span class="full">
|
2238 |
|
2261 |
<select class="select' . $required . $css . '" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '[country]" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '-country">
|
2262 |
<option selected="selected" value=""></option>';
|
2263 |
|
2264 |
+
foreach ( $this->countries as $country ) {
|
2265 |
+
$output .= "<option value='$country' " . selected( $default, $country, 0 ) . ">$country</option>";
|
2266 |
}
|
2267 |
|
2268 |
$output .= '</select>
|
2275 |
case 'date' :
|
2276 |
|
2277 |
if ( !empty( $field->field_description ) )
|
2278 |
+
$output .= '<span><input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="' . $default . '" class="text vfb-date-picker ' . $field->field_size . $required . $css . '" /><label>' . html_entity_decode( stripslashes( $field->field_description ) ) . '</label></span>';
|
2279 |
else
|
2280 |
$output .= '<input type="text" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="" class="text vfb-date-picker ' . $field->field_size . $required . $css . '" />';
|
2281 |
|
2328 |
case 'file-upload' :
|
2329 |
|
2330 |
$options = ( is_array( unserialize( $field->field_options ) ) ) ? unserialize( $field->field_options ) : unserialize( $field->field_options );
|
2331 |
+
$accept = ( !empty( $options[0] ) ) ? " {accept:'$options[0]'}" : '';
|
2332 |
|
2333 |
if ( !empty( $field->field_description ) )
|
2334 |
+
$output .= '<span><input type="file" size="35" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="' . $default . '" class="text ' . $field->field_size . $required . $validation . $accept . $css . '" /><label>' . stripslashes( $field->field_description ) . '</label></span>';
|
2335 |
else
|
2336 |
+
$output .= '<input type="file" size="35" name="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" id="vfb-' . esc_html( $field->field_key ) . '-' . $field->field_id . '" value="' . $default . '" class="text ' . $field->field_size . $required . $validation . $accept . $css . '" />';
|
2337 |
|
2338 |
|
2339 |
break;
|
2411 |
/* If the verification is set to required, run validation check */
|
2412 |
if ( true == $required && !empty( $secret_field ) )
|
2413 |
if ( !is_numeric( $_REQUEST[ $secret_field ] ) && strlen( $_REQUEST[ $secret_field ] ) !== 2 )
|
2414 |
+
wp_die( __( 'Security check: failed secret question. Please try again!' , 'visual-form-builder') );
|
2415 |
|
2416 |
/* Test if it's a known SPAM bot */
|
2417 |
if ( $this->isBot() )
|
2418 |
+
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') );
|
2419 |
|
2420 |
/* Basic security check before moving any further */
|
2421 |
if ( isset( $_REQUEST['visual-form-builder-submit'] ) && $_REQUEST['vfb-spam'] == '' ) :
|
2423 |
|
2424 |
/* Security check to verify the nonce */
|
2425 |
if ( ! wp_verify_nonce( $nonce, 'visual-form-builder-nonce' ) )
|
2426 |
+
wp_die( __( 'Security check: unable to verify nonce value.' , 'visual-form-builder') );
|
2427 |
|
2428 |
/* Set submitted action to display success message */
|
2429 |
$this->submitted = true;
|
2433 |
|
2434 |
/* Query to get all forms */
|
2435 |
$order = sanitize_sql_orderby( 'form_id DESC' );
|
|
|
2436 |
|
2437 |
/* Build our forms as an object */
|
2438 |
+
$forms = $wpdb->get_results( "SELECT * FROM $this->form_table_name WHERE form_id = $form_id ORDER BY $order" );
|
2439 |
|
2440 |
/* Get sender and email details */
|
2441 |
foreach ( $forms as $form ) {
|
2454 |
}
|
2455 |
|
2456 |
/* Sender name override query */
|
2457 |
+
$senders = $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_email_from_name_override = fields.field_id WHERE forms.form_id = $form_id" );
|
|
|
2458 |
|
2459 |
/* Sender email override query */
|
2460 |
+
$emails = $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_email_from_override = fields.field_id WHERE forms.form_id = $form_id" );
|
|
|
2461 |
|
2462 |
/* Notification send to email override query */
|
2463 |
+
$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" );
|
|
|
2464 |
|
2465 |
/* Loop through name results and assign sender name to override, if needed */
|
2466 |
foreach( $senders as $sender ) {
|
2482 |
|
2483 |
/* Query to get all forms */
|
2484 |
$order = sanitize_sql_orderby( 'field_sequence ASC' );
|
|
|
2485 |
|
2486 |
/* Build our forms as an object */
|
2487 |
+
$fields = $wpdb->get_results( "SELECT field_id, field_key, field_name, field_type, field_options, field_parent FROM $this->field_table_name WHERE form_id = $form_id ORDER BY $order" );
|
2488 |
|
2489 |
/* Setup counter for alt rows */
|
2490 |
$i = $points = 0;
|
2491 |
|
2492 |
+
/* Setup HTML email vars */
|
2493 |
+
$header = $body = $message = $footer = $html_email = $auto_response_email = '';
|
2494 |
+
|
2495 |
/* Prepare the beginning of the content */
|
2496 |
+
$header = '<html>
|
2497 |
+
<head>
|
2498 |
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
2499 |
+
<title>HTML Email</title>
|
2500 |
+
</head>
|
2501 |
+
<body><table rules="all" style="border-color: #666;" cellpadding="10">' . "\n";
|
2502 |
|
2503 |
/* Loop through each form field and build the body of the message */
|
2504 |
foreach ( $fields as $field ) {
|
2563 |
'value' => $uploaded_file['url']
|
2564 |
);
|
2565 |
|
2566 |
+
$body .= '<tr><td><strong>' . stripslashes( $field->field_name ) . ': </strong></td><td><a href="' . $uploaded_file['url'] . '">' . $uploaded_file['url'] . '</a></td></tr>' . "\n";
|
2567 |
}
|
2568 |
}
|
2569 |
else {
|
2570 |
$value = $_POST[ 'vfb-' . $field->field_key . '-' . $field->field_id ];
|
2571 |
+
$body .= '<tr><td><strong>' . stripslashes( $field->field_name ) . ': </strong></td><td>' . $value . '</td></tr>' . "\n";
|
2572 |
}
|
2573 |
}
|
2574 |
/* Everything else */
|
2644 |
//if ( $field->field_type !== 'submit' ) {
|
2645 |
if ( !in_array( $field->field_type , array( 'verification', 'secret', 'submit' ) ) ) {
|
2646 |
if ( $field->field_type == 'fieldset' )
|
2647 |
+
$body .= '<tr style="background-color:#393E40;color:white;font-size:14px;"><td colspan="2">' . stripslashes( $field->field_name ) . '</td></tr>' . "\n";
|
2648 |
elseif ( $field->field_type == 'section' )
|
2649 |
+
$body .= '<tr style="background-color:#6E7273;color:white;font-size:14px;"><td colspan="2">' . stripslashes( $field->field_name ) . '</td></tr>' . "\n";
|
2650 |
else
|
2651 |
+
$body .= '<tr><td><strong>' . stripslashes( $field->field_name ) . ': </strong></td><td>' . $value . '</td></tr>' . "\n";
|
2652 |
}
|
2653 |
|
2654 |
$data[] = array(
|
2679 |
$wpdb->insert( $this->entries_table_name, $entry );
|
2680 |
|
2681 |
/* Close out the content */
|
2682 |
+
$footer .= '<tr><td class="footer" height="61" align="left" valign="middle" colspan="2"><p style="font-size: 12px; font-weight: normal; margin: 0; line-height: 16px; padding: 0;">This email was built and sent using <a href="http://wordpress.org/extend/plugins/visual-form-builder/" style="font-size: 12px;">Visual Form Builder</a>.</p></td></tr></table></body></html>' . "\n";
|
2683 |
+
|
2684 |
+
/* Build complete HTML email */
|
2685 |
+
$message = $header . $body . $footer;
|
2686 |
|
2687 |
/* Initialize header filter vars */
|
2688 |
$this->header_from_name = stripslashes( $form_from_name );
|
2722 |
$notify_message = ( $form_notification_message !== '' ) ? html_entity_decode( $form_notification_message ) : '';
|
2723 |
|
2724 |
/* Either prepend the notification message to the submitted entry, or send by itself */
|
2725 |
+
/* Either prepend the notification message to the submitted entry, or send by itself */
|
2726 |
+
if ( $form_notification_entry !== '' )
|
2727 |
+
$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;
|
2728 |
+
else
|
2729 |
+
$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;
|
2730 |
|
2731 |
$attachments = ( $form_notification_entry !== '' ) ? $attachments : '';
|
2732 |
|
2733 |
/* Send the mail */
|
2734 |
+
wp_mail( $copy_email, esc_html( $form_notification_subject ), $auto_response_email, '', $attachments );
|
2735 |
endif;
|
2736 |
|
2737 |
elseif ( isset( $_REQUEST['visual-form-builder-submit'] ) ) :
|
2755 |
wp_die( __( 'Not a valid email address', 'visual-form-builder' ), '', array( 'back_link' => true ) );
|
2756 |
break;
|
2757 |
|
2758 |
+
case 'currency' :
|
2759 |
if ( !is_numeric( $data ) )
|
2760 |
+
wp_die( __( 'Not a valid currency.', 'visual-form-builder' ), '', array( 'back_link' => true ) );
|
2761 |
break;
|
2762 |
|
2763 |
+
case 'number' :
|
2764 |
if ( !is_int( $data ) )
|
2765 |
wp_die( __( 'Not a valid digit. Please enter a number without a decimal point.', 'visual-form-builder' ), '', array( 'back_link' => true ) );
|
2766 |
break;
|