Version Description
Fixed export entries feature and added a date filter to the entries list
Download this release
Release Info
Developer | mmuro |
Plugin | Visual Form Builder |
Version | 2.3.1 |
Comparing to | |
See all releases |
Code changes from version 2.3 to 2.3.1
- class-entries-list.php +200 -24
- readme.txt +10 -1
- visual-form-builder.php +10 -34
class-entries-list.php
CHANGED
@@ -26,6 +26,9 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
26 |
'plural' => 'entries',
|
27 |
'ajax' => false
|
28 |
) );
|
|
|
|
|
|
|
29 |
}
|
30 |
|
31 |
/**
|
@@ -122,7 +125,18 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
122 |
|
123 |
/* If the form filter dropdown is used */
|
124 |
if ( $this->current_filter_action() )
|
125 |
-
$where
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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";
|
@@ -172,15 +186,26 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
172 |
* @since 1.2
|
173 |
*/
|
174 |
function process_bulk_action() {
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
|
180 |
-
|
181 |
-
$
|
182 |
-
$
|
183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
}
|
185 |
}
|
186 |
|
@@ -276,7 +301,7 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
276 |
|
277 |
/* Find new field names and make a new column with a header */
|
278 |
if ( !array_key_exists( $field_key, $cols ) ) {
|
279 |
-
$cols[$field_key] = array(
|
280 |
'header' => $header,
|
281 |
'data' => array()
|
282 |
);
|
@@ -296,6 +321,8 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
296 |
case 'fieldset' :
|
297 |
case 'section' :
|
298 |
case 'instructions' :
|
|
|
|
|
299 |
case 'submit' :
|
300 |
break;
|
301 |
|
@@ -333,7 +360,7 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
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 */
|
@@ -346,22 +373,25 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
346 |
/* Loop through each row of data and add to our CSV */
|
347 |
for ( $i = 0; $i < $row; $i++ ) {
|
348 |
/* End our row of data, if needed */
|
349 |
-
if ( $csv_rows[$i] )
|
350 |
-
$csv_rows[$i] .= ',';
|
|
|
|
|
351 |
|
352 |
/* Add a starting quote for this row's data */
|
353 |
-
$csv_rows[$i] .= '"';
|
354 |
|
355 |
/* If there's data at this point, add it to the row */
|
356 |
-
if ( array_key_exists( $i, $data['data'] ) )
|
357 |
-
$csv_rows[$i] .= $data['data'][$i];
|
358 |
|
359 |
/* Add a closing quote for this row's data */
|
360 |
-
$csv_rows[$i] .= '"';
|
361 |
}
|
362 |
}
|
363 |
|
364 |
/* Change our header so the browser spits out a CSV file to download */
|
|
|
365 |
header('Content-type: text/csv');
|
366 |
header('Content-Disposition: attachment; filename="' . date( 'Y-m-d' ) . '-entries.csv"');
|
367 |
ob_clean();
|
@@ -376,7 +406,7 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
376 |
|
377 |
die();
|
378 |
|
379 |
-
endif;
|
380 |
}
|
381 |
|
382 |
/**
|
@@ -391,8 +421,9 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
391 |
|
392 |
/* Only display the dropdown on the top of the table */
|
393 |
if ( 'top' == $which ) {
|
394 |
-
echo '<div class="alignleft actions">
|
395 |
-
|
|
|
396 |
<option value="-1"' . selected( $this->current_filter_action(), -1 ) . '>' . __( 'View all forms' , 'visual-form-builder') . '</option>';
|
397 |
|
398 |
foreach ( $cols as $form ) {
|
@@ -405,6 +436,48 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
405 |
}
|
406 |
}
|
407 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
408 |
/**
|
409 |
* Set our forms filter action
|
410 |
*
|
@@ -461,9 +534,6 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
461 |
|
462 |
/* Build the column headers */
|
463 |
$this->_column_headers = array($columns, $hidden, $sortable);
|
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();
|
@@ -502,8 +572,25 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
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;
|
@@ -515,5 +602,94 @@ class VisualFormBuilder_Entries_List extends WP_List_Table {
|
|
515 |
'total_pages' => ceil( $total_items / $per_page )
|
516 |
) );
|
517 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
}
|
519 |
?>
|
26 |
'plural' => 'entries',
|
27 |
'ajax' => false
|
28 |
) );
|
29 |
+
|
30 |
+
/* Handle our bulk actions */
|
31 |
+
$this->process_bulk_action();
|
32 |
}
|
33 |
|
34 |
/**
|
125 |
|
126 |
/* If the form filter dropdown is used */
|
127 |
if ( $this->current_filter_action() )
|
128 |
+
$where .= 'AND forms.form_id = ' . $this->current_filter_action();
|
129 |
+
|
130 |
+
/* Get the month and year from the dropdown */
|
131 |
+
$m = isset( $_REQUEST['m'] ) ? (int) $_REQUEST['m'] : 0;
|
132 |
+
|
133 |
+
/* If a month/year has been selected, parse out the month/year and build the clause */
|
134 |
+
if ( $m > 0 ) {
|
135 |
+
$year = substr( $m, 0, 4 );
|
136 |
+
$month = substr( $m, -2 );
|
137 |
+
|
138 |
+
$where .= " AND YEAR(date_submitted) = $year AND MONTH(date_submitted) = $month";
|
139 |
+
}
|
140 |
|
141 |
$sql_order = sanitize_sql_orderby( "$order_col $order" );
|
142 |
$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";
|
186 |
* @since 1.2
|
187 |
*/
|
188 |
function process_bulk_action() {
|
189 |
+
switch( $this->current_action() ) {
|
190 |
+
case 'export-all' :
|
191 |
+
$this->export_entries();
|
192 |
+
break;
|
193 |
|
194 |
+
case 'export-selected' :
|
195 |
+
$entry_id = ( isset( $_REQUEST['entry'] ) && is_array( $_REQUEST['entry'] ) ) ? $_REQUEST['entry'] : array( $_REQUEST['entry'] );
|
196 |
+
$this->export_entries( $entry_id );
|
197 |
+
break;
|
198 |
+
|
199 |
+
case 'delete' :
|
200 |
+
$entry_id = ( isset( $_REQUEST['entry'] ) && is_array( $_REQUEST['entry'] ) ) ? $_REQUEST['entry'] : array( $_REQUEST['entry'] );
|
201 |
+
|
202 |
+
global $wpdb;
|
203 |
+
|
204 |
+
foreach ( $entry_id as $id ) {
|
205 |
+
$id = absint( $id );
|
206 |
+
$wpdb->query( "DELETE FROM $this->entries_table_name WHERE entries_id = $id" );
|
207 |
+
}
|
208 |
+
break;
|
209 |
}
|
210 |
}
|
211 |
|
301 |
|
302 |
/* Find new field names and make a new column with a header */
|
303 |
if ( !array_key_exists( $field_key, $cols ) ) {
|
304 |
+
$cols[ $field_key ] = array(
|
305 |
'header' => $header,
|
306 |
'data' => array()
|
307 |
);
|
321 |
case 'fieldset' :
|
322 |
case 'section' :
|
323 |
case 'instructions' :
|
324 |
+
case 'verification' :
|
325 |
+
case 'secret' :
|
326 |
case 'submit' :
|
327 |
break;
|
328 |
|
360 |
/* Setup our CSV vars */
|
361 |
$csv_headers = NULL;
|
362 |
$csv_rows = array();
|
363 |
+
|
364 |
/* Loop through each column */
|
365 |
foreach ( $cols as $data ) {
|
366 |
/* End our header row, if needed */
|
373 |
/* Loop through each row of data and add to our CSV */
|
374 |
for ( $i = 0; $i < $row; $i++ ) {
|
375 |
/* End our row of data, if needed */
|
376 |
+
if ( array_key_exists( $i, $csv_rows ) && !empty( $csv_rows[ $i ] ) )
|
377 |
+
$csv_rows[ $i ] .= ',';
|
378 |
+
elseif ( !array_key_exists( $i, $csv_rows ) )
|
379 |
+
$csv_rows[ $i ] = '';
|
380 |
|
381 |
/* Add a starting quote for this row's data */
|
382 |
+
$csv_rows[ $i ] .= '"';
|
383 |
|
384 |
/* If there's data at this point, add it to the row */
|
385 |
+
if ( array_key_exists( $i, $data[ 'data' ] ) )
|
386 |
+
$csv_rows[ $i ] .= $data[ 'data' ][ $i ];
|
387 |
|
388 |
/* Add a closing quote for this row's data */
|
389 |
+
$csv_rows[ $i ] .= '"';
|
390 |
}
|
391 |
}
|
392 |
|
393 |
/* Change our header so the browser spits out a CSV file to download */
|
394 |
+
ob_start();
|
395 |
header('Content-type: text/csv');
|
396 |
header('Content-Disposition: attachment; filename="' . date( 'Y-m-d' ) . '-entries.csv"');
|
397 |
ob_clean();
|
406 |
|
407 |
die();
|
408 |
|
409 |
+
endif;
|
410 |
}
|
411 |
|
412 |
/**
|
421 |
|
422 |
/* Only display the dropdown on the top of the table */
|
423 |
if ( 'top' == $which ) {
|
424 |
+
echo '<div class="alignleft actions">';
|
425 |
+
$this->months_dropdown();
|
426 |
+
echo '<select id="form-filter" name="form-filter">
|
427 |
<option value="-1"' . selected( $this->current_filter_action(), -1 ) . '>' . __( 'View all forms' , 'visual-form-builder') . '</option>';
|
428 |
|
429 |
foreach ( $cols as $form ) {
|
436 |
}
|
437 |
}
|
438 |
|
439 |
+
/**
|
440 |
+
* Display Year/Month filter
|
441 |
+
*
|
442 |
+
* @since 2.3.1
|
443 |
+
*/
|
444 |
+
function months_dropdown() {
|
445 |
+
global $wpdb, $wp_locale;
|
446 |
+
|
447 |
+
$months = $wpdb->get_results( $wpdb->prepare( "
|
448 |
+
SELECT DISTINCT YEAR( date_submitted ) AS year, MONTH( date_submitted ) AS month
|
449 |
+
FROM $this->entries_table_name
|
450 |
+
ORDER BY date_submitted DESC
|
451 |
+
" ) );
|
452 |
+
|
453 |
+
$month_count = count( $months );
|
454 |
+
|
455 |
+
if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
|
456 |
+
return;
|
457 |
+
|
458 |
+
$m = isset( $_REQUEST['m'] ) ? (int) $_REQUEST['m'] : 0;
|
459 |
+
?>
|
460 |
+
<select name='m'>
|
461 |
+
<option<?php selected( $m, 0 ); ?> value='0'><?php _e( 'Show all dates' ); ?></option>
|
462 |
+
<?php
|
463 |
+
foreach ( $months as $arc_row ) {
|
464 |
+
if ( 0 == $arc_row->year )
|
465 |
+
continue;
|
466 |
+
|
467 |
+
$month = zeroise( $arc_row->month, 2 );
|
468 |
+
$year = $arc_row->year;
|
469 |
+
|
470 |
+
printf( "<option %s value='%s'>%s</option>\n",
|
471 |
+
selected( $m, $year . $month, false ),
|
472 |
+
esc_attr( $arc_row->year . $month ),
|
473 |
+
sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
|
474 |
+
);
|
475 |
+
}
|
476 |
+
?>
|
477 |
+
</select>
|
478 |
+
<?php
|
479 |
+
}
|
480 |
+
|
481 |
/**
|
482 |
* Set our forms filter action
|
483 |
*
|
534 |
|
535 |
/* Build the column headers */
|
536 |
$this->_column_headers = array($columns, $hidden, $sortable);
|
|
|
|
|
|
|
537 |
|
538 |
/* Get entries search terms */
|
539 |
$search_terms = ( !empty( $_REQUEST['s'] ) ) ? explode( ' ', $_REQUEST['s'] ) : array();
|
572 |
);
|
573 |
}
|
574 |
|
575 |
+
$where = '';
|
576 |
+
|
577 |
+
/* If the form filter dropdown is used */
|
578 |
+
if ( $this->current_filter_action() )
|
579 |
+
$where .= 'AND form_id = ' . $this->current_filter_action();
|
580 |
+
|
581 |
+
/* Get the month/year from the dropdown */
|
582 |
+
$m = isset( $_REQUEST['m'] ) ? (int) $_REQUEST['m'] : 0;
|
583 |
+
|
584 |
+
/* Parse month/year and build the clause */
|
585 |
+
if ( $m > 0 ) {
|
586 |
+
$year = substr( $m, 0, 4 );
|
587 |
+
$month = substr( $m, -2 );
|
588 |
+
|
589 |
+
$where .= " AND YEAR(date_submitted) = $year AND MONTH(date_submitted) = $month";
|
590 |
+
}
|
591 |
+
|
592 |
/* How many entries do we have? */
|
593 |
+
$total_items = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $this->entries_table_name WHERE 1=1 $where" ) );
|
594 |
|
595 |
/* Add sorted data to the items property */
|
596 |
$this->items = $data;
|
602 |
'total_pages' => ceil( $total_items / $per_page )
|
603 |
) );
|
604 |
}
|
605 |
+
|
606 |
+
/**
|
607 |
+
* Display the pagination.
|
608 |
+
* Customize default function to work with months and form drop down filters
|
609 |
+
*
|
610 |
+
* @since 3.1.0
|
611 |
+
* @access protected
|
612 |
+
*/
|
613 |
+
function pagination( $which ) {
|
614 |
+
if ( empty( $this->_pagination_args ) )
|
615 |
+
return;
|
616 |
+
|
617 |
+
extract( $this->_pagination_args, EXTR_SKIP );
|
618 |
+
|
619 |
+
$output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
|
620 |
+
|
621 |
+
$current = $this->get_pagenum();
|
622 |
+
|
623 |
+
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
624 |
+
|
625 |
+
$current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
|
626 |
+
|
627 |
+
$page_links = array();
|
628 |
+
|
629 |
+
/* Added to pick up the months dropdown */
|
630 |
+
$m = isset( $_REQUEST['m'] ) ? (int) $_REQUEST['m'] : 0;
|
631 |
+
|
632 |
+
$disable_first = $disable_last = '';
|
633 |
+
if ( $current == 1 )
|
634 |
+
$disable_first = ' disabled';
|
635 |
+
if ( $current == $total_pages )
|
636 |
+
$disable_last = ' disabled';
|
637 |
+
|
638 |
+
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
639 |
+
'first-page' . $disable_first,
|
640 |
+
esc_attr__( 'Go to the first page' ),
|
641 |
+
esc_url( remove_query_arg( 'paged', $current_url ) ),
|
642 |
+
'«'
|
643 |
+
);
|
644 |
+
|
645 |
+
/* Modified the add_query_args to include my custom dropdowns */
|
646 |
+
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
647 |
+
'prev-page' . $disable_first,
|
648 |
+
esc_attr__( 'Go to the previous page' ),
|
649 |
+
esc_url( add_query_arg( array( 'paged' => max( 1, $current-1 ), 'm' => $m, 'form-filter' => $this->current_filter_action() ), $current_url ) ),
|
650 |
+
'‹'
|
651 |
+
);
|
652 |
+
|
653 |
+
if ( 'bottom' == $which )
|
654 |
+
$html_current_page = $current;
|
655 |
+
else
|
656 |
+
$html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='paged' value='%s' size='%d' />",
|
657 |
+
esc_attr__( 'Current page' ),
|
658 |
+
$current,
|
659 |
+
strlen( $total_pages )
|
660 |
+
);
|
661 |
+
|
662 |
+
$html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
|
663 |
+
$page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
|
664 |
+
|
665 |
+
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
666 |
+
'next-page' . $disable_last,
|
667 |
+
esc_attr__( 'Go to the next page' ),
|
668 |
+
esc_url( add_query_arg( array( 'paged' => min( $total_pages, $current+1 ), 'm' => $m, 'form-filter' => $this->current_filter_action() ), $current_url ) ),
|
669 |
+
'›'
|
670 |
+
);
|
671 |
+
|
672 |
+
/* Modified the add_query_args to include my custom dropdowns */
|
673 |
+
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
674 |
+
'last-page' . $disable_last,
|
675 |
+
esc_attr__( 'Go to the last page' ),
|
676 |
+
esc_url( add_query_arg( array( 'paged' => $total_pages, 'm' => $m, 'form-filter' => $this->current_filter_action() ), $current_url ) ),
|
677 |
+
'»'
|
678 |
+
);
|
679 |
+
|
680 |
+
$pagination_links_class = 'pagination-links';
|
681 |
+
if ( ! empty( $infinite_scroll ) )
|
682 |
+
$pagination_links_class = ' hide-if-js';
|
683 |
+
$output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
|
684 |
+
|
685 |
+
if ( $total_pages )
|
686 |
+
$page_class = $total_pages < 2 ? ' one-page' : '';
|
687 |
+
else
|
688 |
+
$page_class = ' no-pages';
|
689 |
+
|
690 |
+
$this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
|
691 |
+
|
692 |
+
echo $this->_pagination;
|
693 |
+
}
|
694 |
}
|
695 |
?>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=G87A9
|
|
4 |
Tags: form, forms, contact form, form to email, email form, email, input, validation, jquery, shortcode
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.4
|
7 |
-
Stable tag: 2.3
|
8 |
|
9 |
Build contact forms using a simple, clean interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
|
10 |
|
@@ -169,6 +169,12 @@ To Export Selected:
|
|
169 |
|
170 |
== Changelog ==
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
**Version 2.3**
|
173 |
|
174 |
* Add media button to Posts/Pages to easily embed forms (thanks to Paul Armstrong Designs!)
|
@@ -312,6 +318,9 @@ To Export Selected:
|
|
312 |
|
313 |
== Upgrade Notice ==
|
314 |
|
|
|
|
|
|
|
315 |
= 2.3 =
|
316 |
Added media button, Entries search and default values
|
317 |
|
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.1
|
8 |
|
9 |
Build contact forms using a simple, clean interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
|
10 |
|
169 |
|
170 |
== Changelog ==
|
171 |
|
172 |
+
**Version 2.3.1**
|
173 |
+
|
174 |
+
* Fix bug where Export feature was broken
|
175 |
+
* Fix bug where server validation failed on certain data types
|
176 |
+
* Add months drop down filter to Entries list
|
177 |
+
|
178 |
**Version 2.3**
|
179 |
|
180 |
* Add media button to Posts/Pages to easily embed forms (thanks to Paul Armstrong Designs!)
|
318 |
|
319 |
== Upgrade Notice ==
|
320 |
|
321 |
+
= 2.3.1 =
|
322 |
+
Fixed export entries feature and added a date filter to the entries list
|
323 |
+
|
324 |
= 2.3 =
|
325 |
Added media button, Entries search and default values
|
326 |
|
visual-form-builder.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Visual Form Builder
|
|
4 |
Description: Dynamically build forms using a simple interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
|
5 |
Author: Matthew Muro
|
6 |
Author URI: http://matthewmuro.com
|
7 |
-
Version: 2.3
|
8 |
*/
|
9 |
|
10 |
/*
|
@@ -28,7 +28,7 @@ $visual_form_builder = new Visual_Form_Builder();
|
|
28 |
/* Restrict Categories class */
|
29 |
class Visual_Form_Builder{
|
30 |
|
31 |
-
protected $vfb_db_version = '2.3';
|
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 |
|
@@ -106,11 +106,15 @@ class Visual_Form_Builder{
|
|
106 |
* @since 1.2
|
107 |
*/
|
108 |
public function includes(){
|
|
|
|
|
109 |
/* Load the Entries List class */
|
110 |
require_once( trailingslashit( plugin_dir_path( __FILE__ ) ) . 'class-entries-list.php' );
|
|
|
111 |
|
112 |
/* Load the Entries Details class */
|
113 |
require_once( trailingslashit( plugin_dir_path( __FILE__ ) ) . 'class-entries-detail.php' );
|
|
|
114 |
}
|
115 |
|
116 |
/**
|
@@ -322,27 +326,6 @@ class Visual_Form_Builder{
|
|
322 |
}
|
323 |
}
|
324 |
|
325 |
-
/**
|
326 |
-
* Runs the export_entries function in the class-entries-list.php file
|
327 |
-
*
|
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 |
-
|
345 |
-
|
346 |
/**
|
347 |
* Install database tables
|
348 |
*
|
@@ -1412,7 +1395,7 @@ class Visual_Form_Builder{
|
|
1412 |
* @since 1.0
|
1413 |
*/
|
1414 |
public function admin() {
|
1415 |
-
global $wpdb;
|
1416 |
|
1417 |
/* Set variables depending on which tab is selected */
|
1418 |
$form_nav_selected_id = ( isset( $_REQUEST['form'] ) ) ? $_REQUEST['form'] : '0';
|
@@ -1453,10 +1436,7 @@ class Visual_Form_Builder{
|
|
1453 |
<?php
|
1454 |
/* Display the Entries */
|
1455 |
if ( isset( $_REQUEST['view'] ) && in_array( $_REQUEST['view'], array( 'entries' ) ) ) :
|
1456 |
-
|
1457 |
-
$entries_list = new VisualFormBuilder_Entries_List();
|
1458 |
-
$entries_detail = new VisualFormBuilder_Entries_Detail();
|
1459 |
-
|
1460 |
if ( isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], array( 'view' ) ) ) :
|
1461 |
$entries_detail->entries_detail();
|
1462 |
else :
|
@@ -2755,14 +2735,10 @@ class Visual_Form_Builder{
|
|
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
|
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;
|
2767 |
|
2768 |
case 'phone' :
|
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.1
|
8 |
*/
|
9 |
|
10 |
/*
|
28 |
/* Restrict Categories class */
|
29 |
class Visual_Form_Builder{
|
30 |
|
31 |
+
protected $vfb_db_version = '2.3.1';
|
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 |
|
106 |
* @since 1.2
|
107 |
*/
|
108 |
public function includes(){
|
109 |
+
global $entries_list, $entries_detail;
|
110 |
+
|
111 |
/* Load the Entries List class */
|
112 |
require_once( trailingslashit( plugin_dir_path( __FILE__ ) ) . 'class-entries-list.php' );
|
113 |
+
$entries_list = new VisualFormBuilder_Entries_List();
|
114 |
|
115 |
/* Load the Entries Details class */
|
116 |
require_once( trailingslashit( plugin_dir_path( __FILE__ ) ) . 'class-entries-detail.php' );
|
117 |
+
$entries_detail = new VisualFormBuilder_Entries_Detail();
|
118 |
}
|
119 |
|
120 |
/**
|
326 |
}
|
327 |
}
|
328 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
/**
|
330 |
* Install database tables
|
331 |
*
|
1395 |
* @since 1.0
|
1396 |
*/
|
1397 |
public function admin() {
|
1398 |
+
global $wpdb, $entries_list, $entries_detail;
|
1399 |
|
1400 |
/* Set variables depending on which tab is selected */
|
1401 |
$form_nav_selected_id = ( isset( $_REQUEST['form'] ) ) ? $_REQUEST['form'] : '0';
|
1436 |
<?php
|
1437 |
/* Display the Entries */
|
1438 |
if ( isset( $_REQUEST['view'] ) && in_array( $_REQUEST['view'], array( 'entries' ) ) ) :
|
1439 |
+
|
|
|
|
|
|
|
1440 |
if ( isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], array( 'view' ) ) ) :
|
1441 |
$entries_detail->entries_detail();
|
1442 |
else :
|
2735 |
wp_die( __( 'Not a valid email address', 'visual-form-builder' ), '', array( 'back_link' => true ) );
|
2736 |
break;
|
2737 |
|
2738 |
+
case 'number' :
|
2739 |
case 'currency' :
|
2740 |
if ( !is_numeric( $data ) )
|
2741 |
+
wp_die( __( 'Not a valid number.', 'visual-form-builder' ), '', array( 'back_link' => true ) );
|
|
|
|
|
|
|
|
|
|
|
2742 |
break;
|
2743 |
|
2744 |
case 'phone' :
|