@@ -64,8 +64,8 @@ |
||
64 | 64 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles&frm_action=destroy&id=' . $style->ID ) ); ?>" id="frm_delete_style" class="submitdelete deletion" onclick="return confirm('<?php esc_attr_e( 'Are you sure you want to delete that style?', 'formidable' ) ?>')"><?php _e( 'Delete Style', 'formidable' ) ?></a> |
65 | 65 | <?php } ?> |
66 | 66 | <?php |
67 | - if ( $style->ID ) { |
|
68 | - echo '<span class="howto"><span>.frm_style_'. esc_attr( $style->post_name ) .'</span></span>'; |
|
67 | + if ( $style->ID ) { |
|
68 | + echo '<span class="howto"><span>.frm_style_'. esc_attr( $style->post_name ) .'</span></span>'; |
|
69 | 69 | } ?> |
70 | 70 | <div class="publishing-action"> |
71 | 71 | <input type="button" value="<?php esc_attr_e( 'Reset to Default', 'formidable' ) ?>" class="button-secondary frm_reset_style" /> |
@@ -2,14 +2,14 @@ discard block |
||
2 | 2 | <div class="wrap"> |
3 | 3 | <?php FrmStylesHelper::style_menu(); ?> |
4 | 4 | |
5 | - <?php include(FrmAppHelper::plugin_path() .'/classes/views/shared/errors.php'); ?> |
|
5 | + <?php include( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); ?> |
|
6 | 6 | |
7 | 7 | <?php do_action( 'frm_style_switcher', $style, $styles ) ?> |
8 | 8 | |
9 | 9 | <form id="frm_styling_form" action="" name="frm_styling_form" method="post"> |
10 | 10 | <input type="hidden" name="ID" value="<?php echo esc_attr( $style->ID ) ?>" /> |
11 | 11 | <input type="hidden" name="frm_action" value="save" /> |
12 | - <textarea name="<?php echo esc_attr( $frm_style->get_field_name('custom_css') ) ?>" class="frm_hidden"><?php echo FrmAppHelper::esc_textarea( $style->post_content['custom_css'] ) ?></textarea> |
|
12 | + <textarea name="<?php echo esc_attr( $frm_style->get_field_name( 'custom_css' ) ) ?>" class="frm_hidden"><?php echo FrmAppHelper::esc_textarea( $style->post_content['custom_css'] ) ?></textarea> |
|
13 | 13 | <?php wp_nonce_field( 'frm_style_nonce', 'frm_style' ); ?> |
14 | 14 | |
15 | 15 | <div id="nav-menus-frame"> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | <div class="styling_settings"> |
20 | 20 | <input type="hidden" name="style_name" value="frm_style_<?php echo esc_attr( $style->post_name ) ?>" /> |
21 | - <?php FrmStylesController::do_accordion_sections( FrmStylesController::$screen, 'side', compact('style', 'frm_style') ); ?> |
|
21 | + <?php FrmStylesController::do_accordion_sections( FrmStylesController::$screen, 'side', compact( 'style', 'frm_style' ) ); ?> |
|
22 | 22 | </div> |
23 | 23 | |
24 | 24 | </div><!-- /#menu-settings-column --> |
@@ -31,17 +31,17 @@ discard block |
||
31 | 31 | <div class="major-publishing-actions"> |
32 | 32 | <label class="menu-name-label howto open-label" for="menu-name"> |
33 | 33 | <span><?php _e( 'Style Name', 'formidable' ) ?></span> |
34 | - <input id="menu-name" name="<?php echo esc_attr( $frm_style->get_field_name('post_title', '') ); ?>" type="text" class="menu-name regular-text menu-item-textbox" title="<?php esc_attr_e( 'Enter style name here', 'formidable' ) ?>" value="<?php echo esc_attr( $style->post_title ) ?>" /> |
|
34 | + <input id="menu-name" name="<?php echo esc_attr( $frm_style->get_field_name( 'post_title', '' ) ); ?>" type="text" class="menu-name regular-text menu-item-textbox" title="<?php esc_attr_e( 'Enter style name here', 'formidable' ) ?>" value="<?php echo esc_attr( $style->post_title ) ?>" /> |
|
35 | 35 | </label> |
36 | 36 | |
37 | - <input name="prev_menu_order" type="hidden" value="<?php echo esc_attr($style->menu_order) ?>" /> |
|
37 | + <input name="prev_menu_order" type="hidden" value="<?php echo esc_attr( $style->menu_order ) ?>" /> |
|
38 | 38 | <label class="menu-name-label howto open-label default-style-box" for="menu_order"> |
39 | 39 | <span> |
40 | 40 | <?php if ( $style->menu_order ) { ?> |
41 | - <input name="<?php echo esc_attr( $frm_style->get_field_name('menu_order', '') ); ?>" type="hidden" value="1" /> |
|
42 | - <input id="menu_order" disabled="disabled" type="checkbox" value="1" <?php checked($style->menu_order, 1) ?> /> |
|
41 | + <input name="<?php echo esc_attr( $frm_style->get_field_name( 'menu_order', '' ) ); ?>" type="hidden" value="1" /> |
|
42 | + <input id="menu_order" disabled="disabled" type="checkbox" value="1" <?php checked( $style->menu_order, 1 ) ?> /> |
|
43 | 43 | <?php } else { ?> |
44 | - <input id="menu_order" name="<?php echo esc_attr( $frm_style->get_field_name('menu_order', '') ); ?>" type="checkbox" value="1" <?php checked($style->menu_order, 1) ?> /> |
|
44 | + <input id="menu_order" name="<?php echo esc_attr( $frm_style->get_field_name( 'menu_order', '' ) ); ?>" type="checkbox" value="1" <?php checked( $style->menu_order, 1 ) ?> /> |
|
45 | 45 | <?php } ?> |
46 | 46 | <?php _e( 'Make default style', 'formidable' ) ?></span> |
47 | 47 | </label> |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | <div id="post-body"> |
55 | 55 | <div id="post-body-content"> |
56 | 56 | |
57 | - <?php include( dirname(__FILE__) .'/_sample_form.php') ?> |
|
57 | + <?php include( dirname( __FILE__ ) . '/_sample_form.php' ) ?> |
|
58 | 58 | |
59 | 59 | </div><!-- /#post-body-content --> |
60 | 60 | </div><!-- /#post-body --> |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | <?php } ?> |
66 | 66 | <?php |
67 | 67 | if ( $style->ID ) { |
68 | - echo '<span class="howto"><span>.frm_style_'. esc_attr( $style->post_name ) .'</span></span>'; |
|
68 | + echo '<span class="howto"><span>.frm_style_' . esc_attr( $style->post_name ) . '</span></span>'; |
|
69 | 69 | } ?> |
70 | 70 | <div class="publishing-action"> |
71 | 71 | <input type="button" value="<?php esc_attr_e( 'Reset to Default', 'formidable' ) ?>" class="button-secondary frm_reset_style" /> |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | protected $modes = array(); |
68 | 68 | |
69 | 69 | /** |
70 | - * |
|
71 | - * @var array |
|
72 | - */ |
|
73 | - protected $params; |
|
70 | + * |
|
71 | + * @var array |
|
72 | + */ |
|
73 | + protected $params; |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Stores the value returned by ->get_column_info() |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | 'single_row_columns' ); |
88 | 88 | |
89 | 89 | /** |
90 | - * Construct the table object |
|
91 | - */ |
|
90 | + * Construct the table object |
|
91 | + */ |
|
92 | 92 | public function __construct( $args ) { |
93 | - $args = wp_parse_args( $args, array( |
|
93 | + $args = wp_parse_args( $args, array( |
|
94 | 94 | 'params' => array(), |
95 | 95 | 'plural' => '', |
96 | 96 | 'singular' => '', |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined('ABSPATH') ) { |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | 3 | die( 'You are not allowed to call this page directly.' ); |
4 | 4 | } |
5 | 5 | |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | return $this->get_pagenum(); |
276 | 276 | } |
277 | 277 | |
278 | - if ( isset( $this->_pagination_args[ $key ] ) ) { |
|
279 | - return $this->_pagination_args[ $key ]; |
|
278 | + if ( isset( $this->_pagination_args[$key] ) ) { |
|
279 | + return $this->_pagination_args[$key]; |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
@@ -331,8 +331,8 @@ discard block |
||
331 | 331 | } |
332 | 332 | |
333 | 333 | private function hidden_search_inputs( $param_name ) { |
334 | - if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
|
335 | - echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $_REQUEST[ $param_name ] ) . '" />'; |
|
334 | + if ( ! empty( $_REQUEST[$param_name] ) ) { |
|
335 | + echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $_REQUEST[$param_name] ) . '" />'; |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | |
376 | 376 | echo "<ul class='subsubsub'>\n"; |
377 | 377 | foreach ( $views as $class => $view ) { |
378 | - $views[ $class ] = "\t<li class='$class'>$view"; |
|
378 | + $views[$class] = "\t<li class='$class'>$view"; |
|
379 | 379 | } |
380 | 380 | echo implode( " |</li>\n", $views ) . "</li>\n"; |
381 | 381 | echo '</ul>'; |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | foreach ( $this->_actions as $name => $title ) { |
437 | 437 | $class = 'edit' == $name ? ' class="hide-if-no-js"' : ''; |
438 | 438 | |
439 | - echo "\t<option value='". esc_attr( $name ) ."'$class>$title</option>\n"; |
|
439 | + echo "\t<option value='" . esc_attr( $name ) . "'$class>$title</option>\n"; |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | echo "</select>\n"; |
@@ -468,8 +468,8 @@ discard block |
||
468 | 468 | |
469 | 469 | private static function get_bulk_action( $action_name ) { |
470 | 470 | $action = false; |
471 | - if ( isset( $_REQUEST[ $action_name ] ) && -1 != sanitize_text_field( $_REQUEST[ $action_name ] ) ) { |
|
472 | - $action = sanitize_text_field( $_REQUEST[ $action_name ] ); |
|
471 | + if ( isset( $_REQUEST[$action_name] ) && -1 != sanitize_text_field( $_REQUEST[$action_name] ) ) { |
|
472 | + $action = sanitize_text_field( $_REQUEST[$action_name] ); |
|
473 | 473 | } |
474 | 474 | return $action; |
475 | 475 | } |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | |
495 | 495 | $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">'; |
496 | 496 | foreach ( $actions as $action => $link ) { |
497 | - ++$i; |
|
497 | + ++ $i; |
|
498 | 498 | ( $i == $action_count ) ? $sep = '' : $sep = ' | '; |
499 | 499 | $out .= "<span class='$action'>$link$sep</span>"; |
500 | 500 | } |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | |
761 | 761 | // If the primary column doesn't exist fall back to the |
762 | 762 | // first non-checkbox column. |
763 | - if ( ! isset( $columns[ $default ] ) ) { |
|
763 | + if ( ! isset( $columns[$default] ) ) { |
|
764 | 764 | $default = FrmListHelper::get_default_primary_column_name(); |
765 | 765 | } |
766 | 766 | |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | */ |
775 | 775 | $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); |
776 | 776 | |
777 | - if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { |
|
777 | + if ( empty( $column ) || ! isset( $columns[$column] ) ) { |
|
778 | 778 | $column = $default; |
779 | 779 | } |
780 | 780 | |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | // In 4.3, we added a fourth argument for primary column. |
797 | 797 | $column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); |
798 | 798 | foreach ( $this->_column_headers as $key => $value ) { |
799 | - $column_headers[ $key ] = $value; |
|
799 | + $column_headers[$key] = $value; |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | return $column_headers; |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | $data[1] = false; |
830 | 830 | } |
831 | 831 | |
832 | - $sortable[ $id ] = $data; |
|
832 | + $sortable[$id] = $data; |
|
833 | 833 | } |
834 | 834 | |
835 | 835 | $primary = $this->get_primary_column_name(); |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | static $cb_counter = 1; |
885 | 885 | $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>' |
886 | 886 | . '<input id="cb-select-all-' . esc_attr( $cb_counter ) . '" type="checkbox" />'; |
887 | - $cb_counter++; |
|
887 | + $cb_counter ++; |
|
888 | 888 | } |
889 | 889 | |
890 | 890 | foreach ( $columns as $column_key => $column_display_name ) { |
@@ -904,8 +904,8 @@ discard block |
||
904 | 904 | $class[] = 'column-primary'; |
905 | 905 | } |
906 | 906 | |
907 | - if ( isset( $sortable[ $column_key ] ) ) { |
|
908 | - list( $orderby, $desc_first ) = $sortable[ $column_key ]; |
|
907 | + if ( isset( $sortable[$column_key] ) ) { |
|
908 | + list( $orderby, $desc_first ) = $sortable[$column_key]; |
|
909 | 909 | |
910 | 910 | if ( $current_orderby == $orderby ) { |
911 | 911 | $order = 'asc' == $current_order ? 'desc' : 'asc'; |
@@ -520,8 +520,9 @@ |
||
520 | 520 | <?php |
521 | 521 | foreach ( $this->modes as $mode => $title ) { |
522 | 522 | $classes = array( 'view-' . $mode ); |
523 | - if ( $current_mode == $mode ) |
|
524 | - $classes[] = 'current'; |
|
523 | + if ( $current_mode == $mode ) { |
|
524 | + $classes[] = 'current'; |
|
525 | + } |
|
525 | 526 | printf( |
526 | 527 | "<a href='%s' class='%s' id='view-switch-$mode'><span class='screen-reader-text'>%s</span></a>\n", |
527 | 528 | esc_url( add_query_arg( 'mode', $mode ) ), |
@@ -253,6 +253,9 @@ discard block |
||
253 | 253 | <?php |
254 | 254 | } |
255 | 255 | |
256 | + /** |
|
257 | + * @param string $param_name |
|
258 | + */ |
|
256 | 259 | private function hidden_search_inputs( $param_name ) { |
257 | 260 | if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
258 | 261 | echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $_REQUEST[ $param_name ] ) . '" />'; |
@@ -389,6 +392,9 @@ discard block |
||
389 | 392 | return $action; |
390 | 393 | } |
391 | 394 | |
395 | + /** |
|
396 | + * @param string $action_name |
|
397 | + */ |
|
392 | 398 | private static function get_bulk_action( $action_name ) { |
393 | 399 | $action = false; |
394 | 400 | if ( isset( $_REQUEST[ $action_name ] ) && -1 != sanitize_text_field( $_REQUEST[ $action_name ] ) ) { |
@@ -1,26 +1,26 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | class FrmEntryValidate { |
4 | - public static function validate( $values, $exclude = false ) { |
|
5 | - global $wpdb; |
|
4 | + public static function validate( $values, $exclude = false ) { |
|
5 | + global $wpdb; |
|
6 | 6 | |
7 | - FrmEntry::sanitize_entry_post( $values ); |
|
8 | - $errors = array(); |
|
7 | + FrmEntry::sanitize_entry_post( $values ); |
|
8 | + $errors = array(); |
|
9 | 9 | |
10 | - if ( ! isset($values['form_id']) || ! isset($values['item_meta']) ) { |
|
11 | - $errors['form'] = __( 'There was a problem with your submission. Please try again.', 'formidable' ); |
|
12 | - return $errors; |
|
13 | - } |
|
10 | + if ( ! isset($values['form_id']) || ! isset($values['item_meta']) ) { |
|
11 | + $errors['form'] = __( 'There was a problem with your submission. Please try again.', 'formidable' ); |
|
12 | + return $errors; |
|
13 | + } |
|
14 | 14 | |
15 | 15 | if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) { |
16 | - $errors['form'] = __( 'You do not have permission to do that', 'formidable' ); |
|
17 | - } |
|
16 | + $errors['form'] = __( 'You do not have permission to do that', 'formidable' ); |
|
17 | + } |
|
18 | 18 | |
19 | - if ( ! isset($values['item_key']) || $values['item_key'] == '' ) { |
|
20 | - $_POST['item_key'] = $values['item_key'] = FrmAppHelper::get_unique_key('', $wpdb->prefix .'frm_items', 'item_key'); |
|
21 | - } |
|
19 | + if ( ! isset($values['item_key']) || $values['item_key'] == '' ) { |
|
20 | + $_POST['item_key'] = $values['item_key'] = FrmAppHelper::get_unique_key('', $wpdb->prefix .'frm_items', 'item_key'); |
|
21 | + } |
|
22 | 22 | |
23 | - $where = apply_filters('frm_posted_field_ids', array( 'fi.form_id' => $values['form_id'] ) ); |
|
23 | + $where = apply_filters('frm_posted_field_ids', array( 'fi.form_id' => $values['form_id'] ) ); |
|
24 | 24 | // Don't get subfields |
25 | 25 | $where['fr.parent_form_id'] = array( null, 0 ); |
26 | 26 | // Don't get excluded fields (like file upload fields in the ajax validation) |
@@ -28,46 +28,46 @@ discard block |
||
28 | 28 | $where['fi.type not'] = $exclude; |
29 | 29 | } |
30 | 30 | |
31 | - $posted_fields = FrmField::getAll($where, 'field_order'); |
|
31 | + $posted_fields = FrmField::getAll($where, 'field_order'); |
|
32 | 32 | |
33 | - // Pass exclude value to validate_field function so it can be used for repeating sections |
|
34 | - $args = array( 'exclude' => $exclude ); |
|
33 | + // Pass exclude value to validate_field function so it can be used for repeating sections |
|
34 | + $args = array( 'exclude' => $exclude ); |
|
35 | 35 | |
36 | - foreach ( $posted_fields as $posted_field ) { |
|
37 | - self::validate_field($posted_field, $errors, $values, $args); |
|
38 | - unset($posted_field); |
|
39 | - } |
|
36 | + foreach ( $posted_fields as $posted_field ) { |
|
37 | + self::validate_field($posted_field, $errors, $values, $args); |
|
38 | + unset($posted_field); |
|
39 | + } |
|
40 | 40 | |
41 | - // check for spam |
|
42 | - self::spam_check( $exclude, $values, $errors ); |
|
41 | + // check for spam |
|
42 | + self::spam_check( $exclude, $values, $errors ); |
|
43 | 43 | |
44 | - $errors = apply_filters( 'frm_validate_entry', $errors, $values, compact('exclude') ); |
|
44 | + $errors = apply_filters( 'frm_validate_entry', $errors, $values, compact('exclude') ); |
|
45 | 45 | |
46 | - return $errors; |
|
47 | - } |
|
46 | + return $errors; |
|
47 | + } |
|
48 | 48 | |
49 | - public static function validate_field( $posted_field, &$errors, $values, $args = array() ) { |
|
50 | - $defaults = array( |
|
51 | - 'id' => $posted_field->id, |
|
52 | - 'parent_field_id' => '', // the id of the repeat or embed form |
|
53 | - 'key_pointer' => '', // the pointer in the posted array |
|
54 | - 'exclude' => array(), // exclude these field types from validation |
|
55 | - ); |
|
56 | - $args = wp_parse_args( $args, $defaults ); |
|
49 | + public static function validate_field( $posted_field, &$errors, $values, $args = array() ) { |
|
50 | + $defaults = array( |
|
51 | + 'id' => $posted_field->id, |
|
52 | + 'parent_field_id' => '', // the id of the repeat or embed form |
|
53 | + 'key_pointer' => '', // the pointer in the posted array |
|
54 | + 'exclude' => array(), // exclude these field types from validation |
|
55 | + ); |
|
56 | + $args = wp_parse_args( $args, $defaults ); |
|
57 | 57 | |
58 | - if ( empty($args['parent_field_id']) ) { |
|
58 | + if ( empty($args['parent_field_id']) ) { |
|
59 | 59 | $value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : ''; |
60 | - } else { |
|
61 | - // value is from a nested form |
|
62 | - $value = $values; |
|
63 | - } |
|
60 | + } else { |
|
61 | + // value is from a nested form |
|
62 | + $value = $values; |
|
63 | + } |
|
64 | 64 | |
65 | - // Check for values in "Other" fields |
|
66 | - FrmEntriesHelper::maybe_set_other_validation( $posted_field, $value, $args ); |
|
65 | + // Check for values in "Other" fields |
|
66 | + FrmEntriesHelper::maybe_set_other_validation( $posted_field, $value, $args ); |
|
67 | 67 | |
68 | - if ( isset($posted_field->field_options['default_blank']) && $posted_field->field_options['default_blank'] && $value == $posted_field->default_value ) { |
|
69 | - $value = ''; |
|
70 | - } |
|
68 | + if ( isset($posted_field->field_options['default_blank']) && $posted_field->field_options['default_blank'] && $value == $posted_field->default_value ) { |
|
69 | + $value = ''; |
|
70 | + } |
|
71 | 71 | |
72 | 72 | // Check for an array with only one value |
73 | 73 | // Don't reset values in "Other" fields because array keys need to be preserved |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | $value = reset($value); |
76 | 76 | } |
77 | 77 | |
78 | - if ( $posted_field->required == '1' && ! is_array( $value ) && trim( $value ) == '' ) { |
|
78 | + if ( $posted_field->required == '1' && ! is_array( $value ) && trim( $value ) == '' ) { |
|
79 | 79 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
80 | - } else if ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { |
|
81 | - $_POST['item_name'] = $value; |
|
82 | - } |
|
80 | + } else if ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { |
|
81 | + $_POST['item_name'] = $value; |
|
82 | + } |
|
83 | 83 | |
84 | 84 | if ( $value != '' ) { |
85 | 85 | self::validate_url_field( $errors, $posted_field, $value, $args ); |
@@ -88,41 +88,41 @@ discard block |
||
88 | 88 | self::validate_phone_field( $errors, $posted_field, $value, $args ); |
89 | 89 | } |
90 | 90 | |
91 | - FrmEntriesHelper::set_posted_value($posted_field, $value, $args); |
|
91 | + FrmEntriesHelper::set_posted_value($posted_field, $value, $args); |
|
92 | 92 | |
93 | - self::validate_recaptcha($errors, $posted_field, $args); |
|
93 | + self::validate_recaptcha($errors, $posted_field, $args); |
|
94 | 94 | |
95 | - $errors = apply_filters('frm_validate_field_entry', $errors, $posted_field, $value, $args); |
|
96 | - } |
|
95 | + $errors = apply_filters('frm_validate_field_entry', $errors, $posted_field, $value, $args); |
|
96 | + } |
|
97 | 97 | |
98 | 98 | public static function validate_url_field( &$errors, $field, &$value, $args ) { |
99 | 99 | if ( $value == '' || ! in_array( $field->type, array( 'website', 'url', 'image' ) ) ) { |
100 | - return; |
|
101 | - } |
|
102 | - |
|
103 | - if ( trim($value) == 'http://' ) { |
|
104 | - $value = ''; |
|
105 | - } else { |
|
106 | - $value = esc_url_raw( $value ); |
|
107 | - $value = preg_match('/^(https?|ftps?|mailto|news|feed|telnet):/is', $value) ? $value : 'http://'. $value; |
|
108 | - } |
|
109 | - |
|
110 | - //validate the url format |
|
111 | - if ( ! preg_match('/^http(s)?:\/\/([\da-z\.-]+)\.([\da-z\.-]+)/i', $value) ) { |
|
100 | + return; |
|
101 | + } |
|
102 | + |
|
103 | + if ( trim($value) == 'http://' ) { |
|
104 | + $value = ''; |
|
105 | + } else { |
|
106 | + $value = esc_url_raw( $value ); |
|
107 | + $value = preg_match('/^(https?|ftps?|mailto|news|feed|telnet):/is', $value) ? $value : 'http://'. $value; |
|
108 | + } |
|
109 | + |
|
110 | + //validate the url format |
|
111 | + if ( ! preg_match('/^http(s)?:\/\/([\da-z\.-]+)\.([\da-z\.-]+)/i', $value) ) { |
|
112 | 112 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
113 | - } |
|
114 | - } |
|
113 | + } |
|
114 | + } |
|
115 | 115 | |
116 | 116 | public static function validate_email_field( &$errors, $field, $value, $args ) { |
117 | - if ( $value == '' || $field->type != 'email' ) { |
|
118 | - return; |
|
119 | - } |
|
117 | + if ( $value == '' || $field->type != 'email' ) { |
|
118 | + return; |
|
119 | + } |
|
120 | 120 | |
121 | - //validate the email format |
|
122 | - if ( ! is_email($value) ) { |
|
121 | + //validate the email format |
|
122 | + if ( ! is_email($value) ) { |
|
123 | 123 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
124 | - } |
|
125 | - } |
|
124 | + } |
|
125 | + } |
|
126 | 126 | |
127 | 127 | public static function validate_number_field( &$errors, $field, $value, $args ) { |
128 | 128 | //validate the number format |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | public static function validate_recaptcha( &$errors, $field, $args ) { |
202 | - if ( $field->type != 'captcha' || FrmAppHelper::is_admin() || apply_filters( 'frm_is_field_hidden', false, $field, stripslashes_deep( $_POST ) ) ) { |
|
203 | - return; |
|
204 | - } |
|
202 | + if ( $field->type != 'captcha' || FrmAppHelper::is_admin() || apply_filters( 'frm_is_field_hidden', false, $field, stripslashes_deep( $_POST ) ) ) { |
|
203 | + return; |
|
204 | + } |
|
205 | 205 | |
206 | 206 | $frm_settings = FrmAppHelper::get_settings(); |
207 | 207 | if ( empty( $frm_settings->pubkey ) ) { |
@@ -209,53 +209,53 @@ discard block |
||
209 | 209 | return; |
210 | 210 | } |
211 | 211 | |
212 | - if ( ! isset($_POST['g-recaptcha-response']) ) { |
|
213 | - // If captcha is missing, check if it was already verified |
|
212 | + if ( ! isset($_POST['g-recaptcha-response']) ) { |
|
213 | + // If captcha is missing, check if it was already verified |
|
214 | 214 | if ( ! isset( $_POST['recaptcha_checked'] ) || ! wp_verify_nonce( $_POST['recaptcha_checked'], 'frm_ajax' ) ) { |
215 | - // There was no captcha submitted |
|
215 | + // There was no captcha submitted |
|
216 | 216 | $errors[ 'field' . $args['id'] ] = __( 'The captcha is missing from this form', 'formidable' ); |
217 | - } |
|
218 | - return; |
|
219 | - } |
|
217 | + } |
|
218 | + return; |
|
219 | + } |
|
220 | 220 | |
221 | - $arg_array = array( |
|
222 | - 'body' => array( |
|
221 | + $arg_array = array( |
|
222 | + 'body' => array( |
|
223 | 223 | 'secret' => $frm_settings->privkey, |
224 | 224 | 'response' => $_POST['g-recaptcha-response'], |
225 | 225 | 'remoteip' => FrmAppHelper::get_ip_address(), |
226 | 226 | ), |
227 | 227 | ); |
228 | - $resp = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', $arg_array ); |
|
229 | - $response = json_decode(wp_remote_retrieve_body( $resp ), true); |
|
228 | + $resp = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', $arg_array ); |
|
229 | + $response = json_decode(wp_remote_retrieve_body( $resp ), true); |
|
230 | 230 | |
231 | - if ( isset( $response['success'] ) && ! $response['success'] ) { |
|
232 | - // What happens when the CAPTCHA was entered incorrectly |
|
231 | + if ( isset( $response['success'] ) && ! $response['success'] ) { |
|
232 | + // What happens when the CAPTCHA was entered incorrectly |
|
233 | 233 | $errors[ 'field' . $args['id'] ] = ( ! isset( $field->field_options['invalid'] ) || $field->field_options['invalid'] == '' ) ? $frm_settings->re_msg : $field->field_options['invalid']; |
234 | - } |
|
235 | - } |
|
236 | - |
|
237 | - /** |
|
238 | - * check for spam |
|
239 | - * @param boolean $exclude |
|
240 | - * @param array $values |
|
241 | - * @param array $errors by reference |
|
242 | - */ |
|
243 | - public static function spam_check( $exclude, $values, &$errors ) { |
|
244 | - if ( ! empty( $exclude ) || ! isset( $values['item_meta'] ) || empty( $values['item_meta'] ) || ! empty( $errors ) ) { |
|
245 | - // only check spam if there are no other errors |
|
246 | - return; |
|
247 | - } |
|
248 | - |
|
249 | - if ( self::is_akismet_spam( $values ) ) { |
|
234 | + } |
|
235 | + } |
|
236 | + |
|
237 | + /** |
|
238 | + * check for spam |
|
239 | + * @param boolean $exclude |
|
240 | + * @param array $values |
|
241 | + * @param array $errors by reference |
|
242 | + */ |
|
243 | + public static function spam_check( $exclude, $values, &$errors ) { |
|
244 | + if ( ! empty( $exclude ) || ! isset( $values['item_meta'] ) || empty( $values['item_meta'] ) || ! empty( $errors ) ) { |
|
245 | + // only check spam if there are no other errors |
|
246 | + return; |
|
247 | + } |
|
248 | + |
|
249 | + if ( self::is_akismet_spam( $values ) ) { |
|
250 | 250 | if ( self::is_akismet_enabled_for_user( $values['form_id'] ) ) { |
251 | 251 | $errors['spam'] = __( 'Your entry appears to be spam!', 'formidable' ); |
252 | 252 | } |
253 | - } |
|
253 | + } |
|
254 | 254 | |
255 | - if ( self::blacklist_check( $values ) ) { |
|
256 | - $errors['spam'] = __( 'Your entry appears to be spam!', 'formidable' ); |
|
257 | - } |
|
258 | - } |
|
255 | + if ( self::blacklist_check( $values ) ) { |
|
256 | + $errors['spam'] = __( 'Your entry appears to be spam!', 'formidable' ); |
|
257 | + } |
|
258 | + } |
|
259 | 259 | |
260 | 260 | private static function is_akismet_spam( $values ) { |
261 | 261 | global $wpcom_api_key; |
@@ -267,54 +267,54 @@ discard block |
||
267 | 267 | return ( isset( $form->options['akismet'] ) && ! empty( $form->options['akismet'] ) && ( $form->options['akismet'] != 'logged' || ! is_user_logged_in() ) ); |
268 | 268 | } |
269 | 269 | |
270 | - public static function blacklist_check( $values ) { |
|
271 | - if ( ! apply_filters('frm_check_blacklist', true, $values) ) { |
|
272 | - return false; |
|
273 | - } |
|
270 | + public static function blacklist_check( $values ) { |
|
271 | + if ( ! apply_filters('frm_check_blacklist', true, $values) ) { |
|
272 | + return false; |
|
273 | + } |
|
274 | 274 | |
275 | - $mod_keys = trim( get_option( 'blacklist_keys' ) ); |
|
275 | + $mod_keys = trim( get_option( 'blacklist_keys' ) ); |
|
276 | 276 | |
277 | - if ( empty( $mod_keys ) ) { |
|
278 | - return false; |
|
279 | - } |
|
277 | + if ( empty( $mod_keys ) ) { |
|
278 | + return false; |
|
279 | + } |
|
280 | 280 | |
281 | - $content = FrmEntriesHelper::entry_array_to_string($values); |
|
281 | + $content = FrmEntriesHelper::entry_array_to_string($values); |
|
282 | 282 | |
283 | 283 | if ( empty($content) ) { |
284 | - return false; |
|
284 | + return false; |
|
285 | 285 | } |
286 | 286 | |
287 | - $words = explode( "\n", $mod_keys ); |
|
287 | + $words = explode( "\n", $mod_keys ); |
|
288 | 288 | |
289 | - foreach ( (array) $words as $word ) { |
|
290 | - $word = trim( $word ); |
|
289 | + foreach ( (array) $words as $word ) { |
|
290 | + $word = trim( $word ); |
|
291 | 291 | |
292 | - if ( empty($word) ) { |
|
293 | - continue; |
|
294 | - } |
|
292 | + if ( empty($word) ) { |
|
293 | + continue; |
|
294 | + } |
|
295 | 295 | |
296 | - if ( preg_match('#' . preg_quote( $word, '#' ) . '#', $content) ) { |
|
297 | - return true; |
|
298 | - } |
|
299 | - } |
|
296 | + if ( preg_match('#' . preg_quote( $word, '#' ) . '#', $content) ) { |
|
297 | + return true; |
|
298 | + } |
|
299 | + } |
|
300 | 300 | |
301 | - return false; |
|
302 | - } |
|
301 | + return false; |
|
302 | + } |
|
303 | 303 | |
304 | - /** |
|
305 | - * Check entries for spam |
|
306 | - * |
|
307 | - * @return boolean true if is spam |
|
308 | - */ |
|
309 | - public static function akismet( $values ) { |
|
310 | - $content = FrmEntriesHelper::entry_array_to_string( $values ); |
|
304 | + /** |
|
305 | + * Check entries for spam |
|
306 | + * |
|
307 | + * @return boolean true if is spam |
|
308 | + */ |
|
309 | + public static function akismet( $values ) { |
|
310 | + $content = FrmEntriesHelper::entry_array_to_string( $values ); |
|
311 | 311 | |
312 | 312 | if ( empty( $content ) ) { |
313 | - return false; |
|
313 | + return false; |
|
314 | 314 | } |
315 | 315 | |
316 | - $datas = array(); |
|
317 | - self::parse_akismet_array( $datas, $content ); |
|
316 | + $datas = array(); |
|
317 | + self::parse_akismet_array( $datas, $content ); |
|
318 | 318 | |
319 | 319 | $query_string = ''; |
320 | 320 | foreach ( $datas as $key => $data ) { |
@@ -322,35 +322,35 @@ discard block |
||
322 | 322 | unset( $key, $data ); |
323 | 323 | } |
324 | 324 | |
325 | - $response = Akismet::http_post($query_string, 'comment-check'); |
|
325 | + $response = Akismet::http_post($query_string, 'comment-check'); |
|
326 | 326 | |
327 | 327 | return ( is_array( $response ) && $response[1] == 'true' ); |
328 | - } |
|
329 | - |
|
330 | - /** |
|
331 | - * @since 2.0 |
|
332 | - * @param string $content |
|
333 | - */ |
|
334 | - private static function parse_akismet_array( &$datas, $content ) { |
|
335 | - $datas['blog'] = FrmAppHelper::site_url(); |
|
336 | - $datas['user_ip'] = preg_replace( '/[^0-9., ]/', '', FrmAppHelper::get_ip_address() ); |
|
328 | + } |
|
329 | + |
|
330 | + /** |
|
331 | + * @since 2.0 |
|
332 | + * @param string $content |
|
333 | + */ |
|
334 | + private static function parse_akismet_array( &$datas, $content ) { |
|
335 | + $datas['blog'] = FrmAppHelper::site_url(); |
|
336 | + $datas['user_ip'] = preg_replace( '/[^0-9., ]/', '', FrmAppHelper::get_ip_address() ); |
|
337 | 337 | $datas['user_agent'] = FrmAppHelper::get_server_value( 'HTTP_USER_AGENT' ); |
338 | 338 | $datas['referrer'] = isset( $_SERVER['HTTP_REFERER'] ) ? FrmAppHelper::get_server_value( 'HTTP_REFERER' ) : false; |
339 | - $datas['comment_type'] = 'formidable'; |
|
340 | - $datas['comment_content'] = $content; |
|
339 | + $datas['comment_type'] = 'formidable'; |
|
340 | + $datas['comment_content'] = $content; |
|
341 | 341 | |
342 | - if ( $permalink = get_permalink() ) { |
|
343 | - $datas['permalink'] = $permalink; |
|
344 | - } |
|
342 | + if ( $permalink = get_permalink() ) { |
|
343 | + $datas['permalink'] = $permalink; |
|
344 | + } |
|
345 | 345 | |
346 | - foreach ( $_SERVER as $key => $value ) { |
|
346 | + foreach ( $_SERVER as $key => $value ) { |
|
347 | 347 | if ( ! in_array( $key, array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' ) ) && is_string( $value ) ) { |
348 | 348 | $datas[ $key ] = wp_strip_all_tags( $value ); |
349 | - } else { |
|
349 | + } else { |
|
350 | 350 | $datas[ $key ] = ''; |
351 | - } |
|
351 | + } |
|
352 | 352 | |
353 | - unset($key, $value); |
|
354 | - } |
|
355 | - } |
|
353 | + unset($key, $value); |
|
354 | + } |
|
355 | + } |
|
356 | 356 | } |
@@ -7,20 +7,20 @@ discard block |
||
7 | 7 | FrmEntry::sanitize_entry_post( $values ); |
8 | 8 | $errors = array(); |
9 | 9 | |
10 | - if ( ! isset($values['form_id']) || ! isset($values['item_meta']) ) { |
|
10 | + if ( ! isset( $values['form_id'] ) || ! isset( $values['item_meta'] ) ) { |
|
11 | 11 | $errors['form'] = __( 'There was a problem with your submission. Please try again.', 'formidable' ); |
12 | 12 | return $errors; |
13 | 13 | } |
14 | 14 | |
15 | - if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) { |
|
15 | + if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values['frm_submit_entry_' . $values['form_id']] ) || ! wp_verify_nonce( $values['frm_submit_entry_' . $values['form_id']], 'frm_submit_entry_nonce' ) ) ) { |
|
16 | 16 | $errors['form'] = __( 'You do not have permission to do that', 'formidable' ); |
17 | 17 | } |
18 | 18 | |
19 | - if ( ! isset($values['item_key']) || $values['item_key'] == '' ) { |
|
20 | - $_POST['item_key'] = $values['item_key'] = FrmAppHelper::get_unique_key('', $wpdb->prefix .'frm_items', 'item_key'); |
|
19 | + if ( ! isset( $values['item_key'] ) || $values['item_key'] == '' ) { |
|
20 | + $_POST['item_key'] = $values['item_key'] = FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_items', 'item_key' ); |
|
21 | 21 | } |
22 | 22 | |
23 | - $where = apply_filters('frm_posted_field_ids', array( 'fi.form_id' => $values['form_id'] ) ); |
|
23 | + $where = apply_filters( 'frm_posted_field_ids', array( 'fi.form_id' => $values['form_id'] ) ); |
|
24 | 24 | // Don't get subfields |
25 | 25 | $where['fr.parent_form_id'] = array( null, 0 ); |
26 | 26 | // Don't get excluded fields (like file upload fields in the ajax validation) |
@@ -28,20 +28,20 @@ discard block |
||
28 | 28 | $where['fi.type not'] = $exclude; |
29 | 29 | } |
30 | 30 | |
31 | - $posted_fields = FrmField::getAll($where, 'field_order'); |
|
31 | + $posted_fields = FrmField::getAll( $where, 'field_order' ); |
|
32 | 32 | |
33 | 33 | // Pass exclude value to validate_field function so it can be used for repeating sections |
34 | 34 | $args = array( 'exclude' => $exclude ); |
35 | 35 | |
36 | 36 | foreach ( $posted_fields as $posted_field ) { |
37 | - self::validate_field($posted_field, $errors, $values, $args); |
|
38 | - unset($posted_field); |
|
37 | + self::validate_field( $posted_field, $errors, $values, $args ); |
|
38 | + unset( $posted_field ); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | // check for spam |
42 | 42 | self::spam_check( $exclude, $values, $errors ); |
43 | 43 | |
44 | - $errors = apply_filters( 'frm_validate_entry', $errors, $values, compact('exclude') ); |
|
44 | + $errors = apply_filters( 'frm_validate_entry', $errors, $values, compact( 'exclude' ) ); |
|
45 | 45 | |
46 | 46 | return $errors; |
47 | 47 | } |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | ); |
56 | 56 | $args = wp_parse_args( $args, $defaults ); |
57 | 57 | |
58 | - if ( empty($args['parent_field_id']) ) { |
|
59 | - $value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : ''; |
|
58 | + if ( empty( $args['parent_field_id'] ) ) { |
|
59 | + $value = isset( $values['item_meta'][$args['id']] ) ? $values['item_meta'][$args['id']] : ''; |
|
60 | 60 | } else { |
61 | 61 | // value is from a nested form |
62 | 62 | $value = $values; |
@@ -65,18 +65,18 @@ discard block |
||
65 | 65 | // Check for values in "Other" fields |
66 | 66 | FrmEntriesHelper::maybe_set_other_validation( $posted_field, $value, $args ); |
67 | 67 | |
68 | - if ( isset($posted_field->field_options['default_blank']) && $posted_field->field_options['default_blank'] && $value == $posted_field->default_value ) { |
|
68 | + if ( isset( $posted_field->field_options['default_blank'] ) && $posted_field->field_options['default_blank'] && $value == $posted_field->default_value ) { |
|
69 | 69 | $value = ''; |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Check for an array with only one value |
73 | 73 | // Don't reset values in "Other" fields because array keys need to be preserved |
74 | - if ( is_array($value) && count( $value ) == 1 && $args['other'] !== true ) { |
|
75 | - $value = reset($value); |
|
74 | + if ( is_array( $value ) && count( $value ) == 1 && $args['other'] !== true ) { |
|
75 | + $value = reset( $value ); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | if ( $posted_field->required == '1' && ! is_array( $value ) && trim( $value ) == '' ) { |
79 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
79 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
80 | 80 | } else if ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { |
81 | 81 | $_POST['item_name'] = $value; |
82 | 82 | } |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | self::validate_phone_field( $errors, $posted_field, $value, $args ); |
89 | 89 | } |
90 | 90 | |
91 | - FrmEntriesHelper::set_posted_value($posted_field, $value, $args); |
|
91 | + FrmEntriesHelper::set_posted_value( $posted_field, $value, $args ); |
|
92 | 92 | |
93 | - self::validate_recaptcha($errors, $posted_field, $args); |
|
93 | + self::validate_recaptcha( $errors, $posted_field, $args ); |
|
94 | 94 | |
95 | - $errors = apply_filters('frm_validate_field_entry', $errors, $posted_field, $value, $args); |
|
95 | + $errors = apply_filters( 'frm_validate_field_entry', $errors, $posted_field, $value, $args ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | public static function validate_url_field( &$errors, $field, &$value, $args ) { |
@@ -100,16 +100,16 @@ discard block |
||
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
103 | - if ( trim($value) == 'http://' ) { |
|
103 | + if ( trim( $value ) == 'http://' ) { |
|
104 | 104 | $value = ''; |
105 | 105 | } else { |
106 | 106 | $value = esc_url_raw( $value ); |
107 | - $value = preg_match('/^(https?|ftps?|mailto|news|feed|telnet):/is', $value) ? $value : 'http://'. $value; |
|
107 | + $value = preg_match( '/^(https?|ftps?|mailto|news|feed|telnet):/is', $value ) ? $value : 'http://' . $value; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | //validate the url format |
111 | - if ( ! preg_match('/^http(s)?:\/\/([\da-z\.-]+)\.([\da-z\.-]+)/i', $value) ) { |
|
112 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
111 | + if ( ! preg_match( '/^http(s)?:\/\/([\da-z\.-]+)\.([\da-z\.-]+)/i', $value ) ) { |
|
112 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | //validate the email format |
122 | - if ( ! is_email($value) ) { |
|
123 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
122 | + if ( ! is_email( $value ) ) { |
|
123 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | return; |
131 | 131 | } |
132 | 132 | |
133 | - if ( ! is_numeric( $value) ) { |
|
134 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
133 | + if ( ! is_numeric( $value ) ) { |
|
134 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | // validate number settings |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | if ( $frm_settings->use_html && isset( $field->field_options['minnum'] ) && isset( $field->field_options['maxnum'] ) ) { |
142 | 142 | //minnum maxnum |
143 | 143 | if ( (float) $value < $field->field_options['minnum'] ) { |
144 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a higher number', 'formidable' ); |
|
144 | + $errors['field' . $args['id']] = __( 'Please select a higher number', 'formidable' ); |
|
145 | 145 | } else if ( (float) $value > $field->field_options['maxnum'] ) { |
146 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a lower number', 'formidable' ); |
|
146 | + $errors['field' . $args['id']] = __( 'Please select a lower number', 'formidable' ); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $pattern = self::phone_format( $field ); |
158 | 158 | |
159 | 159 | if ( ! preg_match( $pattern, $value ) ) { |
160 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
160 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | return; |
210 | 210 | } |
211 | 211 | |
212 | - if ( ! isset($_POST['g-recaptcha-response']) ) { |
|
212 | + if ( ! isset( $_POST['g-recaptcha-response'] ) ) { |
|
213 | 213 | // If captcha is missing, check if it was already verified |
214 | 214 | if ( ! isset( $_POST['recaptcha_checked'] ) || ! wp_verify_nonce( $_POST['recaptcha_checked'], 'frm_ajax' ) ) { |
215 | 215 | // There was no captcha submitted |
216 | - $errors[ 'field' . $args['id'] ] = __( 'The captcha is missing from this form', 'formidable' ); |
|
216 | + $errors['field' . $args['id']] = __( 'The captcha is missing from this form', 'formidable' ); |
|
217 | 217 | } |
218 | 218 | return; |
219 | 219 | } |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | ), |
227 | 227 | ); |
228 | 228 | $resp = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', $arg_array ); |
229 | - $response = json_decode(wp_remote_retrieve_body( $resp ), true); |
|
229 | + $response = json_decode( wp_remote_retrieve_body( $resp ), true ); |
|
230 | 230 | |
231 | 231 | if ( isset( $response['success'] ) && ! $response['success'] ) { |
232 | 232 | // What happens when the CAPTCHA was entered incorrectly |
233 | - $errors[ 'field' . $args['id'] ] = ( ! isset( $field->field_options['invalid'] ) || $field->field_options['invalid'] == '' ) ? $frm_settings->re_msg : $field->field_options['invalid']; |
|
233 | + $errors['field' . $args['id']] = ( ! isset( $field->field_options['invalid'] ) || $field->field_options['invalid'] == '' ) ? $frm_settings->re_msg : $field->field_options['invalid']; |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | |
260 | 260 | private static function is_akismet_spam( $values ) { |
261 | 261 | global $wpcom_api_key; |
262 | - return ( is_callable('Akismet::http_post') && ( get_option('wordpress_api_key') || $wpcom_api_key ) && self::akismet( $values ) ); |
|
262 | + return ( is_callable( 'Akismet::http_post' ) && ( get_option( 'wordpress_api_key' ) || $wpcom_api_key ) && self::akismet( $values ) ); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | private static function is_akismet_enabled_for_user( $form_id ) { |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | public static function blacklist_check( $values ) { |
271 | - if ( ! apply_filters('frm_check_blacklist', true, $values) ) { |
|
271 | + if ( ! apply_filters( 'frm_check_blacklist', true, $values ) ) { |
|
272 | 272 | return false; |
273 | 273 | } |
274 | 274 | |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | return false; |
279 | 279 | } |
280 | 280 | |
281 | - $content = FrmEntriesHelper::entry_array_to_string($values); |
|
281 | + $content = FrmEntriesHelper::entry_array_to_string( $values ); |
|
282 | 282 | |
283 | - if ( empty($content) ) { |
|
283 | + if ( empty( $content ) ) { |
|
284 | 284 | return false; |
285 | 285 | } |
286 | 286 | |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | foreach ( (array) $words as $word ) { |
290 | 290 | $word = trim( $word ); |
291 | 291 | |
292 | - if ( empty($word) ) { |
|
292 | + if ( empty( $word ) ) { |
|
293 | 293 | continue; |
294 | 294 | } |
295 | 295 | |
296 | - if ( preg_match('#' . preg_quote( $word, '#' ) . '#', $content) ) { |
|
296 | + if ( preg_match( '#' . preg_quote( $word, '#' ) . '#', $content ) ) { |
|
297 | 297 | return true; |
298 | 298 | } |
299 | 299 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | unset( $key, $data ); |
323 | 323 | } |
324 | 324 | |
325 | - $response = Akismet::http_post($query_string, 'comment-check'); |
|
325 | + $response = Akismet::http_post( $query_string, 'comment-check' ); |
|
326 | 326 | |
327 | 327 | return ( is_array( $response ) && $response[1] == 'true' ); |
328 | 328 | } |
@@ -345,12 +345,12 @@ discard block |
||
345 | 345 | |
346 | 346 | foreach ( $_SERVER as $key => $value ) { |
347 | 347 | if ( ! in_array( $key, array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' ) ) && is_string( $value ) ) { |
348 | - $datas[ $key ] = wp_strip_all_tags( $value ); |
|
348 | + $datas[$key] = wp_strip_all_tags( $value ); |
|
349 | 349 | } else { |
350 | - $datas[ $key ] = ''; |
|
350 | + $datas[$key] = ''; |
|
351 | 351 | } |
352 | 352 | |
353 | - unset($key, $value); |
|
353 | + unset( $key, $value ); |
|
354 | 354 | } |
355 | 355 | } |
356 | 356 | } |