@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! isset($saving) ) { |
3 | - header( 'Content-type: text/css' ); |
|
3 | + header( 'Content-type: text/css' ); |
|
4 | 4 | |
5 | - if ( isset($css) && $css ) { |
|
6 | - echo $css; |
|
7 | - die(); |
|
8 | - } |
|
5 | + if ( isset($css) && $css ) { |
|
6 | + echo $css; |
|
7 | + die(); |
|
8 | + } |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | if ( ! isset($frm_style) ) { |
12 | - $frm_style = new FrmStyle(); |
|
12 | + $frm_style = new FrmStyle(); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | $styles = $frm_style->get_all(); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | <?php |
188 | 188 | foreach ( $styles as $style ) { |
189 | 189 | include( dirname( __FILE__ ) . '/_single_theme.css.php' ); |
190 | - unset($style); |
|
190 | + unset($style); |
|
191 | 191 | } |
192 | 192 | ?> |
193 | 193 |
@@ -1,19 +1,19 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! isset($saving) ) { |
|
2 | +if ( ! isset( $saving ) ) { |
|
3 | 3 | header( 'Content-type: text/css' ); |
4 | 4 | |
5 | - if ( isset($css) && $css ) { |
|
5 | + if ( isset( $css ) && $css ) { |
|
6 | 6 | echo $css; |
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | } |
10 | 10 | |
11 | -if ( ! isset($frm_style) ) { |
|
11 | +if ( ! isset( $frm_style ) ) { |
|
12 | 12 | $frm_style = new FrmStyle(); |
13 | 13 | } |
14 | 14 | |
15 | 15 | $styles = $frm_style->get_all(); |
16 | -$default_style = $frm_style->get_default_style($styles); |
|
16 | +$default_style = $frm_style->get_default_style( $styles ); |
|
17 | 17 | $defaults = $default_style->post_content; |
18 | 18 | ?> |
19 | 19 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | <?php |
195 | 195 | foreach ( $styles as $style ) { |
196 | 196 | include( dirname( __FILE__ ) . '/_single_theme.css.php' ); |
197 | - unset($style); |
|
197 | + unset( $style ); |
|
198 | 198 | } |
199 | 199 | ?> |
200 | 200 | |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | overflow:hidden!important; |
620 | 620 | } |
621 | 621 | |
622 | -<?php include( dirname(__FILE__) . '/frm_grids.css' ); ?> |
|
622 | +<?php include( dirname( __FILE__ ) . '/frm_grids.css' ); ?> |
|
623 | 623 | |
624 | 624 | /* Left and right label styling for non-Formidable styling - very basic, not responsive */ |
625 | 625 | .frm_form_field.frm_left_container label.frm_primary_label{ |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $display = apply_filters('frm_display_field_options', array( |
4 | - 'type' => $field['type'], 'field_data' => $field, |
|
5 | - 'required' => true, 'unique' => false, 'read_only' => false, |
|
6 | - 'description' => true, 'options' => true, 'label_position' => true, |
|
7 | - 'invalid' => false, 'size' => false, 'clear_on_focus' => false, |
|
8 | - 'default_blank' => true, 'css' => true, 'conf_field' => false, |
|
4 | + 'type' => $field['type'], 'field_data' => $field, |
|
5 | + 'required' => true, 'unique' => false, 'read_only' => false, |
|
6 | + 'description' => true, 'options' => true, 'label_position' => true, |
|
7 | + 'invalid' => false, 'size' => false, 'clear_on_focus' => false, |
|
8 | + 'default_blank' => true, 'css' => true, 'conf_field' => false, |
|
9 | 9 | 'max' => true, 'captcha_size' => false, |
10 | 10 | )); |
11 | 11 | |
@@ -25,19 +25,19 @@ discard block |
||
25 | 25 | $frm_settings = FrmAppHelper::get_settings(); |
26 | 26 | |
27 | 27 | if ( ! isset( $frm_all_field_selection ) ) { |
28 | - if ( isset($frm_field_selection) && isset($pro_field_selection) ) { |
|
29 | - $frm_all_field_selection = array_merge($frm_field_selection, $pro_field_selection); |
|
30 | - } else { |
|
28 | + if ( isset($frm_field_selection) && isset($pro_field_selection) ) { |
|
29 | + $frm_all_field_selection = array_merge($frm_field_selection, $pro_field_selection); |
|
30 | + } else { |
|
31 | 31 | $pro_field_selection = FrmField::pro_field_selection(); |
32 | 32 | $frm_all_field_selection = array_merge( FrmField::field_selection(), $pro_field_selection ); |
33 | - } |
|
33 | + } |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | $disabled_fields = FrmAppHelper::pro_is_installed() ? array() : $pro_field_selection; |
37 | 37 | |
38 | 38 | |
39 | 39 | if ( ! isset( $ajax ) ) { |
40 | - $li_classes .= ' ui-state-default widgets-holder-wrap'; ?> |
|
40 | + $li_classes .= ' ui-state-default widgets-holder-wrap'; ?> |
|
41 | 41 | <li id="frm_field_id_<?php echo esc_attr( $field['id'] ); ?>" class="<?php echo esc_attr( $li_classes ) ?>" data-fid="<?php echo esc_attr( $field['id'] ) ?>" data-formid="<?php echo ( 'divider' == $field['type'] ) ? esc_attr( $field['form_select'] ) : esc_attr( $field['form_id'] ); ?>"> |
42 | 42 | <?php |
43 | 43 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | </span> |
60 | 60 | <?php } |
61 | 61 | |
62 | - ?> |
|
62 | + ?> |
|
63 | 63 | <label class="<?php echo ( $field['type'] == 'end_divider' ) ? '' : 'frm_ipe_field_label'; ?> frm_primary_label <?php echo ( $field['type'] == 'break' ) ? 'button': ''; ?>" id="field_label_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['name'] == '' ) ? __( '(no label)', 'formidable' ) : force_balance_tags( $field['name'] ); ?></label> |
64 | 64 | |
65 | 65 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | if ( in_array( $field['type'], array( 'select', 'radio', 'checkbox' ) ) ) { ?> |
106 | 106 | <div class="frm-show-click frm_small_top_margin"><?php |
107 | 107 | |
108 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
108 | + if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
109 | 109 | echo '<p class="howto">' . FrmFieldsHelper::get_term_link( $field['taxonomy'] ) . '</p>'; |
110 | 110 | } else if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) { |
111 | 111 | ?> |
@@ -117,16 +117,16 @@ discard block |
||
117 | 117 | <a href="javascript:void(0);" id="other_button_<?php echo esc_attr( $field['id'] ); ?>" data-opttype="other" data-ftype="<?php echo esc_attr( $field['type'] ) ?>" class="button frm_cb_button frm_add_opt<?php echo ( in_array( $field['type'], array( 'radio', 'select' ) ) && $field['other'] == true ? ' frm_hidden' : '' ); ?>"><?php _e( 'Add "Other"', 'formidable' ) ?></a> |
118 | 118 | <input type="hidden" value="<?php echo esc_attr( $field['other'] ); ?>" id="other_input_<?php echo esc_attr( $field['id'] ); ?>" name="field_options[other_<?php echo esc_attr( $field['id'] ); ?>]"> |
119 | 119 | <?php |
120 | - } |
|
120 | + } |
|
121 | 121 | |
122 | - if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?> |
|
122 | + if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?> |
|
123 | 123 | <a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=frm_import_choices&field_id=' . $field['id'] . '&TB_iframe=1' ) ) ?>" title="<?php echo esc_attr( FrmAppHelper::truncate( strip_tags( str_replace( '"', '"', $field['name'] ) ), 20 ) . ' ' . __( 'Field Choices', 'formidable' ) ); ?>" class="thickbox frm_orange"> |
124 | 124 | <?php _e( 'Bulk Edit Options', 'formidable' ) ?> |
125 | 125 | </a> |
126 | 126 | <?php } ?> |
127 | 127 | </div> |
128 | 128 | <?php |
129 | - } |
|
129 | + } |
|
130 | 130 | ?> |
131 | 131 | </div> |
132 | 132 | <?php |
@@ -158,28 +158,28 @@ discard block |
||
158 | 158 | if ( $display['required'] ) { ?> |
159 | 159 | <label for="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label"><input type="checkbox" id="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_req_field" name="field_options[required_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['required'] ? 'checked="checked"': ''; ?> /> <?php _e( 'Required', 'formidable' ) ?></label> |
160 | 160 | <?php |
161 | - } |
|
161 | + } |
|
162 | 162 | |
163 | 163 | if ( $display['unique'] ) { |
164 | - if ( ! isset( $field['unique'] ) ) { |
|
165 | - $field['unique'] = false; |
|
166 | - } |
|
167 | - ?> |
|
164 | + if ( ! isset( $field['unique'] ) ) { |
|
165 | + $field['unique'] = false; |
|
166 | + } |
|
167 | + ?> |
|
168 | 168 | <label for="frm_uniq_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label frm_help" title="<?php esc_attr_e( 'Unique: Do not allow the same response multiple times. For example, if one user enters \'Joe\', then no one else will be allowed to enter the same name.', 'formidable' ) ?>"><input type="checkbox" name="field_options[unique_<?php echo esc_attr( $field['id'] ) ?>]" id="frm_uniq_field_<?php echo esc_attr( $field['id'] ) ?>" value="1" <?php checked( $field['unique'], 1 ); ?> class="frm_mark_unique" /> <?php _e( 'Unique', 'formidable' ) ?></label> |
169 | 169 | <?php |
170 | - } |
|
170 | + } |
|
171 | 171 | |
172 | 172 | if ( $display['read_only'] ) { |
173 | - if ( ! isset( $field['read_only'] ) ) { |
|
174 | - $field['read_only'] = false; |
|
173 | + if ( ! isset( $field['read_only'] ) ) { |
|
174 | + $field['read_only'] = false; |
|
175 | 175 | } |
176 | - ?> |
|
176 | + ?> |
|
177 | 177 | <label for="frm_read_only_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label frm_help" title="<?php esc_attr_e( 'Read Only: Show this field but do not allow the field value to be edited from the front-end.', 'formidable' ) ?>" ><input type="checkbox" id="frm_read_only_field_<?php echo esc_attr( $field['id'] ) ?>" name="field_options[read_only_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['read_only'] ? ' checked="checked"' : ''; ?>/> <?php _e( 'Read Only', 'formidable' ) ?></label> |
178 | 178 | <?php } |
179 | 179 | |
180 | - do_action('frm_field_options_form_top', $field, $display, $values); |
|
180 | + do_action('frm_field_options_form_top', $field, $display, $values); |
|
181 | 181 | |
182 | - ?> |
|
182 | + ?> |
|
183 | 183 | <?php |
184 | 184 | if ( $display['required'] ) { ?> |
185 | 185 | <div class="frm_required_details<?php echo esc_attr( $field['id'] . ( $field['required'] ? '' : ' frm_hidden' ) ); ?>"> |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | do_action( 'frm_' . $field['type'] . '_field_options_form', $field, $display, $values ); |
266 | 266 | do_action( 'frm_field_options_form', $field, $display, $values ); |
267 | 267 | |
268 | - if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?> |
|
268 | + if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?> |
|
269 | 269 | <tr class="frm_validation_msg <?php echo ($display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>"> |
270 | 270 | <td colspan="2"> |
271 | 271 | <div class="menu-settings"> |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | <input type="text" name="field_options[blank_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['blank'] ); ?>" /> |
279 | 279 | </p> |
280 | 280 | <?php |
281 | - } |
|
281 | + } |
|
282 | 282 | |
283 | 283 | if ( $display['invalid'] ) { ?> |
284 | 284 | <p><label><?php _e( 'Invalid Format', 'formidable' ) ?></label> |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | <input type="text" name="field_options[unique_msg_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['unique_msg'] ); ?>" /> |
294 | 294 | </p> |
295 | 295 | <?php |
296 | - } |
|
296 | + } |
|
297 | 297 | |
298 | 298 | if ( $display['conf_field'] ) { ?> |
299 | 299 | <p class="frm_conf_details<?php echo esc_attr( $field['id'] . ( $field['conf_field'] ? '' : ' frm_hidden' ) ); ?>"> |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | <input type="text" name="field_options[conf_msg_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_msg'] ); ?>" /> |
302 | 302 | </p> |
303 | 303 | <?php |
304 | - } ?> |
|
304 | + } ?> |
|
305 | 305 | </div> |
306 | 306 | </div> |
307 | 307 | </td> |
@@ -1,22 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$display = apply_filters('frm_display_field_options', array( |
|
3 | +$display = apply_filters( 'frm_display_field_options', array( |
|
4 | 4 | 'type' => $field['type'], 'field_data' => $field, |
5 | 5 | 'required' => true, 'unique' => false, 'read_only' => false, |
6 | 6 | 'description' => true, 'options' => true, 'label_position' => true, |
7 | 7 | 'invalid' => false, 'size' => false, 'clear_on_focus' => false, |
8 | 8 | 'default_blank' => true, 'css' => true, 'conf_field' => false, |
9 | 9 | 'max' => true, 'captcha_size' => false, |
10 | -)); |
|
10 | +) ); |
|
11 | 11 | |
12 | 12 | $li_classes = 'form-field edit_form_item frm_field_box frm_top_container frm_not_divider edit_field_type_' . $display['type']; |
13 | -$li_classes = apply_filters('frm_build_field_class', $li_classes, $field ); |
|
13 | +$li_classes = apply_filters( 'frm_build_field_class', $li_classes, $field ); |
|
14 | 14 | |
15 | 15 | if ( isset( $values ) && isset( $values['ajax_load'] ) && $values['ajax_load'] && isset( $count ) && $count > 10 && ! in_array( $field['type'], array( 'divider', 'end_divider' ) ) ) { |
16 | 16 | ?> |
17 | 17 | <li id="frm_field_id_<?php echo esc_attr( $field['id'] ); ?>" class="<?php echo esc_attr( $li_classes ) ?> frm_field_loading" data-fid="<?php echo esc_attr( $field['id'] ) ?>" data-formid="<?php echo esc_attr( 'divider' == $field['type'] ? $field['form_select'] : $field['form_id'] ); ?>" data-ftype="<?php echo esc_attr( $display['type'] ) ?>"> |
18 | 18 | <img src="<?php echo FrmAppHelper::plugin_url() ?>/images/ajax_loader.gif" alt="<?php esc_attr_e( 'Loading', 'formidable' ) ?>" /> |
19 | -<span class="frm_hidden_fdata frm_hidden"><?php echo htmlspecialchars(json_encode($field)) ?></span> |
|
19 | +<span class="frm_hidden_fdata frm_hidden"><?php echo htmlspecialchars( json_encode( $field ) ) ?></span> |
|
20 | 20 | </li> |
21 | 21 | <?php |
22 | 22 | return; |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | $frm_settings = FrmAppHelper::get_settings(); |
26 | 26 | |
27 | 27 | if ( ! isset( $frm_all_field_selection ) ) { |
28 | - if ( isset($frm_field_selection) && isset($pro_field_selection) ) { |
|
29 | - $frm_all_field_selection = array_merge($frm_field_selection, $pro_field_selection); |
|
28 | + if ( isset( $frm_field_selection ) && isset( $pro_field_selection ) ) { |
|
29 | + $frm_all_field_selection = array_merge( $frm_field_selection, $pro_field_selection ); |
|
30 | 30 | } else { |
31 | 31 | $pro_field_selection = FrmField::pro_field_selection(); |
32 | 32 | $frm_all_field_selection = array_merge( FrmField::field_selection(), $pro_field_selection ); |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | <a href="javascript:void(0);" class="frm_bstooltip alignright frm-show-hover frm-move frm-hover-icon frm_icon_font frm_move_icon" title="<?php esc_attr_e( 'Move Field', 'formidable' ) ?>"> </a> |
52 | 52 | <a href="#" class="frm_bstooltip alignright frm-show-hover frm-hover-icon frm_icon_font frm_delete_icon frm_delete_field" title="<?php esc_attr_e( 'Delete Field', 'formidable' ) ?>"> </a> |
53 | 53 | <a href="#" class="frm_bstooltip alignright frm-show-hover frm-hover-icon frm_icon_font frm_duplicate_icon" title="<?php ( $field['type'] == 'divider' ) ? esc_attr_e( 'Duplicate Section', 'formidable' ) : esc_attr_e( 'Duplicate Field', 'formidable' ) ?>"> </a> |
54 | - <input type="hidden" name="frm_fields_submitted[]" value="<?php echo esc_attr($field['id']) ?>" /> |
|
55 | - <?php do_action('frm_extra_field_actions', $field['id']); ?> |
|
54 | + <input type="hidden" name="frm_fields_submitted[]" value="<?php echo esc_attr( $field['id'] ) ?>" /> |
|
55 | + <?php do_action( 'frm_extra_field_actions', $field['id'] ); ?> |
|
56 | 56 | <?php if ( $display['required'] ) { ?> |
57 | 57 | <span id="require_field_<?php echo esc_attr( $field['id'] ); ?>"> |
58 | 58 | <a href="javascript:void(0);" class="frm_req_field frm_action_icon frm_required_icon frm_icon_font alignleft frm_required<?php echo (int) $field['required'] ?>" id="req_field_<?php echo esc_attr( $field['id'] ); ?>" title="Click to Mark as <?php echo FrmField::is_required( $field ) ? 'not ' : ''; ?>Required"></a> |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | <?php } |
61 | 61 | |
62 | 62 | ?> |
63 | - <label class="<?php echo ( $field['type'] == 'end_divider' ) ? '' : 'frm_ipe_field_label'; ?> frm_primary_label <?php echo ( $field['type'] == 'break' ) ? 'button': ''; ?>" id="field_label_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['name'] == '' ) ? __( '(no label)', 'formidable' ) : force_balance_tags( $field['name'] ); ?></label> |
|
63 | + <label class="<?php echo ( $field['type'] == 'end_divider' ) ? '' : 'frm_ipe_field_label'; ?> frm_primary_label <?php echo ( $field['type'] == 'break' ) ? 'button' : ''; ?>" id="field_label_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['name'] == '' ) ? __( '(no label)', 'formidable' ) : force_balance_tags( $field['name'] ); ?></label> |
|
64 | 64 | |
65 | 65 | |
66 | 66 | <div id="field_<?php echo esc_attr( $field['id'] ) ?>_inner_container" class="frm_inner_field_container"> |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | </div> |
79 | 79 | <?php |
80 | 80 | if ( $display['description'] ) { ?> |
81 | - <div class="frm_ipe_field_desc description <?php echo ($field['description'] == '') ? 'frm-show-click' : '' ?>" id="field_description_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ($field['description'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['description'] ); ?></div> |
|
81 | + <div class="frm_ipe_field_desc description <?php echo ( $field['description'] == '' ) ? 'frm-show-click' : '' ?>" id="field_description_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['description'] == '' ) ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['description'] ); ?></div> |
|
82 | 82 | <input type="hidden" name="field_options[description_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['description'] ); ?>" /> |
83 | 83 | |
84 | 84 | <?php } ?> |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | <div class="frm_form_fields"> |
91 | 91 | <input type="text" id="conf_field_<?php echo esc_attr( $field['field_key'] ) ?>" name="field_options[conf_input_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_input'] ); ?>" class="dyn_default_value" /> |
92 | 92 | </div> |
93 | - <div id="conf_field_description_<?php echo esc_attr( $field['id'] ) ?>" class="frm_ipe_field_conf_desc description <?php echo ($field['conf_desc'] == '') ? 'frm-show-click' : '' ?>"><?php |
|
94 | - echo ($field['conf_desc'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags($field['conf_desc']); ?></div> |
|
93 | + <div id="conf_field_description_<?php echo esc_attr( $field['id'] ) ?>" class="frm_ipe_field_conf_desc description <?php echo ( $field['conf_desc'] == '' ) ? 'frm-show-click' : '' ?>"><?php |
|
94 | + echo ( $field['conf_desc'] == '' ) ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['conf_desc'] ); ?></div> |
|
95 | 95 | <input type="hidden" name="field_options[conf_desc_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_desc'] ); ?>" /> |
96 | 96 | </div> |
97 | 97 | <?php if ( $display['clear_on_focus'] ) { ?> |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | if ( in_array( $field['type'], array( 'select', 'radio', 'checkbox' ) ) ) { ?> |
107 | 107 | <div class="frm-show-click frm_small_top_margin"><?php |
108 | 108 | |
109 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
109 | + if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) { |
|
110 | 110 | echo '<p class="howto">' . FrmFieldsHelper::get_term_link( $field['taxonomy'] ) . '</p>'; |
111 | 111 | } else if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) { |
112 | 112 | ?> |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | <?php |
121 | 121 | } |
122 | 122 | |
123 | - if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?> |
|
123 | + if ( ! isset( $field['post_field'] ) || $field['post_field'] != 'post_category' ) { ?> |
|
124 | 124 | <a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=frm_import_choices&field_id=' . $field['id'] . '&TB_iframe=1' ) ) ?>" title="<?php echo esc_attr( FrmAppHelper::truncate( strip_tags( str_replace( '"', '"', $field['name'] ) ), 20 ) . ' ' . __( 'Field Choices', 'formidable' ) ); ?>" class="thickbox frm_orange"> |
125 | 125 | <?php _e( 'Bulk Edit Options', 'formidable' ) ?> |
126 | 126 | </a> |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | <?php |
134 | 134 | } |
135 | 135 | |
136 | -do_action('frm_before_field_options', $field); |
|
136 | +do_action( 'frm_before_field_options', $field ); |
|
137 | 137 | |
138 | 138 | if ( $display['options'] ) { ?> |
139 | 139 | <div class="widget"> |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | </div> |
144 | 144 | <div class="widget-inside"> |
145 | 145 | <table class="form-table frm_clear_none"> |
146 | - <?php $field_types = FrmFieldsHelper::get_field_types($field['type']); ?> |
|
146 | + <?php $field_types = FrmFieldsHelper::get_field_types( $field['type'] ); ?> |
|
147 | 147 | <tr><td class="frm_150_width"><label><?php _e( 'Field Type', 'formidable' ) ?></label></td> |
148 | 148 | <td> |
149 | - <select <?php if ( count($field_types) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>> |
|
149 | + <select <?php if ( count( $field_types ) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>> |
|
150 | 150 | <?php |
151 | 151 | foreach ( $field_types as $fkey => $ftype ) { ?> |
152 | - <option value="<?php echo esc_attr( $fkey ) ?>" <?php echo ( $fkey == $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists($fkey, $disabled_fields ) ? 'disabled="disabled"' : ''; ?>><?php echo is_array($ftype) ? $ftype['name'] : $ftype ?> </option> |
|
152 | + <option value="<?php echo esc_attr( $fkey ) ?>" <?php echo ( $fkey == $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists( $fkey, $disabled_fields ) ? 'disabled="disabled"' : ''; ?>><?php echo is_array( $ftype ) ? $ftype['name'] : $ftype ?> </option> |
|
153 | 153 | <?php |
154 | 154 | unset( $fkey, $ftype ); |
155 | 155 | } ?> |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | </label> |
185 | 185 | <?php } |
186 | 186 | |
187 | - do_action('frm_field_options_form_top', $field, $display, $values); |
|
187 | + do_action( 'frm_field_options_form_top', $field, $display, $values ); |
|
188 | 188 | |
189 | 189 | ?> |
190 | 190 | <?php |
@@ -221,13 +221,13 @@ discard block |
||
221 | 221 | if ( $display['label_position'] ) { ?> |
222 | 222 | <tr><td class="frm_150_width"><label><?php _e( 'Label Position', 'formidable' ) ?></label></td> |
223 | 223 | <td><select name="field_options[label_<?php echo esc_attr( $field['id'] ) ?>]"> |
224 | - <option value=""<?php selected($field['label'], ''); ?>><?php _e( 'Default', 'formidable' ) ?></option> |
|
225 | - <option value="top"<?php selected($field['label'], 'top'); ?>><?php _e( 'Top', 'formidable' ) ?></option> |
|
226 | - <option value="left"<?php selected($field['label'], 'left'); ?>><?php _e( 'Left', 'formidable' ) ?></option> |
|
227 | - <option value="right"<?php selected($field['label'], 'right'); ?>><?php _e( 'Right', 'formidable' ) ?></option> |
|
228 | - <option value="inline"<?php selected($field['label'], 'inline'); ?>><?php _e( 'Inline (left without a set width)', 'formidable' ) ?></option> |
|
229 | - <option value="none"<?php selected($field['label'], 'none'); ?>><?php _e( 'None', 'formidable' ) ?></option> |
|
230 | - <option value="hidden"<?php selected($field['label'], 'hidden'); ?>><?php _e( 'Hidden (but leave the space)', 'formidable' ) ?></option> |
|
224 | + <option value=""<?php selected( $field['label'], '' ); ?>><?php _e( 'Default', 'formidable' ) ?></option> |
|
225 | + <option value="top"<?php selected( $field['label'], 'top' ); ?>><?php _e( 'Top', 'formidable' ) ?></option> |
|
226 | + <option value="left"<?php selected( $field['label'], 'left' ); ?>><?php _e( 'Left', 'formidable' ) ?></option> |
|
227 | + <option value="right"<?php selected( $field['label'], 'right' ); ?>><?php _e( 'Right', 'formidable' ) ?></option> |
|
228 | + <option value="inline"<?php selected( $field['label'], 'inline' ); ?>><?php _e( 'Inline (left without a set width)', 'formidable' ) ?></option> |
|
229 | + <option value="none"<?php selected( $field['label'], 'none' ); ?>><?php _e( 'None', 'formidable' ) ?></option> |
|
230 | + <option value="hidden"<?php selected( $field['label'], 'hidden' ); ?>><?php _e( 'Hidden (but leave the space)', 'formidable' ) ?></option> |
|
231 | 231 | </select> |
232 | 232 | </td> |
233 | 233 | </tr> |
@@ -250,8 +250,8 @@ discard block |
||
250 | 250 | <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Set the size of the captcha field. The compact option is best if your form is in a small area.', 'formidable' ) ?>" ></span> |
251 | 251 | </td> |
252 | 252 | <td><select name="field_options[captcha_size_<?php echo esc_attr( $field['id'] ) ?>]"> |
253 | - <option value="normal"<?php selected($field['captcha_size'], 'normal'); ?>><?php _e( 'Normal', 'formidable' ) ?></option> |
|
254 | - <option value="compact"<?php selected($field['captcha_size'], 'compact'); ?>><?php _e( 'Compact', 'formidable' ) ?></option> |
|
253 | + <option value="normal"<?php selected( $field['captcha_size'], 'normal' ); ?>><?php _e( 'Normal', 'formidable' ) ?></option> |
|
254 | + <option value="compact"<?php selected( $field['captcha_size'], 'compact' ); ?>><?php _e( 'Compact', 'formidable' ) ?></option> |
|
255 | 255 | </select> |
256 | 256 | </td> |
257 | 257 | </tr> |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | do_action( 'frm_field_options_form', $field, $display, $values ); |
274 | 274 | |
275 | 275 | if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?> |
276 | - <tr class="frm_validation_msg <?php echo ($display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>"> |
|
276 | + <tr class="frm_validation_msg <?php echo ( $display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>"> |
|
277 | 277 | <td colspan="2"> |
278 | 278 | <div class="menu-settings"> |
279 | 279 | <h3 class="frm_no_bg"><?php _e( 'Validation', 'formidable' ) ?></h3> |
@@ -337,4 +337,4 @@ discard block |
||
337 | 337 | <?php |
338 | 338 | } |
339 | 339 | |
340 | -unset($display); |
|
340 | +unset( $display ); |
@@ -5,69 +5,69 @@ discard block |
||
5 | 5 | |
6 | 6 | class FrmEntriesHelper { |
7 | 7 | |
8 | - public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) { |
|
9 | - $values = array(); |
|
8 | + public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) { |
|
9 | + $values = array(); |
|
10 | 10 | foreach ( array( 'name' => '', 'description' => '', 'item_key' => '' ) as $var => $default ) { |
11 | 11 | $values[ $var ] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' ); |
12 | - } |
|
13 | - |
|
14 | - $values['fields'] = array(); |
|
15 | - if ( empty($fields) ) { |
|
16 | - return apply_filters('frm_setup_new_entry', $values); |
|
17 | - } |
|
18 | - |
|
19 | - foreach ( (array) $fields as $field ) { |
|
20 | - $new_value = self::get_field_value_for_new_entry( $field, $reset, $args ); |
|
21 | - |
|
22 | - $field_array = array( |
|
23 | - 'id' => $field->id, |
|
24 | - 'value' => $new_value, |
|
25 | - 'default_value' => $field->default_value, |
|
26 | - 'name' => $field->name, |
|
27 | - 'description' => $field->description, |
|
28 | - 'type' => apply_filters('frm_field_type', $field->type, $field, $new_value), |
|
29 | - 'options' => $field->options, |
|
30 | - 'required' => $field->required, |
|
31 | - 'field_key' => $field->field_key, |
|
32 | - 'field_order' => $field->field_order, |
|
33 | - 'form_id' => $field->form_id, |
|
12 | + } |
|
13 | + |
|
14 | + $values['fields'] = array(); |
|
15 | + if ( empty($fields) ) { |
|
16 | + return apply_filters('frm_setup_new_entry', $values); |
|
17 | + } |
|
18 | + |
|
19 | + foreach ( (array) $fields as $field ) { |
|
20 | + $new_value = self::get_field_value_for_new_entry( $field, $reset, $args ); |
|
21 | + |
|
22 | + $field_array = array( |
|
23 | + 'id' => $field->id, |
|
24 | + 'value' => $new_value, |
|
25 | + 'default_value' => $field->default_value, |
|
26 | + 'name' => $field->name, |
|
27 | + 'description' => $field->description, |
|
28 | + 'type' => apply_filters('frm_field_type', $field->type, $field, $new_value), |
|
29 | + 'options' => $field->options, |
|
30 | + 'required' => $field->required, |
|
31 | + 'field_key' => $field->field_key, |
|
32 | + 'field_order' => $field->field_order, |
|
33 | + 'form_id' => $field->form_id, |
|
34 | 34 | 'parent_form_id' => isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id, |
35 | - 'reset_value' => $reset, |
|
35 | + 'reset_value' => $reset, |
|
36 | 36 | 'in_embed_form' => isset( $args['in_embed_form'] ) ? $args['in_embed_form'] : '0', |
37 | - ); |
|
37 | + ); |
|
38 | 38 | |
39 | - $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true); |
|
40 | - $opt_defaults['required_indicator'] = ''; |
|
39 | + $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true); |
|
40 | + $opt_defaults['required_indicator'] = ''; |
|
41 | 41 | $opt_defaults['original_type'] = $field->type; |
42 | 42 | |
43 | 43 | foreach ( $opt_defaults as $opt => $default_opt ) { |
44 | - $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt; |
|
45 | - unset($opt, $default_opt); |
|
46 | - } |
|
44 | + $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt; |
|
45 | + unset($opt, $default_opt); |
|
46 | + } |
|
47 | 47 | |
48 | - unset($opt_defaults); |
|
48 | + unset($opt_defaults); |
|
49 | 49 | |
50 | - if ( $field_array['custom_html'] == '' ) { |
|
51 | - $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type); |
|
52 | - } |
|
50 | + if ( $field_array['custom_html'] == '' ) { |
|
51 | + $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type); |
|
52 | + } |
|
53 | 53 | |
54 | - $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field, $args ); |
|
55 | - $field_array = array_merge( $field->field_options, $field_array ); |
|
54 | + $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field, $args ); |
|
55 | + $field_array = array_merge( $field->field_options, $field_array ); |
|
56 | 56 | |
57 | - $values['fields'][] = $field_array; |
|
57 | + $values['fields'][] = $field_array; |
|
58 | 58 | |
59 | - if ( ! $form || ! isset($form->id) ) { |
|
60 | - $form = FrmForm::getOne($field->form_id); |
|
61 | - } |
|
62 | - } |
|
59 | + if ( ! $form || ! isset($form->id) ) { |
|
60 | + $form = FrmForm::getOne($field->form_id); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - $form->options = maybe_unserialize($form->options); |
|
65 | - if ( is_array($form->options) ) { |
|
66 | - foreach ( $form->options as $opt => $value ) { |
|
67 | - $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value ); |
|
68 | - unset($opt, $value); |
|
69 | - } |
|
70 | - } |
|
64 | + $form->options = maybe_unserialize($form->options); |
|
65 | + if ( is_array($form->options) ) { |
|
66 | + foreach ( $form->options as $opt => $value ) { |
|
67 | + $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value ); |
|
68 | + unset($opt, $value); |
|
69 | + } |
|
70 | + } |
|
71 | 71 | |
72 | 72 | $form_defaults = FrmFormsHelper::get_default_opts(); |
73 | 73 | |
@@ -77,19 +77,19 @@ discard block |
||
77 | 77 | $values = array_merge( $form_defaults, $values ); |
78 | 78 | |
79 | 79 | return apply_filters( 'frm_setup_new_entry', $values ); |
80 | - } |
|
80 | + } |
|
81 | 81 | |
82 | 82 | /** |
83 | - * Set the value for each field |
|
84 | - * This function is used when the form is first loaded and on all page turns *for a new entry* |
|
85 | - * |
|
86 | - * @since 2.0.13 |
|
87 | - * |
|
88 | - * @param object $field - this is passed by reference since it is an object |
|
89 | - * @param boolean $reset |
|
90 | - * @param array $args |
|
91 | - * @return string|array $new_value |
|
92 | - */ |
|
83 | + * Set the value for each field |
|
84 | + * This function is used when the form is first loaded and on all page turns *for a new entry* |
|
85 | + * |
|
86 | + * @since 2.0.13 |
|
87 | + * |
|
88 | + * @param object $field - this is passed by reference since it is an object |
|
89 | + * @param boolean $reset |
|
90 | + * @param array $args |
|
91 | + * @return string|array $new_value |
|
92 | + */ |
|
93 | 93 | private static function get_field_value_for_new_entry( $field, $reset, $args ) { |
94 | 94 | //If checkbox, multi-select dropdown, or checkbox data from entries field, the value should be an array |
95 | 95 | $return_array = FrmField::is_field_with_multiple_values( $field ); |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * Check if a field has a posted value |
|
119 | - * |
|
120 | - * @since 2.01.0 |
|
121 | - * @param object $field |
|
122 | - * @param array $args |
|
123 | - * @return boolean $value_is_posted |
|
124 | - */ |
|
118 | + * Check if a field has a posted value |
|
119 | + * |
|
120 | + * @since 2.01.0 |
|
121 | + * @param object $field |
|
122 | + * @param array $args |
|
123 | + * @return boolean $value_is_posted |
|
124 | + */ |
|
125 | 125 | public static function value_is_posted( $field, $args ) { |
126 | 126 | $value_is_posted = false; |
127 | 127 | if ( $_POST ) { |
@@ -139,15 +139,15 @@ discard block |
||
139 | 139 | |
140 | 140 | public static function setup_edit_vars( $values, $record ) { |
141 | 141 | $values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' ); |
142 | - $values['form_id'] = $record->form_id; |
|
143 | - $values['is_draft'] = $record->is_draft; |
|
144 | - return apply_filters('frm_setup_edit_entry_vars', $values, $record); |
|
145 | - } |
|
142 | + $values['form_id'] = $record->form_id; |
|
143 | + $values['is_draft'] = $record->is_draft; |
|
144 | + return apply_filters('frm_setup_edit_entry_vars', $values, $record); |
|
145 | + } |
|
146 | 146 | |
147 | - public static function get_admin_params( $form = null ) { |
|
147 | + public static function get_admin_params( $form = null ) { |
|
148 | 148 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_admin_params' ); |
149 | 149 | return FrmForm::set_current_form( $form ); |
150 | - } |
|
150 | + } |
|
151 | 151 | |
152 | 152 | public static function set_current_form( $form_id ) { |
153 | 153 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::set_current_form' ); |
@@ -159,284 +159,284 @@ discard block |
||
159 | 159 | return FrmForm::get_current_form( $form_id ); |
160 | 160 | } |
161 | 161 | |
162 | - public static function get_current_form_id() { |
|
162 | + public static function get_current_form_id() { |
|
163 | 163 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_current_form_id' ); |
164 | 164 | return FrmForm::get_current_form_id(); |
165 | - } |
|
165 | + } |
|
166 | 166 | |
167 | - public static function maybe_get_entry( &$entry ) { |
|
167 | + public static function maybe_get_entry( &$entry ) { |
|
168 | 168 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmEntry::maybe_get_entry' ); |
169 | 169 | FrmEntry::maybe_get_entry( $entry ); |
170 | - } |
|
170 | + } |
|
171 | 171 | |
172 | 172 | public static function replace_default_message( $message, $atts ) { |
173 | - if ( strpos($message, '[default-message') === false && |
|
174 | - strpos($message, '[default_message') === false && |
|
175 | - ! empty( $message ) ) { |
|
176 | - return $message; |
|
177 | - } |
|
178 | - |
|
179 | - if ( empty($message) ) { |
|
180 | - $message = '[default-message]'; |
|
181 | - } |
|
182 | - |
|
183 | - preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER); |
|
184 | - |
|
185 | - foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
186 | - $add_atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] ); |
|
187 | - if ( $add_atts ) { |
|
188 | - $this_atts = array_merge($atts, $add_atts); |
|
189 | - } else { |
|
190 | - $this_atts = $atts; |
|
191 | - } |
|
173 | + if ( strpos($message, '[default-message') === false && |
|
174 | + strpos($message, '[default_message') === false && |
|
175 | + ! empty( $message ) ) { |
|
176 | + return $message; |
|
177 | + } |
|
178 | + |
|
179 | + if ( empty($message) ) { |
|
180 | + $message = '[default-message]'; |
|
181 | + } |
|
182 | + |
|
183 | + preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER); |
|
184 | + |
|
185 | + foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
186 | + $add_atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] ); |
|
187 | + if ( $add_atts ) { |
|
188 | + $this_atts = array_merge($atts, $add_atts); |
|
189 | + } else { |
|
190 | + $this_atts = $atts; |
|
191 | + } |
|
192 | 192 | |
193 | 193 | $default = FrmEntryFormat::show_entry( $this_atts ); |
194 | 194 | |
195 | - // Add the default message |
|
196 | - $message = str_replace( $shortcodes[0][ $short_key ], $default, $message ); |
|
197 | - } |
|
195 | + // Add the default message |
|
196 | + $message = str_replace( $shortcodes[0][ $short_key ], $default, $message ); |
|
197 | + } |
|
198 | 198 | |
199 | - return $message; |
|
200 | - } |
|
199 | + return $message; |
|
200 | + } |
|
201 | 201 | |
202 | 202 | public static function prepare_display_value( $entry, $field, $atts ) { |
203 | 203 | $field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false; |
204 | 204 | |
205 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
205 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
206 | 206 | FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value ); |
207 | - } |
|
207 | + } |
|
208 | 208 | |
209 | - if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) { |
|
210 | - return self::display_value($field_value, $field, $atts); |
|
211 | - } |
|
209 | + if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) { |
|
210 | + return self::display_value($field_value, $field, $atts); |
|
211 | + } |
|
212 | 212 | |
213 | - // this is an embeded form |
|
214 | - $val = ''; |
|
213 | + // this is an embeded form |
|
214 | + $val = ''; |
|
215 | 215 | |
216 | - if ( strpos($atts['embedded_field_id'], 'form') === 0 ) { |
|
217 | - //this is a repeating section |
|
216 | + if ( strpos($atts['embedded_field_id'], 'form') === 0 ) { |
|
217 | + //this is a repeating section |
|
218 | 218 | $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) ); |
219 | - } else { |
|
220 | - // get all values for this field |
|
221 | - $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false; |
|
219 | + } else { |
|
220 | + // get all values for this field |
|
221 | + $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false; |
|
222 | 222 | |
223 | - if ( $child_values ) { |
|
224 | - $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
|
225 | - } |
|
226 | - } |
|
223 | + if ( $child_values ) { |
|
224 | + $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
|
225 | + } |
|
226 | + } |
|
227 | 227 | |
228 | - $field_value = array(); |
|
228 | + $field_value = array(); |
|
229 | 229 | |
230 | - if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) { |
|
231 | - return $val; |
|
232 | - } |
|
230 | + if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) { |
|
231 | + return $val; |
|
232 | + } |
|
233 | 233 | |
234 | - foreach ( $child_entries as $child_entry ) { |
|
235 | - $atts['item_id'] = $child_entry->id; |
|
236 | - $atts['post_id'] = $child_entry->post_id; |
|
234 | + foreach ( $child_entries as $child_entry ) { |
|
235 | + $atts['item_id'] = $child_entry->id; |
|
236 | + $atts['post_id'] = $child_entry->post_id; |
|
237 | 237 | |
238 | - // get the value for this field -- check for post values as well |
|
239 | - $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field); |
|
238 | + // get the value for this field -- check for post values as well |
|
239 | + $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field); |
|
240 | 240 | |
241 | - if ( $entry_val ) { |
|
242 | - // foreach entry get display_value |
|
243 | - $field_value[] = self::display_value($entry_val, $field, $atts); |
|
244 | - } |
|
241 | + if ( $entry_val ) { |
|
242 | + // foreach entry get display_value |
|
243 | + $field_value[] = self::display_value($entry_val, $field, $atts); |
|
244 | + } |
|
245 | 245 | |
246 | - unset($child_entry); |
|
247 | - } |
|
246 | + unset($child_entry); |
|
247 | + } |
|
248 | 248 | |
249 | - $val = implode(', ', (array) $field_value ); |
|
249 | + $val = implode(', ', (array) $field_value ); |
|
250 | 250 | $val = wp_kses_post( $val ); |
251 | 251 | |
252 | - return $val; |
|
253 | - } |
|
252 | + return $val; |
|
253 | + } |
|
254 | 254 | |
255 | - /** |
|
256 | - * Prepare the saved value for display |
|
257 | - * @return string |
|
258 | - */ |
|
255 | + /** |
|
256 | + * Prepare the saved value for display |
|
257 | + * @return string |
|
258 | + */ |
|
259 | 259 | public static function display_value( $value, $field, $atts = array() ) { |
260 | 260 | |
261 | - $defaults = array( |
|
262 | - 'type' => '', 'html' => false, 'show_filename' => true, |
|
263 | - 'truncate' => false, 'sep' => ', ', 'post_id' => 0, |
|
264 | - 'form_id' => $field->form_id, 'field' => $field, 'keepjs' => 0, |
|
261 | + $defaults = array( |
|
262 | + 'type' => '', 'html' => false, 'show_filename' => true, |
|
263 | + 'truncate' => false, 'sep' => ', ', 'post_id' => 0, |
|
264 | + 'form_id' => $field->form_id, 'field' => $field, 'keepjs' => 0, |
|
265 | 265 | 'return_array' => false, |
266 | - ); |
|
266 | + ); |
|
267 | 267 | |
268 | - $atts = wp_parse_args( $atts, $defaults ); |
|
269 | - $atts = apply_filters('frm_display_value_atts', $atts, $field, $value); |
|
268 | + $atts = wp_parse_args( $atts, $defaults ); |
|
269 | + $atts = apply_filters('frm_display_value_atts', $atts, $field, $value); |
|
270 | 270 | |
271 | - if ( ! isset($field->field_options['post_field']) ) { |
|
272 | - $field->field_options['post_field'] = ''; |
|
273 | - } |
|
271 | + if ( ! isset($field->field_options['post_field']) ) { |
|
272 | + $field->field_options['post_field'] = ''; |
|
273 | + } |
|
274 | 274 | |
275 | - if ( ! isset($field->field_options['custom_field']) ) { |
|
276 | - $field->field_options['custom_field'] = ''; |
|
277 | - } |
|
275 | + if ( ! isset($field->field_options['custom_field']) ) { |
|
276 | + $field->field_options['custom_field'] = ''; |
|
277 | + } |
|
278 | 278 | |
279 | - if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) { |
|
280 | - $atts['pre_truncate'] = $atts['truncate']; |
|
281 | - $atts['truncate'] = true; |
|
282 | - $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0; |
|
279 | + if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) { |
|
280 | + $atts['pre_truncate'] = $atts['truncate']; |
|
281 | + $atts['truncate'] = true; |
|
282 | + $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0; |
|
283 | 283 | |
284 | - $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts); |
|
285 | - $atts['truncate'] = $atts['pre_truncate']; |
|
286 | - } |
|
284 | + $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts); |
|
285 | + $atts['truncate'] = $atts['pre_truncate']; |
|
286 | + } |
|
287 | 287 | |
288 | - if ( $value == '' ) { |
|
289 | - return $value; |
|
290 | - } |
|
288 | + if ( $value == '' ) { |
|
289 | + return $value; |
|
290 | + } |
|
291 | 291 | |
292 | - $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts); |
|
292 | + $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts); |
|
293 | 293 | $value = apply_filters( 'frm_display_' . $field->type . '_value_custom', $value, compact( 'field', 'atts' ) ); |
294 | 294 | |
295 | - $new_value = ''; |
|
295 | + $new_value = ''; |
|
296 | 296 | |
297 | - if ( is_array($value) && $atts['type'] != 'file' ) { |
|
298 | - foreach ( $value as $val ) { |
|
299 | - if ( is_array($val) ) { |
|
297 | + if ( is_array($value) && $atts['type'] != 'file' ) { |
|
298 | + foreach ( $value as $val ) { |
|
299 | + if ( is_array($val) ) { |
|
300 | 300 | //TODO: add options for display (li or ,) |
301 | - $new_value .= implode($atts['sep'], $val); |
|
302 | - if ( $atts['type'] != 'data' ) { |
|
303 | - $new_value .= '<br/>'; |
|
304 | - } |
|
305 | - } |
|
306 | - unset($val); |
|
307 | - } |
|
308 | - } |
|
309 | - |
|
310 | - if ( ! empty($new_value) ) { |
|
311 | - $value = $new_value; |
|
312 | - } else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) { |
|
313 | - $value = implode($atts['sep'], $value); |
|
314 | - } |
|
315 | - |
|
316 | - if ( $atts['truncate'] && $atts['type'] != 'image' ) { |
|
317 | - $value = FrmAppHelper::truncate($value, 50); |
|
318 | - } |
|
301 | + $new_value .= implode($atts['sep'], $val); |
|
302 | + if ( $atts['type'] != 'data' ) { |
|
303 | + $new_value .= '<br/>'; |
|
304 | + } |
|
305 | + } |
|
306 | + unset($val); |
|
307 | + } |
|
308 | + } |
|
309 | + |
|
310 | + if ( ! empty($new_value) ) { |
|
311 | + $value = $new_value; |
|
312 | + } else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) { |
|
313 | + $value = implode($atts['sep'], $value); |
|
314 | + } |
|
315 | + |
|
316 | + if ( $atts['truncate'] && $atts['type'] != 'image' ) { |
|
317 | + $value = FrmAppHelper::truncate($value, 50); |
|
318 | + } |
|
319 | 319 | |
320 | 320 | if ( ! $atts['keepjs'] && ! is_array( $value ) ) { |
321 | 321 | $value = wp_kses_post( $value ); |
322 | 322 | } |
323 | 323 | |
324 | - return apply_filters('frm_display_value', $value, $field, $atts); |
|
325 | - } |
|
324 | + return apply_filters('frm_display_value', $value, $field, $atts); |
|
325 | + } |
|
326 | 326 | |
327 | 327 | public static function set_posted_value( $field, $value, $args ) { |
328 | - // If validating a field with "other" opt, set back to prev value now |
|
329 | - if ( isset( $args['other'] ) && $args['other'] ) { |
|
330 | - $value = $args['temp_value']; |
|
331 | - } |
|
332 | - if ( empty($args['parent_field_id']) ) { |
|
333 | - $_POST['item_meta'][ $field->id ] = $value; |
|
334 | - } else { |
|
335 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; |
|
336 | - } |
|
337 | - } |
|
328 | + // If validating a field with "other" opt, set back to prev value now |
|
329 | + if ( isset( $args['other'] ) && $args['other'] ) { |
|
330 | + $value = $args['temp_value']; |
|
331 | + } |
|
332 | + if ( empty($args['parent_field_id']) ) { |
|
333 | + $_POST['item_meta'][ $field->id ] = $value; |
|
334 | + } else { |
|
335 | + $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; |
|
336 | + } |
|
337 | + } |
|
338 | 338 | |
339 | 339 | public static function get_posted_value( $field, &$value, $args ) { |
340 | 340 | $field_id = is_object( $field ) ? $field->id : $field; |
341 | 341 | |
342 | - if ( empty($args['parent_field_id']) ) { |
|
343 | - $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : ''; |
|
344 | - } else { |
|
345 | - $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : ''; |
|
346 | - } |
|
342 | + if ( empty($args['parent_field_id']) ) { |
|
343 | + $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : ''; |
|
344 | + } else { |
|
345 | + $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : ''; |
|
346 | + } |
|
347 | 347 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
348 | 348 | $value = stripslashes_deep( $value ); |
349 | - } |
|
350 | - |
|
351 | - /** |
|
352 | - * Check if field has an "Other" option and if any other values are posted |
|
353 | - * |
|
354 | - * @since 2.0 |
|
355 | - * |
|
356 | - * @param object $field |
|
357 | - * @param string|array $value |
|
358 | - * @param array $args |
|
359 | - */ |
|
360 | - public static function maybe_set_other_validation( $field, &$value, &$args ) { |
|
361 | - $args['other'] = false; |
|
362 | - if ( ! $value || empty( $value ) || ! FrmAppHelper::pro_is_installed() ) { |
|
363 | - return; |
|
364 | - } |
|
365 | - |
|
366 | - // Get other value for fields in repeating section |
|
367 | - self::set_other_repeating_vals( $field, $value, $args ); |
|
368 | - |
|
369 | - // Check if there are any posted "Other" values |
|
349 | + } |
|
350 | + |
|
351 | + /** |
|
352 | + * Check if field has an "Other" option and if any other values are posted |
|
353 | + * |
|
354 | + * @since 2.0 |
|
355 | + * |
|
356 | + * @param object $field |
|
357 | + * @param string|array $value |
|
358 | + * @param array $args |
|
359 | + */ |
|
360 | + public static function maybe_set_other_validation( $field, &$value, &$args ) { |
|
361 | + $args['other'] = false; |
|
362 | + if ( ! $value || empty( $value ) || ! FrmAppHelper::pro_is_installed() ) { |
|
363 | + return; |
|
364 | + } |
|
365 | + |
|
366 | + // Get other value for fields in repeating section |
|
367 | + self::set_other_repeating_vals( $field, $value, $args ); |
|
368 | + |
|
369 | + // Check if there are any posted "Other" values |
|
370 | 370 | if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { |
371 | 371 | |
372 | - // Save original value |
|
373 | - $args['temp_value'] = $value; |
|
374 | - $args['other'] = true; |
|
375 | - $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] ); |
|
376 | - |
|
377 | - // Set the validation value now |
|
378 | - self::set_other_validation_val( $value, $other_vals, $field, $args ); |
|
379 | - } |
|
380 | - } |
|
381 | - |
|
382 | - /** |
|
383 | - * Sets radio or checkbox value equal to "other" value if it is set - FOR REPEATING SECTIONS |
|
384 | - * |
|
385 | - * @since 2.0 |
|
386 | - * |
|
387 | - * @param object $field |
|
388 | - * @param string|array $value |
|
389 | - * @param array $args |
|
390 | - */ |
|
391 | - public static function set_other_repeating_vals( $field, &$value, &$args ) { |
|
392 | - if ( ! $args['parent_field_id'] ) { |
|
393 | - return; |
|
394 | - } |
|
395 | - |
|
396 | - // Check if there are any other posted "other" values for this field |
|
372 | + // Save original value |
|
373 | + $args['temp_value'] = $value; |
|
374 | + $args['other'] = true; |
|
375 | + $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] ); |
|
376 | + |
|
377 | + // Set the validation value now |
|
378 | + self::set_other_validation_val( $value, $other_vals, $field, $args ); |
|
379 | + } |
|
380 | + } |
|
381 | + |
|
382 | + /** |
|
383 | + * Sets radio or checkbox value equal to "other" value if it is set - FOR REPEATING SECTIONS |
|
384 | + * |
|
385 | + * @since 2.0 |
|
386 | + * |
|
387 | + * @param object $field |
|
388 | + * @param string|array $value |
|
389 | + * @param array $args |
|
390 | + */ |
|
391 | + public static function set_other_repeating_vals( $field, &$value, &$args ) { |
|
392 | + if ( ! $args['parent_field_id'] ) { |
|
393 | + return; |
|
394 | + } |
|
395 | + |
|
396 | + // Check if there are any other posted "other" values for this field |
|
397 | 397 | if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { |
398 | - // Save original value |
|
399 | - $args['temp_value'] = $value; |
|
400 | - $args['other'] = true; |
|
401 | - |
|
402 | - $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ]; |
|
403 | - |
|
404 | - // Set the validation value now |
|
405 | - self::set_other_validation_val( $value, $other_vals, $field, $args ); |
|
406 | - } |
|
407 | - } |
|
408 | - |
|
409 | - /** |
|
410 | - * Modify value used for validation |
|
411 | - * This function essentially removes the "Other" radio or checkbox value from the $value being validated. |
|
412 | - * It also adds any text from the free text fields to the value |
|
413 | - * |
|
414 | - * Needs to accommodate for times when other opt is selected, but no other free text is entered |
|
415 | - * |
|
416 | - * @since 2.0 |
|
417 | - * |
|
418 | - * @param string|array $value |
|
419 | - * @param string|array $other_vals (usually of posted values) |
|
420 | - * @param object $field |
|
421 | - * @param array $args |
|
422 | - */ |
|
423 | - public static function set_other_validation_val( &$value, $other_vals, $field, &$args ) { |
|
424 | - // Checkboxes and multi-select dropdowns |
|
425 | - if ( is_array( $value ) && $field->type == 'checkbox' ) { |
|
426 | - // Combine "Other" values with checked values. "Other" values will override checked box values. |
|
427 | - $value = array_merge( $value, $other_vals ); |
|
428 | - $value = array_filter( $value ); |
|
429 | - if ( count( $value ) == 0 ) { |
|
430 | - $value = ''; |
|
431 | - } |
|
432 | - } else { |
|
398 | + // Save original value |
|
399 | + $args['temp_value'] = $value; |
|
400 | + $args['other'] = true; |
|
401 | + |
|
402 | + $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ]; |
|
403 | + |
|
404 | + // Set the validation value now |
|
405 | + self::set_other_validation_val( $value, $other_vals, $field, $args ); |
|
406 | + } |
|
407 | + } |
|
408 | + |
|
409 | + /** |
|
410 | + * Modify value used for validation |
|
411 | + * This function essentially removes the "Other" radio or checkbox value from the $value being validated. |
|
412 | + * It also adds any text from the free text fields to the value |
|
413 | + * |
|
414 | + * Needs to accommodate for times when other opt is selected, but no other free text is entered |
|
415 | + * |
|
416 | + * @since 2.0 |
|
417 | + * |
|
418 | + * @param string|array $value |
|
419 | + * @param string|array $other_vals (usually of posted values) |
|
420 | + * @param object $field |
|
421 | + * @param array $args |
|
422 | + */ |
|
423 | + public static function set_other_validation_val( &$value, $other_vals, $field, &$args ) { |
|
424 | + // Checkboxes and multi-select dropdowns |
|
425 | + if ( is_array( $value ) && $field->type == 'checkbox' ) { |
|
426 | + // Combine "Other" values with checked values. "Other" values will override checked box values. |
|
427 | + $value = array_merge( $value, $other_vals ); |
|
428 | + $value = array_filter( $value ); |
|
429 | + if ( count( $value ) == 0 ) { |
|
430 | + $value = ''; |
|
431 | + } |
|
432 | + } else { |
|
433 | 433 | // Radio and dropdowns |
434 | - $other_key = array_filter( array_keys($field->options), 'is_string'); |
|
435 | - $other_key = reset( $other_key ); |
|
434 | + $other_key = array_filter( array_keys($field->options), 'is_string'); |
|
435 | + $other_key = reset( $other_key ); |
|
436 | 436 | |
437 | - // Multi-select dropdown |
|
438 | - if ( is_array( $value ) ) { |
|
439 | - $o_key = array_search( $field->options[ $other_key ], $value ); |
|
437 | + // Multi-select dropdown |
|
438 | + if ( is_array( $value ) ) { |
|
439 | + $o_key = array_search( $field->options[ $other_key ], $value ); |
|
440 | 440 | |
441 | 441 | if ( $o_key !== false ) { |
442 | 442 | // Modify the original value so other key will be preserved |
@@ -451,20 +451,20 @@ discard block |
||
451 | 451 | $args['temp_value'] = $value; |
452 | 452 | $value[ $other_key ] = reset( $other_vals ); |
453 | 453 | } |
454 | - } else if ( $field->options[ $other_key ] == $value ) { |
|
455 | - $value = $other_vals; |
|
456 | - } |
|
457 | - } |
|
458 | - } |
|
454 | + } else if ( $field->options[ $other_key ] == $value ) { |
|
455 | + $value = $other_vals; |
|
456 | + } |
|
457 | + } |
|
458 | + } |
|
459 | 459 | |
460 | 460 | public static function enqueue_scripts( $params ) { |
461 | 461 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmFormsController::enqueue_scripts' ); |
462 | 462 | FrmFormsController::enqueue_scripts( $params ); |
463 | 463 | } |
464 | 464 | |
465 | - // Add submitted values to a string for spam checking |
|
465 | + // Add submitted values to a string for spam checking |
|
466 | 466 | public static function entry_array_to_string( $values ) { |
467 | - $content = ''; |
|
467 | + $content = ''; |
|
468 | 468 | foreach ( $values['item_meta'] as $val ) { |
469 | 469 | if ( $content != '' ) { |
470 | 470 | $content .= "\n\n"; |
@@ -472,14 +472,14 @@ discard block |
||
472 | 472 | |
473 | 473 | if ( is_array($val) ) { |
474 | 474 | $val = FrmAppHelper::array_flatten( $val ); |
475 | - $val = implode(',', $val); |
|
475 | + $val = implode(',', $val); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | $content .= $val; |
479 | 479 | } |
480 | 480 | |
481 | 481 | return $content; |
482 | - } |
|
482 | + } |
|
483 | 483 | |
484 | 484 | public static function fill_entry_values( $atts, $f, array &$values ) { |
485 | 485 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmEntryFormat::fill_entry_values' ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined('ABSPATH') ) { |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | 3 | die( 'You are not allowed to call this page directly.' ); |
4 | 4 | } |
5 | 5 | |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) { |
9 | 9 | $values = array(); |
10 | 10 | foreach ( array( 'name' => '', 'description' => '', 'item_key' => '' ) as $var => $default ) { |
11 | - $values[ $var ] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' ); |
|
11 | + $values[$var] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' ); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | $values['fields'] = array(); |
15 | - if ( empty($fields) ) { |
|
16 | - return apply_filters('frm_setup_new_entry', $values); |
|
15 | + if ( empty( $fields ) ) { |
|
16 | + return apply_filters( 'frm_setup_new_entry', $values ); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | foreach ( (array) $fields as $field ) { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | 'default_value' => $field->default_value, |
26 | 26 | 'name' => $field->name, |
27 | 27 | 'description' => $field->description, |
28 | - 'type' => apply_filters('frm_field_type', $field->type, $field, $new_value), |
|
28 | + 'type' => apply_filters( 'frm_field_type', $field->type, $field, $new_value ), |
|
29 | 29 | 'options' => $field->options, |
30 | 30 | 'required' => $field->required, |
31 | 31 | 'field_key' => $field->field_key, |
@@ -36,43 +36,43 @@ discard block |
||
36 | 36 | 'in_embed_form' => isset( $args['in_embed_form'] ) ? $args['in_embed_form'] : '0', |
37 | 37 | ); |
38 | 38 | |
39 | - $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true); |
|
39 | + $opt_defaults = FrmFieldsHelper::get_default_field_opts( $field_array['type'], $field, true ); |
|
40 | 40 | $opt_defaults['required_indicator'] = ''; |
41 | 41 | $opt_defaults['original_type'] = $field->type; |
42 | 42 | |
43 | 43 | foreach ( $opt_defaults as $opt => $default_opt ) { |
44 | - $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt; |
|
45 | - unset($opt, $default_opt); |
|
44 | + $field_array[$opt] = ( isset( $field->field_options[$opt] ) && $field->field_options[$opt] != '' ) ? $field->field_options[$opt] : $default_opt; |
|
45 | + unset( $opt, $default_opt ); |
|
46 | 46 | } |
47 | 47 | |
48 | - unset($opt_defaults); |
|
48 | + unset( $opt_defaults ); |
|
49 | 49 | |
50 | 50 | if ( $field_array['custom_html'] == '' ) { |
51 | - $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type); |
|
51 | + $field_array['custom_html'] = FrmFieldsHelper::get_default_html( $field->type ); |
|
52 | 52 | } |
53 | 53 | |
54 | - $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field, $args ); |
|
54 | + $field_array = apply_filters( 'frm_setup_new_fields_vars', $field_array, $field, $args ); |
|
55 | 55 | $field_array = array_merge( $field->field_options, $field_array ); |
56 | 56 | |
57 | 57 | $values['fields'][] = $field_array; |
58 | 58 | |
59 | - if ( ! $form || ! isset($form->id) ) { |
|
60 | - $form = FrmForm::getOne($field->form_id); |
|
59 | + if ( ! $form || ! isset( $form->id ) ) { |
|
60 | + $form = FrmForm::getOne( $field->form_id ); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | - $form->options = maybe_unserialize($form->options); |
|
65 | - if ( is_array($form->options) ) { |
|
64 | + $form->options = maybe_unserialize( $form->options ); |
|
65 | + if ( is_array( $form->options ) ) { |
|
66 | 66 | foreach ( $form->options as $opt => $value ) { |
67 | - $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value ); |
|
68 | - unset($opt, $value); |
|
67 | + $values[$opt] = FrmAppHelper::get_post_param( $opt, $value ); |
|
68 | + unset( $opt, $value ); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | 72 | $form_defaults = FrmFormsHelper::get_default_opts(); |
73 | 73 | |
74 | 74 | $frm_settings = FrmAppHelper::get_settings(); |
75 | - $form_defaults['custom_style'] = ( $frm_settings->load_style != 'none' ); |
|
75 | + $form_defaults['custom_style'] = ( $frm_settings->load_style != 'none' ); |
|
76 | 76 | |
77 | 77 | $values = array_merge( $form_defaults, $values ); |
78 | 78 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $return_array = FrmField::is_field_with_multiple_values( $field ); |
96 | 96 | |
97 | 97 | // Do any shortcodes in default value and allow customization of default value |
98 | - $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true, $return_array); |
|
98 | + $field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true, $return_array ); |
|
99 | 99 | // Calls FrmProFieldsHelper::get_default_value |
100 | 100 | |
101 | 101 | $new_value = $field->default_value; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | if ( ! is_array( $new_value ) ) { |
111 | - $new_value = str_replace('"', '"', $new_value); |
|
111 | + $new_value = str_replace( '"', '"', $new_value ); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return $new_value; |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | if ( $_POST ) { |
128 | 128 | $repeating = isset( $args['repeating'] ) && $args['repeating']; |
129 | 129 | if ( $repeating ) { |
130 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { |
|
130 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) { |
|
131 | 131 | $value_is_posted = true; |
132 | 132 | } |
133 | - } else if ( isset( $_POST['item_meta'][ $field->id ] ) ) { |
|
133 | + } else if ( isset( $_POST['item_meta'][$field->id] ) ) { |
|
134 | 134 | $value_is_posted = true; |
135 | 135 | } |
136 | 136 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' ); |
142 | 142 | $values['form_id'] = $record->form_id; |
143 | 143 | $values['is_draft'] = $record->is_draft; |
144 | - return apply_filters('frm_setup_edit_entry_vars', $values, $record); |
|
144 | + return apply_filters( 'frm_setup_edit_entry_vars', $values, $record ); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | public static function get_admin_params( $form = null ) { |
@@ -170,22 +170,22 @@ discard block |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | public static function replace_default_message( $message, $atts ) { |
173 | - if ( strpos($message, '[default-message') === false && |
|
174 | - strpos($message, '[default_message') === false && |
|
173 | + if ( strpos( $message, '[default-message' ) === false && |
|
174 | + strpos( $message, '[default_message' ) === false && |
|
175 | 175 | ! empty( $message ) ) { |
176 | 176 | return $message; |
177 | 177 | } |
178 | 178 | |
179 | - if ( empty($message) ) { |
|
179 | + if ( empty( $message ) ) { |
|
180 | 180 | $message = '[default-message]'; |
181 | 181 | } |
182 | 182 | |
183 | - preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER); |
|
183 | + preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER ); |
|
184 | 184 | |
185 | 185 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
186 | - $add_atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] ); |
|
186 | + $add_atts = shortcode_parse_atts( $shortcodes[2][$short_key] ); |
|
187 | 187 | if ( $add_atts ) { |
188 | - $this_atts = array_merge($atts, $add_atts); |
|
188 | + $this_atts = array_merge( $atts, $add_atts ); |
|
189 | 189 | } else { |
190 | 190 | $this_atts = $atts; |
191 | 191 | } |
@@ -193,32 +193,32 @@ discard block |
||
193 | 193 | $default = FrmEntryFormat::show_entry( $this_atts ); |
194 | 194 | |
195 | 195 | // Add the default message |
196 | - $message = str_replace( $shortcodes[0][ $short_key ], $default, $message ); |
|
196 | + $message = str_replace( $shortcodes[0][$short_key], $default, $message ); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | return $message; |
200 | 200 | } |
201 | 201 | |
202 | 202 | public static function prepare_display_value( $entry, $field, $atts ) { |
203 | - $field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false; |
|
203 | + $field_value = isset( $entry->metas[$field->id] ) ? $entry->metas[$field->id] : false; |
|
204 | 204 | |
205 | 205 | if ( FrmAppHelper::pro_is_installed() ) { |
206 | 206 | FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value ); |
207 | 207 | } |
208 | 208 | |
209 | - if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) { |
|
210 | - return self::display_value($field_value, $field, $atts); |
|
209 | + if ( $field->form_id == $entry->form_id || empty( $atts['embedded_field_id'] ) ) { |
|
210 | + return self::display_value( $field_value, $field, $atts ); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | // this is an embeded form |
214 | 214 | $val = ''; |
215 | 215 | |
216 | - if ( strpos($atts['embedded_field_id'], 'form') === 0 ) { |
|
216 | + if ( strpos( $atts['embedded_field_id'], 'form' ) === 0 ) { |
|
217 | 217 | //this is a repeating section |
218 | 218 | $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) ); |
219 | 219 | } else { |
220 | 220 | // get all values for this field |
221 | - $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false; |
|
221 | + $child_values = isset( $entry->metas[$atts['embedded_field_id']] ) ? $entry->metas[$atts['embedded_field_id']] : false; |
|
222 | 222 | |
223 | 223 | if ( $child_values ) { |
224 | 224 | $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | $field_value = array(); |
229 | 229 | |
230 | - if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) { |
|
230 | + if ( ! isset( $child_entries ) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) { |
|
231 | 231 | return $val; |
232 | 232 | } |
233 | 233 | |
@@ -236,17 +236,17 @@ discard block |
||
236 | 236 | $atts['post_id'] = $child_entry->post_id; |
237 | 237 | |
238 | 238 | // get the value for this field -- check for post values as well |
239 | - $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field); |
|
239 | + $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value( $child_entry, $field ); |
|
240 | 240 | |
241 | 241 | if ( $entry_val ) { |
242 | 242 | // foreach entry get display_value |
243 | - $field_value[] = self::display_value($entry_val, $field, $atts); |
|
243 | + $field_value[] = self::display_value( $entry_val, $field, $atts ); |
|
244 | 244 | } |
245 | 245 | |
246 | - unset($child_entry); |
|
246 | + unset( $child_entry ); |
|
247 | 247 | } |
248 | 248 | |
249 | - $val = implode(', ', (array) $field_value ); |
|
249 | + $val = implode( ', ', (array) $field_value ); |
|
250 | 250 | $val = wp_kses_post( $val ); |
251 | 251 | |
252 | 252 | return $val; |
@@ -266,22 +266,22 @@ discard block |
||
266 | 266 | ); |
267 | 267 | |
268 | 268 | $atts = wp_parse_args( $atts, $defaults ); |
269 | - $atts = apply_filters('frm_display_value_atts', $atts, $field, $value); |
|
269 | + $atts = apply_filters( 'frm_display_value_atts', $atts, $field, $value ); |
|
270 | 270 | |
271 | - if ( ! isset($field->field_options['post_field']) ) { |
|
271 | + if ( ! isset( $field->field_options['post_field'] ) ) { |
|
272 | 272 | $field->field_options['post_field'] = ''; |
273 | 273 | } |
274 | 274 | |
275 | - if ( ! isset($field->field_options['custom_field']) ) { |
|
275 | + if ( ! isset( $field->field_options['custom_field'] ) ) { |
|
276 | 276 | $field->field_options['custom_field'] = ''; |
277 | 277 | } |
278 | 278 | |
279 | 279 | if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) { |
280 | 280 | $atts['pre_truncate'] = $atts['truncate']; |
281 | 281 | $atts['truncate'] = true; |
282 | - $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0; |
|
282 | + $atts['exclude_cat'] = isset( $field->field_options['exclude_cat'] ) ? $field->field_options['exclude_cat'] : 0; |
|
283 | 283 | |
284 | - $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts); |
|
284 | + $value = FrmProEntryMetaHelper::get_post_value( $atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts ); |
|
285 | 285 | $atts['truncate'] = $atts['pre_truncate']; |
286 | 286 | } |
287 | 287 | |
@@ -289,39 +289,39 @@ discard block |
||
289 | 289 | return $value; |
290 | 290 | } |
291 | 291 | |
292 | - $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts); |
|
292 | + $value = apply_filters( 'frm_display_value_custom', maybe_unserialize( $value ), $field, $atts ); |
|
293 | 293 | $value = apply_filters( 'frm_display_' . $field->type . '_value_custom', $value, compact( 'field', 'atts' ) ); |
294 | 294 | |
295 | 295 | $new_value = ''; |
296 | 296 | |
297 | - if ( is_array($value) && $atts['type'] != 'file' ) { |
|
297 | + if ( is_array( $value ) && $atts['type'] != 'file' ) { |
|
298 | 298 | foreach ( $value as $val ) { |
299 | - if ( is_array($val) ) { |
|
299 | + if ( is_array( $val ) ) { |
|
300 | 300 | //TODO: add options for display (li or ,) |
301 | - $new_value .= implode($atts['sep'], $val); |
|
301 | + $new_value .= implode( $atts['sep'], $val ); |
|
302 | 302 | if ( $atts['type'] != 'data' ) { |
303 | 303 | $new_value .= '<br/>'; |
304 | 304 | } |
305 | 305 | } |
306 | - unset($val); |
|
306 | + unset( $val ); |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
310 | - if ( ! empty($new_value) ) { |
|
310 | + if ( ! empty( $new_value ) ) { |
|
311 | 311 | $value = $new_value; |
312 | - } else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) { |
|
313 | - $value = implode($atts['sep'], $value); |
|
312 | + } else if ( is_array( $value ) && $atts['type'] != 'file' && ! $atts['return_array'] ) { |
|
313 | + $value = implode( $atts['sep'], $value ); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | if ( $atts['truncate'] && $atts['type'] != 'image' ) { |
317 | - $value = FrmAppHelper::truncate($value, 50); |
|
317 | + $value = FrmAppHelper::truncate( $value, 50 ); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | if ( ! $atts['keepjs'] && ! is_array( $value ) ) { |
321 | 321 | $value = wp_kses_post( $value ); |
322 | 322 | } |
323 | 323 | |
324 | - return apply_filters('frm_display_value', $value, $field, $atts); |
|
324 | + return apply_filters( 'frm_display_value', $value, $field, $atts ); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | public static function set_posted_value( $field, $value, $args ) { |
@@ -329,20 +329,20 @@ discard block |
||
329 | 329 | if ( isset( $args['other'] ) && $args['other'] ) { |
330 | 330 | $value = $args['temp_value']; |
331 | 331 | } |
332 | - if ( empty($args['parent_field_id']) ) { |
|
333 | - $_POST['item_meta'][ $field->id ] = $value; |
|
332 | + if ( empty( $args['parent_field_id'] ) ) { |
|
333 | + $_POST['item_meta'][$field->id] = $value; |
|
334 | 334 | } else { |
335 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; |
|
335 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value; |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
339 | 339 | public static function get_posted_value( $field, &$value, $args ) { |
340 | 340 | $field_id = is_object( $field ) ? $field->id : $field; |
341 | 341 | |
342 | - if ( empty($args['parent_field_id']) ) { |
|
343 | - $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : ''; |
|
342 | + if ( empty( $args['parent_field_id'] ) ) { |
|
343 | + $value = isset( $_POST['item_meta'][$field_id] ) ? $_POST['item_meta'][$field_id] : ''; |
|
344 | 344 | } else { |
345 | - $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : ''; |
|
345 | + $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] : ''; |
|
346 | 346 | } |
347 | 347 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
348 | 348 | $value = stripslashes_deep( $value ); |
@@ -367,12 +367,12 @@ discard block |
||
367 | 367 | self::set_other_repeating_vals( $field, $value, $args ); |
368 | 368 | |
369 | 369 | // Check if there are any posted "Other" values |
370 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { |
|
370 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) { |
|
371 | 371 | |
372 | 372 | // Save original value |
373 | 373 | $args['temp_value'] = $value; |
374 | 374 | $args['other'] = true; |
375 | - $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] ); |
|
375 | + $other_vals = stripslashes_deep( $_POST['item_meta']['other'][$field->id] ); |
|
376 | 376 | |
377 | 377 | // Set the validation value now |
378 | 378 | self::set_other_validation_val( $value, $other_vals, $field, $args ); |
@@ -394,12 +394,12 @@ discard block |
||
394 | 394 | } |
395 | 395 | |
396 | 396 | // Check if there are any other posted "other" values for this field |
397 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { |
|
397 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) { |
|
398 | 398 | // Save original value |
399 | 399 | $args['temp_value'] = $value; |
400 | 400 | $args['other'] = true; |
401 | 401 | |
402 | - $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ]; |
|
402 | + $other_vals = $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id]; |
|
403 | 403 | |
404 | 404 | // Set the validation value now |
405 | 405 | self::set_other_validation_val( $value, $other_vals, $field, $args ); |
@@ -431,27 +431,27 @@ discard block |
||
431 | 431 | } |
432 | 432 | } else { |
433 | 433 | // Radio and dropdowns |
434 | - $other_key = array_filter( array_keys($field->options), 'is_string'); |
|
434 | + $other_key = array_filter( array_keys( $field->options ), 'is_string' ); |
|
435 | 435 | $other_key = reset( $other_key ); |
436 | 436 | |
437 | 437 | // Multi-select dropdown |
438 | 438 | if ( is_array( $value ) ) { |
439 | - $o_key = array_search( $field->options[ $other_key ], $value ); |
|
439 | + $o_key = array_search( $field->options[$other_key], $value ); |
|
440 | 440 | |
441 | 441 | if ( $o_key !== false ) { |
442 | 442 | // Modify the original value so other key will be preserved |
443 | - $value[ $other_key ] = $value[ $o_key ]; |
|
443 | + $value[$other_key] = $value[$o_key]; |
|
444 | 444 | |
445 | 445 | // By default, the array keys will be numeric for multi-select dropdowns |
446 | 446 | // If going backwards and forwards between pages, the array key will match the other key |
447 | 447 | if ( $o_key != $other_key ) { |
448 | - unset( $value[ $o_key ] ); |
|
448 | + unset( $value[$o_key] ); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | $args['temp_value'] = $value; |
452 | - $value[ $other_key ] = reset( $other_vals ); |
|
452 | + $value[$other_key] = reset( $other_vals ); |
|
453 | 453 | } |
454 | - } else if ( $field->options[ $other_key ] == $value ) { |
|
454 | + } else if ( $field->options[$other_key] == $value ) { |
|
455 | 455 | $value = $other_vals; |
456 | 456 | } |
457 | 457 | } |
@@ -470,9 +470,9 @@ discard block |
||
470 | 470 | $content .= "\n\n"; |
471 | 471 | } |
472 | 472 | |
473 | - if ( is_array($val) ) { |
|
473 | + if ( is_array( $val ) ) { |
|
474 | 474 | $val = FrmAppHelper::array_flatten( $val ); |
475 | - $val = implode(',', $val); |
|
475 | + $val = implode( ',', $val ); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | $content .= $val; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | public $id = 0; // the id of the post |
5 | 5 | |
6 | 6 | /** |
7 | - * @param int|string $id The id of the stylsheet or 'default' |
|
7 | + * @param integer $id The id of the stylsheet or 'default' |
|
8 | 8 | */ |
9 | 9 | public function __construct( $id = 0 ) { |
10 | 10 | $this->id = $id; |
@@ -120,6 +120,9 @@ discard block |
||
120 | 120 | set_transient('frmpro_css', $css); |
121 | 121 | } |
122 | 122 | |
123 | + /** |
|
124 | + * @param string $filename |
|
125 | + */ |
|
123 | 126 | private function get_css_content( $filename ) { |
124 | 127 | $css = '/* ' . __( 'WARNING: Any changes made to this file will be lost when your Formidable settings are updated', 'formidable' ) . ' */' . "\n"; |
125 | 128 |
@@ -1,52 +1,52 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | class FrmStyle { |
3 | - public $number = false; // Unique ID number of the current instance. |
|
3 | + public $number = false; // Unique ID number of the current instance. |
|
4 | 4 | public $id = 0; // the id of the post |
5 | 5 | |
6 | 6 | /** |
7 | 7 | * @param int|string $id The id of the stylsheet or 'default' |
8 | 8 | */ |
9 | 9 | public function __construct( $id = 0 ) { |
10 | - $this->id = $id; |
|
11 | - } |
|
10 | + $this->id = $id; |
|
11 | + } |
|
12 | 12 | |
13 | - public function get_new() { |
|
13 | + public function get_new() { |
|
14 | 14 | $this->id = 0; |
15 | 15 | |
16 | - $max_slug_value = pow(36, 6); |
|
17 | - $min_slug_value = 37; // we want to have at least 2 characters in the slug |
|
18 | - $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 ); |
|
19 | - |
|
20 | - $style = array( |
|
21 | - 'post_type' => FrmStylesController::$post_type, |
|
22 | - 'ID' => '', |
|
23 | - 'post_title' => __( 'New Style', 'formidable' ), |
|
24 | - 'post_name' => $key, |
|
25 | - 'post_content' => $this->get_defaults(), |
|
26 | - 'menu_order' => '', |
|
27 | - 'post_status' => 'publish', |
|
28 | - ); |
|
16 | + $max_slug_value = pow(36, 6); |
|
17 | + $min_slug_value = 37; // we want to have at least 2 characters in the slug |
|
18 | + $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 ); |
|
19 | + |
|
20 | + $style = array( |
|
21 | + 'post_type' => FrmStylesController::$post_type, |
|
22 | + 'ID' => '', |
|
23 | + 'post_title' => __( 'New Style', 'formidable' ), |
|
24 | + 'post_name' => $key, |
|
25 | + 'post_content' => $this->get_defaults(), |
|
26 | + 'menu_order' => '', |
|
27 | + 'post_status' => 'publish', |
|
28 | + ); |
|
29 | 29 | |
30 | - return (object) $style; |
|
31 | - } |
|
30 | + return (object) $style; |
|
31 | + } |
|
32 | 32 | |
33 | 33 | public function save( $settings ) { |
34 | 34 | return FrmAppHelper::save_settings( $settings, 'frm_styles' ); |
35 | - } |
|
35 | + } |
|
36 | 36 | |
37 | 37 | public function duplicate( $id ) { |
38 | - // duplicating is a pro feature |
|
39 | - } |
|
38 | + // duplicating is a pro feature |
|
39 | + } |
|
40 | 40 | |
41 | - public function update( $id = 'default' ) { |
|
41 | + public function update( $id = 'default' ) { |
|
42 | 42 | $all_instances = $this->get_all(); |
43 | 43 | |
44 | 44 | if ( empty($id) ) { |
45 | - $new_style = (array) $this->get_new(); |
|
46 | - $all_instances[] = $new_style; |
|
45 | + $new_style = (array) $this->get_new(); |
|
46 | + $all_instances[] = $new_style; |
|
47 | 47 | } |
48 | 48 | |
49 | - $action_ids = array(); |
|
49 | + $action_ids = array(); |
|
50 | 50 | |
51 | 51 | foreach ( $all_instances as $number => $new_instance ) { |
52 | 52 | $new_instance = stripslashes_deep( (array) $new_instance); |
@@ -54,46 +54,46 @@ discard block |
||
54 | 54 | if ( $id != $this->id || ! $_POST || ! isset($_POST['frm_style_setting']) ) { |
55 | 55 | $all_instances[ $number ] = $new_instance; |
56 | 56 | |
57 | - if ( $new_instance['menu_order'] && $_POST && empty($_POST['prev_menu_order']) && isset($_POST['frm_style_setting']['menu_order']) ) { |
|
58 | - // this style was set to default, so remove default setting on previous default style |
|
59 | - $new_instance['menu_order'] = 0; |
|
60 | - $action_ids[] = $this->save($new_instance); |
|
61 | - } |
|
57 | + if ( $new_instance['menu_order'] && $_POST && empty($_POST['prev_menu_order']) && isset($_POST['frm_style_setting']['menu_order']) ) { |
|
58 | + // this style was set to default, so remove default setting on previous default style |
|
59 | + $new_instance['menu_order'] = 0; |
|
60 | + $action_ids[] = $this->save($new_instance); |
|
61 | + } |
|
62 | 62 | |
63 | - // don't continue if not saving this style |
|
64 | - continue; |
|
63 | + // don't continue if not saving this style |
|
64 | + continue; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $new_instance['post_title'] = sanitize_text_field( $_POST['frm_style_setting']['post_title'] ); |
68 | 68 | $new_instance['post_content'] = $_POST['frm_style_setting']['post_content']; |
69 | 69 | $new_instance['post_type'] = FrmStylesController::$post_type; |
70 | - $new_instance['post_status'] = 'publish'; |
|
70 | + $new_instance['post_status'] = 'publish'; |
|
71 | 71 | $new_instance['menu_order'] = isset( $_POST['frm_style_setting']['menu_order'] ) ? absint( $_POST['frm_style_setting']['menu_order'] ) : 0; |
72 | 72 | |
73 | - if ( empty($id) ) { |
|
74 | - $new_instance['post_name'] = $new_instance['post_title']; |
|
75 | - } |
|
73 | + if ( empty($id) ) { |
|
74 | + $new_instance['post_name'] = $new_instance['post_title']; |
|
75 | + } |
|
76 | 76 | |
77 | - $default_settings = $this->get_defaults(); |
|
77 | + $default_settings = $this->get_defaults(); |
|
78 | 78 | |
79 | - foreach ( $default_settings as $setting => $default ) { |
|
79 | + foreach ( $default_settings as $setting => $default ) { |
|
80 | 80 | if ( ! isset( $new_instance['post_content'][ $setting ] ) ) { |
81 | 81 | $new_instance['post_content'][ $setting ] = $default; |
82 | 82 | } |
83 | 83 | |
84 | 84 | if ( strpos( $setting, 'color' ) !== false || in_array( $setting, array( 'error_bg', 'error_border', 'error_text' ) ) ) { |
85 | - //if is a color |
|
85 | + //if is a color |
|
86 | 86 | $new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] ); |
87 | 87 | } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) { |
88 | 88 | $new_instance['post_content'][ $setting ] = 0; |
89 | - } else if ( $setting == 'font' ) { |
|
90 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
91 | - } |
|
92 | - } |
|
89 | + } else if ( $setting == 'font' ) { |
|
90 | + $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
91 | + } |
|
92 | + } |
|
93 | 93 | |
94 | 94 | $all_instances[ $number ] = $new_instance; |
95 | 95 | |
96 | - $action_ids[] = $this->save($new_instance); |
|
96 | + $action_ids[] = $this->save($new_instance); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | return $action_ids; |
103 | 103 | } |
104 | 104 | |
105 | - /** |
|
106 | - * Create static css file |
|
107 | - */ |
|
105 | + /** |
|
106 | + * Create static css file |
|
107 | + */ |
|
108 | 108 | public function save_settings() { |
109 | 109 | $filename = FrmAppHelper::plugin_path() . '/css/custom_theme.css.php'; |
110 | 110 | update_option( 'frm_last_style_update', date('njGi') ); |
111 | 111 | |
112 | - if ( ! is_file($filename) ) { |
|
113 | - return; |
|
114 | - } |
|
112 | + if ( ! is_file($filename) ) { |
|
113 | + return; |
|
114 | + } |
|
115 | 115 | |
116 | 116 | $this->clear_cache(); |
117 | 117 | |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | $create_file = new FrmCreateFile( array( 'folder_name' => 'formidable/css', 'file_name' => 'formidablepro.css' ) ); |
121 | 121 | $create_file->create_file( $css ); |
122 | 122 | |
123 | - update_option('frmpro_css', $css); |
|
123 | + update_option('frmpro_css', $css); |
|
124 | 124 | |
125 | - set_transient('frmpro_css', $css); |
|
125 | + set_transient('frmpro_css', $css); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | private function get_css_content( $filename ) { |
@@ -131,10 +131,10 @@ discard block |
||
131 | 131 | $saving = true; |
132 | 132 | $frm_style = $this; |
133 | 133 | |
134 | - ob_start(); |
|
135 | - include( $filename ); |
|
134 | + ob_start(); |
|
135 | + include( $filename ); |
|
136 | 136 | $css .= preg_replace( '/\/\*(.|\s)*?\*\//', '', str_replace( array( "\r\n", "\r", "\n", "\t", ' ' ), '', ob_get_contents() ) ); |
137 | - ob_end_clean(); |
|
137 | + ob_end_clean(); |
|
138 | 138 | |
139 | 139 | return $css; |
140 | 140 | } |
@@ -154,276 +154,276 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | public function destroy( $id ) { |
157 | - return wp_delete_post($id); |
|
158 | - } |
|
157 | + return wp_delete_post($id); |
|
158 | + } |
|
159 | 159 | |
160 | - public function get_one() { |
|
161 | - if ( 'default' == $this->id ) { |
|
162 | - $style = $this->get_default_style(); |
|
163 | - if ( $style ) { |
|
164 | - $this->id = $style->ID; |
|
165 | - } else { |
|
166 | - $this->id = 0; |
|
167 | - } |
|
168 | - return $style; |
|
169 | - } |
|
160 | + public function get_one() { |
|
161 | + if ( 'default' == $this->id ) { |
|
162 | + $style = $this->get_default_style(); |
|
163 | + if ( $style ) { |
|
164 | + $this->id = $style->ID; |
|
165 | + } else { |
|
166 | + $this->id = 0; |
|
167 | + } |
|
168 | + return $style; |
|
169 | + } |
|
170 | 170 | |
171 | - $style = get_post($this->id); |
|
171 | + $style = get_post($this->id); |
|
172 | 172 | |
173 | - if ( ! $style ) { |
|
174 | - return $style; |
|
175 | - } |
|
173 | + if ( ! $style ) { |
|
174 | + return $style; |
|
175 | + } |
|
176 | 176 | |
177 | - $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
177 | + $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
178 | 178 | |
179 | - $default_values = $this->get_defaults(); |
|
179 | + $default_values = $this->get_defaults(); |
|
180 | 180 | |
181 | - // fill default values |
|
182 | - $style->post_content = $this->override_defaults($style->post_content); |
|
183 | - $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
181 | + // fill default values |
|
182 | + $style->post_content = $this->override_defaults($style->post_content); |
|
183 | + $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
184 | 184 | |
185 | - return $style; |
|
186 | - } |
|
185 | + return $style; |
|
186 | + } |
|
187 | 187 | |
188 | - public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) { |
|
189 | - $post_atts = array( |
|
188 | + public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) { |
|
189 | + $post_atts = array( |
|
190 | 190 | 'post_type' => FrmStylesController::$post_type, |
191 | 191 | 'post_status' => 'publish', |
192 | 192 | 'numberposts' => $limit, |
193 | 193 | 'orderby' => $orderby, |
194 | 194 | 'order' => $order, |
195 | - ); |
|
195 | + ); |
|
196 | 196 | |
197 | - $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts'); |
|
197 | + $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts'); |
|
198 | 198 | |
199 | - if ( empty($temp_styles) ) { |
|
200 | - global $wpdb; |
|
201 | - // make sure there wasn't a conflict with the query |
|
199 | + if ( empty($temp_styles) ) { |
|
200 | + global $wpdb; |
|
201 | + // make sure there wasn't a conflict with the query |
|
202 | 202 | $query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->posts . ' WHERE post_type=%s AND post_status=%s ORDER BY post_title ASC LIMIT 99', FrmStylesController::$post_type, 'publish' ); |
203 | - $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results'); |
|
204 | - |
|
205 | - if ( empty($temp_styles) ) { |
|
206 | - // create a new style if there are none |
|
207 | - $new = $this->get_new(); |
|
208 | - $new->post_title = $new->post_name = __( 'Formidable Style', 'formidable' ); |
|
209 | - $new->menu_order = 1; |
|
210 | - $new = $this->save( (array) $new); |
|
211 | - $this->update('default'); |
|
212 | - |
|
213 | - $post_atts['include'] = $new; |
|
214 | - |
|
215 | - $temp_styles = get_posts( $post_atts ); |
|
216 | - } |
|
217 | - } |
|
218 | - |
|
219 | - $default_values = $this->get_defaults(); |
|
220 | - $default_style = false; |
|
221 | - |
|
222 | - $styles = array(); |
|
223 | - foreach ( $temp_styles as $style ) { |
|
224 | - $this->id = $style->ID; |
|
225 | - if ( $style->menu_order ) { |
|
226 | - if ( $default_style ) { |
|
227 | - // only return one default |
|
228 | - $style->menu_order = 0; |
|
229 | - } else { |
|
230 | - // check for a default style |
|
231 | - $default_style = $style->ID; |
|
232 | - } |
|
233 | - } |
|
234 | - |
|
235 | - $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
236 | - |
|
237 | - // fill default values |
|
238 | - $style->post_content = $this->override_defaults($style->post_content); |
|
239 | - $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
203 | + $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results'); |
|
204 | + |
|
205 | + if ( empty($temp_styles) ) { |
|
206 | + // create a new style if there are none |
|
207 | + $new = $this->get_new(); |
|
208 | + $new->post_title = $new->post_name = __( 'Formidable Style', 'formidable' ); |
|
209 | + $new->menu_order = 1; |
|
210 | + $new = $this->save( (array) $new); |
|
211 | + $this->update('default'); |
|
212 | + |
|
213 | + $post_atts['include'] = $new; |
|
214 | + |
|
215 | + $temp_styles = get_posts( $post_atts ); |
|
216 | + } |
|
217 | + } |
|
218 | + |
|
219 | + $default_values = $this->get_defaults(); |
|
220 | + $default_style = false; |
|
221 | + |
|
222 | + $styles = array(); |
|
223 | + foreach ( $temp_styles as $style ) { |
|
224 | + $this->id = $style->ID; |
|
225 | + if ( $style->menu_order ) { |
|
226 | + if ( $default_style ) { |
|
227 | + // only return one default |
|
228 | + $style->menu_order = 0; |
|
229 | + } else { |
|
230 | + // check for a default style |
|
231 | + $default_style = $style->ID; |
|
232 | + } |
|
233 | + } |
|
234 | + |
|
235 | + $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
236 | + |
|
237 | + // fill default values |
|
238 | + $style->post_content = $this->override_defaults($style->post_content); |
|
239 | + $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
240 | 240 | |
241 | 241 | $styles[ $style->ID ] = $style; |
242 | - } |
|
242 | + } |
|
243 | 243 | |
244 | - if ( ! $default_style ) { |
|
245 | - $default_style = reset($styles); |
|
244 | + if ( ! $default_style ) { |
|
245 | + $default_style = reset($styles); |
|
246 | 246 | $styles[ $default_style->ID ]->menu_order = 1; |
247 | - } |
|
247 | + } |
|
248 | 248 | |
249 | - return $styles; |
|
250 | - } |
|
249 | + return $styles; |
|
250 | + } |
|
251 | 251 | |
252 | 252 | public function get_default_style( $styles = null ) { |
253 | - if ( ! isset($styles) ) { |
|
253 | + if ( ! isset($styles) ) { |
|
254 | 254 | $styles = $this->get_all( 'menu_order', 'DESC', 1 ); |
255 | - } |
|
255 | + } |
|
256 | 256 | |
257 | - foreach ( $styles as $style ) { |
|
258 | - if ( $style->menu_order ) { |
|
259 | - return $style; |
|
260 | - } |
|
261 | - } |
|
262 | - } |
|
257 | + foreach ( $styles as $style ) { |
|
258 | + if ( $style->menu_order ) { |
|
259 | + return $style; |
|
260 | + } |
|
261 | + } |
|
262 | + } |
|
263 | 263 | |
264 | 264 | public function override_defaults( $settings ) { |
265 | - if ( ! is_array($settings) ) { |
|
266 | - return $settings; |
|
267 | - } |
|
268 | - |
|
269 | - $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height']; |
|
270 | - |
|
271 | - if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) { |
|
272 | - $settings['form_desc_size'] = $settings['description_font_size']; |
|
273 | - $settings['form_desc_color'] = $settings['description_color']; |
|
274 | - $settings['title_color'] = $settings['label_color']; |
|
275 | - } |
|
276 | - |
|
277 | - if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) { |
|
278 | - $settings['section_color'] = $settings['label_color']; |
|
279 | - $settings['section_border_color'] = $settings['border_color']; |
|
280 | - } |
|
281 | - |
|
282 | - if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) { |
|
283 | - $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
|
284 | - $settings['submit_hover_color'] = $settings['submit_text_color']; |
|
285 | - $settings['submit_hover_border_color'] = $settings['submit_border_color']; |
|
286 | - |
|
287 | - $settings['submit_active_bg_color'] = $settings['submit_bg_color']; |
|
288 | - $settings['submit_active_color'] = $settings['submit_text_color']; |
|
289 | - $settings['submit_active_border_color'] = $settings['submit_border_color']; |
|
290 | - } |
|
291 | - |
|
292 | - return $settings; |
|
265 | + if ( ! is_array($settings) ) { |
|
266 | + return $settings; |
|
267 | + } |
|
268 | + |
|
269 | + $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height']; |
|
270 | + |
|
271 | + if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) { |
|
272 | + $settings['form_desc_size'] = $settings['description_font_size']; |
|
273 | + $settings['form_desc_color'] = $settings['description_color']; |
|
274 | + $settings['title_color'] = $settings['label_color']; |
|
275 | + } |
|
276 | + |
|
277 | + if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) { |
|
278 | + $settings['section_color'] = $settings['label_color']; |
|
279 | + $settings['section_border_color'] = $settings['border_color']; |
|
280 | + } |
|
281 | + |
|
282 | + if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) { |
|
283 | + $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
|
284 | + $settings['submit_hover_color'] = $settings['submit_text_color']; |
|
285 | + $settings['submit_hover_border_color'] = $settings['submit_border_color']; |
|
286 | + |
|
287 | + $settings['submit_active_bg_color'] = $settings['submit_bg_color']; |
|
288 | + $settings['submit_active_color'] = $settings['submit_text_color']; |
|
289 | + $settings['submit_active_border_color'] = $settings['submit_border_color']; |
|
290 | + } |
|
291 | + |
|
292 | + return $settings; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | public function get_defaults() { |
296 | - return array( |
|
297 | - 'theme_css' => 'ui-lightness', |
|
298 | - 'theme_name' => 'UI Lightness', |
|
296 | + return array( |
|
297 | + 'theme_css' => 'ui-lightness', |
|
298 | + 'theme_name' => 'UI Lightness', |
|
299 | 299 | |
300 | 300 | 'center_form' => '', |
301 | - 'form_width' => '100%', |
|
302 | - 'form_align' => 'left', |
|
303 | - 'direction' => is_rtl() ? 'rtl' : 'ltr', |
|
304 | - 'fieldset' => '0px', |
|
305 | - 'fieldset_color' => '000000', |
|
306 | - 'fieldset_padding' => '0 0 15px 0', |
|
307 | - 'fieldset_bg_color' => '', |
|
308 | - |
|
309 | - 'title_size' => '20px', |
|
310 | - 'title_color' => '444444', |
|
301 | + 'form_width' => '100%', |
|
302 | + 'form_align' => 'left', |
|
303 | + 'direction' => is_rtl() ? 'rtl' : 'ltr', |
|
304 | + 'fieldset' => '0px', |
|
305 | + 'fieldset_color' => '000000', |
|
306 | + 'fieldset_padding' => '0 0 15px 0', |
|
307 | + 'fieldset_bg_color' => '', |
|
308 | + |
|
309 | + 'title_size' => '20px', |
|
310 | + 'title_color' => '444444', |
|
311 | 311 | 'title_margin_top' => '10px', |
312 | 312 | 'title_margin_bottom' => '10px', |
313 | - 'form_desc_size' => '14px', |
|
314 | - 'form_desc_color' => '666666', |
|
313 | + 'form_desc_size' => '14px', |
|
314 | + 'form_desc_color' => '666666', |
|
315 | 315 | 'form_desc_margin_top' => '10px', |
316 | 316 | 'form_desc_margin_bottom' => '25px', |
317 | 317 | |
318 | - 'font' => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif', |
|
319 | - 'font_size' => '14px', |
|
320 | - 'label_color' => '444444', |
|
321 | - 'weight' => 'bold', |
|
322 | - 'position' => 'none', |
|
323 | - 'align' => 'left', |
|
324 | - 'width' => '150px', |
|
325 | - 'required_color' => 'B94A48', |
|
326 | - 'required_weight' => 'bold', |
|
327 | - 'label_padding' => '0 0 3px 0', |
|
328 | - |
|
329 | - 'description_font_size' => '12px', |
|
330 | - 'description_color' => '666666', |
|
331 | - 'description_weight' => 'normal', |
|
332 | - 'description_style' => 'normal', |
|
333 | - 'description_align' => 'left', |
|
318 | + 'font' => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif', |
|
319 | + 'font_size' => '14px', |
|
320 | + 'label_color' => '444444', |
|
321 | + 'weight' => 'bold', |
|
322 | + 'position' => 'none', |
|
323 | + 'align' => 'left', |
|
324 | + 'width' => '150px', |
|
325 | + 'required_color' => 'B94A48', |
|
326 | + 'required_weight' => 'bold', |
|
327 | + 'label_padding' => '0 0 3px 0', |
|
328 | + |
|
329 | + 'description_font_size' => '12px', |
|
330 | + 'description_color' => '666666', |
|
331 | + 'description_weight' => 'normal', |
|
332 | + 'description_style' => 'normal', |
|
333 | + 'description_align' => 'left', |
|
334 | 334 | 'description_margin' => '0', |
335 | 335 | |
336 | - 'field_font_size' => '14px', |
|
337 | - 'field_height' => '32px', |
|
338 | - 'line_height' => 'normal', |
|
339 | - 'field_width' => '100%', |
|
340 | - 'auto_width' => false, |
|
341 | - 'field_pad' => '6px 10px', |
|
342 | - 'field_margin' => '20px', |
|
336 | + 'field_font_size' => '14px', |
|
337 | + 'field_height' => '32px', |
|
338 | + 'line_height' => 'normal', |
|
339 | + 'field_width' => '100%', |
|
340 | + 'auto_width' => false, |
|
341 | + 'field_pad' => '6px 10px', |
|
342 | + 'field_margin' => '20px', |
|
343 | 343 | 'field_weight' => 'normal', |
344 | - 'text_color' => '555555', |
|
345 | - //'border_color_hv' => 'cccccc', |
|
346 | - 'border_color' => 'cccccc', |
|
347 | - 'field_border_width' => '1px', |
|
348 | - 'field_border_style' => 'solid', |
|
349 | - |
|
350 | - 'bg_color' => 'ffffff', |
|
351 | - //'bg_color_hv' => 'ffffff', |
|
344 | + 'text_color' => '555555', |
|
345 | + //'border_color_hv' => 'cccccc', |
|
346 | + 'border_color' => 'cccccc', |
|
347 | + 'field_border_width' => '1px', |
|
348 | + 'field_border_style' => 'solid', |
|
349 | + |
|
350 | + 'bg_color' => 'ffffff', |
|
351 | + //'bg_color_hv' => 'ffffff', |
|
352 | 352 | 'remove_box_shadow' => '', |
353 | - 'bg_color_active' => 'ffffff', |
|
353 | + 'bg_color_active' => 'ffffff', |
|
354 | 354 | 'border_color_active' => '66afe9', |
355 | 355 | 'remove_box_shadow_active' => '', |
356 | - 'text_color_error' => '444444', |
|
357 | - 'bg_color_error' => 'ffffff', |
|
356 | + 'text_color_error' => '444444', |
|
357 | + 'bg_color_error' => 'ffffff', |
|
358 | 358 | 'border_color_error' => 'B94A48', |
359 | 359 | 'border_width_error' => '1px', |
360 | 360 | 'border_style_error' => 'solid', |
361 | - 'bg_color_disabled' => 'ffffff', |
|
362 | - 'border_color_disabled' => 'E5E5E5', |
|
363 | - 'text_color_disabled' => 'A1A1A1', |
|
364 | - |
|
365 | - 'radio_align' => 'block', |
|
366 | - 'check_align' => 'block', |
|
367 | - 'check_font_size' => '13px', |
|
368 | - 'check_label_color' => '444444', |
|
369 | - 'check_weight' => 'normal', |
|
370 | - |
|
371 | - 'section_font_size' => '18px', |
|
372 | - 'section_color' => '444444', |
|
373 | - 'section_weight' => 'bold', |
|
374 | - 'section_pad' => '15px 0 3px 0', |
|
375 | - 'section_mar_top' => '15px', |
|
361 | + 'bg_color_disabled' => 'ffffff', |
|
362 | + 'border_color_disabled' => 'E5E5E5', |
|
363 | + 'text_color_disabled' => 'A1A1A1', |
|
364 | + |
|
365 | + 'radio_align' => 'block', |
|
366 | + 'check_align' => 'block', |
|
367 | + 'check_font_size' => '13px', |
|
368 | + 'check_label_color' => '444444', |
|
369 | + 'check_weight' => 'normal', |
|
370 | + |
|
371 | + 'section_font_size' => '18px', |
|
372 | + 'section_color' => '444444', |
|
373 | + 'section_weight' => 'bold', |
|
374 | + 'section_pad' => '15px 0 3px 0', |
|
375 | + 'section_mar_top' => '15px', |
|
376 | 376 | 'section_mar_bottom' => '12px', |
377 | - 'section_bg_color' => '', |
|
378 | - 'section_border_color' => 'e8e8e8', |
|
379 | - 'section_border_width' => '2px', |
|
380 | - 'section_border_style' => 'solid', |
|
381 | - 'section_border_loc' => '-top', |
|
382 | - 'collapse_icon' => '6', |
|
383 | - 'collapse_pos' => 'after', |
|
384 | - 'repeat_icon' => '1', |
|
385 | - |
|
386 | - 'submit_style' => false, |
|
387 | - 'submit_font_size' => '14px', |
|
388 | - 'submit_width' => 'auto', |
|
389 | - 'submit_height' => 'auto', |
|
390 | - 'submit_bg_color' => 'ffffff', |
|
391 | - 'submit_border_color' => 'cccccc', |
|
392 | - 'submit_border_width' => '1px', |
|
393 | - 'submit_text_color' => '444444', |
|
394 | - 'submit_weight' => 'normal', |
|
395 | - 'submit_border_radius' => '4px', |
|
396 | - 'submit_bg_img' => '', |
|
397 | - 'submit_margin' => '10px', |
|
398 | - 'submit_padding' => '6px 11px', |
|
399 | - 'submit_shadow_color' => 'eeeeee', |
|
400 | - 'submit_hover_bg_color' => 'efefef', |
|
401 | - 'submit_hover_color' => '444444', |
|
402 | - 'submit_hover_border_color' => 'cccccc', |
|
403 | - 'submit_active_bg_color' => 'efefef', |
|
404 | - 'submit_active_color' => '444444', |
|
405 | - 'submit_active_border_color' => 'cccccc', |
|
406 | - |
|
407 | - 'border_radius' => '4px', |
|
408 | - 'error_bg' => 'F2DEDE', |
|
409 | - 'error_border' => 'EBCCD1', |
|
410 | - 'error_text' => 'B94A48', |
|
411 | - 'error_font_size' => '14px', |
|
412 | - |
|
413 | - 'success_bg_color' => 'DFF0D8', |
|
414 | - 'success_border_color' => 'D6E9C6', |
|
415 | - 'success_text_color' => '468847', |
|
416 | - 'success_font_size' => '14px', |
|
417 | - |
|
418 | - 'important_style' => false, |
|
377 | + 'section_bg_color' => '', |
|
378 | + 'section_border_color' => 'e8e8e8', |
|
379 | + 'section_border_width' => '2px', |
|
380 | + 'section_border_style' => 'solid', |
|
381 | + 'section_border_loc' => '-top', |
|
382 | + 'collapse_icon' => '6', |
|
383 | + 'collapse_pos' => 'after', |
|
384 | + 'repeat_icon' => '1', |
|
385 | + |
|
386 | + 'submit_style' => false, |
|
387 | + 'submit_font_size' => '14px', |
|
388 | + 'submit_width' => 'auto', |
|
389 | + 'submit_height' => 'auto', |
|
390 | + 'submit_bg_color' => 'ffffff', |
|
391 | + 'submit_border_color' => 'cccccc', |
|
392 | + 'submit_border_width' => '1px', |
|
393 | + 'submit_text_color' => '444444', |
|
394 | + 'submit_weight' => 'normal', |
|
395 | + 'submit_border_radius' => '4px', |
|
396 | + 'submit_bg_img' => '', |
|
397 | + 'submit_margin' => '10px', |
|
398 | + 'submit_padding' => '6px 11px', |
|
399 | + 'submit_shadow_color' => 'eeeeee', |
|
400 | + 'submit_hover_bg_color' => 'efefef', |
|
401 | + 'submit_hover_color' => '444444', |
|
402 | + 'submit_hover_border_color' => 'cccccc', |
|
403 | + 'submit_active_bg_color' => 'efefef', |
|
404 | + 'submit_active_color' => '444444', |
|
405 | + 'submit_active_border_color' => 'cccccc', |
|
406 | + |
|
407 | + 'border_radius' => '4px', |
|
408 | + 'error_bg' => 'F2DEDE', |
|
409 | + 'error_border' => 'EBCCD1', |
|
410 | + 'error_text' => 'B94A48', |
|
411 | + 'error_font_size' => '14px', |
|
412 | + |
|
413 | + 'success_bg_color' => 'DFF0D8', |
|
414 | + 'success_border_color' => 'D6E9C6', |
|
415 | + 'success_text_color' => '468847', |
|
416 | + 'success_font_size' => '14px', |
|
417 | + |
|
418 | + 'important_style' => false, |
|
419 | 419 | |
420 | 420 | 'progress_bg_color' => 'dddddd', |
421 | 421 | 'progress_active_color' => '008ec2', |
422 | 422 | 'progress_color' => 'ffffff', |
423 | 423 | |
424 | - 'custom_css' => '', |
|
425 | - ); |
|
426 | - } |
|
424 | + 'custom_css' => '', |
|
425 | + ); |
|
426 | + } |
|
427 | 427 | |
428 | 428 | public function get_field_name( $field_name, $post_field = 'post_content' ) { |
429 | 429 | return 'frm_style_setting' . ( empty( $post_field ) ? '' : '[' . $post_field . ']' ) . '[' . $field_name . ']'; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | class FrmStyle { |
3 | - public $number = false; // Unique ID number of the current instance. |
|
3 | + public $number = false; // Unique ID number of the current instance. |
|
4 | 4 | public $id = 0; // the id of the post |
5 | 5 | |
6 | 6 | /** |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | public function get_new() { |
14 | 14 | $this->id = 0; |
15 | 15 | |
16 | - $max_slug_value = pow(36, 6); |
|
16 | + $max_slug_value = pow( 36, 6 ); |
|
17 | 17 | $min_slug_value = 37; // we want to have at least 2 characters in the slug |
18 | - $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 ); |
|
18 | + $key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 ); |
|
19 | 19 | |
20 | 20 | $style = array( |
21 | 21 | 'post_type' => FrmStylesController::$post_type, |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function update( $id = 'default' ) { |
42 | 42 | $all_instances = $this->get_all(); |
43 | 43 | |
44 | - if ( empty($id) ) { |
|
44 | + if ( empty( $id ) ) { |
|
45 | 45 | $new_style = (array) $this->get_new(); |
46 | 46 | $all_instances[] = $new_style; |
47 | 47 | } |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | $action_ids = array(); |
50 | 50 | |
51 | 51 | foreach ( $all_instances as $number => $new_instance ) { |
52 | - $new_instance = stripslashes_deep( (array) $new_instance); |
|
52 | + $new_instance = stripslashes_deep( (array) $new_instance ); |
|
53 | 53 | $this->id = $new_instance['ID']; |
54 | - if ( $id != $this->id || ! $_POST || ! isset($_POST['frm_style_setting']) ) { |
|
55 | - $all_instances[ $number ] = $new_instance; |
|
54 | + if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) { |
|
55 | + $all_instances[$number] = $new_instance; |
|
56 | 56 | |
57 | - if ( $new_instance['menu_order'] && $_POST && empty($_POST['prev_menu_order']) && isset($_POST['frm_style_setting']['menu_order']) ) { |
|
57 | + if ( $new_instance['menu_order'] && $_POST && empty( $_POST['prev_menu_order'] ) && isset( $_POST['frm_style_setting']['menu_order'] ) ) { |
|
58 | 58 | // this style was set to default, so remove default setting on previous default style |
59 | 59 | $new_instance['menu_order'] = 0; |
60 | - $action_ids[] = $this->save($new_instance); |
|
60 | + $action_ids[] = $this->save( $new_instance ); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // don't continue if not saving this style |
@@ -67,33 +67,33 @@ discard block |
||
67 | 67 | $new_instance['post_title'] = sanitize_text_field( $_POST['frm_style_setting']['post_title'] ); |
68 | 68 | $new_instance['post_content'] = $_POST['frm_style_setting']['post_content']; |
69 | 69 | $new_instance['post_type'] = FrmStylesController::$post_type; |
70 | - $new_instance['post_status'] = 'publish'; |
|
70 | + $new_instance['post_status'] = 'publish'; |
|
71 | 71 | $new_instance['menu_order'] = isset( $_POST['frm_style_setting']['menu_order'] ) ? absint( $_POST['frm_style_setting']['menu_order'] ) : 0; |
72 | 72 | |
73 | - if ( empty($id) ) { |
|
73 | + if ( empty( $id ) ) { |
|
74 | 74 | $new_instance['post_name'] = $new_instance['post_title']; |
75 | 75 | } |
76 | 76 | |
77 | 77 | $default_settings = $this->get_defaults(); |
78 | 78 | |
79 | 79 | foreach ( $default_settings as $setting => $default ) { |
80 | - if ( ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
81 | - $new_instance['post_content'][ $setting ] = $default; |
|
80 | + if ( ! isset( $new_instance['post_content'][$setting] ) ) { |
|
81 | + $new_instance['post_content'][$setting] = $default; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | if ( strpos( $setting, 'color' ) !== false || in_array( $setting, array( 'error_bg', 'error_border', 'error_text' ) ) ) { |
85 | 85 | //if is a color |
86 | - $new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] ); |
|
87 | - } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
88 | - $new_instance['post_content'][ $setting ] = 0; |
|
86 | + $new_instance['post_content'][$setting] = str_replace( '#', '', $new_instance['post_content'][$setting] ); |
|
87 | + } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][$setting] ) ) { |
|
88 | + $new_instance['post_content'][$setting] = 0; |
|
89 | 89 | } else if ( $setting == 'font' ) { |
90 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
90 | + $new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] ); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - $all_instances[ $number ] = $new_instance; |
|
94 | + $all_instances[$number] = $new_instance; |
|
95 | 95 | |
96 | - $action_ids[] = $this->save($new_instance); |
|
96 | + $action_ids[] = $this->save( $new_instance ); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function save_settings() { |
109 | 109 | $filename = FrmAppHelper::plugin_path() . '/css/custom_theme.css.php'; |
110 | - update_option( 'frm_last_style_update', date('njGi') ); |
|
110 | + update_option( 'frm_last_style_update', date( 'njGi' ) ); |
|
111 | 111 | |
112 | - if ( ! is_file($filename) ) { |
|
112 | + if ( ! is_file( $filename ) ) { |
|
113 | 113 | return; |
114 | 114 | } |
115 | 115 | |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | $create_file = new FrmCreateFile( array( 'folder_name' => 'formidable/css', 'file_name' => 'formidablepro.css' ) ); |
121 | 121 | $create_file->create_file( $css ); |
122 | 122 | |
123 | - update_option('frmpro_css', $css); |
|
123 | + update_option( 'frmpro_css', $css ); |
|
124 | 124 | |
125 | - set_transient('frmpro_css', $css); |
|
125 | + set_transient( 'frmpro_css', $css ); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | private function get_css_content( $filename ) { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | public function destroy( $id ) { |
157 | - return wp_delete_post($id); |
|
157 | + return wp_delete_post( $id ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | public function get_one() { |
@@ -168,19 +168,19 @@ discard block |
||
168 | 168 | return $style; |
169 | 169 | } |
170 | 170 | |
171 | - $style = get_post($this->id); |
|
171 | + $style = get_post( $this->id ); |
|
172 | 172 | |
173 | 173 | if ( ! $style ) { |
174 | 174 | return $style; |
175 | 175 | } |
176 | 176 | |
177 | - $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
177 | + $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content ); |
|
178 | 178 | |
179 | 179 | $default_values = $this->get_defaults(); |
180 | 180 | |
181 | 181 | // fill default values |
182 | - $style->post_content = $this->override_defaults($style->post_content); |
|
183 | - $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
182 | + $style->post_content = $this->override_defaults( $style->post_content ); |
|
183 | + $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
|
184 | 184 | |
185 | 185 | return $style; |
186 | 186 | } |
@@ -194,21 +194,21 @@ discard block |
||
194 | 194 | 'order' => $order, |
195 | 195 | ); |
196 | 196 | |
197 | - $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts'); |
|
197 | + $temp_styles = FrmAppHelper::check_cache( serialize( $post_atts ), 'frm_styles', $post_atts, 'get_posts' ); |
|
198 | 198 | |
199 | - if ( empty($temp_styles) ) { |
|
199 | + if ( empty( $temp_styles ) ) { |
|
200 | 200 | global $wpdb; |
201 | 201 | // make sure there wasn't a conflict with the query |
202 | 202 | $query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->posts . ' WHERE post_type=%s AND post_status=%s ORDER BY post_title ASC LIMIT 99', FrmStylesController::$post_type, 'publish' ); |
203 | - $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results'); |
|
203 | + $temp_styles = FrmAppHelper::check_cache( 'frm_backup_style_check', 'frm_styles', $query, 'get_results' ); |
|
204 | 204 | |
205 | - if ( empty($temp_styles) ) { |
|
205 | + if ( empty( $temp_styles ) ) { |
|
206 | 206 | // create a new style if there are none |
207 | 207 | $new = $this->get_new(); |
208 | 208 | $new->post_title = $new->post_name = __( 'Formidable Style', 'formidable' ); |
209 | 209 | $new->menu_order = 1; |
210 | - $new = $this->save( (array) $new); |
|
211 | - $this->update('default'); |
|
210 | + $new = $this->save( (array) $new ); |
|
211 | + $this->update( 'default' ); |
|
212 | 212 | |
213 | 213 | $post_atts['include'] = $new; |
214 | 214 | |
@@ -232,25 +232,25 @@ discard block |
||
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
235 | - $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
235 | + $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content ); |
|
236 | 236 | |
237 | 237 | // fill default values |
238 | - $style->post_content = $this->override_defaults($style->post_content); |
|
239 | - $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
238 | + $style->post_content = $this->override_defaults( $style->post_content ); |
|
239 | + $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
|
240 | 240 | |
241 | - $styles[ $style->ID ] = $style; |
|
241 | + $styles[$style->ID] = $style; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | if ( ! $default_style ) { |
245 | - $default_style = reset($styles); |
|
246 | - $styles[ $default_style->ID ]->menu_order = 1; |
|
245 | + $default_style = reset( $styles ); |
|
246 | + $styles[$default_style->ID]->menu_order = 1; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | return $styles; |
250 | 250 | } |
251 | 251 | |
252 | 252 | public function get_default_style( $styles = null ) { |
253 | - if ( ! isset($styles) ) { |
|
253 | + if ( ! isset( $styles ) ) { |
|
254 | 254 | $styles = $this->get_all( 'menu_order', 'DESC', 1 ); |
255 | 255 | } |
256 | 256 | |
@@ -262,24 +262,24 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | public function override_defaults( $settings ) { |
265 | - if ( ! is_array($settings) ) { |
|
265 | + if ( ! is_array( $settings ) ) { |
|
266 | 266 | return $settings; |
267 | 267 | } |
268 | 268 | |
269 | - $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height']; |
|
269 | + $settings['line_height'] = ( ! isset( $settings['field_height'] ) || $settings['field_height'] == '' || $settings['field_height'] == 'auto' ) ? 'normal' : $settings['field_height']; |
|
270 | 270 | |
271 | - if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) { |
|
271 | + if ( ! isset( $settings['form_desc_size'] ) && isset( $settings['description_font_size'] ) ) { |
|
272 | 272 | $settings['form_desc_size'] = $settings['description_font_size']; |
273 | 273 | $settings['form_desc_color'] = $settings['description_color']; |
274 | 274 | $settings['title_color'] = $settings['label_color']; |
275 | 275 | } |
276 | 276 | |
277 | - if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) { |
|
277 | + if ( ! isset( $settings['section_color'] ) && isset( $settings['label_color'] ) ) { |
|
278 | 278 | $settings['section_color'] = $settings['label_color']; |
279 | 279 | $settings['section_border_color'] = $settings['border_color']; |
280 | 280 | } |
281 | 281 | |
282 | - if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) { |
|
282 | + if ( ! isset( $settings['submit_hover_bg_color'] ) && isset( $settings['submit_bg_color'] ) ) { |
|
283 | 283 | $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
284 | 284 | $settings['submit_hover_color'] = $settings['submit_text_color']; |
285 | 285 | $settings['submit_hover_border_color'] = $settings['submit_border_color']; |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | $this->file_name = $atts['file_name']; |
19 | 19 | $this->error_message = isset( $atts['error_message'] ) ? $atts['error_message'] : ''; |
20 | 20 | $this->uploads = wp_upload_dir(); |
21 | - $this->chmod_dir = defined('FS_CHMOD_DIR') ? FS_CHMOD_DIR : ( fileperms( ABSPATH ) & 0777 | 0755 ); |
|
22 | - $this->chmod_file = defined('FS_CHMOD_FILE') ? FS_CHMOD_FILE : ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ); |
|
21 | + $this->chmod_dir = defined( 'FS_CHMOD_DIR' ) ? FS_CHMOD_DIR : ( fileperms( ABSPATH ) & 0777 | 0755 ); |
|
22 | + $this->chmod_file = defined( 'FS_CHMOD_FILE' ) ? FS_CHMOD_FILE : ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function create_file( $file_content ) { |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | private function get_ftp_creds( $type ) { |
86 | 86 | $credentials = get_option( 'ftp_credentials', array( 'hostname' => '', 'username' => '' ) ); |
87 | 87 | |
88 | - $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : $credentials['hostname']; |
|
89 | - $credentials['username'] = defined('FTP_USER') ? FTP_USER : $credentials['username']; |
|
90 | - $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : ''; |
|
88 | + $credentials['hostname'] = defined( 'FTP_HOST' ) ? FTP_HOST : $credentials['hostname']; |
|
89 | + $credentials['username'] = defined( 'FTP_USER' ) ? FTP_USER : $credentials['username']; |
|
90 | + $credentials['password'] = defined( 'FTP_PASS' ) ? FTP_PASS : ''; |
|
91 | 91 | |
92 | 92 | // Check to see if we are setting the public/private keys for ssh |
93 | - $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : ''; |
|
94 | - $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : ''; |
|
93 | + $credentials['public_key'] = defined( 'FTP_PUBKEY' ) ? FTP_PUBKEY : ''; |
|
94 | + $credentials['private_key'] = defined( 'FTP_PRIKEY' ) ? FTP_PRIKEY : ''; |
|
95 | 95 | |
96 | 96 | // Sanitize the hostname, Some people might pass in odd-data: |
97 | 97 | $credentials['hostname'] = preg_replace( '|\w+://|', '', $credentials['hostname'] ); //Strip any schemes off |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <div class="field-group field-group-background clearfix frm-first-row"> |
2 | 2 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('label_color') ) ?>" id="frm_label_color" class="hex" value="<?php echo esc_attr( $style->post_content['label_color'] ) ?>" /> |
|
3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'label_color' ) ) ?>" id="frm_label_color" class="hex" value="<?php echo esc_attr( $style->post_content['label_color'] ) ?>" /> |
|
4 | 4 | </div> |
5 | 5 | <div class="field-group clearfix frm-first-row"> |
6 | 6 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
7 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('weight') ) ?>" id="frm_weight"> |
|
7 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'weight' ) ) ?>" id="frm_weight"> |
|
8 | 8 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
9 | 9 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['weight'], $value ) ?>><?php echo esc_html( $name ) ?></option> |
10 | 10 | <?php } ?> |
@@ -12,45 +12,45 @@ discard block |
||
12 | 12 | </div> |
13 | 13 | <div class="field-group clearfix frm-first-row"> |
14 | 14 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
15 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('font_size') ) ?>" id="frm_font_size" value="<?php echo esc_attr($style->post_content['font_size']) ?>" size="3" /> |
|
15 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'font_size' ) ) ?>" id="frm_font_size" value="<?php echo esc_attr( $style->post_content['font_size'] ) ?>" size="3" /> |
|
16 | 16 | </div> |
17 | 17 | |
18 | 18 | <div class="field-group clearfix frm_clear"> |
19 | 19 | <label><?php _e( 'Position', 'formidable' ) ?></label> |
20 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('position') ) ?>" id="frm_position"> |
|
20 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'position' ) ) ?>" id="frm_position"> |
|
21 | 21 | <?php foreach ( array( 'none' => __( 'top', 'formidable' ), 'left' => __( 'left', 'formidable' ), 'right' => __( 'right', 'formidable' ), 'no_label' => __( 'none', 'formidable' ) ) as $pos => $pos_label ) { ?> |
22 | - <option value="<?php echo esc_attr( $pos ) ?>" <?php selected($style->post_content['position'], $pos) ?>><?php echo esc_html( $pos_label ) ?></option> |
|
22 | + <option value="<?php echo esc_attr( $pos ) ?>" <?php selected( $style->post_content['position'], $pos ) ?>><?php echo esc_html( $pos_label ) ?></option> |
|
23 | 23 | <?php } ?> |
24 | 24 | </select> |
25 | 25 | </div> |
26 | 26 | |
27 | 27 | <div class="field-group clearfix"> |
28 | 28 | <label><?php _e( 'Align', 'formidable' ) ?></label> |
29 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('align') ) ?>" id="frm_align"> |
|
30 | - <option value="left" <?php selected($style->post_content['align'], 'left') ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
31 | - <option value="right" <?php selected($style->post_content['align'], 'right') ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
29 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'align' ) ) ?>" id="frm_align"> |
|
30 | + <option value="left" <?php selected( $style->post_content['align'], 'left' ) ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
31 | + <option value="right" <?php selected( $style->post_content['align'], 'right' ) ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
32 | 32 | </select> |
33 | 33 | </div> |
34 | 34 | |
35 | 35 | <div class="field-group clearfix"> |
36 | 36 | <label><?php _e( 'Width', 'formidable' ) ?></label> |
37 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('width') ) ?>" id="frm_width" value="<?php echo esc_attr( $style->post_content['width'] ) ?>" /> |
|
37 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'width' ) ) ?>" id="frm_width" value="<?php echo esc_attr( $style->post_content['width'] ) ?>" /> |
|
38 | 38 | </div> |
39 | 39 | |
40 | 40 | <div class="field-group clearfix frm_clear"> |
41 | 41 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
42 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('label_padding') ) ?>" id="frm_label_padding" value="<?php echo esc_attr( $style->post_content['label_padding'] ) ?>" /> |
|
42 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'label_padding' ) ) ?>" id="frm_label_padding" value="<?php echo esc_attr( $style->post_content['label_padding'] ) ?>" /> |
|
43 | 43 | </div> |
44 | 44 | |
45 | 45 | <div class="clear"></div> |
46 | 46 | <h3><?php _e( 'Required Indicator', 'formidable' ) ?></h3> |
47 | 47 | <div class="field-group field-group-border clearfix after-h3"> |
48 | 48 | <label class="background"><?php _e( 'Color', 'formidable' ) ?></label> |
49 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('required_color') ) ?>" id="frm_required_color" class="hex" value="<?php echo esc_attr( $style->post_content['required_color'] ) ?>" /> |
|
49 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'required_color' ) ) ?>" id="frm_required_color" class="hex" value="<?php echo esc_attr( $style->post_content['required_color'] ) ?>" /> |
|
50 | 50 | </div> |
51 | 51 | <div class="field-group clearfix after-h3"> |
52 | 52 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
53 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('required_weight') ) ?>" id="frm_required_weight"> |
|
53 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'required_weight' ) ) ?>" id="frm_required_weight"> |
|
54 | 54 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
55 | 55 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['required_weight'], $value ) ?>><?php echo esc_html( $name ) ?></option> |
56 | 56 | <?php } ?> |
@@ -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> |
@@ -2,26 +2,26 @@ discard block |
||
2 | 2 | |
3 | 3 | class FrmSettingsController { |
4 | 4 | |
5 | - public static function menu() { |
|
5 | + public static function menu() { |
|
6 | 6 | // Make sure admins can see the menu items |
7 | 7 | FrmAppHelper::force_capability( 'frm_change_settings' ); |
8 | 8 | |
9 | - add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); |
|
10 | - } |
|
9 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); |
|
10 | + } |
|
11 | 11 | |
12 | - public static function license_box() { |
|
12 | + public static function license_box() { |
|
13 | 13 | $a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); |
14 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' ); |
|
15 | - } |
|
14 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' ); |
|
15 | + } |
|
16 | 16 | |
17 | - public static function display_form( $errors = array(), $message = '' ) { |
|
18 | - global $frm_vars; |
|
17 | + public static function display_form( $errors = array(), $message = '' ) { |
|
18 | + global $frm_vars; |
|
19 | 19 | |
20 | - $frm_settings = FrmAppHelper::get_settings(); |
|
21 | - $frm_roles = FrmAppHelper::frm_capabilities(); |
|
20 | + $frm_settings = FrmAppHelper::get_settings(); |
|
21 | + $frm_roles = FrmAppHelper::frm_capabilities(); |
|
22 | 22 | |
23 | - $uploads = wp_upload_dir(); |
|
24 | - $target_path = $uploads['basedir'] . '/formidable/css'; |
|
23 | + $uploads = wp_upload_dir(); |
|
24 | + $target_path = $uploads['basedir'] . '/formidable/css'; |
|
25 | 25 | |
26 | 26 | $sections = array(); |
27 | 27 | if ( apply_filters( 'frm_include_addon_page', false ) ) { |
@@ -30,53 +30,53 @@ discard block |
||
30 | 30 | 'name' => __( 'Plugin Licenses', 'formidable' ), |
31 | 31 | ); |
32 | 32 | } |
33 | - $sections = apply_filters( 'frm_add_settings_section', $sections ); |
|
33 | + $sections = apply_filters( 'frm_add_settings_section', $sections ); |
|
34 | 34 | |
35 | - $captcha_lang = FrmAppHelper::locales( 'captcha' ); |
|
35 | + $captcha_lang = FrmAppHelper::locales( 'captcha' ); |
|
36 | 36 | |
37 | - require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' ); |
|
38 | - } |
|
37 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' ); |
|
38 | + } |
|
39 | 39 | |
40 | - public static function process_form( $stop_load = false ) { |
|
41 | - global $frm_vars; |
|
40 | + public static function process_form( $stop_load = false ) { |
|
41 | + global $frm_vars; |
|
42 | 42 | |
43 | - $frm_settings = FrmAppHelper::get_settings(); |
|
43 | + $frm_settings = FrmAppHelper::get_settings(); |
|
44 | 44 | |
45 | 45 | $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' ); |
46 | 46 | if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) { |
47 | - wp_die( $frm_settings->admin_permission ); |
|
48 | - } |
|
47 | + wp_die( $frm_settings->admin_permission ); |
|
48 | + } |
|
49 | 49 | |
50 | - $errors = array(); |
|
51 | - $message = ''; |
|
50 | + $errors = array(); |
|
51 | + $message = ''; |
|
52 | 52 | |
53 | - if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) { |
|
54 | - //$errors = $frm_settings->validate($_POST,array()); |
|
55 | - $frm_settings->update( stripslashes_deep( $_POST ) ); |
|
53 | + if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) { |
|
54 | + //$errors = $frm_settings->validate($_POST,array()); |
|
55 | + $frm_settings->update( stripslashes_deep( $_POST ) ); |
|
56 | 56 | |
57 | - if ( empty( $errors ) ) { |
|
58 | - $frm_settings->store(); |
|
59 | - $message = __( 'Settings Saved', 'formidable' ); |
|
60 | - } |
|
61 | - } else { |
|
62 | - $message = __( 'Settings Saved', 'formidable' ); |
|
63 | - } |
|
57 | + if ( empty( $errors ) ) { |
|
58 | + $frm_settings->store(); |
|
59 | + $message = __( 'Settings Saved', 'formidable' ); |
|
60 | + } |
|
61 | + } else { |
|
62 | + $message = __( 'Settings Saved', 'formidable' ); |
|
63 | + } |
|
64 | 64 | |
65 | 65 | if ( $stop_load == 'stop_load' ) { |
66 | - $frm_vars['settings_routed'] = true; |
|
67 | - return; |
|
68 | - } |
|
66 | + $frm_vars['settings_routed'] = true; |
|
67 | + return; |
|
68 | + } |
|
69 | 69 | |
70 | - self::display_form( $errors, $message ); |
|
71 | - } |
|
70 | + self::display_form( $errors, $message ); |
|
71 | + } |
|
72 | 72 | |
73 | - public static function route( $stop_load = false ) { |
|
74 | - $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
73 | + public static function route( $stop_load = false ) { |
|
74 | + $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
75 | 75 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
76 | - if ( $action == 'process-form' ) { |
|
76 | + if ( $action == 'process-form' ) { |
|
77 | 77 | self::process_form( $stop_load ); |
78 | - } else if ( $stop_load != 'stop_load' ) { |
|
78 | + } else if ( $stop_load != 'stop_load' ) { |
|
79 | 79 | self::display_form(); |
80 | - } |
|
81 | - } |
|
80 | + } |
|
81 | + } |
|
82 | 82 | } |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <div class="field-group field-group-background clearfix frm-first-row"> |
2 | 2 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('description_color') ) ?>" id="frm_description_color" class="hex" value="<?php echo esc_attr( $style->post_content['description_color'] ) ?>" /> |
|
3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'description_color' ) ) ?>" id="frm_description_color" class="hex" value="<?php echo esc_attr( $style->post_content['description_color'] ) ?>" /> |
|
4 | 4 | </div> |
5 | 5 | <div class="field-group clearfix frm-first-row"> |
6 | 6 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
7 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('description_weight') ) ?>" id="frm_description_weight"> |
|
7 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'description_weight' ) ) ?>" id="frm_description_weight"> |
|
8 | 8 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
9 | 9 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['description_weight'], $value ) ?>><?php echo esc_html( $name ) ?></option> |
10 | 10 | <?php } ?> |
@@ -12,25 +12,25 @@ discard block |
||
12 | 12 | </div> |
13 | 13 | <div class="field-group clearfix frm-first-row"> |
14 | 14 | <label><?php _e( 'Style', 'formidable' ) ?></label> |
15 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('description_style') ) ?>" id="frm_description_style"> |
|
16 | - <option value="normal" <?php selected($style->post_content['description_style'], 'normal') ?>><?php _e( 'normal', 'formidable' ) ?></option> |
|
17 | - <option value="italic" <?php selected($style->post_content['description_style'], 'italic') ?>><?php _e( 'italic', 'formidable' ) ?></option> |
|
15 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'description_style' ) ) ?>" id="frm_description_style"> |
|
16 | + <option value="normal" <?php selected( $style->post_content['description_style'], 'normal' ) ?>><?php _e( 'normal', 'formidable' ) ?></option> |
|
17 | + <option value="italic" <?php selected( $style->post_content['description_style'], 'italic' ) ?>><?php _e( 'italic', 'formidable' ) ?></option> |
|
18 | 18 | </select> |
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class="field-group clearfix"> |
22 | 22 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
23 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('description_font_size') ) ?>" id="frm_description_font_size" value="<?php echo esc_attr( $style->post_content['description_font_size'] ) ?>" size="3" /> |
|
23 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'description_font_size' ) ) ?>" id="frm_description_font_size" value="<?php echo esc_attr( $style->post_content['description_font_size'] ) ?>" size="3" /> |
|
24 | 24 | </div> |
25 | 25 | <div class="field-group clearfix"> |
26 | 26 | <label><?php _e( 'Align', 'formidable' ) ?></label> |
27 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('description_align') ) ?>" id="frm_description_align"> |
|
28 | - <option value="left" <?php selected($style->post_content['description_align'], 'left') ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
29 | - <option value="right" <?php selected($style->post_content['description_align'], 'right') ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
27 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'description_align' ) ) ?>" id="frm_description_align"> |
|
28 | + <option value="left" <?php selected( $style->post_content['description_align'], 'left' ) ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
29 | + <option value="right" <?php selected( $style->post_content['description_align'], 'right' ) ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
30 | 30 | </select> |
31 | 31 | </div> |
32 | 32 | <div class="field-group clearfix"> |
33 | 33 | <label><?php _e( 'Margin', 'formidable' ) ?></label> |
34 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('description_margin') ) ?>" id="frm_description_margin" value="<?php echo esc_attr( $style->post_content['description_margin'] ) ?>" size="3" /> |
|
34 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'description_margin' ) ) ?>" id="frm_description_margin" value="<?php echo esc_attr( $style->post_content['description_margin'] ) ?>" size="3" /> |
|
35 | 35 | </div> |
36 | 36 | <div class="clear"></div> |