@@ -1,26 +1,26 @@ discard block |
||
1 | 1 | <div class="field-group clearfix frm-half frm-first-row"> |
2 | 2 | <label><?php _e( 'Radio', 'formidable' ) ?></label> |
3 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('radio_align') ) ?>" id="frm_radio_align"> |
|
4 | - <option value="block" <?php selected($style->post_content['radio_align'], 'block') ?>><?php _e( 'Multiple Rows' , 'formidable' ) ?></option> |
|
5 | - <option value="inline" <?php selected($style->post_content['radio_align'], 'inline') ?>><?php _e( 'Single Row' , 'formidable' ) ?></option> |
|
3 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'radio_align' ) ) ?>" id="frm_radio_align"> |
|
4 | + <option value="block" <?php selected( $style->post_content['radio_align'], 'block' ) ?>><?php _e( 'Multiple Rows', 'formidable' ) ?></option> |
|
5 | + <option value="inline" <?php selected( $style->post_content['radio_align'], 'inline' ) ?>><?php _e( 'Single Row', 'formidable' ) ?></option> |
|
6 | 6 | </select> |
7 | 7 | </div> |
8 | 8 | |
9 | 9 | <div class="field-group clearfix frm-half frm-first-row"> |
10 | 10 | <label><?php _e( 'Check Box', 'formidable' ) ?></label> |
11 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('check_align') ) ?>" id="frm_check_align"> |
|
12 | - <option value="block" <?php selected($style->post_content['check_align'], 'block') ?>><?php _e( 'Multiple Rows' , 'formidable' ) ?></option> |
|
13 | - <option value="inline" <?php selected($style->post_content['check_align'], 'inline') ?>><?php _e( 'Single Row' , 'formidable' ) ?></option> |
|
11 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'check_align' ) ) ?>" id="frm_check_align"> |
|
12 | + <option value="block" <?php selected( $style->post_content['check_align'], 'block' ) ?>><?php _e( 'Multiple Rows', 'formidable' ) ?></option> |
|
13 | + <option value="inline" <?php selected( $style->post_content['check_align'], 'inline' ) ?>><?php _e( 'Single Row', 'formidable' ) ?></option> |
|
14 | 14 | </select> |
15 | 15 | </div> |
16 | 16 | |
17 | 17 | <div class="field-group field-group-background clearfix"> |
18 | 18 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
19 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('check_label_color') ) ?>" id="frm_check_label_color" class="hex" value="<?php echo esc_attr( $style->post_content['check_label_color'] ) ?>" /> |
|
19 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'check_label_color' ) ) ?>" id="frm_check_label_color" class="hex" value="<?php echo esc_attr( $style->post_content['check_label_color'] ) ?>" /> |
|
20 | 20 | </div> |
21 | 21 | <div class="field-group clearfix"> |
22 | 22 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
23 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('check_weight') ) ?>" id="frm_check_weight"> |
|
23 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'check_weight' ) ) ?>" id="frm_check_weight"> |
|
24 | 24 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
25 | 25 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['check_weight'], $value ) ?>><?php echo esc_html( $name ) ?></option> |
26 | 26 | <?php } ?> |
@@ -28,5 +28,5 @@ discard block |
||
28 | 28 | </div> |
29 | 29 | <div class="field-group clearfix"> |
30 | 30 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
31 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('check_font_size') ) ?>" id="frm_check_font_size" value="<?php echo esc_attr( $style->post_content['check_font_size'] ) ?>" size="3" /> |
|
31 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'check_font_size' ) ) ?>" id="frm_check_font_size" value="<?php echo esc_attr( $style->post_content['check_font_size'] ) ?>" size="3" /> |
|
32 | 32 | </div> |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <p class="frm_no_top_margin"> |
2 | 2 | <label for="frm_submit_style"> |
3 | - <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('submit_style') ) ?>" id="frm_submit_style" <?php checked( $style->post_content['submit_style'], 1 ) ?> value="1" /> |
|
3 | + <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_style' ) ) ?>" id="frm_submit_style" <?php checked( $style->post_content['submit_style'], 1 ) ?> value="1" /> |
|
4 | 4 | <?php esc_html_e( 'Disable submit button styling', 'formidable' ); ?> |
5 | 5 | <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Note: If disabled, you may not see the change take effect until you make 2 more styling changes or click "Update Options".', 'formidable' ) ?>"></span> |
6 | 6 | </label> |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | <div class="posttypediv"> |
10 | 10 | <ul class="posttype-tabs add-menu-item-tabs"> |
11 | 11 | <li <?php echo ( 'default' == $current_tab ? ' class="tabs"' : '' ); ?>> |
12 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=default#tabs-panel-button-default') ?>" class="nav-tab-link" data-type="tabs-panel-button-default" ><?php _e( 'Default', 'formidable' ) ?></a> |
|
12 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=default#tabs-panel-button-default' ) ?>" class="nav-tab-link" data-type="tabs-panel-button-default" ><?php _e( 'Default', 'formidable' ) ?></a> |
|
13 | 13 | </li> |
14 | 14 | <li <?php echo ( 'button-hover' == $current_tab ? ' class="tabs"' : '' ); ?>> |
15 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=button-hover#page-button-hover') ?>" class="nav-tab-link" data-type="tabs-panel-button-hover" ><?php _e( 'Hover', 'formidable' ) ?></a> |
|
15 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=button-hover#page-button-hover' ) ?>" class="nav-tab-link" data-type="tabs-panel-button-hover" ><?php _e( 'Hover', 'formidable' ) ?></a> |
|
16 | 16 | </li> |
17 | 17 | <li <?php echo ( 'button-click' == $current_tab ? ' class="tabs"' : '' ); ?>> |
18 | 18 | <a href="?page=formidable-styles&page-tab=button-click#tabs-panel-button-click" class="nav-tab-link" data-type="tabs-panel-button-click"><?php _e( 'Click', 'formidable' ) ?></a> |
@@ -24,22 +24,22 @@ discard block |
||
24 | 24 | ?>"> |
25 | 25 | <div class="field-group field-group-border clearfix"> |
26 | 26 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
27 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_font_size') ) ?>" id="frm_submit_font_size" value="<?php echo esc_attr( $style->post_content['submit_font_size'] ) ?>" size="3" /> |
|
27 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_font_size' ) ) ?>" id="frm_submit_font_size" value="<?php echo esc_attr( $style->post_content['submit_font_size'] ) ?>" size="3" /> |
|
28 | 28 | </div> |
29 | 29 | |
30 | 30 | <div class="field-group clearfix"> |
31 | 31 | <label><?php _e( 'Width', 'formidable' ) ?></label> |
32 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_width') ) ?>" id="frm_submit_width" value="<?php echo esc_attr( $style->post_content['submit_width'] ) ?>" size="5" /> |
|
32 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_width' ) ) ?>" id="frm_submit_width" value="<?php echo esc_attr( $style->post_content['submit_width'] ) ?>" size="5" /> |
|
33 | 33 | </div> |
34 | 34 | |
35 | 35 | <div class="field-group clearfix"> |
36 | 36 | <label><?php _e( 'Height', 'formidable' ) ?></label> |
37 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_height') ) ?>" id="frm_submit_height" value="<?php echo esc_attr( $style->post_content['submit_height'] ) ?>" size="5" /> |
|
37 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_height' ) ) ?>" id="frm_submit_height" value="<?php echo esc_attr( $style->post_content['submit_height'] ) ?>" size="5" /> |
|
38 | 38 | </div> |
39 | 39 | |
40 | 40 | <div class="field-group clearfix"> |
41 | 41 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
42 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('submit_weight') ) ?>" id="frm_submit_weight"> |
|
42 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_weight' ) ) ?>" id="frm_submit_weight"> |
|
43 | 43 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
44 | 44 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['submit_weight'], $value ) ?>><?php echo esc_html( $name ) ?></option> |
45 | 45 | <?php } ?> |
@@ -48,48 +48,48 @@ discard block |
||
48 | 48 | |
49 | 49 | <div class="field-group clearfix"> |
50 | 50 | <label><?php _e( 'Corners', 'formidable' ) ?></label> |
51 | - <input type="text" value="<?php echo esc_attr( $style->post_content['submit_border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name('submit_border_radius') ) ?>" id="frm_submit_border_radius" size="4"/> |
|
51 | + <input type="text" value="<?php echo esc_attr( $style->post_content['submit_border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_border_radius' ) ) ?>" id="frm_submit_border_radius" size="4"/> |
|
52 | 52 | </div> |
53 | 53 | |
54 | 54 | <div class="field-group field-group-border clearfix"> |
55 | 55 | <label><?php _e( 'BG color', 'formidable' ) ?></label> |
56 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_bg_color') ) ?>" id="frm_submit_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_bg_color'] ) ?>" /> |
|
56 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_bg_color' ) ) ?>" id="frm_submit_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_bg_color'] ) ?>" /> |
|
57 | 57 | </div> |
58 | 58 | |
59 | 59 | <div class="field-group clearfix"> |
60 | 60 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
61 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_text_color') ) ?>" id="frm_submit_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_text_color'] ) ?>" /> |
|
61 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_text_color' ) ) ?>" id="frm_submit_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_text_color'] ) ?>" /> |
|
62 | 62 | </div> |
63 | 63 | |
64 | 64 | <div class="field-group field-group-border clearfix"> |
65 | 65 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
66 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_border_color') ) ?>" id="frm_submit_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_border_color'] ) ?>" /> |
|
66 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_border_color' ) ) ?>" id="frm_submit_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_border_color'] ) ?>" /> |
|
67 | 67 | </div> |
68 | 68 | |
69 | 69 | <div class="field-group clearfix"> |
70 | 70 | <label><?php _e( 'Thickness', 'formidable' ) ?></label> |
71 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_border_width') ) ?>" id="frm_submit_border_width" value="<?php echo esc_attr( $style->post_content['submit_border_width'] ) ?>" size="4" /> |
|
71 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_border_width' ) ) ?>" id="frm_submit_border_width" value="<?php echo esc_attr( $style->post_content['submit_border_width'] ) ?>" size="4" /> |
|
72 | 72 | </div> |
73 | 73 | |
74 | 74 | <div class="field-group clearfix"> |
75 | 75 | <label><?php _e( 'Shadow', 'formidable' ) ?></label> |
76 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_shadow_color') ) ?>" id="frm_submit_shadow_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_shadow_color'] ) ?>" /> |
|
76 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_shadow_color' ) ) ?>" id="frm_submit_shadow_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_shadow_color'] ) ?>" /> |
|
77 | 77 | </div> |
78 | 78 | |
79 | 79 | <div class="clear"></div> |
80 | 80 | <div class="field-group field-group-border frm-full"> |
81 | 81 | <label><?php _e( 'BG Image', 'formidable' ) ?></label> |
82 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_bg_img') ) ?>" id="frm_submit_bg_img" value="<?php echo esc_attr( $style->post_content['submit_bg_img'] ) ?>" /> |
|
82 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_bg_img' ) ) ?>" id="frm_submit_bg_img" value="<?php echo esc_attr( $style->post_content['submit_bg_img'] ) ?>" /> |
|
83 | 83 | </div> |
84 | 84 | |
85 | 85 | <div class="field-group field-group-border clearfix"> |
86 | 86 | <label><?php _e( 'Margin', 'formidable' ) ?></label> |
87 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_margin') ) ?>" id="frm_submit_margin" value="<?php echo esc_attr( $style->post_content['submit_margin'] ) ?>" size="6" /> |
|
87 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_margin' ) ) ?>" id="frm_submit_margin" value="<?php echo esc_attr( $style->post_content['submit_margin'] ) ?>" size="6" /> |
|
88 | 88 | </div> |
89 | 89 | |
90 | 90 | <div class="field-group clearfix"> |
91 | 91 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
92 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_padding') ) ?>" id="frm_submit_padding" value="<?php echo esc_attr( $style->post_content['submit_padding'] ) ?>" size="6" /> |
|
92 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_padding' ) ) ?>" id="frm_submit_padding" value="<?php echo esc_attr( $style->post_content['submit_padding'] ) ?>" size="6" /> |
|
93 | 93 | </div> |
94 | 94 | <div class="clear"></div> |
95 | 95 | </div><!-- /.tabs-panel --> |
@@ -99,17 +99,17 @@ discard block |
||
99 | 99 | ?>"> |
100 | 100 | <div class="field-group clearfix"> |
101 | 101 | <label><?php _e( 'BG color', 'formidable' ) ?></label> |
102 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_hover_bg_color') ) ?>" id="frm_submit_hover_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_bg_color'] ) ?>" /> |
|
102 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_hover_bg_color' ) ) ?>" id="frm_submit_hover_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_bg_color'] ) ?>" /> |
|
103 | 103 | </div> |
104 | 104 | |
105 | 105 | <div class="field-group clearfix"> |
106 | 106 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
107 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_hover_color') ) ?>" id="frm_submit_hover_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_color'] ) ?>" /> |
|
107 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_hover_color' ) ) ?>" id="frm_submit_hover_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_color'] ) ?>" /> |
|
108 | 108 | </div> |
109 | 109 | |
110 | 110 | <div class="field-group clearfix"> |
111 | 111 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
112 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_hover_border_color') ) ?>" id="frm_submit_hover_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_border_color'] ) ?>" /> |
|
112 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_hover_border_color' ) ) ?>" id="frm_submit_hover_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_border_color'] ) ?>" /> |
|
113 | 113 | </div> |
114 | 114 | |
115 | 115 | <div class="clear"></div> |
@@ -120,17 +120,17 @@ discard block |
||
120 | 120 | ?>"> |
121 | 121 | <div class="field-group clearfix"> |
122 | 122 | <label><?php _e( 'BG color', 'formidable' ) ?></label> |
123 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_active_bg_color') ) ?>" id="frm_submit_active_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_bg_color'] ) ?>" /> |
|
123 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_active_bg_color' ) ) ?>" id="frm_submit_active_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_bg_color'] ) ?>" /> |
|
124 | 124 | </div> |
125 | 125 | |
126 | 126 | <div class="field-group clearfix"> |
127 | 127 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
128 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_active_color') ) ?>" id="frm_submit_active_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_color'] ) ?>" /> |
|
128 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_active_color' ) ) ?>" id="frm_submit_active_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_color'] ) ?>" /> |
|
129 | 129 | </div> |
130 | 130 | |
131 | 131 | <div class="field-group clearfix"> |
132 | 132 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
133 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_active_border_color') ) ?>" id="frm_submit_active_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_border_color'] ) ?>" /> |
|
133 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_active_border_color' ) ) ?>" id="frm_submit_active_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_border_color'] ) ?>" /> |
|
134 | 134 | </div> |
135 | 135 | |
136 | 136 | <div class="clear"></div> |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <div id="form_entries_page" class="wrap"> |
2 | 2 | <h1><?php _e( 'Entries', 'formidable' ); ?> |
3 | - <?php do_action('frm_entry_inside_h2', $form); ?> |
|
3 | + <?php do_action( 'frm_entry_inside_h2', $form ); ?> |
|
4 | 4 | </h1> |
5 | 5 | |
6 | 6 | <?php require( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); ?> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | <div id="poststuff"> |
10 | 10 | <div id="post-body" class="metabox-holder columns-2"> |
11 | 11 | <div id="post-body-content"> |
12 | - <?php FrmAppController::get_form_nav($form, true, 'hide'); ?> |
|
12 | + <?php FrmAppController::get_form_nav( $form, true, 'hide' ); ?> |
|
13 | 13 | </div> |
14 | 14 | <div id="postbox-container-1" class="postbox-container"> |
15 | 15 | <input type="hidden" name="page" value="formidable-entries" /> |
@@ -23,41 +23,41 @@ |
||
23 | 23 | |
24 | 24 | global $frm_vars; |
25 | 25 | $frm_vars = array( |
26 | - 'load_css' => false, 'forms_loaded' => array(), |
|
27 | - 'created_entries' => array(), |
|
28 | - 'pro_is_authorized' => false, |
|
26 | + 'load_css' => false, 'forms_loaded' => array(), |
|
27 | + 'created_entries' => array(), |
|
28 | + 'pro_is_authorized' => false, |
|
29 | 29 | ); |
30 | 30 | |
31 | 31 | function frm_forms_autoloader( $class_name ) { |
32 | - // Only load Frm classes here |
|
32 | + // Only load Frm classes here |
|
33 | 33 | if ( ! preg_match( '/^Frm.+$/', $class_name ) ) { |
34 | - return; |
|
35 | - } |
|
34 | + return; |
|
35 | + } |
|
36 | 36 | |
37 | - $filepath = dirname(__FILE__); |
|
37 | + $filepath = dirname(__FILE__); |
|
38 | 38 | if ( preg_match( '/^FrmPro.+$/', $class_name ) ) { |
39 | - $filepath .= '/pro'; |
|
40 | - } |
|
41 | - $filepath .= '/classes'; |
|
39 | + $filepath .= '/pro'; |
|
40 | + } |
|
41 | + $filepath .= '/classes'; |
|
42 | 42 | |
43 | 43 | if ( preg_match( '/^.+Helper$/', $class_name ) ) { |
44 | - $filepath .= '/helpers/'; |
|
44 | + $filepath .= '/helpers/'; |
|
45 | 45 | } else if ( preg_match( '/^.+Controller$/', $class_name ) ) { |
46 | - $filepath .= '/controllers/'; |
|
47 | - } else { |
|
48 | - $filepath .= '/models/'; |
|
49 | - } |
|
46 | + $filepath .= '/controllers/'; |
|
47 | + } else { |
|
48 | + $filepath .= '/models/'; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | $filepath .= $class_name . '.php'; |
52 | 52 | |
53 | - if ( file_exists($filepath) ) { |
|
54 | - include($filepath); |
|
55 | - } |
|
53 | + if ( file_exists($filepath) ) { |
|
54 | + include($filepath); |
|
55 | + } |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | // if __autoload is active, put it on the spl_autoload stack |
59 | 59 | if ( is_array(spl_autoload_functions()) && in_array( '__autoload', spl_autoload_functions()) ) { |
60 | - spl_autoload_register('__autoload'); |
|
60 | + spl_autoload_register('__autoload'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // Add the autoloader |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | return; |
35 | 35 | } |
36 | 36 | |
37 | - $filepath = dirname(__FILE__); |
|
37 | + $filepath = dirname( __FILE__ ); |
|
38 | 38 | if ( preg_match( '/^FrmPro.+$/', $class_name ) ) { |
39 | 39 | $filepath .= '/pro'; |
40 | 40 | } |
@@ -50,25 +50,25 @@ discard block |
||
50 | 50 | |
51 | 51 | $filepath .= $class_name . '.php'; |
52 | 52 | |
53 | - if ( file_exists($filepath) ) { |
|
54 | - include($filepath); |
|
53 | + if ( file_exists( $filepath ) ) { |
|
54 | + include( $filepath ); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | // if __autoload is active, put it on the spl_autoload stack |
59 | -if ( is_array(spl_autoload_functions()) && in_array( '__autoload', spl_autoload_functions()) ) { |
|
60 | - spl_autoload_register('__autoload'); |
|
59 | +if ( is_array( spl_autoload_functions() ) && in_array( '__autoload', spl_autoload_functions() ) ) { |
|
60 | + spl_autoload_register( '__autoload' ); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // Add the autoloader |
64 | -spl_autoload_register('frm_forms_autoloader'); |
|
64 | +spl_autoload_register( 'frm_forms_autoloader' ); |
|
65 | 65 | |
66 | -$frm_path = dirname(__FILE__); |
|
67 | -if ( file_exists($frm_path . '/pro/formidable-pro.php') ) { |
|
66 | +$frm_path = dirname( __FILE__ ); |
|
67 | +if ( file_exists( $frm_path . '/pro/formidable-pro.php' ) ) { |
|
68 | 68 | include( $frm_path . '/pro/formidable-pro.php' ); |
69 | 69 | } |
70 | 70 | |
71 | 71 | FrmHooksController::trigger_load_hook(); |
72 | 72 | |
73 | 73 | include_once( $frm_path . '/deprecated.php' ); |
74 | -unset($frm_path); |
|
74 | +unset( $frm_path ); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $join_form_in_query = true; |
24 | 24 | } |
25 | 25 | |
26 | - $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : ''; |
|
26 | + $s = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; |
|
27 | 27 | |
28 | 28 | if ( $s != '' && FrmAppHelper::pro_is_installed() ) { |
29 | 29 | $fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : ''; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby; |
34 | - if ( strpos($orderby, 'meta') !== false ) { |
|
34 | + if ( strpos( $orderby, 'meta' ) !== false ) { |
|
35 | 35 | $order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) ); |
36 | 36 | $orderby .= in_array( $order_field_type, array( 'number', 'scale' ) ) ? ' +0 ' : ''; |
37 | 37 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $start = (int) isset( $_REQUEST['start'] ) ? absint( $_REQUEST['start'] ) : ( ( $page - 1 ) * $per_page ); |
44 | 44 | |
45 | 45 | $this->items = FrmEntry::getAll( $s_query, $order, ' LIMIT ' . $start . ',' . $per_page, true, $join_form_in_query ); |
46 | - $total_items = FrmEntry::getRecordCount($s_query); |
|
46 | + $total_items = FrmEntry::getRecordCount( $s_query ); |
|
47 | 47 | |
48 | 48 | $this->set_pagination_args( array( |
49 | 49 | 'total_items' => $total_items, |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | public function no_items() { |
55 | 55 | $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; |
56 | - if ( ! empty($s) ) { |
|
56 | + if ( ! empty( $s ) ) { |
|
57 | 57 | _e( 'No Entries Found', 'formidable' ); |
58 | 58 | return; |
59 | 59 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $form = $this->params['form']; |
63 | 63 | |
64 | 64 | if ( $form_id ) { |
65 | - $form = FrmForm::getOne($form_id); |
|
65 | + $form = FrmForm::getOne( $form_id ); |
|
66 | 66 | } |
67 | 67 | $colspan = $this->get_column_count(); |
68 | 68 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | $r = "<tr id='item-action-{$item->id}'$style>"; |
122 | 122 | |
123 | - list( $columns, $hidden, , $primary ) = $this->get_column_info(); |
|
123 | + list( $columns, $hidden,, $primary ) = $this->get_column_info(); |
|
124 | 124 | $action_col = false; |
125 | 125 | |
126 | 126 | foreach ( $columns as $column_name => $column_display_name ) { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | $attributes = 'class="' . esc_attr( $class ) . '"'; |
140 | - unset($class); |
|
140 | + unset( $class ); |
|
141 | 141 | $attributes .= ' data-colname="' . $column_display_name . '"'; |
142 | 142 | |
143 | 143 | $form_id = $this->params['form'] ? $this->params['form'] : 0; |
@@ -155,24 +155,24 @@ discard block |
||
155 | 155 | break; |
156 | 156 | case 'name': |
157 | 157 | case 'description': |
158 | - $val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100); |
|
158 | + $val = FrmAppHelper::truncate( strip_tags( $item->{$col_name}), 100 ); |
|
159 | 159 | break; |
160 | 160 | case 'created_at': |
161 | 161 | case 'updated_at': |
162 | - $date = FrmAppHelper::get_formatted_time($item->{$col_name}); |
|
162 | + $date = FrmAppHelper::get_formatted_time( $item->{$col_name}); |
|
163 | 163 | $val = '<abbr title="' . esc_attr( FrmAppHelper::get_formatted_time( $item->{$col_name}, '', 'g:i:s A' ) ) . '">' . $date . '</abbr>'; |
164 | 164 | break; |
165 | 165 | case 'is_draft': |
166 | - $val = empty($item->is_draft) ? __( 'No') : __( 'Yes'); |
|
166 | + $val = empty( $item->is_draft ) ? __( 'No' ) : __( 'Yes' ); |
|
167 | 167 | break; |
168 | 168 | case 'form_id': |
169 | - $val = FrmFormsHelper::edit_form_link($item->form_id); |
|
169 | + $val = FrmFormsHelper::edit_form_link( $item->form_id ); |
|
170 | 170 | break; |
171 | 171 | case 'post_id': |
172 | - $val = FrmAppHelper::post_edit_link($item->post_id); |
|
172 | + $val = FrmAppHelper::post_edit_link( $item->post_id ); |
|
173 | 173 | break; |
174 | 174 | case 'user_id': |
175 | - $user = get_userdata($item->user_id); |
|
175 | + $user = get_userdata( $item->user_id ); |
|
176 | 176 | $val = $user ? $user->user_login : ''; |
177 | 177 | break; |
178 | 178 | default: |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } |
195 | 195 | $r .= '</td>'; |
196 | 196 | } |
197 | - unset($val); |
|
197 | + unset( $val ); |
|
198 | 198 | } |
199 | 199 | $r .= '</tr>'; |
200 | 200 | |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | private function get_actions( &$actions, $item, $view_link ) { |
208 | 208 | $actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>'; |
209 | 209 | |
210 | - if ( current_user_can('frm_delete_entries') ) { |
|
210 | + if ( current_user_can( 'frm_delete_entries' ) ) { |
|
211 | 211 | $delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form']; |
212 | 212 | $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( $delete_link ) ) . '" class="submitdelete" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete that?', 'formidable' ) ) . '\')">' . __( 'Delete' ) . '</a>'; |
213 | 213 | } |
214 | 214 | |
215 | - $actions = apply_filters('frm_row_actions', $actions, $item); |
|
215 | + $actions = apply_filters( 'frm_row_actions', $actions, $item ); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | private function get_column_value( $item, &$val ) { |
@@ -6,10 +6,10 @@ discard block |
||
6 | 6 | protected $field; |
7 | 7 | |
8 | 8 | public function prepare_items() { |
9 | - global $per_page; |
|
9 | + global $per_page; |
|
10 | 10 | |
11 | 11 | $per_page = $this->get_items_per_page( 'formidable_page_formidable_entries_per_page' ); |
12 | - $form_id = $this->params['form']; |
|
12 | + $form_id = $this->params['form']; |
|
13 | 13 | |
14 | 14 | $default_orderby = 'id'; |
15 | 15 | $default_order = 'DESC'; |
@@ -25,25 +25,25 @@ discard block |
||
25 | 25 | |
26 | 26 | $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : ''; |
27 | 27 | |
28 | - if ( $s != '' && FrmAppHelper::pro_is_installed() ) { |
|
29 | - $fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : ''; |
|
30 | - $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid ); |
|
31 | - } |
|
28 | + if ( $s != '' && FrmAppHelper::pro_is_installed() ) { |
|
29 | + $fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : ''; |
|
30 | + $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid ); |
|
31 | + } |
|
32 | 32 | |
33 | - $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby; |
|
34 | - if ( strpos($orderby, 'meta') !== false ) { |
|
35 | - $order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) ); |
|
33 | + $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby; |
|
34 | + if ( strpos($orderby, 'meta') !== false ) { |
|
35 | + $order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) ); |
|
36 | 36 | $orderby .= in_array( $order_field_type, array( 'number', 'scale' ) ) ? ' +0 ' : ''; |
37 | - } |
|
37 | + } |
|
38 | 38 | |
39 | 39 | $order = isset( $_REQUEST['order'] ) ? sanitize_title( $_REQUEST['order'] ) : $default_order; |
40 | 40 | $order = ' ORDER BY ' . $orderby . ' ' . $order; |
41 | 41 | |
42 | - $page = $this->get_pagenum(); |
|
42 | + $page = $this->get_pagenum(); |
|
43 | 43 | $start = (int) isset( $_REQUEST['start'] ) ? absint( $_REQUEST['start'] ) : ( ( $page - 1 ) * $per_page ); |
44 | 44 | |
45 | 45 | $this->items = FrmEntry::getAll( $s_query, $order, ' LIMIT ' . $start . ',' . $per_page, true, $join_form_in_query ); |
46 | - $total_items = FrmEntry::getRecordCount($s_query); |
|
46 | + $total_items = FrmEntry::getRecordCount($s_query); |
|
47 | 47 | |
48 | 48 | $this->set_pagination_args( array( |
49 | 49 | 'total_items' => $total_items, |
@@ -52,19 +52,19 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | public function no_items() { |
55 | - $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; |
|
56 | - if ( ! empty($s) ) { |
|
57 | - _e( 'No Entries Found', 'formidable' ); |
|
58 | - return; |
|
59 | - } |
|
55 | + $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; |
|
56 | + if ( ! empty($s) ) { |
|
57 | + _e( 'No Entries Found', 'formidable' ); |
|
58 | + return; |
|
59 | + } |
|
60 | 60 | |
61 | 61 | $form_id = $this->params['form']; |
62 | 62 | $form = $this->params['form']; |
63 | 63 | |
64 | - if ( $form_id ) { |
|
65 | - $form = FrmForm::getOne($form_id); |
|
66 | - } |
|
67 | - $colspan = $this->get_column_count(); |
|
64 | + if ( $form_id ) { |
|
65 | + $form = FrmForm::getOne($form_id); |
|
66 | + } |
|
67 | + $colspan = $this->get_column_count(); |
|
68 | 68 | |
69 | 69 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/no_entries.php' ); |
70 | 70 | } |
@@ -84,12 +84,12 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
87 | - * Gets the name of the primary column in the Entries screen |
|
88 | - * |
|
89 | - * @since 2.0.14 |
|
90 | - * |
|
91 | - * @return string $primary_column |
|
92 | - */ |
|
87 | + * Gets the name of the primary column in the Entries screen |
|
88 | + * |
|
89 | + * @since 2.0.14 |
|
90 | + * |
|
91 | + * @return string $primary_column |
|
92 | + */ |
|
93 | 93 | protected function get_primary_column_name() { |
94 | 94 | $columns = get_column_headers( $this->screen ); |
95 | 95 | $hidden = get_hidden_columns( $this->screen ); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $this->get_actions( $actions, $item, $view_link ); |
115 | 115 | |
116 | - $action_links = $this->row_actions( $actions ); |
|
116 | + $action_links = $this->row_actions( $actions ); |
|
117 | 117 | |
118 | 118 | // Set up the checkbox ( because the user is editable, otherwise its empty ) |
119 | 119 | $checkbox = "<input type='checkbox' name='item-action[]' id='cb-item-action-{$item->id}' value='{$item->id}' />"; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $r = "<tr id='item-action-{$item->id}'$style>"; |
122 | 122 | |
123 | 123 | list( $columns, $hidden, , $primary ) = $this->get_column_info(); |
124 | - $action_col = false; |
|
124 | + $action_col = false; |
|
125 | 125 | |
126 | 126 | foreach ( $columns as $column_name => $column_display_name ) { |
127 | 127 | $class = $column_name . ' column-' . $column_name; |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | if ( in_array( $column_name, $hidden ) ) { |
134 | 134 | $class .= ' frm_hidden'; |
135 | 135 | } else if ( ! $action_col && ! in_array( $column_name, array( 'cb', 'id', 'form_id', 'post_id' ) ) ) { |
136 | - $action_col = $column_name; |
|
137 | - } |
|
136 | + $action_col = $column_name; |
|
137 | + } |
|
138 | 138 | |
139 | 139 | $attributes = 'class="' . esc_attr( $class ) . '"'; |
140 | 140 | unset($class); |
@@ -152,30 +152,30 @@ discard block |
||
152 | 152 | case 'ip': |
153 | 153 | case 'id': |
154 | 154 | case 'item_key': |
155 | - $val = $item->{$col_name}; |
|
156 | - break; |
|
155 | + $val = $item->{$col_name}; |
|
156 | + break; |
|
157 | 157 | case 'name': |
158 | 158 | case 'description': |
159 | - $val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100); |
|
160 | - break; |
|
159 | + $val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100); |
|
160 | + break; |
|
161 | 161 | case 'created_at': |
162 | 162 | case 'updated_at': |
163 | - $date = FrmAppHelper::get_formatted_time($item->{$col_name}); |
|
163 | + $date = FrmAppHelper::get_formatted_time($item->{$col_name}); |
|
164 | 164 | $val = '<abbr title="' . esc_attr( FrmAppHelper::get_formatted_time( $item->{$col_name}, '', 'g:i:s A' ) ) . '">' . $date . '</abbr>'; |
165 | 165 | break; |
166 | 166 | case 'is_draft': |
167 | - $val = empty($item->is_draft) ? __( 'No') : __( 'Yes'); |
|
168 | - break; |
|
167 | + $val = empty($item->is_draft) ? __( 'No') : __( 'Yes'); |
|
168 | + break; |
|
169 | 169 | case 'form_id': |
170 | - $val = FrmFormsHelper::edit_form_link($item->form_id); |
|
171 | - break; |
|
170 | + $val = FrmFormsHelper::edit_form_link($item->form_id); |
|
171 | + break; |
|
172 | 172 | case 'post_id': |
173 | - $val = FrmAppHelper::post_edit_link($item->post_id); |
|
174 | - break; |
|
173 | + $val = FrmAppHelper::post_edit_link($item->post_id); |
|
174 | + break; |
|
175 | 175 | case 'user_id': |
176 | - $user = get_userdata($item->user_id); |
|
177 | - $val = $user ? $user->user_login : ''; |
|
178 | - break; |
|
176 | + $user = get_userdata($item->user_id); |
|
177 | + $val = $user ? $user->user_login : ''; |
|
178 | + break; |
|
179 | 179 | default: |
180 | 180 | $val = apply_filters( 'frm_entries_' . $col_name . '_column', false, compact( 'item' ) ); |
181 | 181 | if ( $val === false ) { |
@@ -185,15 +185,15 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | if ( $col_name != 'cb' ) { |
188 | - $r .= "<td $attributes>"; |
|
188 | + $r .= "<td $attributes>"; |
|
189 | 189 | if ( $column_name == $action_col ) { |
190 | 190 | $edit_link = '?page=formidable-entries&frm_action=edit&id=' . $item->id; |
191 | 191 | $r .= '<a href="' . esc_url( isset( $actions['edit'] ) ? $edit_link : $view_link ) . '" class="row-title" >' . $val . '</a> '; |
192 | - $r .= $action_links; |
|
192 | + $r .= $action_links; |
|
193 | 193 | } else { |
194 | - $r .= $val; |
|
195 | - } |
|
196 | - $r .= '</td>'; |
|
194 | + $r .= $val; |
|
195 | + } |
|
196 | + $r .= '</td>'; |
|
197 | 197 | } |
198 | 198 | unset($val); |
199 | 199 | } |
@@ -202,19 +202,19 @@ discard block |
||
202 | 202 | return $r; |
203 | 203 | } |
204 | 204 | |
205 | - /** |
|
206 | - * @param string $view_link |
|
207 | - */ |
|
208 | - private function get_actions( &$actions, $item, $view_link ) { |
|
205 | + /** |
|
206 | + * @param string $view_link |
|
207 | + */ |
|
208 | + private function get_actions( &$actions, $item, $view_link ) { |
|
209 | 209 | $actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>'; |
210 | 210 | |
211 | - if ( current_user_can('frm_delete_entries') ) { |
|
211 | + if ( current_user_can('frm_delete_entries') ) { |
|
212 | 212 | $delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form']; |
213 | 213 | $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( $delete_link ) ) . '" class="submitdelete" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete that?', 'formidable' ) ) . '\')">' . __( 'Delete' ) . '</a>'; |
214 | - } |
|
214 | + } |
|
215 | 215 | |
216 | - $actions = apply_filters('frm_row_actions', $actions, $item); |
|
217 | - } |
|
216 | + $actions = apply_filters('frm_row_actions', $actions, $item); |
|
217 | + } |
|
218 | 218 | |
219 | 219 | private function get_column_value( $item, &$val ) { |
220 | 220 | $col_name = $this->column_name; |
@@ -2,129 +2,129 @@ discard block |
||
2 | 2 | |
3 | 3 | class FrmFieldsController { |
4 | 4 | |
5 | - public static function load_field() { |
|
5 | + public static function load_field() { |
|
6 | 6 | FrmAppHelper::permission_check('frm_edit_forms'); |
7 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
7 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
8 | 8 | |
9 | - $fields = $_POST['field']; |
|
10 | - if ( empty( $fields ) ) { |
|
11 | - wp_die(); |
|
12 | - } |
|
9 | + $fields = $_POST['field']; |
|
10 | + if ( empty( $fields ) ) { |
|
11 | + wp_die(); |
|
12 | + } |
|
13 | 13 | |
14 | - $_GET['page'] = 'formidable'; |
|
15 | - $fields = stripslashes_deep( $fields ); |
|
14 | + $_GET['page'] = 'formidable'; |
|
15 | + $fields = stripslashes_deep( $fields ); |
|
16 | 16 | |
17 | - $ajax = true; |
|
17 | + $ajax = true; |
|
18 | 18 | $values = array( 'id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ) ); |
19 | - $path = FrmAppHelper::plugin_path(); |
|
20 | - $field_html = array(); |
|
21 | - |
|
22 | - foreach ( $fields as $field ) { |
|
23 | - $field = htmlspecialchars_decode( nl2br( $field ) ); |
|
24 | - $field = json_decode( $field, true ); |
|
25 | - if ( ! isset( $field['id'] ) ) { |
|
26 | - // this field may have already been loaded |
|
27 | - continue; |
|
28 | - } |
|
19 | + $path = FrmAppHelper::plugin_path(); |
|
20 | + $field_html = array(); |
|
21 | + |
|
22 | + foreach ( $fields as $field ) { |
|
23 | + $field = htmlspecialchars_decode( nl2br( $field ) ); |
|
24 | + $field = json_decode( $field, true ); |
|
25 | + if ( ! isset( $field['id'] ) ) { |
|
26 | + // this field may have already been loaded |
|
27 | + continue; |
|
28 | + } |
|
29 | 29 | |
30 | - $field_id = absint( $field['id'] ); |
|
30 | + $field_id = absint( $field['id'] ); |
|
31 | 31 | |
32 | - if ( ! isset( $field['value'] ) ) { |
|
33 | - $field['value'] = ''; |
|
34 | - } |
|
32 | + if ( ! isset( $field['value'] ) ) { |
|
33 | + $field['value'] = ''; |
|
34 | + } |
|
35 | 35 | |
36 | 36 | $field_name = 'item_meta[' . $field_id . ']'; |
37 | - $html_id = FrmFieldsHelper::get_html_id($field); |
|
37 | + $html_id = FrmFieldsHelper::get_html_id($field); |
|
38 | 38 | |
39 | - ob_start(); |
|
39 | + ob_start(); |
|
40 | 40 | include( $path . '/classes/views/frm-forms/add_field.php' ); |
41 | - $field_html[ $field_id ] = ob_get_contents(); |
|
42 | - ob_end_clean(); |
|
43 | - } |
|
41 | + $field_html[ $field_id ] = ob_get_contents(); |
|
42 | + ob_end_clean(); |
|
43 | + } |
|
44 | 44 | |
45 | - unset($path); |
|
45 | + unset($path); |
|
46 | 46 | |
47 | - echo json_encode($field_html); |
|
47 | + echo json_encode($field_html); |
|
48 | 48 | |
49 | - wp_die(); |
|
50 | - } |
|
49 | + wp_die(); |
|
50 | + } |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Create a new field with ajax |
54 | 54 | */ |
55 | - public static function create() { |
|
55 | + public static function create() { |
|
56 | 56 | FrmAppHelper::permission_check('frm_edit_forms'); |
57 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
57 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
58 | 58 | |
59 | 59 | $field_type = FrmAppHelper::get_post_param( 'field_type', '', 'sanitize_text_field' ); |
60 | 60 | $form_id = FrmAppHelper::get_post_param( 'form_id', 0, 'absint' ); |
61 | 61 | |
62 | 62 | $field = self::include_new_field( $field_type, $form_id ); |
63 | 63 | |
64 | - // this hook will allow for multiple fields to be added at once |
|
65 | - do_action('frm_after_field_created', $field, $form_id); |
|
64 | + // this hook will allow for multiple fields to be added at once |
|
65 | + do_action('frm_after_field_created', $field, $form_id); |
|
66 | 66 | |
67 | - wp_die(); |
|
68 | - } |
|
67 | + wp_die(); |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * Set up and create a new field |
|
72 | - * |
|
73 | - * @param string $field_type |
|
74 | - * @param integer $form_id |
|
75 | - * @return array|bool |
|
76 | - */ |
|
70 | + /** |
|
71 | + * Set up and create a new field |
|
72 | + * |
|
73 | + * @param string $field_type |
|
74 | + * @param integer $form_id |
|
75 | + * @return array|bool |
|
76 | + */ |
|
77 | 77 | public static function include_new_field( $field_type, $form_id ) { |
78 | - $values = array(); |
|
79 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
80 | - $values['post_type'] = FrmProFormsHelper::post_type($form_id); |
|
81 | - } |
|
78 | + $values = array(); |
|
79 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
80 | + $values['post_type'] = FrmProFormsHelper::post_type($form_id); |
|
81 | + } |
|
82 | 82 | |
83 | 83 | $field_values = FrmFieldsHelper::setup_new_vars( $field_type, $form_id ); |
84 | - $field_values = apply_filters( 'frm_before_field_created', $field_values ); |
|
84 | + $field_values = apply_filters( 'frm_before_field_created', $field_values ); |
|
85 | 85 | |
86 | - $field_id = FrmField::create( $field_values ); |
|
86 | + $field_id = FrmField::create( $field_values ); |
|
87 | 87 | |
88 | - if ( ! $field_id ) { |
|
89 | - return false; |
|
90 | - } |
|
88 | + if ( ! $field_id ) { |
|
89 | + return false; |
|
90 | + } |
|
91 | 91 | |
92 | - $field = self::include_single_field($field_id, $values, $form_id); |
|
92 | + $field = self::include_single_field($field_id, $values, $form_id); |
|
93 | 93 | |
94 | - return $field; |
|
95 | - } |
|
94 | + return $field; |
|
95 | + } |
|
96 | 96 | |
97 | 97 | public static function edit_name( $field = 'name', $id = '' ) { |
98 | 98 | FrmAppHelper::permission_check('frm_edit_forms'); |
99 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
99 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
100 | 100 | |
101 | - if ( empty($field) ) { |
|
102 | - $field = 'name'; |
|
103 | - } |
|
101 | + if ( empty($field) ) { |
|
102 | + $field = 'name'; |
|
103 | + } |
|
104 | 104 | |
105 | - if ( empty($id) ) { |
|
105 | + if ( empty($id) ) { |
|
106 | 106 | $id = FrmAppHelper::get_post_param( 'element_id', '', 'sanitize_title' ); |
107 | 107 | $id = str_replace( 'field_label_', '', $id ); |
108 | - } |
|
108 | + } |
|
109 | 109 | |
110 | 110 | $value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_kses_post' ); |
111 | 111 | $value = trim( $value ); |
112 | - if ( trim(strip_tags($value)) == '' ) { |
|
113 | - // set blank value if there is no content |
|
114 | - $value = ''; |
|
115 | - } |
|
112 | + if ( trim(strip_tags($value)) == '' ) { |
|
113 | + // set blank value if there is no content |
|
114 | + $value = ''; |
|
115 | + } |
|
116 | 116 | |
117 | 117 | FrmField::update( $id, array( $field => $value ) ); |
118 | 118 | |
119 | 119 | do_action( 'frm_after_update_field_' . $field, compact( 'id', 'value' ) ); |
120 | 120 | |
121 | 121 | echo stripslashes( wp_kses_post( $value ) ); |
122 | - wp_die(); |
|
123 | - } |
|
122 | + wp_die(); |
|
123 | + } |
|
124 | 124 | |
125 | - public static function update_ajax_option() { |
|
125 | + public static function update_ajax_option() { |
|
126 | 126 | FrmAppHelper::permission_check('frm_edit_forms'); |
127 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
127 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
128 | 128 | |
129 | 129 | $field_id = FrmAppHelper::get_post_param( 'field', 0, 'absint' ); |
130 | 130 | if ( ! $field_id ) { |
@@ -139,252 +139,252 @@ discard block |
||
139 | 139 | unset($new_val); |
140 | 140 | } |
141 | 141 | |
142 | - FrmField::update( $field_id, array( |
|
143 | - 'field_options' => $field->field_options, |
|
142 | + FrmField::update( $field_id, array( |
|
143 | + 'field_options' => $field->field_options, |
|
144 | 144 | 'form_id' => $field->form_id, |
145 | - ) ); |
|
146 | - wp_die(); |
|
147 | - } |
|
145 | + ) ); |
|
146 | + wp_die(); |
|
147 | + } |
|
148 | 148 | |
149 | - public static function duplicate() { |
|
149 | + public static function duplicate() { |
|
150 | 150 | FrmAppHelper::permission_check('frm_edit_forms'); |
151 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
151 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
152 | 152 | |
153 | - global $wpdb; |
|
153 | + global $wpdb; |
|
154 | 154 | |
155 | 155 | $field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
156 | 156 | $form_id = FrmAppHelper::get_post_param( 'form_id', 0, 'absint' ); |
157 | 157 | |
158 | 158 | $copy_field = FrmField::getOne( $field_id ); |
159 | - if ( ! $copy_field ) { |
|
160 | - wp_die(); |
|
161 | - } |
|
159 | + if ( ! $copy_field ) { |
|
160 | + wp_die(); |
|
161 | + } |
|
162 | 162 | |
163 | 163 | do_action( 'frm_duplicate_field', $copy_field, $form_id ); |
164 | 164 | do_action( 'frm_duplicate_field_' . $copy_field->type, $copy_field, $form_id ); |
165 | 165 | |
166 | 166 | $values = array(); |
167 | - FrmFieldsHelper::fill_field( $values, $copy_field, $form_id ); |
|
167 | + FrmFieldsHelper::fill_field( $values, $copy_field, $form_id ); |
|
168 | 168 | |
169 | 169 | $field_count = FrmDb::get_count( $wpdb->prefix . 'frm_fields fi LEFT JOIN ' . $wpdb->prefix . 'frm_forms fr ON (fi.form_id = fr.id)', array( 'or' => 1, 'fr.id' => $form_id, 'fr.parent_form_id' => $form_id ) ); |
170 | 170 | |
171 | - $values['field_order'] = $field_count + 1; |
|
171 | + $values['field_order'] = $field_count + 1; |
|
172 | 172 | |
173 | - $values = apply_filters( 'frm_prepare_single_field_for_duplication', $values ); |
|
173 | + $values = apply_filters( 'frm_prepare_single_field_for_duplication', $values ); |
|
174 | 174 | |
175 | 175 | $field_id = FrmField::create( $values ); |
176 | 176 | if ( ! $field_id ) { |
177 | 177 | wp_die(); |
178 | 178 | } |
179 | 179 | |
180 | - self::include_single_field($field_id, $values); |
|
180 | + self::include_single_field($field_id, $values); |
|
181 | 181 | |
182 | - wp_die(); |
|
183 | - } |
|
182 | + wp_die(); |
|
183 | + } |
|
184 | 184 | |
185 | - /** |
|
186 | - * Load a single field in the form builder along with all needed variables |
|
187 | - */ |
|
188 | - public static function include_single_field( $field_id, $values, $form_id = 0 ) { |
|
189 | - $field = FrmFieldsHelper::setup_edit_vars(FrmField::getOne($field_id)); |
|
185 | + /** |
|
186 | + * Load a single field in the form builder along with all needed variables |
|
187 | + */ |
|
188 | + public static function include_single_field( $field_id, $values, $form_id = 0 ) { |
|
189 | + $field = FrmFieldsHelper::setup_edit_vars(FrmField::getOne($field_id)); |
|
190 | 190 | $field_name = 'item_meta[' . $field_id . ']'; |
191 | - $html_id = FrmFieldsHelper::get_html_id($field); |
|
192 | - $id = $form_id ? $form_id : $field['form_id']; |
|
193 | - if ( $field['type'] == 'html' ) { |
|
194 | - $field['stop_filter'] = true; |
|
195 | - } |
|
191 | + $html_id = FrmFieldsHelper::get_html_id($field); |
|
192 | + $id = $form_id ? $form_id : $field['form_id']; |
|
193 | + if ( $field['type'] == 'html' ) { |
|
194 | + $field['stop_filter'] = true; |
|
195 | + } |
|
196 | 196 | |
197 | 197 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_field.php' ); |
198 | 198 | |
199 | - return $field; |
|
200 | - } |
|
199 | + return $field; |
|
200 | + } |
|
201 | 201 | |
202 | - public static function destroy() { |
|
202 | + public static function destroy() { |
|
203 | 203 | FrmAppHelper::permission_check('frm_edit_forms'); |
204 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
204 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
205 | 205 | |
206 | 206 | $field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
207 | 207 | FrmField::destroy( $field_id ); |
208 | - wp_die(); |
|
209 | - } |
|
208 | + wp_die(); |
|
209 | + } |
|
210 | 210 | |
211 | - /* Field Options */ |
|
211 | + /* Field Options */ |
|
212 | 212 | |
213 | - //Add Single Option or Other Option |
|
214 | - public static function add_option() { |
|
213 | + //Add Single Option or Other Option |
|
214 | + public static function add_option() { |
|
215 | 215 | FrmAppHelper::permission_check('frm_edit_forms'); |
216 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
216 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
217 | 217 | |
218 | 218 | $id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
219 | 219 | $opt_type = FrmAppHelper::get_post_param( 'opt_type', '', 'sanitize_text_field' ); |
220 | 220 | $opt_key = FrmAppHelper::get_post_param( 'opt_key', 0, 'absint' ); |
221 | 221 | |
222 | - $field = FrmField::getOne($id); |
|
222 | + $field = FrmField::getOne($id); |
|
223 | 223 | |
224 | - if ( 'other' == $opt_type ) { |
|
224 | + if ( 'other' == $opt_type ) { |
|
225 | 225 | $opt = __( 'Other', 'formidable' ); |
226 | - $other_val = ''; |
|
227 | - $opt_key = 'other_' . $opt_key; |
|
228 | - } else { |
|
226 | + $other_val = ''; |
|
227 | + $opt_key = 'other_' . $opt_key; |
|
228 | + } else { |
|
229 | 229 | $opt = __( 'New Option', 'formidable' ); |
230 | - } |
|
231 | - $field_val = $opt; |
|
230 | + } |
|
231 | + $field_val = $opt; |
|
232 | 232 | |
233 | - $field_data = $field; |
|
233 | + $field_data = $field; |
|
234 | 234 | $field = (array) $field; |
235 | 235 | $field['separate_value'] = isset( $field_data->field_options['separate_value'] ) ? $field_data->field_options['separate_value'] : 0; |
236 | 236 | unset( $field_data ); |
237 | 237 | |
238 | 238 | $field_name = 'item_meta[' . $id . ']'; |
239 | 239 | $html_id = FrmFieldsHelper::get_html_id( $field ); |
240 | - $checked = ''; |
|
240 | + $checked = ''; |
|
241 | 241 | |
242 | - if ( 'other' == $opt_type ) { |
|
242 | + if ( 'other' == $opt_type ) { |
|
243 | 243 | include( FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/other-option.php' ); |
244 | - } else { |
|
244 | + } else { |
|
245 | 245 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' ); |
246 | - } |
|
247 | - wp_die(); |
|
248 | - } |
|
246 | + } |
|
247 | + wp_die(); |
|
248 | + } |
|
249 | 249 | |
250 | - public static function edit_option() { |
|
250 | + public static function edit_option() { |
|
251 | 251 | _deprecated_function( __FUNCTION__, '2.3' ); |
252 | - } |
|
252 | + } |
|
253 | 253 | |
254 | - public static function delete_option() { |
|
254 | + public static function delete_option() { |
|
255 | 255 | _deprecated_function( __FUNCTION__, '2.3' ); |
256 | - } |
|
256 | + } |
|
257 | 257 | |
258 | - public static function import_choices() { |
|
259 | - FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' ); |
|
258 | + public static function import_choices() { |
|
259 | + FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' ); |
|
260 | 260 | |
261 | 261 | $field_id = absint( $_REQUEST['field_id'] ); |
262 | 262 | |
263 | - global $current_screen, $hook_suffix; |
|
263 | + global $current_screen, $hook_suffix; |
|
264 | 264 | |
265 | - // Catch plugins that include admin-header.php before admin.php completes. |
|
266 | - if ( empty( $current_screen ) && function_exists( 'set_current_screen' ) ) { |
|
267 | - $hook_suffix = ''; |
|
268 | - set_current_screen(); |
|
269 | - } |
|
265 | + // Catch plugins that include admin-header.php before admin.php completes. |
|
266 | + if ( empty( $current_screen ) && function_exists( 'set_current_screen' ) ) { |
|
267 | + $hook_suffix = ''; |
|
268 | + set_current_screen(); |
|
269 | + } |
|
270 | 270 | |
271 | - if ( function_exists( 'register_admin_color_schemes' ) ) { |
|
272 | - register_admin_color_schemes(); |
|
273 | - } |
|
271 | + if ( function_exists( 'register_admin_color_schemes' ) ) { |
|
272 | + register_admin_color_schemes(); |
|
273 | + } |
|
274 | 274 | |
275 | 275 | $hook_suffix = ''; |
276 | 276 | $admin_body_class = ''; |
277 | 277 | |
278 | - if ( get_user_setting( 'mfold' ) == 'f' ) { |
|
279 | - $admin_body_class .= ' folded'; |
|
280 | - } |
|
278 | + if ( get_user_setting( 'mfold' ) == 'f' ) { |
|
279 | + $admin_body_class .= ' folded'; |
|
280 | + } |
|
281 | 281 | |
282 | - if ( function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() ) { |
|
283 | - $admin_body_class .= ' admin-bar'; |
|
284 | - } |
|
282 | + if ( function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() ) { |
|
283 | + $admin_body_class .= ' admin-bar'; |
|
284 | + } |
|
285 | 285 | |
286 | - if ( is_rtl() ) { |
|
287 | - $admin_body_class .= ' rtl'; |
|
288 | - } |
|
286 | + if ( is_rtl() ) { |
|
287 | + $admin_body_class .= ' rtl'; |
|
288 | + } |
|
289 | 289 | |
290 | - $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
|
291 | - $prepop = array(); |
|
292 | - FrmFieldsHelper::get_bulk_prefilled_opts($prepop); |
|
290 | + $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
|
291 | + $prepop = array(); |
|
292 | + FrmFieldsHelper::get_bulk_prefilled_opts($prepop); |
|
293 | 293 | |
294 | - $field = FrmField::getOne($field_id); |
|
294 | + $field = FrmField::getOne($field_id); |
|
295 | 295 | |
296 | - wp_enqueue_script( 'utils' ); |
|
296 | + wp_enqueue_script( 'utils' ); |
|
297 | 297 | wp_enqueue_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css' ); |
298 | - FrmAppHelper::load_admin_wide_js(); |
|
298 | + FrmAppHelper::load_admin_wide_js(); |
|
299 | 299 | |
300 | 300 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/import_choices.php' ); |
301 | - wp_die(); |
|
302 | - } |
|
301 | + wp_die(); |
|
302 | + } |
|
303 | 303 | |
304 | - public static function import_options() { |
|
304 | + public static function import_options() { |
|
305 | 305 | FrmAppHelper::permission_check('frm_edit_forms'); |
306 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
306 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
307 | 307 | |
308 | - if ( ! is_admin() || ! current_user_can('frm_edit_forms') ) { |
|
309 | - return; |
|
310 | - } |
|
308 | + if ( ! is_admin() || ! current_user_can('frm_edit_forms') ) { |
|
309 | + return; |
|
310 | + } |
|
311 | 311 | |
312 | 312 | $field_id = absint( $_POST['field_id'] ); |
313 | - $field = FrmField::getOne($field_id); |
|
313 | + $field = FrmField::getOne($field_id); |
|
314 | 314 | |
315 | 315 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'select' ) ) ) { |
316 | - return; |
|
317 | - } |
|
316 | + return; |
|
317 | + } |
|
318 | 318 | |
319 | - $field = FrmFieldsHelper::setup_edit_vars($field); |
|
319 | + $field = FrmFieldsHelper::setup_edit_vars($field); |
|
320 | 320 | $opts = FrmAppHelper::get_param( 'opts', '', 'post', 'wp_kses_post' ); |
321 | 321 | $opts = explode( "\n", rtrim( $opts, "\n" ) ); |
322 | 322 | $opts = array_map( 'trim', $opts ); |
323 | 323 | |
324 | - if ( $field['separate_value'] ) { |
|
325 | - foreach ( $opts as $opt_key => $opt ) { |
|
326 | - if ( strpos($opt, '|') !== false ) { |
|
327 | - $vals = explode('|', $opt); |
|
328 | - if ( $vals[0] != $vals[1] ) { |
|
329 | - $opts[ $opt_key ] = array( 'label' => trim( $vals[0] ), 'value' => trim( $vals[1] ) ); |
|
330 | - } |
|
331 | - unset($vals); |
|
332 | - } |
|
333 | - unset($opt_key, $opt); |
|
334 | - } |
|
335 | - } |
|
336 | - |
|
337 | - //Keep other options after bulk update |
|
338 | - if ( isset( $field['field_options']['other'] ) && $field['field_options']['other'] == true ) { |
|
339 | - $other_array = array(); |
|
340 | - foreach ( $field['options'] as $opt_key => $opt ) { |
|
324 | + if ( $field['separate_value'] ) { |
|
325 | + foreach ( $opts as $opt_key => $opt ) { |
|
326 | + if ( strpos($opt, '|') !== false ) { |
|
327 | + $vals = explode('|', $opt); |
|
328 | + if ( $vals[0] != $vals[1] ) { |
|
329 | + $opts[ $opt_key ] = array( 'label' => trim( $vals[0] ), 'value' => trim( $vals[1] ) ); |
|
330 | + } |
|
331 | + unset($vals); |
|
332 | + } |
|
333 | + unset($opt_key, $opt); |
|
334 | + } |
|
335 | + } |
|
336 | + |
|
337 | + //Keep other options after bulk update |
|
338 | + if ( isset( $field['field_options']['other'] ) && $field['field_options']['other'] == true ) { |
|
339 | + $other_array = array(); |
|
340 | + foreach ( $field['options'] as $opt_key => $opt ) { |
|
341 | 341 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
342 | 342 | $other_array[ $opt_key ] = $opt; |
343 | 343 | } |
344 | - unset($opt_key, $opt); |
|
345 | - } |
|
346 | - if ( ! empty($other_array) ) { |
|
347 | - $opts = array_merge( $opts, $other_array); |
|
348 | - } |
|
349 | - } |
|
344 | + unset($opt_key, $opt); |
|
345 | + } |
|
346 | + if ( ! empty($other_array) ) { |
|
347 | + $opts = array_merge( $opts, $other_array); |
|
348 | + } |
|
349 | + } |
|
350 | 350 | |
351 | - $field['options'] = $opts; |
|
351 | + $field['options'] = $opts; |
|
352 | 352 | |
353 | - if ( $field['type'] == 'radio' || $field['type'] == 'checkbox' ) { |
|
353 | + if ( $field['type'] == 'radio' || $field['type'] == 'checkbox' ) { |
|
354 | 354 | $field_name = 'item_meta[' . $field['id'] . ']'; |
355 | 355 | |
356 | 356 | // Get html_id which will be used in single-option.php |
357 | 357 | $html_id = FrmFieldsHelper::get_html_id( $field ); |
358 | 358 | |
359 | 359 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php' ); |
360 | - } else { |
|
361 | - FrmFieldsHelper::show_single_option($field); |
|
362 | - } |
|
360 | + } else { |
|
361 | + FrmFieldsHelper::show_single_option($field); |
|
362 | + } |
|
363 | 363 | |
364 | - wp_die(); |
|
365 | - } |
|
364 | + wp_die(); |
|
365 | + } |
|
366 | 366 | |
367 | - public static function update_order() { |
|
367 | + public static function update_order() { |
|
368 | 368 | FrmAppHelper::permission_check('frm_edit_forms'); |
369 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
369 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
370 | 370 | |
371 | 371 | $fields = FrmAppHelper::get_post_param( 'frm_field_id' ); |
372 | 372 | foreach ( (array) $fields as $position => $item ) { |
373 | 373 | FrmField::update( absint( $item ), array( 'field_order' => absint( $position ) ) ); |
374 | 374 | } |
375 | - wp_die(); |
|
376 | - } |
|
375 | + wp_die(); |
|
376 | + } |
|
377 | 377 | |
378 | 378 | public static function change_type( $type ) { |
379 | - $type_switch = array( |
|
380 | - 'scale' => 'radio', |
|
381 | - '10radio' => 'radio', |
|
382 | - 'rte' => 'textarea', |
|
383 | - 'website' => 'url', |
|
384 | - ); |
|
385 | - if ( isset( $type_switch[ $type ] ) ) { |
|
386 | - $type = $type_switch[ $type ]; |
|
387 | - } |
|
379 | + $type_switch = array( |
|
380 | + 'scale' => 'radio', |
|
381 | + '10radio' => 'radio', |
|
382 | + 'rte' => 'textarea', |
|
383 | + 'website' => 'url', |
|
384 | + ); |
|
385 | + if ( isset( $type_switch[ $type ] ) ) { |
|
386 | + $type = $type_switch[ $type ]; |
|
387 | + } |
|
388 | 388 | |
389 | 389 | $pro_fields = FrmField::pro_field_selection(); |
390 | 390 | $types = array_keys( $pro_fields ); |
@@ -392,137 +392,137 @@ discard block |
||
392 | 392 | $type = 'text'; |
393 | 393 | } |
394 | 394 | |
395 | - return $type; |
|
396 | - } |
|
395 | + return $type; |
|
396 | + } |
|
397 | 397 | |
398 | 398 | public static function display_field_options( $display ) { |
399 | 399 | switch ( $display['type'] ) { |
400 | - case 'captcha': |
|
401 | - $display['required'] = false; |
|
402 | - $display['invalid'] = true; |
|
403 | - $display['default_blank'] = false; |
|
400 | + case 'captcha': |
|
401 | + $display['required'] = false; |
|
402 | + $display['invalid'] = true; |
|
403 | + $display['default_blank'] = false; |
|
404 | 404 | $display['captcha_size'] = true; |
405 | - break; |
|
406 | - case 'radio': |
|
407 | - $display['default_blank'] = false; |
|
408 | - break; |
|
409 | - case 'text': |
|
410 | - case 'textarea': |
|
411 | - $display['size'] = true; |
|
412 | - $display['clear_on_focus'] = true; |
|
413 | - break; |
|
414 | - case 'select': |
|
415 | - $display['size'] = true; |
|
416 | - break; |
|
417 | - case 'url': |
|
418 | - case 'website': |
|
419 | - case 'email': |
|
420 | - $display['size'] = true; |
|
421 | - $display['clear_on_focus'] = true; |
|
422 | - $display['invalid'] = true; |
|
423 | - } |
|
424 | - |
|
425 | - return $display; |
|
426 | - } |
|
427 | - |
|
428 | - public static function input_html( $field, $echo = true ) { |
|
429 | - $class = array(); //$field['type']; |
|
430 | - self::add_input_classes($field, $class); |
|
431 | - |
|
432 | - $add_html = array(); |
|
433 | - self::add_html_size($field, $add_html); |
|
434 | - self::add_html_length($field, $add_html); |
|
435 | - self::add_html_placeholder($field, $add_html, $class); |
|
405 | + break; |
|
406 | + case 'radio': |
|
407 | + $display['default_blank'] = false; |
|
408 | + break; |
|
409 | + case 'text': |
|
410 | + case 'textarea': |
|
411 | + $display['size'] = true; |
|
412 | + $display['clear_on_focus'] = true; |
|
413 | + break; |
|
414 | + case 'select': |
|
415 | + $display['size'] = true; |
|
416 | + break; |
|
417 | + case 'url': |
|
418 | + case 'website': |
|
419 | + case 'email': |
|
420 | + $display['size'] = true; |
|
421 | + $display['clear_on_focus'] = true; |
|
422 | + $display['invalid'] = true; |
|
423 | + } |
|
424 | + |
|
425 | + return $display; |
|
426 | + } |
|
427 | + |
|
428 | + public static function input_html( $field, $echo = true ) { |
|
429 | + $class = array(); //$field['type']; |
|
430 | + self::add_input_classes($field, $class); |
|
431 | + |
|
432 | + $add_html = array(); |
|
433 | + self::add_html_size($field, $add_html); |
|
434 | + self::add_html_length($field, $add_html); |
|
435 | + self::add_html_placeholder($field, $add_html, $class); |
|
436 | 436 | self::add_validation_messages( $field, $add_html ); |
437 | 437 | |
438 | - $class = apply_filters('frm_field_classes', implode(' ', $class), $field); |
|
438 | + $class = apply_filters('frm_field_classes', implode(' ', $class), $field); |
|
439 | 439 | |
440 | 440 | FrmFormsHelper::add_html_attr( $class, 'class', $add_html ); |
441 | 441 | |
442 | - self::add_shortcodes_to_html($field, $add_html); |
|
442 | + self::add_shortcodes_to_html($field, $add_html); |
|
443 | 443 | |
444 | 444 | $add_html = apply_filters( 'frm_field_extra_html', $add_html, $field ); |
445 | 445 | $add_html = ' ' . implode( ' ', $add_html ) . ' '; |
446 | 446 | |
447 | - if ( $echo ) { |
|
448 | - echo $add_html; |
|
449 | - } |
|
447 | + if ( $echo ) { |
|
448 | + echo $add_html; |
|
449 | + } |
|
450 | 450 | |
451 | - return $add_html; |
|
452 | - } |
|
451 | + return $add_html; |
|
452 | + } |
|
453 | 453 | |
454 | 454 | private static function add_input_classes( $field, array &$class ) { |
455 | - if ( isset($field['input_class']) && ! empty($field['input_class']) ) { |
|
456 | - $class[] = $field['input_class']; |
|
457 | - } |
|
455 | + if ( isset($field['input_class']) && ! empty($field['input_class']) ) { |
|
456 | + $class[] = $field['input_class']; |
|
457 | + } |
|
458 | 458 | |
459 | - if ( $field['type'] == 'hidden' || $field['type'] == 'user_id' ) { |
|
460 | - return; |
|
461 | - } |
|
459 | + if ( $field['type'] == 'hidden' || $field['type'] == 'user_id' ) { |
|
460 | + return; |
|
461 | + } |
|
462 | 462 | |
463 | - if ( isset($field['size']) && $field['size'] > 0 ) { |
|
464 | - $class[] = 'auto_width'; |
|
465 | - } |
|
466 | - } |
|
463 | + if ( isset($field['size']) && $field['size'] > 0 ) { |
|
464 | + $class[] = 'auto_width'; |
|
465 | + } |
|
466 | + } |
|
467 | 467 | |
468 | 468 | private static function add_html_size( $field, array &$add_html ) { |
469 | 469 | if ( ! isset( $field['size'] ) || $field['size'] <= 0 || in_array( $field['type'], array( 'select', 'data', 'time', 'hidden', 'file', 'lookup' ) ) ) { |
470 | - return; |
|
471 | - } |
|
470 | + return; |
|
471 | + } |
|
472 | 472 | |
473 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
474 | - return; |
|
475 | - } |
|
473 | + if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
474 | + return; |
|
475 | + } |
|
476 | 476 | |
477 | - if ( is_numeric($field['size']) ) { |
|
478 | - $field['size'] .= 'px'; |
|
479 | - } |
|
477 | + if ( is_numeric($field['size']) ) { |
|
478 | + $field['size'] .= 'px'; |
|
479 | + } |
|
480 | 480 | |
481 | - $important = apply_filters('frm_use_important_width', 1, $field); |
|
482 | - // Note: This inline styling must stay since we cannot realistically set a class for every possible field size |
|
481 | + $important = apply_filters('frm_use_important_width', 1, $field); |
|
482 | + // Note: This inline styling must stay since we cannot realistically set a class for every possible field size |
|
483 | 483 | $add_html['style'] = 'style="width:' . esc_attr( $field['size'] ) . ( $important ? ' !important' : '' ) . '"'; |
484 | 484 | |
485 | - self::add_html_cols($field, $add_html); |
|
486 | - } |
|
485 | + self::add_html_cols($field, $add_html); |
|
486 | + } |
|
487 | 487 | |
488 | 488 | private static function add_html_cols( $field, array &$add_html ) { |
489 | 489 | if ( ! in_array( $field['type'], array( 'textarea', 'rte' ) ) ) { |
490 | - return; |
|
491 | - } |
|
490 | + return; |
|
491 | + } |
|
492 | 492 | |
493 | - // convert to cols for textareas |
|
494 | - $calc = array( |
|
495 | - '' => 9, |
|
496 | - 'px' => 9, |
|
497 | - 'rem' => 0.444, |
|
498 | - 'em' => 0.544, |
|
499 | - ); |
|
493 | + // convert to cols for textareas |
|
494 | + $calc = array( |
|
495 | + '' => 9, |
|
496 | + 'px' => 9, |
|
497 | + 'rem' => 0.444, |
|
498 | + 'em' => 0.544, |
|
499 | + ); |
|
500 | 500 | |
501 | - // include "col" for valid html |
|
502 | - $unit = trim(preg_replace('/[0-9]+/', '', $field['size'])); |
|
501 | + // include "col" for valid html |
|
502 | + $unit = trim(preg_replace('/[0-9]+/', '', $field['size'])); |
|
503 | 503 | |
504 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
505 | - return; |
|
506 | - } |
|
504 | + if ( ! isset( $calc[ $unit ] ) ) { |
|
505 | + return; |
|
506 | + } |
|
507 | 507 | |
508 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
508 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
509 | 509 | |
510 | 510 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
511 | - } |
|
511 | + } |
|
512 | 512 | |
513 | 513 | private static function add_html_length( $field, array &$add_html ) { |
514 | - // check for max setting and if this field accepts maxlength |
|
514 | + // check for max setting and if this field accepts maxlength |
|
515 | 515 | if ( FrmField::is_option_empty( $field, 'max' ) || in_array( $field['type'], array( 'textarea', 'rte', 'hidden', 'file' ) ) ) { |
516 | - return; |
|
517 | - } |
|
516 | + return; |
|
517 | + } |
|
518 | 518 | |
519 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
520 | - // don't load on form builder page |
|
521 | - return; |
|
522 | - } |
|
519 | + if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
520 | + // don't load on form builder page |
|
521 | + return; |
|
522 | + } |
|
523 | 523 | |
524 | 524 | $add_html['maxlength'] = 'maxlength="' . esc_attr( $field['max'] ) . '"'; |
525 | - } |
|
525 | + } |
|
526 | 526 | |
527 | 527 | private static function add_html_placeholder( $field, array &$add_html, array &$class ) { |
528 | 528 | if ( empty( $field['default_value'] ) || FrmAppHelper::is_admin_page( 'formidable' ) ) { |
@@ -530,35 +530,35 @@ discard block |
||
530 | 530 | } |
531 | 531 | |
532 | 532 | $default_value_array = is_array( $field['default_value'] ); |
533 | - if ( ! FrmField::is_option_true( $field, 'clear_on_focus' ) ) { |
|
533 | + if ( ! FrmField::is_option_true( $field, 'clear_on_focus' ) ) { |
|
534 | 534 | if ( $default_value_array ) { |
535 | 535 | $field['default_value'] = json_encode( $field['default_value'] ); |
536 | 536 | } |
537 | 537 | $add_html['data-frmval'] = 'data-frmval="' . esc_attr( $field['default_value'] ) . '"'; |
538 | - return; |
|
539 | - } |
|
538 | + return; |
|
539 | + } |
|
540 | 540 | |
541 | 541 | if ( $default_value_array ) { |
542 | 542 | // don't include a json placeholder |
543 | 543 | return; |
544 | 544 | } |
545 | 545 | |
546 | - $frm_settings = FrmAppHelper::get_settings(); |
|
546 | + $frm_settings = FrmAppHelper::get_settings(); |
|
547 | 547 | |
548 | 548 | if ( $frm_settings->use_html && ! in_array( $field['type'], array( 'select', 'radio', 'checkbox', 'hidden' ) ) ) { |
549 | - // use HMTL5 placeholder with js fallback |
|
549 | + // use HMTL5 placeholder with js fallback |
|
550 | 550 | $add_html['placeholder'] = 'placeholder="' . esc_attr( $field['default_value'] ) . '"'; |
551 | - wp_enqueue_script('jquery-placeholder'); |
|
552 | - } else if ( ! $frm_settings->use_html ) { |
|
551 | + wp_enqueue_script('jquery-placeholder'); |
|
552 | + } else if ( ! $frm_settings->use_html ) { |
|
553 | 553 | $val = str_replace( array( "\r\n", "\n" ), '\r', addslashes( str_replace( ''', "'", esc_attr( $field['default_value'] ) ) ) ); |
554 | 554 | $add_html['data-frmval'] = 'data-frmval="' . esc_attr( $val ) . '"'; |
555 | - $class[] = 'frm_toggle_default'; |
|
555 | + $class[] = 'frm_toggle_default'; |
|
556 | 556 | |
557 | - if ( $field['value'] == $field['default_value'] ) { |
|
558 | - $class[] = 'frm_default'; |
|
559 | - } |
|
560 | - } |
|
561 | - } |
|
557 | + if ( $field['value'] == $field['default_value'] ) { |
|
558 | + $class[] = 'frm_default'; |
|
559 | + } |
|
560 | + } |
|
561 | + } |
|
562 | 562 | |
563 | 563 | private static function add_validation_messages( $field, array &$add_html ) { |
564 | 564 | if ( FrmField::is_required( $field ) ) { |
@@ -572,44 +572,44 @@ discard block |
||
572 | 572 | } |
573 | 573 | } |
574 | 574 | |
575 | - private static function add_shortcodes_to_html( $field, array &$add_html ) { |
|
576 | - if ( FrmField::is_option_empty( $field, 'shortcodes' ) ) { |
|
577 | - return; |
|
578 | - } |
|
575 | + private static function add_shortcodes_to_html( $field, array &$add_html ) { |
|
576 | + if ( FrmField::is_option_empty( $field, 'shortcodes' ) ) { |
|
577 | + return; |
|
578 | + } |
|
579 | 579 | |
580 | - foreach ( $field['shortcodes'] as $k => $v ) { |
|
581 | - if ( 'opt' === $k ) { |
|
582 | - continue; |
|
583 | - } |
|
580 | + foreach ( $field['shortcodes'] as $k => $v ) { |
|
581 | + if ( 'opt' === $k ) { |
|
582 | + continue; |
|
583 | + } |
|
584 | 584 | |
585 | - if ( is_numeric($k) && strpos($v, '=') ) { |
|
586 | - $add_html[] = $v; |
|
587 | - } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
585 | + if ( is_numeric($k) && strpos($v, '=') ) { |
|
586 | + $add_html[] = $v; |
|
587 | + } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
588 | 588 | $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
589 | - } else { |
|
589 | + } else { |
|
590 | 590 | $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
591 | - } |
|
592 | - |
|
593 | - unset($k, $v); |
|
594 | - } |
|
595 | - } |
|
596 | - |
|
597 | - public static function check_value( $opt, $opt_key, $field ) { |
|
598 | - if ( is_array( $opt ) ) { |
|
599 | - if ( FrmField::is_option_true( $field, 'separate_value' ) ) { |
|
600 | - $opt = isset( $opt['value'] ) ? $opt['value'] : ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) ); |
|
601 | - } else { |
|
602 | - $opt = isset( $opt['label'] ) ? $opt['label'] : reset( $opt ); |
|
603 | - } |
|
604 | - } |
|
605 | - return $opt; |
|
606 | - } |
|
591 | + } |
|
592 | + |
|
593 | + unset($k, $v); |
|
594 | + } |
|
595 | + } |
|
596 | + |
|
597 | + public static function check_value( $opt, $opt_key, $field ) { |
|
598 | + if ( is_array( $opt ) ) { |
|
599 | + if ( FrmField::is_option_true( $field, 'separate_value' ) ) { |
|
600 | + $opt = isset( $opt['value'] ) ? $opt['value'] : ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) ); |
|
601 | + } else { |
|
602 | + $opt = isset( $opt['label'] ) ? $opt['label'] : reset( $opt ); |
|
603 | + } |
|
604 | + } |
|
605 | + return $opt; |
|
606 | + } |
|
607 | 607 | |
608 | 608 | public static function check_label( $opt ) { |
609 | - if ( is_array($opt) ) { |
|
610 | - $opt = (isset($opt['label']) ? $opt['label'] : reset($opt)); |
|
611 | - } |
|
609 | + if ( is_array($opt) ) { |
|
610 | + $opt = (isset($opt['label']) ? $opt['label'] : reset($opt)); |
|
611 | + } |
|
612 | 612 | |
613 | - return $opt; |
|
614 | - } |
|
613 | + return $opt; |
|
614 | + } |
|
615 | 615 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | class FrmFieldsController { |
4 | 4 | |
5 | 5 | public static function load_field() { |
6 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
6 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
7 | 7 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
8 | 8 | |
9 | 9 | $fields = $_POST['field']; |
@@ -34,17 +34,17 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | $field_name = 'item_meta[' . $field_id . ']'; |
37 | - $html_id = FrmFieldsHelper::get_html_id($field); |
|
37 | + $html_id = FrmFieldsHelper::get_html_id( $field ); |
|
38 | 38 | |
39 | 39 | ob_start(); |
40 | 40 | include( $path . '/classes/views/frm-forms/add_field.php' ); |
41 | - $field_html[ $field_id ] = ob_get_contents(); |
|
41 | + $field_html[$field_id] = ob_get_contents(); |
|
42 | 42 | ob_end_clean(); |
43 | 43 | } |
44 | 44 | |
45 | - unset($path); |
|
45 | + unset( $path ); |
|
46 | 46 | |
47 | - echo json_encode($field_html); |
|
47 | + echo json_encode( $field_html ); |
|
48 | 48 | |
49 | 49 | wp_die(); |
50 | 50 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * Create a new field with ajax |
54 | 54 | */ |
55 | 55 | public static function create() { |
56 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
56 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
57 | 57 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
58 | 58 | |
59 | 59 | $field_type = FrmAppHelper::get_post_param( 'field_type', '', 'sanitize_text_field' ); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $field = self::include_new_field( $field_type, $form_id ); |
63 | 63 | |
64 | 64 | // this hook will allow for multiple fields to be added at once |
65 | - do_action('frm_after_field_created', $field, $form_id); |
|
65 | + do_action( 'frm_after_field_created', $field, $form_id ); |
|
66 | 66 | |
67 | 67 | wp_die(); |
68 | 68 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | public static function include_new_field( $field_type, $form_id ) { |
78 | 78 | $values = array(); |
79 | 79 | if ( FrmAppHelper::pro_is_installed() ) { |
80 | - $values['post_type'] = FrmProFormsHelper::post_type($form_id); |
|
80 | + $values['post_type'] = FrmProFormsHelper::post_type( $form_id ); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | $field_values = FrmFieldsHelper::setup_new_vars( $field_type, $form_id ); |
@@ -89,27 +89,27 @@ discard block |
||
89 | 89 | return false; |
90 | 90 | } |
91 | 91 | |
92 | - $field = self::include_single_field($field_id, $values, $form_id); |
|
92 | + $field = self::include_single_field( $field_id, $values, $form_id ); |
|
93 | 93 | |
94 | 94 | return $field; |
95 | 95 | } |
96 | 96 | |
97 | 97 | public static function edit_name( $field = 'name', $id = '' ) { |
98 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
98 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
99 | 99 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
100 | 100 | |
101 | - if ( empty($field) ) { |
|
101 | + if ( empty( $field ) ) { |
|
102 | 102 | $field = 'name'; |
103 | 103 | } |
104 | 104 | |
105 | - if ( empty($id) ) { |
|
105 | + if ( empty( $id ) ) { |
|
106 | 106 | $id = FrmAppHelper::get_post_param( 'element_id', '', 'sanitize_title' ); |
107 | 107 | $id = str_replace( 'field_label_', '', $id ); |
108 | 108 | } |
109 | 109 | |
110 | 110 | $value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_kses_post' ); |
111 | 111 | $value = trim( $value ); |
112 | - if ( trim(strip_tags($value)) == '' ) { |
|
112 | + if ( trim( strip_tags( $value ) ) == '' ) { |
|
113 | 113 | // set blank value if there is no content |
114 | 114 | $value = ''; |
115 | 115 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | public static function update_ajax_option() { |
126 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
126 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
127 | 127 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
128 | 128 | |
129 | 129 | $field_id = FrmAppHelper::get_post_param( 'field', 0, 'absint' ); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | if ( isset( $_POST['separate_value'] ) ) { |
137 | 137 | $new_val = FrmField::is_option_true( $field, 'separate_value' ) ? 0 : 1; |
138 | 138 | $field->field_options['separate_value'] = $new_val; |
139 | - unset($new_val); |
|
139 | + unset( $new_val ); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | FrmField::update( $field_id, array( |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | public static function duplicate() { |
150 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
150 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
151 | 151 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
152 | 152 | |
153 | 153 | global $wpdb; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | wp_die(); |
178 | 178 | } |
179 | 179 | |
180 | - self::include_single_field($field_id, $values); |
|
180 | + self::include_single_field( $field_id, $values ); |
|
181 | 181 | |
182 | 182 | wp_die(); |
183 | 183 | } |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | * Load a single field in the form builder along with all needed variables |
187 | 187 | */ |
188 | 188 | public static function include_single_field( $field_id, $values, $form_id = 0 ) { |
189 | - $field = FrmFieldsHelper::setup_edit_vars(FrmField::getOne($field_id)); |
|
189 | + $field = FrmFieldsHelper::setup_edit_vars( FrmField::getOne( $field_id ) ); |
|
190 | 190 | $field_name = 'item_meta[' . $field_id . ']'; |
191 | - $html_id = FrmFieldsHelper::get_html_id($field); |
|
191 | + $html_id = FrmFieldsHelper::get_html_id( $field ); |
|
192 | 192 | $id = $form_id ? $form_id : $field['form_id']; |
193 | 193 | if ( $field['type'] == 'html' ) { |
194 | 194 | $field['stop_filter'] = true; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | } |
201 | 201 | |
202 | 202 | public static function destroy() { |
203 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
203 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
204 | 204 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
205 | 205 | |
206 | 206 | $field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | |
213 | 213 | //Add Single Option or Other Option |
214 | 214 | public static function add_option() { |
215 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
215 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
216 | 216 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
217 | 217 | |
218 | 218 | $id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
219 | 219 | $opt_type = FrmAppHelper::get_post_param( 'opt_type', '', 'sanitize_text_field' ); |
220 | 220 | $opt_key = FrmAppHelper::get_post_param( 'opt_key', 0, 'absint' ); |
221 | 221 | |
222 | - $field = FrmField::getOne($id); |
|
222 | + $field = FrmField::getOne( $id ); |
|
223 | 223 | |
224 | 224 | if ( 'other' == $opt_type ) { |
225 | 225 | $opt = __( 'Other', 'formidable' ); |
@@ -289,9 +289,9 @@ discard block |
||
289 | 289 | |
290 | 290 | $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
291 | 291 | $prepop = array(); |
292 | - FrmFieldsHelper::get_bulk_prefilled_opts($prepop); |
|
292 | + FrmFieldsHelper::get_bulk_prefilled_opts( $prepop ); |
|
293 | 293 | |
294 | - $field = FrmField::getOne($field_id); |
|
294 | + $field = FrmField::getOne( $field_id ); |
|
295 | 295 | |
296 | 296 | wp_enqueue_script( 'utils' ); |
297 | 297 | wp_enqueue_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css' ); |
@@ -302,35 +302,35 @@ discard block |
||
302 | 302 | } |
303 | 303 | |
304 | 304 | public static function import_options() { |
305 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
305 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
306 | 306 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
307 | 307 | |
308 | - if ( ! is_admin() || ! current_user_can('frm_edit_forms') ) { |
|
308 | + if ( ! is_admin() || ! current_user_can( 'frm_edit_forms' ) ) { |
|
309 | 309 | return; |
310 | 310 | } |
311 | 311 | |
312 | 312 | $field_id = absint( $_POST['field_id'] ); |
313 | - $field = FrmField::getOne($field_id); |
|
313 | + $field = FrmField::getOne( $field_id ); |
|
314 | 314 | |
315 | 315 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'select' ) ) ) { |
316 | 316 | return; |
317 | 317 | } |
318 | 318 | |
319 | - $field = FrmFieldsHelper::setup_edit_vars($field); |
|
319 | + $field = FrmFieldsHelper::setup_edit_vars( $field ); |
|
320 | 320 | $opts = FrmAppHelper::get_param( 'opts', '', 'post', 'wp_kses_post' ); |
321 | 321 | $opts = explode( "\n", rtrim( $opts, "\n" ) ); |
322 | 322 | $opts = array_map( 'trim', $opts ); |
323 | 323 | |
324 | 324 | if ( $field['separate_value'] ) { |
325 | 325 | foreach ( $opts as $opt_key => $opt ) { |
326 | - if ( strpos($opt, '|') !== false ) { |
|
327 | - $vals = explode('|', $opt); |
|
326 | + if ( strpos( $opt, '|' ) !== false ) { |
|
327 | + $vals = explode( '|', $opt ); |
|
328 | 328 | if ( $vals[0] != $vals[1] ) { |
329 | - $opts[ $opt_key ] = array( 'label' => trim( $vals[0] ), 'value' => trim( $vals[1] ) ); |
|
329 | + $opts[$opt_key] = array( 'label' => trim( $vals[0] ), 'value' => trim( $vals[1] ) ); |
|
330 | 330 | } |
331 | - unset($vals); |
|
331 | + unset( $vals ); |
|
332 | 332 | } |
333 | - unset($opt_key, $opt); |
|
333 | + unset( $opt_key, $opt ); |
|
334 | 334 | } |
335 | 335 | } |
336 | 336 | |
@@ -339,12 +339,12 @@ discard block |
||
339 | 339 | $other_array = array(); |
340 | 340 | foreach ( $field['options'] as $opt_key => $opt ) { |
341 | 341 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
342 | - $other_array[ $opt_key ] = $opt; |
|
342 | + $other_array[$opt_key] = $opt; |
|
343 | 343 | } |
344 | - unset($opt_key, $opt); |
|
344 | + unset( $opt_key, $opt ); |
|
345 | 345 | } |
346 | - if ( ! empty($other_array) ) { |
|
347 | - $opts = array_merge( $opts, $other_array); |
|
346 | + if ( ! empty( $other_array ) ) { |
|
347 | + $opts = array_merge( $opts, $other_array ); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
@@ -358,14 +358,14 @@ discard block |
||
358 | 358 | |
359 | 359 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php' ); |
360 | 360 | } else { |
361 | - FrmFieldsHelper::show_single_option($field); |
|
361 | + FrmFieldsHelper::show_single_option( $field ); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | wp_die(); |
365 | 365 | } |
366 | 366 | |
367 | 367 | public static function update_order() { |
368 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
368 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
369 | 369 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
370 | 370 | |
371 | 371 | $fields = FrmAppHelper::get_post_param( 'frm_field_id' ); |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | 'rte' => 'textarea', |
383 | 383 | 'website' => 'url', |
384 | 384 | ); |
385 | - if ( isset( $type_switch[ $type ] ) ) { |
|
386 | - $type = $type_switch[ $type ]; |
|
385 | + if ( isset( $type_switch[$type] ) ) { |
|
386 | + $type = $type_switch[$type]; |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | $pro_fields = FrmField::pro_field_selection(); |
@@ -427,19 +427,19 @@ discard block |
||
427 | 427 | |
428 | 428 | public static function input_html( $field, $echo = true ) { |
429 | 429 | $class = array(); //$field['type']; |
430 | - self::add_input_classes($field, $class); |
|
430 | + self::add_input_classes( $field, $class ); |
|
431 | 431 | |
432 | 432 | $add_html = array(); |
433 | - self::add_html_size($field, $add_html); |
|
434 | - self::add_html_length($field, $add_html); |
|
435 | - self::add_html_placeholder($field, $add_html, $class); |
|
433 | + self::add_html_size( $field, $add_html ); |
|
434 | + self::add_html_length( $field, $add_html ); |
|
435 | + self::add_html_placeholder( $field, $add_html, $class ); |
|
436 | 436 | self::add_validation_messages( $field, $add_html ); |
437 | 437 | |
438 | - $class = apply_filters('frm_field_classes', implode(' ', $class), $field); |
|
438 | + $class = apply_filters( 'frm_field_classes', implode( ' ', $class ), $field ); |
|
439 | 439 | |
440 | 440 | FrmFormsHelper::add_html_attr( $class, 'class', $add_html ); |
441 | 441 | |
442 | - self::add_shortcodes_to_html($field, $add_html); |
|
442 | + self::add_shortcodes_to_html( $field, $add_html ); |
|
443 | 443 | |
444 | 444 | $add_html = apply_filters( 'frm_field_extra_html', $add_html, $field ); |
445 | 445 | $add_html = ' ' . implode( ' ', $add_html ) . ' '; |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | } |
453 | 453 | |
454 | 454 | private static function add_input_classes( $field, array &$class ) { |
455 | - if ( isset($field['input_class']) && ! empty($field['input_class']) ) { |
|
455 | + if ( isset( $field['input_class'] ) && ! empty( $field['input_class'] ) ) { |
|
456 | 456 | $class[] = $field['input_class']; |
457 | 457 | } |
458 | 458 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | return; |
461 | 461 | } |
462 | 462 | |
463 | - if ( isset($field['size']) && $field['size'] > 0 ) { |
|
463 | + if ( isset( $field['size'] ) && $field['size'] > 0 ) { |
|
464 | 464 | $class[] = 'auto_width'; |
465 | 465 | } |
466 | 466 | } |
@@ -470,19 +470,19 @@ discard block |
||
470 | 470 | return; |
471 | 471 | } |
472 | 472 | |
473 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
473 | + if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
|
474 | 474 | return; |
475 | 475 | } |
476 | 476 | |
477 | - if ( is_numeric($field['size']) ) { |
|
477 | + if ( is_numeric( $field['size'] ) ) { |
|
478 | 478 | $field['size'] .= 'px'; |
479 | 479 | } |
480 | 480 | |
481 | - $important = apply_filters('frm_use_important_width', 1, $field); |
|
481 | + $important = apply_filters( 'frm_use_important_width', 1, $field ); |
|
482 | 482 | // Note: This inline styling must stay since we cannot realistically set a class for every possible field size |
483 | 483 | $add_html['style'] = 'style="width:' . esc_attr( $field['size'] ) . ( $important ? ' !important' : '' ) . '"'; |
484 | 484 | |
485 | - self::add_html_cols($field, $add_html); |
|
485 | + self::add_html_cols( $field, $add_html ); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | private static function add_html_cols( $field, array &$add_html ) { |
@@ -499,13 +499,13 @@ discard block |
||
499 | 499 | ); |
500 | 500 | |
501 | 501 | // include "col" for valid html |
502 | - $unit = trim(preg_replace('/[0-9]+/', '', $field['size'])); |
|
502 | + $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
|
503 | 503 | |
504 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
504 | + if ( ! isset( $calc[$unit] ) ) { |
|
505 | 505 | return; |
506 | 506 | } |
507 | 507 | |
508 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
508 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit]; |
|
509 | 509 | |
510 | 510 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
511 | 511 | } |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | return; |
517 | 517 | } |
518 | 518 | |
519 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
519 | + if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
|
520 | 520 | // don't load on form builder page |
521 | 521 | return; |
522 | 522 | } |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | if ( $frm_settings->use_html && ! in_array( $field['type'], array( 'select', 'radio', 'checkbox', 'hidden' ) ) ) { |
549 | 549 | // use HMTL5 placeholder with js fallback |
550 | 550 | $add_html['placeholder'] = 'placeholder="' . esc_attr( $field['default_value'] ) . '"'; |
551 | - wp_enqueue_script('jquery-placeholder'); |
|
551 | + wp_enqueue_script( 'jquery-placeholder' ); |
|
552 | 552 | } else if ( ! $frm_settings->use_html ) { |
553 | 553 | $val = str_replace( array( "\r\n", "\n" ), '\r', addslashes( str_replace( ''', "'", esc_attr( $field['default_value'] ) ) ) ); |
554 | 554 | $add_html['data-frmval'] = 'data-frmval="' . esc_attr( $val ) . '"'; |
@@ -582,15 +582,15 @@ discard block |
||
582 | 582 | continue; |
583 | 583 | } |
584 | 584 | |
585 | - if ( is_numeric($k) && strpos($v, '=') ) { |
|
585 | + if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
|
586 | 586 | $add_html[] = $v; |
587 | - } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
588 | - $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
|
587 | + } else if ( ! empty( $k ) && isset( $add_html[$k] ) ) { |
|
588 | + $add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] ); |
|
589 | 589 | } else { |
590 | - $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
|
590 | + $add_html[$k] = $k . '="' . esc_attr( $v ) . '"'; |
|
591 | 591 | } |
592 | 592 | |
593 | - unset($k, $v); |
|
593 | + unset( $k, $v ); |
|
594 | 594 | } |
595 | 595 | } |
596 | 596 | |
@@ -606,8 +606,8 @@ discard block |
||
606 | 606 | } |
607 | 607 | |
608 | 608 | public static function check_label( $opt ) { |
609 | - if ( is_array($opt) ) { |
|
610 | - $opt = (isset($opt['label']) ? $opt['label'] : reset($opt)); |
|
609 | + if ( is_array( $opt ) ) { |
|
610 | + $opt = ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) ); |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | return $opt; |
@@ -2,70 +2,70 @@ discard block |
||
2 | 2 | |
3 | 3 | class FrmEntriesController { |
4 | 4 | |
5 | - public static function menu() { |
|
5 | + public static function menu() { |
|
6 | 6 | FrmAppHelper::force_capability( 'frm_view_entries' ); |
7 | 7 | |
8 | - add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
8 | + add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
9 | 9 | |
10 | 10 | if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) { |
11 | 11 | $menu_name = FrmAppHelper::get_menu_name(); |
12 | 12 | add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' ); |
13 | 13 | add_filter( 'get_user_option_manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' ); |
14 | 14 | add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' ); |
15 | - } |
|
16 | - } |
|
15 | + } |
|
16 | + } |
|
17 | 17 | |
18 | - /* Display in Back End */ |
|
19 | - public static function route() { |
|
18 | + /* Display in Back End */ |
|
19 | + public static function route() { |
|
20 | 20 | $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
21 | 21 | |
22 | - switch ( $action ) { |
|
23 | - case 'show': |
|
24 | - case 'destroy': |
|
25 | - case 'destroy_all': |
|
26 | - return self::$action(); |
|
22 | + switch ( $action ) { |
|
23 | + case 'show': |
|
24 | + case 'destroy': |
|
25 | + case 'destroy_all': |
|
26 | + return self::$action(); |
|
27 | 27 | |
28 | - default: |
|
29 | - do_action( 'frm_entry_action_route', $action ); |
|
30 | - if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
31 | - return; |
|
32 | - } |
|
28 | + default: |
|
29 | + do_action( 'frm_entry_action_route', $action ); |
|
30 | + if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
31 | + return; |
|
32 | + } |
|
33 | 33 | |
34 | - return self::display_list(); |
|
35 | - } |
|
36 | - } |
|
34 | + return self::display_list(); |
|
35 | + } |
|
36 | + } |
|
37 | 37 | |
38 | 38 | public static function contextual_help( $help, $screen_id, $screen ) { |
39 | - // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
40 | - if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
41 | - return $help; |
|
42 | - } |
|
39 | + // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
40 | + if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
41 | + return $help; |
|
42 | + } |
|
43 | 43 | |
44 | 44 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
45 | 45 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
46 | 46 | if ( $page != 'formidable-entries' || ( ! empty( $action ) && $action != 'list' ) ) { |
47 | - return $help; |
|
48 | - } |
|
47 | + return $help; |
|
48 | + } |
|
49 | 49 | |
50 | 50 | unset( $action, $page ); |
51 | 51 | |
52 | - $screen->add_help_tab( array( |
|
53 | - 'id' => 'formidable-entries-tab', |
|
54 | - 'title' => __( 'Overview', 'formidable' ), |
|
52 | + $screen->add_help_tab( array( |
|
53 | + 'id' => 'formidable-entries-tab', |
|
54 | + 'title' => __( 'Overview', 'formidable' ), |
|
55 | 55 | 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
56 | - )); |
|
56 | + )); |
|
57 | 57 | |
58 | - $screen->set_help_sidebar( |
|
58 | + $screen->set_help_sidebar( |
|
59 | 59 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
60 | 60 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' . |
61 | 61 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>' |
62 | - ); |
|
62 | + ); |
|
63 | 63 | |
64 | - return $help; |
|
65 | - } |
|
64 | + return $help; |
|
65 | + } |
|
66 | 66 | |
67 | 67 | public static function manage_columns( $columns ) { |
68 | - global $frm_vars; |
|
68 | + global $frm_vars; |
|
69 | 69 | $form_id = FrmForm::get_current_form_id(); |
70 | 70 | |
71 | 71 | $columns[ $form_id . '_id' ] = 'ID'; |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
84 | 84 | $columns[ $form_id . '_ip' ] = 'IP'; |
85 | 85 | |
86 | - $frm_vars['cols'] = $columns; |
|
86 | + $frm_vars['cols'] = $columns; |
|
87 | 87 | |
88 | 88 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
89 | 89 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) { |
90 | 90 | add_screen_option( 'per_page', array( 'label' => __( 'Entries', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_entries_per_page' ) ); |
91 | - } |
|
91 | + } |
|
92 | 92 | |
93 | - return $columns; |
|
94 | - } |
|
93 | + return $columns; |
|
94 | + } |
|
95 | 95 | |
96 | 96 | private static function get_columns_for_form( $form_id, &$columns ) { |
97 | 97 | $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' ); |
@@ -135,76 +135,76 @@ discard block |
||
135 | 135 | $menu_name = FrmAppHelper::get_menu_name(); |
136 | 136 | $this_page_name = 'manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden'; |
137 | 137 | if ( $meta_key != $this_page_name || $meta_value == $prev_value ) { |
138 | - return $check; |
|
139 | - } |
|
138 | + return $check; |
|
139 | + } |
|
140 | 140 | |
141 | 141 | if ( empty( $prev_value ) ) { |
142 | 142 | $prev_value = get_metadata( 'user', $object_id, $meta_key, true ); |
143 | 143 | } |
144 | 144 | |
145 | - global $frm_vars; |
|
146 | - //add a check so we don't create a loop |
|
147 | - $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
145 | + global $frm_vars; |
|
146 | + //add a check so we don't create a loop |
|
147 | + $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
148 | 148 | |
149 | - return $check; |
|
150 | - } |
|
149 | + return $check; |
|
150 | + } |
|
151 | 151 | |
152 | - //add hidden columns back from other forms |
|
152 | + //add hidden columns back from other forms |
|
153 | 153 | public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) { |
154 | 154 | $menu_name = FrmAppHelper::get_menu_name(); |
155 | 155 | $sanitized = sanitize_title( $menu_name ); |
156 | 156 | $this_page_name = 'manage' . $sanitized . '_page_formidable-entriescolumnshidden'; |
157 | 157 | if ( $meta_key != $this_page_name ) { |
158 | - return; |
|
159 | - } |
|
160 | - |
|
161 | - global $frm_vars; |
|
162 | - if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
163 | - return; //don't continue if there's no previous value |
|
164 | - } |
|
165 | - |
|
166 | - foreach ( $meta_value as $mk => $mv ) { |
|
167 | - //remove blank values |
|
168 | - if ( empty( $mv ) ) { |
|
169 | - unset( $meta_value[ $mk ] ); |
|
170 | - } |
|
171 | - } |
|
172 | - |
|
173 | - $cur_form_prefix = reset($meta_value); |
|
174 | - $cur_form_prefix = explode('_', $cur_form_prefix); |
|
175 | - $cur_form_prefix = $cur_form_prefix[0]; |
|
176 | - $save = false; |
|
177 | - |
|
178 | - foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
158 | + return; |
|
159 | + } |
|
160 | + |
|
161 | + global $frm_vars; |
|
162 | + if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
163 | + return; //don't continue if there's no previous value |
|
164 | + } |
|
165 | + |
|
166 | + foreach ( $meta_value as $mk => $mv ) { |
|
167 | + //remove blank values |
|
168 | + if ( empty( $mv ) ) { |
|
169 | + unset( $meta_value[ $mk ] ); |
|
170 | + } |
|
171 | + } |
|
172 | + |
|
173 | + $cur_form_prefix = reset($meta_value); |
|
174 | + $cur_form_prefix = explode('_', $cur_form_prefix); |
|
175 | + $cur_form_prefix = $cur_form_prefix[0]; |
|
176 | + $save = false; |
|
177 | + |
|
178 | + foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
179 | 179 | if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) { |
180 | - //don't add blank cols or process included cols |
|
181 | - continue; |
|
182 | - } |
|
180 | + //don't add blank cols or process included cols |
|
181 | + continue; |
|
182 | + } |
|
183 | 183 | |
184 | 184 | $form_prefix = explode( '_', $prev_hidden ); |
185 | - $form_prefix = $form_prefix[0]; |
|
186 | - if ( $form_prefix == $cur_form_prefix ) { |
|
187 | - //don't add back columns that are meant to be hidden |
|
188 | - continue; |
|
189 | - } |
|
185 | + $form_prefix = $form_prefix[0]; |
|
186 | + if ( $form_prefix == $cur_form_prefix ) { |
|
187 | + //don't add back columns that are meant to be hidden |
|
188 | + continue; |
|
189 | + } |
|
190 | 190 | |
191 | - $meta_value[] = $prev_hidden; |
|
192 | - $save = true; |
|
193 | - unset($form_prefix); |
|
194 | - } |
|
191 | + $meta_value[] = $prev_hidden; |
|
192 | + $save = true; |
|
193 | + unset($form_prefix); |
|
194 | + } |
|
195 | 195 | |
196 | 196 | if ( $save ) { |
197 | - $user = wp_get_current_user(); |
|
197 | + $user = wp_get_current_user(); |
|
198 | 198 | update_user_option( $user->ID, $this_page_name, $meta_value, true ); |
199 | - } |
|
200 | - } |
|
199 | + } |
|
200 | + } |
|
201 | 201 | |
202 | 202 | public static function save_per_page( $save, $option, $value ) { |
203 | - if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
204 | - $save = (int) $value; |
|
205 | - } |
|
206 | - return $save; |
|
207 | - } |
|
203 | + if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
204 | + $save = (int) $value; |
|
205 | + } |
|
206 | + return $save; |
|
207 | + } |
|
208 | 208 | |
209 | 209 | public static function sortable_columns() { |
210 | 210 | $form_id = FrmForm::get_current_form_id(); |
@@ -230,46 +230,46 @@ discard block |
||
230 | 230 | } |
231 | 231 | |
232 | 232 | public static function hidden_columns( $result ) { |
233 | - global $frm_vars; |
|
233 | + global $frm_vars; |
|
234 | 234 | |
235 | 235 | $form_id = FrmForm::get_current_form_id(); |
236 | 236 | |
237 | - $return = false; |
|
238 | - foreach ( (array) $result as $r ) { |
|
239 | - if ( ! empty( $r ) ) { |
|
240 | - $form_prefix = explode( '_', $r ); |
|
241 | - $form_prefix = $form_prefix[0]; |
|
237 | + $return = false; |
|
238 | + foreach ( (array) $result as $r ) { |
|
239 | + if ( ! empty( $r ) ) { |
|
240 | + $form_prefix = explode( '_', $r ); |
|
241 | + $form_prefix = $form_prefix[0]; |
|
242 | 242 | |
243 | - if ( (int) $form_prefix == (int) $form_id ) { |
|
244 | - $return = true; |
|
245 | - break; |
|
246 | - } |
|
243 | + if ( (int) $form_prefix == (int) $form_id ) { |
|
244 | + $return = true; |
|
245 | + break; |
|
246 | + } |
|
247 | 247 | |
248 | - unset($form_prefix); |
|
249 | - } |
|
250 | - } |
|
248 | + unset($form_prefix); |
|
249 | + } |
|
250 | + } |
|
251 | 251 | |
252 | - if ( $return ) { |
|
252 | + if ( $return ) { |
|
253 | 253 | return $result; |
254 | 254 | } |
255 | 255 | |
256 | - $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
257 | - $max_columns = 8; |
|
258 | - if ( $i <= $max_columns ) { |
|
256 | + $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
257 | + $max_columns = 8; |
|
258 | + if ( $i <= $max_columns ) { |
|
259 | 259 | return $result; |
260 | 260 | } |
261 | 261 | |
262 | - global $frm_vars; |
|
263 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
264 | - $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
265 | - } |
|
262 | + global $frm_vars; |
|
263 | + if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
264 | + $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
265 | + } |
|
266 | 266 | |
267 | 267 | $has_custom_hidden_columns = ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) ); |
268 | 268 | if ( $has_custom_hidden_columns ) { |
269 | - $result = $frm_vars['current_form']->options['hidden_cols']; |
|
270 | - } else { |
|
271 | - $cols = $frm_vars['cols']; |
|
272 | - $cols = array_reverse($cols, true); |
|
269 | + $result = $frm_vars['current_form']->options['hidden_cols']; |
|
270 | + } else { |
|
271 | + $cols = $frm_vars['cols']; |
|
272 | + $cols = array_reverse($cols, true); |
|
273 | 273 | |
274 | 274 | if ( $form_id ) { |
275 | 275 | $result[] = $form_id . '_id'; |
@@ -277,59 +277,59 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | $result[] = $form_id . '_item_key'; |
280 | - $i--; |
|
280 | + $i--; |
|
281 | 281 | |
282 | 282 | foreach ( $cols as $col_key => $col ) { |
283 | - if ( $i > $max_columns ) { |
|
283 | + if ( $i > $max_columns ) { |
|
284 | 284 | $result[] = $col_key; |
285 | 285 | } |
286 | - //remove some columns by default |
|
287 | - $i--; |
|
288 | - unset($col_key, $col); |
|
289 | - } |
|
290 | - } |
|
286 | + //remove some columns by default |
|
287 | + $i--; |
|
288 | + unset($col_key, $col); |
|
289 | + } |
|
290 | + } |
|
291 | 291 | |
292 | - return $result; |
|
293 | - } |
|
292 | + return $result; |
|
293 | + } |
|
294 | 294 | |
295 | 295 | public static function display_list( $message = '', $errors = array() ) { |
296 | - global $wpdb, $frm_vars; |
|
296 | + global $wpdb, $frm_vars; |
|
297 | 297 | |
298 | 298 | $form = FrmForm::maybe_get_current_form(); |
299 | 299 | $params = FrmForm::get_admin_params( $form ); |
300 | 300 | |
301 | - if ( $form ) { |
|
302 | - $params['form'] = $form->id; |
|
303 | - $frm_vars['current_form'] = $form; |
|
301 | + if ( $form ) { |
|
302 | + $params['form'] = $form->id; |
|
303 | + $frm_vars['current_form'] = $form; |
|
304 | 304 | |
305 | 305 | self::get_delete_form_time( $form, $errors ); |
306 | 306 | } |
307 | 307 | |
308 | - $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
308 | + $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
309 | 309 | |
310 | - $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
310 | + $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
311 | 311 | |
312 | - $pagenum = $wp_list_table->get_pagenum(); |
|
312 | + $pagenum = $wp_list_table->get_pagenum(); |
|
313 | 313 | |
314 | - $wp_list_table->prepare_items(); |
|
314 | + $wp_list_table->prepare_items(); |
|
315 | 315 | |
316 | - $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
317 | - if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
316 | + $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
317 | + if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
318 | 318 | $url = add_query_arg( 'paged', $total_pages ); |
319 | - if ( headers_sent() ) { |
|
320 | - echo FrmAppHelper::js_redirect($url); |
|
321 | - } else { |
|
322 | - wp_redirect( esc_url_raw( $url ) ); |
|
323 | - } |
|
324 | - die(); |
|
325 | - } |
|
326 | - |
|
327 | - if ( empty($message) && isset($_GET['import-message']) ) { |
|
328 | - $message = __( 'Your import is complete', 'formidable' ); |
|
329 | - } |
|
319 | + if ( headers_sent() ) { |
|
320 | + echo FrmAppHelper::js_redirect($url); |
|
321 | + } else { |
|
322 | + wp_redirect( esc_url_raw( $url ) ); |
|
323 | + } |
|
324 | + die(); |
|
325 | + } |
|
326 | + |
|
327 | + if ( empty($message) && isset($_GET['import-message']) ) { |
|
328 | + $message = __( 'Your import is complete', 'formidable' ); |
|
329 | + } |
|
330 | 330 | |
331 | 331 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' ); |
332 | - } |
|
332 | + } |
|
333 | 333 | |
334 | 334 | private static function get_delete_form_time( $form, &$errors ) { |
335 | 335 | if ( 'trash' == $form->status ) { |
@@ -339,19 +339,19 @@ discard block |
||
339 | 339 | } |
340 | 340 | } |
341 | 341 | |
342 | - /* Back End CRUD */ |
|
342 | + /* Back End CRUD */ |
|
343 | 343 | public static function show( $id = 0 ) { |
344 | - FrmAppHelper::permission_check('frm_view_entries'); |
|
344 | + FrmAppHelper::permission_check('frm_view_entries'); |
|
345 | 345 | |
346 | - if ( ! $id ) { |
|
346 | + if ( ! $id ) { |
|
347 | 347 | $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
348 | 348 | |
349 | - if ( ! $id ) { |
|
349 | + if ( ! $id ) { |
|
350 | 350 | $id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' ); |
351 | - } |
|
352 | - } |
|
351 | + } |
|
352 | + } |
|
353 | 353 | |
354 | - $entry = FrmEntry::getOne($id, true); |
|
354 | + $entry = FrmEntry::getOne($id, true); |
|
355 | 355 | if ( ! $entry ) { |
356 | 356 | echo '<div id="form_show_entry_page" class="wrap">' . |
357 | 357 | __( 'You are trying to view an entry that does not exist.', 'formidable' ) . |
@@ -359,110 +359,110 @@ discard block |
||
359 | 359 | return; |
360 | 360 | } |
361 | 361 | |
362 | - $data = maybe_unserialize($entry->description); |
|
362 | + $data = maybe_unserialize($entry->description); |
|
363 | 363 | if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) { |
364 | 364 | $data = array( 'referrer' => $data ); |
365 | 365 | } |
366 | 366 | |
367 | 367 | $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' ); |
368 | - $to_emails = array(); |
|
368 | + $to_emails = array(); |
|
369 | 369 | |
370 | 370 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' ); |
371 | - } |
|
371 | + } |
|
372 | 372 | |
373 | - public static function destroy() { |
|
374 | - FrmAppHelper::permission_check('frm_delete_entries'); |
|
373 | + public static function destroy() { |
|
374 | + FrmAppHelper::permission_check('frm_delete_entries'); |
|
375 | 375 | |
376 | 376 | $params = FrmForm::get_admin_params(); |
377 | 377 | |
378 | - if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
379 | - //unlink entry from post |
|
380 | - global $wpdb; |
|
378 | + if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
379 | + //unlink entry from post |
|
380 | + global $wpdb; |
|
381 | 381 | $wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
382 | - } |
|
382 | + } |
|
383 | 383 | |
384 | - $message = ''; |
|
385 | - if ( FrmEntry::destroy( $params['id'] ) ) { |
|
386 | - $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
387 | - } |
|
384 | + $message = ''; |
|
385 | + if ( FrmEntry::destroy( $params['id'] ) ) { |
|
386 | + $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
387 | + } |
|
388 | 388 | |
389 | - self::display_list( $message ); |
|
390 | - } |
|
389 | + self::display_list( $message ); |
|
390 | + } |
|
391 | 391 | |
392 | - public static function destroy_all() { |
|
393 | - if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
394 | - $frm_settings = FrmAppHelper::get_settings(); |
|
395 | - wp_die( $frm_settings->admin_permission ); |
|
396 | - } |
|
392 | + public static function destroy_all() { |
|
393 | + if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
394 | + $frm_settings = FrmAppHelper::get_settings(); |
|
395 | + wp_die( $frm_settings->admin_permission ); |
|
396 | + } |
|
397 | 397 | |
398 | - global $wpdb; |
|
398 | + global $wpdb; |
|
399 | 399 | $params = FrmForm::get_admin_params(); |
400 | - $message = ''; |
|
401 | - $errors = array(); |
|
402 | - $form_id = (int) $params['form']; |
|
400 | + $message = ''; |
|
401 | + $errors = array(); |
|
402 | + $form_id = (int) $params['form']; |
|
403 | 403 | |
404 | - if ( $form_id ) { |
|
405 | - $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
404 | + if ( $form_id ) { |
|
405 | + $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
406 | 406 | $action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 ); |
407 | 407 | |
408 | - if ( $action ) { |
|
409 | - // this action takes a while, so only trigger it if there are posts to delete |
|
410 | - foreach ( $entry_ids as $entry_id ) { |
|
411 | - do_action( 'frm_before_destroy_entry', $entry_id ); |
|
412 | - unset( $entry_id ); |
|
413 | - } |
|
414 | - } |
|
415 | - |
|
416 | - $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) ); |
|
417 | - $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) ); |
|
418 | - if ( $results ) { |
|
408 | + if ( $action ) { |
|
409 | + // this action takes a while, so only trigger it if there are posts to delete |
|
410 | + foreach ( $entry_ids as $entry_id ) { |
|
411 | + do_action( 'frm_before_destroy_entry', $entry_id ); |
|
412 | + unset( $entry_id ); |
|
413 | + } |
|
414 | + } |
|
415 | + |
|
416 | + $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) ); |
|
417 | + $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) ); |
|
418 | + if ( $results ) { |
|
419 | 419 | FrmEntry::clear_cache(); |
420 | - $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
421 | - } |
|
422 | - } else { |
|
423 | - $errors = __( 'No entries were specified', 'formidable' ); |
|
424 | - } |
|
425 | - |
|
426 | - self::display_list( $message, $errors ); |
|
427 | - } |
|
428 | - |
|
429 | - public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
430 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
431 | - return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
432 | - } |
|
433 | - |
|
434 | - public static function get_form( $filename, $form, $title, $description ) { |
|
435 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
436 | - return FrmFormsController::get_form( $form, $title, $description ); |
|
437 | - } |
|
438 | - |
|
439 | - public static function process_entry( $errors = '', $ajax = false ) { |
|
420 | + $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
421 | + } |
|
422 | + } else { |
|
423 | + $errors = __( 'No entries were specified', 'formidable' ); |
|
424 | + } |
|
425 | + |
|
426 | + self::display_list( $message, $errors ); |
|
427 | + } |
|
428 | + |
|
429 | + public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
430 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
431 | + return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
432 | + } |
|
433 | + |
|
434 | + public static function get_form( $filename, $form, $title, $description ) { |
|
435 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
436 | + return FrmFormsController::get_form( $form, $title, $description ); |
|
437 | + } |
|
438 | + |
|
439 | + public static function process_entry( $errors = '', $ajax = false ) { |
|
440 | 440 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
441 | 441 | if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { |
442 | - return; |
|
443 | - } |
|
442 | + return; |
|
443 | + } |
|
444 | 444 | |
445 | - global $frm_vars; |
|
445 | + global $frm_vars; |
|
446 | 446 | |
447 | 447 | $form = FrmForm::getOne( $form_id ); |
448 | - if ( ! $form ) { |
|
449 | - return; |
|
450 | - } |
|
448 | + if ( ! $form ) { |
|
449 | + return; |
|
450 | + } |
|
451 | 451 | |
452 | 452 | $params = FrmForm::get_params( $form ); |
453 | 453 | |
454 | - if ( ! isset( $frm_vars['form_params'] ) ) { |
|
455 | - $frm_vars['form_params'] = array(); |
|
456 | - } |
|
454 | + if ( ! isset( $frm_vars['form_params'] ) ) { |
|
455 | + $frm_vars['form_params'] = array(); |
|
456 | + } |
|
457 | 457 | $frm_vars['form_params'][ $form->id ] = $params; |
458 | 458 | |
459 | 459 | if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
460 | - return; |
|
461 | - } |
|
460 | + return; |
|
461 | + } |
|
462 | 462 | |
463 | - if ( $errors == '' && ! $ajax ) { |
|
463 | + if ( $errors == '' && ! $ajax ) { |
|
464 | 464 | $errors = FrmEntryValidate::validate( $_POST ); |
465 | - } |
|
465 | + } |
|
466 | 466 | |
467 | 467 | /** |
468 | 468 | * Use this filter to add trigger actions and add errors after |
@@ -473,39 +473,39 @@ discard block |
||
473 | 473 | |
474 | 474 | $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
475 | 475 | |
476 | - if ( empty( $errors ) ) { |
|
476 | + if ( empty( $errors ) ) { |
|
477 | 477 | $_POST['frm_skip_cookie'] = 1; |
478 | - if ( $params['action'] == 'create' ) { |
|
478 | + if ( $params['action'] == 'create' ) { |
|
479 | 479 | if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
480 | 480 | $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
481 | - } |
|
482 | - } |
|
481 | + } |
|
482 | + } |
|
483 | 483 | |
484 | - do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
484 | + do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
485 | 485 | unset( $_POST['frm_skip_cookie'] ); |
486 | - } |
|
487 | - } |
|
488 | - |
|
489 | - public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
490 | - self::_delete_entry( $atts['id'], $form ); |
|
491 | - return $url; |
|
492 | - } |
|
493 | - |
|
494 | - //Delete entry if not redirected |
|
495 | - public static function delete_entry_after_save( $atts ) { |
|
496 | - self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
497 | - } |
|
498 | - |
|
499 | - private static function _delete_entry( $entry_id, $form ) { |
|
500 | - if ( ! $form ) { |
|
501 | - return; |
|
502 | - } |
|
503 | - |
|
504 | - $form->options = maybe_unserialize( $form->options ); |
|
505 | - if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
506 | - FrmEntry::destroy( $entry_id ); |
|
507 | - } |
|
508 | - } |
|
486 | + } |
|
487 | + } |
|
488 | + |
|
489 | + public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
490 | + self::_delete_entry( $atts['id'], $form ); |
|
491 | + return $url; |
|
492 | + } |
|
493 | + |
|
494 | + //Delete entry if not redirected |
|
495 | + public static function delete_entry_after_save( $atts ) { |
|
496 | + self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
497 | + } |
|
498 | + |
|
499 | + private static function _delete_entry( $entry_id, $form ) { |
|
500 | + if ( ! $form ) { |
|
501 | + return; |
|
502 | + } |
|
503 | + |
|
504 | + $form->options = maybe_unserialize( $form->options ); |
|
505 | + if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
506 | + FrmEntry::destroy( $entry_id ); |
|
507 | + } |
|
508 | + } |
|
509 | 509 | |
510 | 510 | public static function show_entry_shortcode( $atts ) { |
511 | 511 | return FrmEntryFormat::show_entry( $atts ); |
@@ -517,15 +517,15 @@ discard block |
||
517 | 517 | } |
518 | 518 | |
519 | 519 | public static function entry_sidebar( $entry ) { |
520 | - $data = maybe_unserialize($entry->description); |
|
521 | - $date_format = get_option('date_format'); |
|
522 | - $time_format = get_option('time_format'); |
|
520 | + $data = maybe_unserialize($entry->description); |
|
521 | + $date_format = get_option('date_format'); |
|
522 | + $time_format = get_option('time_format'); |
|
523 | 523 | if ( isset( $data['browser'] ) ) { |
524 | 524 | $browser = FrmEntryFormat::get_browser( $data['browser'] ); |
525 | 525 | } |
526 | 526 | |
527 | 527 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' ); |
528 | - } |
|
528 | + } |
|
529 | 529 | |
530 | 530 | /*********************************************************************** |
531 | 531 | * Deprecated Functions |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | public static function menu() { |
6 | 6 | FrmAppHelper::force_capability( 'frm_view_entries' ); |
7 | 7 | |
8 | - add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
8 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
9 | 9 | |
10 | 10 | if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) { |
11 | 11 | $menu_name = FrmAppHelper::get_menu_name(); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | 'id' => 'formidable-entries-tab', |
54 | 54 | 'title' => __( 'Overview', 'formidable' ), |
55 | 55 | 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
56 | - )); |
|
56 | + ) ); |
|
57 | 57 | |
58 | 58 | $screen->set_help_sidebar( |
59 | 59 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
@@ -68,20 +68,20 @@ discard block |
||
68 | 68 | global $frm_vars; |
69 | 69 | $form_id = FrmForm::get_current_form_id(); |
70 | 70 | |
71 | - $columns[ $form_id . '_id' ] = 'ID'; |
|
72 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
71 | + $columns[$form_id . '_id'] = 'ID'; |
|
72 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
73 | 73 | |
74 | 74 | if ( $form_id ) { |
75 | 75 | self::get_columns_for_form( $form_id, $columns ); |
76 | 76 | } else { |
77 | - $columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' ); |
|
78 | - $columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' ); |
|
79 | - $columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' ); |
|
77 | + $columns[$form_id . '_form_id'] = __( 'Form', 'formidable' ); |
|
78 | + $columns[$form_id . '_name'] = __( 'Entry Name', 'formidable' ); |
|
79 | + $columns[$form_id . '_user_id'] = __( 'Created By', 'formidable' ); |
|
80 | 80 | } |
81 | 81 | |
82 | - $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
83 | - $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
84 | - $columns[ $form_id . '_ip' ] = 'IP'; |
|
82 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
83 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
84 | + $columns[$form_id . '_ip'] = 'IP'; |
|
85 | 85 | |
86 | 86 | $frm_vars['cols'] = $columns; |
87 | 87 | |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | if ( $sub_form_cols ) { |
108 | 108 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
109 | 109 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
110 | - unset( $sub_form_cols[ $k ] ); |
|
110 | + unset( $sub_form_cols[$k] ); |
|
111 | 111 | continue; |
112 | 112 | } |
113 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
114 | - unset($sub_form_col); |
|
113 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
114 | + unset( $sub_form_col ); |
|
115 | 115 | } |
116 | 116 | } |
117 | - unset($sub_form_cols); |
|
117 | + unset( $sub_form_cols ); |
|
118 | 118 | } else { |
119 | 119 | $col_id = $form_col->field_key; |
120 | 120 | if ( $form_col->form_id != $form_id ) { |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | $has_separate_value = ! FrmField::is_option_empty( $form_col, 'separate_value' ); |
125 | 125 | $is_post_status = FrmField::is_option_true( $form_col, 'post_field' ) && $form_col->field_options['post_field'] == 'post_status'; |
126 | 126 | if ( $has_separate_value && ! $is_post_status ) { |
127 | - $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
127 | + $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
128 | 128 | } |
129 | - $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
129 | + $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | global $frm_vars; |
146 | 146 | //add a check so we don't create a loop |
147 | - $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
147 | + $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
148 | 148 | |
149 | 149 | return $check; |
150 | 150 | } |
@@ -159,19 +159,19 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | global $frm_vars; |
162 | - if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
162 | + if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) { |
|
163 | 163 | return; //don't continue if there's no previous value |
164 | 164 | } |
165 | 165 | |
166 | 166 | foreach ( $meta_value as $mk => $mv ) { |
167 | 167 | //remove blank values |
168 | 168 | if ( empty( $mv ) ) { |
169 | - unset( $meta_value[ $mk ] ); |
|
169 | + unset( $meta_value[$mk] ); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
173 | - $cur_form_prefix = reset($meta_value); |
|
174 | - $cur_form_prefix = explode('_', $cur_form_prefix); |
|
173 | + $cur_form_prefix = reset( $meta_value ); |
|
174 | + $cur_form_prefix = explode( '_', $cur_form_prefix ); |
|
175 | 175 | $cur_form_prefix = $cur_form_prefix[0]; |
176 | 176 | $save = false; |
177 | 177 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | $meta_value[] = $prev_hidden; |
192 | 192 | $save = true; |
193 | - unset($form_prefix); |
|
193 | + unset( $form_prefix ); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | if ( $save ) { |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | foreach ( $fields as $field ) { |
223 | 223 | if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) { |
224 | 224 | // Can't sort on checkboxes because they are stored serialized, or post fields |
225 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
225 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | break; |
246 | 246 | } |
247 | 247 | |
248 | - unset($form_prefix); |
|
248 | + unset( $form_prefix ); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
@@ -253,15 +253,15 @@ discard block |
||
253 | 253 | return $result; |
254 | 254 | } |
255 | 255 | |
256 | - $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
256 | + $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0; |
|
257 | 257 | $max_columns = 8; |
258 | 258 | if ( $i <= $max_columns ) { |
259 | 259 | return $result; |
260 | 260 | } |
261 | 261 | |
262 | 262 | global $frm_vars; |
263 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
264 | - $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
263 | + if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] ) { |
|
264 | + $frm_vars['current_form']->options = maybe_unserialize( $frm_vars['current_form']->options ); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | $has_custom_hidden_columns = ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) ); |
@@ -269,23 +269,23 @@ discard block |
||
269 | 269 | $result = $frm_vars['current_form']->options['hidden_cols']; |
270 | 270 | } else { |
271 | 271 | $cols = $frm_vars['cols']; |
272 | - $cols = array_reverse($cols, true); |
|
272 | + $cols = array_reverse( $cols, true ); |
|
273 | 273 | |
274 | 274 | if ( $form_id ) { |
275 | 275 | $result[] = $form_id . '_id'; |
276 | - $i--; |
|
276 | + $i --; |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | $result[] = $form_id . '_item_key'; |
280 | - $i--; |
|
280 | + $i --; |
|
281 | 281 | |
282 | 282 | foreach ( $cols as $col_key => $col ) { |
283 | 283 | if ( $i > $max_columns ) { |
284 | 284 | $result[] = $col_key; |
285 | 285 | } |
286 | 286 | //remove some columns by default |
287 | - $i--; |
|
288 | - unset($col_key, $col); |
|
287 | + $i --; |
|
288 | + unset( $col_key, $col ); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
@@ -317,14 +317,14 @@ discard block |
||
317 | 317 | if ( $pagenum > $total_pages && $total_pages > 0 ) { |
318 | 318 | $url = add_query_arg( 'paged', $total_pages ); |
319 | 319 | if ( headers_sent() ) { |
320 | - echo FrmAppHelper::js_redirect($url); |
|
320 | + echo FrmAppHelper::js_redirect( $url ); |
|
321 | 321 | } else { |
322 | 322 | wp_redirect( esc_url_raw( $url ) ); |
323 | 323 | } |
324 | 324 | die(); |
325 | 325 | } |
326 | 326 | |
327 | - if ( empty($message) && isset($_GET['import-message']) ) { |
|
327 | + if ( empty( $message ) && isset( $_GET['import-message'] ) ) { |
|
328 | 328 | $message = __( 'Your import is complete', 'formidable' ); |
329 | 329 | } |
330 | 330 | |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | |
342 | 342 | /* Back End CRUD */ |
343 | 343 | public static function show( $id = 0 ) { |
344 | - FrmAppHelper::permission_check('frm_view_entries'); |
|
344 | + FrmAppHelper::permission_check( 'frm_view_entries' ); |
|
345 | 345 | |
346 | 346 | if ( ! $id ) { |
347 | 347 | $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | } |
352 | 352 | } |
353 | 353 | |
354 | - $entry = FrmEntry::getOne($id, true); |
|
354 | + $entry = FrmEntry::getOne( $id, true ); |
|
355 | 355 | if ( ! $entry ) { |
356 | 356 | echo '<div id="form_show_entry_page" class="wrap">' . |
357 | 357 | __( 'You are trying to view an entry that does not exist.', 'formidable' ) . |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | return; |
360 | 360 | } |
361 | 361 | |
362 | - $data = maybe_unserialize($entry->description); |
|
362 | + $data = maybe_unserialize( $entry->description ); |
|
363 | 363 | if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) { |
364 | 364 | $data = array( 'referrer' => $data ); |
365 | 365 | } |
@@ -371,11 +371,11 @@ discard block |
||
371 | 371 | } |
372 | 372 | |
373 | 373 | public static function destroy() { |
374 | - FrmAppHelper::permission_check('frm_delete_entries'); |
|
374 | + FrmAppHelper::permission_check( 'frm_delete_entries' ); |
|
375 | 375 | |
376 | 376 | $params = FrmForm::get_admin_params(); |
377 | 377 | |
378 | - if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
378 | + if ( isset( $params['keep_post'] ) && $params['keep_post'] ) { |
|
379 | 379 | //unlink entry from post |
380 | 380 | global $wpdb; |
381 | 381 | $wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
@@ -454,9 +454,9 @@ discard block |
||
454 | 454 | if ( ! isset( $frm_vars['form_params'] ) ) { |
455 | 455 | $frm_vars['form_params'] = array(); |
456 | 456 | } |
457 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
457 | + $frm_vars['form_params'][$form->id] = $params; |
|
458 | 458 | |
459 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
459 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
460 | 460 | return; |
461 | 461 | } |
462 | 462 | |
@@ -471,13 +471,13 @@ discard block |
||
471 | 471 | */ |
472 | 472 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
473 | 473 | |
474 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
474 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
475 | 475 | |
476 | 476 | if ( empty( $errors ) ) { |
477 | 477 | $_POST['frm_skip_cookie'] = 1; |
478 | 478 | if ( $params['action'] == 'create' ) { |
479 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
480 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
|
479 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
480 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); |
|
481 | 481 | } |
482 | 482 | } |
483 | 483 | |
@@ -517,9 +517,9 @@ discard block |
||
517 | 517 | } |
518 | 518 | |
519 | 519 | public static function entry_sidebar( $entry ) { |
520 | - $data = maybe_unserialize($entry->description); |
|
521 | - $date_format = get_option('date_format'); |
|
522 | - $time_format = get_option('time_format'); |
|
520 | + $data = maybe_unserialize( $entry->description ); |
|
521 | + $date_format = get_option( 'date_format' ); |
|
522 | + $time_format = get_option( 'time_format' ); |
|
523 | 523 | if ( isset( $data['browser'] ) ) { |
524 | 524 | $browser = FrmEntryFormat::get_browser( $data['browser'] ); |
525 | 525 | } |
@@ -196,9 +196,9 @@ |
||
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
199 | - * Flatten multi-dimensional array for multi-file upload fields |
|
200 | - * @since 2.0.9 |
|
201 | - */ |
|
199 | + * Flatten multi-dimensional array for multi-file upload fields |
|
200 | + * @since 2.0.9 |
|
201 | + */ |
|
202 | 202 | public static function flatten_multi_file_upload( $field, &$val ) { |
203 | 203 | if ( $field->type == 'file' && FrmField::is_option_true( $field, 'multiple' ) ) { |
204 | 204 | $val = FrmAppHelper::array_flatten( $val ); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | if ( ! self::skip_field( $atts, $f ) ) { |
53 | 53 | self::fill_entry_values( $atts, $f, $values ); |
54 | 54 | } |
55 | - unset($f); |
|
55 | + unset( $f ); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | self::fill_entry_user_info( $atts, $values ); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'type' => $f->type, |
122 | 122 | ); |
123 | 123 | |
124 | - $values[ $f->id ] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $field_shortcodes, $f ); |
|
124 | + $values[$f->id] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $field_shortcodes, $f ); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | public static function fill_entry_values( $atts, $f, array &$values ) { |
@@ -153,22 +153,22 @@ discard block |
||
153 | 153 | self::prepare_field_output( $atts, $val ); |
154 | 154 | |
155 | 155 | if ( $atts['format'] != 'text' ) { |
156 | - $values[ $f->field_key ] = $val; |
|
156 | + $values[$f->field_key] = $val; |
|
157 | 157 | if ( $atts['entry'] && $f->type != 'textarea' ) { |
158 | - $prev_val = maybe_unserialize( $atts['entry']->metas[ $f->id ] ); |
|
158 | + $prev_val = maybe_unserialize( $atts['entry']->metas[$f->id] ); |
|
159 | 159 | if ( $prev_val != $val ) { |
160 | - $values[ $f->field_key . '-value' ] = $prev_val; |
|
160 | + $values[$f->field_key . '-value'] = $prev_val; |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | } else { |
164 | - $values[ $f->id ] = array( 'label' => $f->name, 'val' => $val, 'type' => $f->type ); |
|
164 | + $values[$f->id] = array( 'label' => $f->name, 'val' => $val, 'type' => $f->type ); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | 168 | private static function fill_missing_fields( $atts, &$values ) { |
169 | - if ( $atts['entry'] && ! isset( $atts['entry']->metas[ $atts['field']->id ] ) ) { |
|
169 | + if ( $atts['entry'] && ! isset( $atts['entry']->metas[$atts['field']->id] ) ) { |
|
170 | 170 | // In case include_blank is set |
171 | - $atts['entry']->metas[ $atts['field']->id ] = ''; |
|
171 | + $atts['entry']->metas[$atts['field']->id] = ''; |
|
172 | 172 | $atts['entry'] = apply_filters( 'frm_prepare_entry_content', $atts['entry'], array( 'field' => $atts['field'] ) ); |
173 | 173 | self::fill_values_from_entry( $atts, $values ); |
174 | 174 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | private static function get_field_value( $atts, &$val ) { |
182 | 182 | $f = $atts['field']; |
183 | 183 | if ( $atts['entry'] ) { |
184 | - $prev_val = maybe_unserialize( $atts['entry']->metas[ $f->id ] ); |
|
184 | + $prev_val = maybe_unserialize( $atts['entry']->metas[$f->id] ); |
|
185 | 185 | $meta = array( 'item_id' => $atts['id'], 'field_id' => $f->id, 'meta_value' => $prev_val, 'field_type' => $f->type ); |
186 | 186 | |
187 | 187 | //This filter applies to the default-message shortcode and frm-show-entry shortcode only |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | return; |
253 | 253 | } |
254 | 254 | |
255 | - $data = self::get_entry_description_data( $atts ); |
|
255 | + $data = self::get_entry_description_data( $atts ); |
|
256 | 256 | |
257 | 257 | if ( $atts['default_email'] ) { |
258 | 258 | $atts['entry']->ip = '[ip]'; |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | preg_match_all( $pattern, $u_agent, $matches ); // get the matching numbers |
340 | 340 | |
341 | 341 | // see how many we have |
342 | - $i = count($matches['browser']); |
|
342 | + $i = count( $matches['browser'] ); |
|
343 | 343 | |
344 | 344 | if ( $i > 1 ) { |
345 | 345 | //we will have two since we are not using 'other' argument yet |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | self::convert_entry_to_content( $values, $atts, $content ); |
368 | 368 | |
369 | 369 | if ( 'text' == $atts['format'] ) { |
370 | - $content = implode('', $content); |
|
370 | + $content = implode( '', $content ); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | if ( $atts['clickable'] ) { |
@@ -420,11 +420,11 @@ discard block |
||
420 | 420 | |
421 | 421 | // merge defaults, global settings, and shortcode options |
422 | 422 | foreach ( $default_settings as $key => $setting ) { |
423 | - if ( $atts[ $key ] != '' ) { |
|
423 | + if ( $atts[$key] != '' ) { |
|
424 | 424 | continue; |
425 | 425 | } |
426 | 426 | |
427 | - $atts[ $key ] = $setting; |
|
427 | + $atts[$key] = $setting; |
|
428 | 428 | unset( $key, $setting ); |
429 | 429 | } |
430 | 430 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'entry' => $this->entry, |
96 | 96 | 'form' => $this->form, |
97 | 97 | ); |
98 | - $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
98 | + $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
99 | 99 | |
100 | 100 | $this->to = array_unique( (array) $to ); |
101 | 101 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * @return array |
434 | 434 | */ |
435 | 435 | private function package_header() { |
436 | - $header = array(); |
|
436 | + $header = array(); |
|
437 | 437 | |
438 | 438 | if ( ! empty( $this->cc ) ) { |
439 | 439 | $header[] = 'CC: ' . implode( ',', $this->cc ); |
@@ -546,12 +546,12 @@ discard block |
||
546 | 546 | $name = trim( str_replace( $email, '', $val ) ); |
547 | 547 | } else { |
548 | 548 | // If user enters a name without an email |
549 | - unset( $recipients[ $key ] ); |
|
549 | + unset( $recipients[$key] ); |
|
550 | 550 | continue; |
551 | 551 | } |
552 | 552 | } |
553 | 553 | |
554 | - $recipients[ $key ] = $name . ' <' . $email . '>'; |
|
554 | + $recipients[$key] = $name . ' <' . $email . '>'; |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | return $recipients; |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | ) ); |
669 | 669 | |
670 | 670 | // Remove phone number from to addresses |
671 | - unset( $this->to[ $key ] ); |
|
671 | + unset( $this->to[$key] ); |
|
672 | 672 | } |
673 | 673 | } |
674 | 674 | } |