@@ -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{ |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | public static function menu() { |
6 | 6 | FrmAppHelper::force_capability( 'frm_view_entries' ); |
7 | 7 | |
8 | - add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
8 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
9 | 9 | |
10 | 10 | if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) { |
11 | 11 | $menu_name = FrmAppHelper::get_menu_name(); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | 'id' => 'formidable-entries-tab', |
54 | 54 | 'title' => __( 'Overview', 'formidable' ), |
55 | 55 | 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
56 | - )); |
|
56 | + ) ); |
|
57 | 57 | |
58 | 58 | $screen->set_help_sidebar( |
59 | 59 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | global $frm_vars, $wpdb; |
69 | 69 | $form_id = FrmForm::get_current_form_id(); |
70 | 70 | |
71 | - $columns[ $form_id . '_id' ] = 'ID'; |
|
72 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
71 | + $columns[$form_id . '_id'] = 'ID'; |
|
72 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
73 | 73 | |
74 | 74 | if ( ! $form_id ) { |
75 | 75 | return $columns; |
76 | 76 | } |
77 | 77 | |
78 | - $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
78 | + $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' ); |
|
79 | 79 | |
80 | 80 | foreach ( $form_cols as $form_col ) { |
81 | 81 | if ( FrmField::is_no_save_field( $form_col->type ) ) { |
@@ -88,30 +88,30 @@ discard block |
||
88 | 88 | if ( $sub_form_cols ) { |
89 | 89 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
90 | 90 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
91 | - unset( $sub_form_cols[ $k ] ); |
|
91 | + unset( $sub_form_cols[$k] ); |
|
92 | 92 | continue; |
93 | 93 | } |
94 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
95 | - unset($sub_form_col); |
|
94 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
95 | + unset( $sub_form_col ); |
|
96 | 96 | } |
97 | 97 | } |
98 | - unset($sub_form_cols); |
|
98 | + unset( $sub_form_cols ); |
|
99 | 99 | } else { |
100 | 100 | $col_id = $form_col->field_key; |
101 | 101 | if ( $form_col->form_id != $form_id ) { |
102 | 102 | $col_id .= '-_-form' . $form_col->form_id; |
103 | 103 | } |
104 | 104 | |
105 | - if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
106 | - $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
105 | + if ( isset( $form_col->field_options['separate_value'] ) && $form_col->field_options['separate_value'] ) { |
|
106 | + $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
107 | 107 | } |
108 | - $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
108 | + $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | - $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
113 | - $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
114 | - $columns[ $form_id . '_ip' ] = 'IP'; |
|
112 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
113 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
114 | + $columns[$form_id . '_ip'] = 'IP'; |
|
115 | 115 | |
116 | 116 | $frm_vars['cols'] = $columns; |
117 | 117 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | global $frm_vars; |
138 | 138 | //add a check so we don't create a loop |
139 | - $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
139 | + $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
140 | 140 | |
141 | 141 | return $check; |
142 | 142 | } |
@@ -151,19 +151,19 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | global $frm_vars; |
154 | - if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
154 | + if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) { |
|
155 | 155 | return; //don't continue if there's no previous value |
156 | 156 | } |
157 | 157 | |
158 | 158 | foreach ( $meta_value as $mk => $mv ) { |
159 | 159 | //remove blank values |
160 | - if ( empty( $mv ) ) { |
|
161 | - unset( $meta_value[ $mk ] ); |
|
160 | + if ( empty( $mv ) ) { |
|
161 | + unset( $meta_value[$mk] ); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - $cur_form_prefix = reset($meta_value); |
|
166 | - $cur_form_prefix = explode('_', $cur_form_prefix); |
|
165 | + $cur_form_prefix = reset( $meta_value ); |
|
166 | + $cur_form_prefix = explode( '_', $cur_form_prefix ); |
|
167 | 167 | $cur_form_prefix = $cur_form_prefix[0]; |
168 | 168 | $save = false; |
169 | 169 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | $meta_value[] = $prev_hidden; |
184 | 184 | $save = true; |
185 | - unset($form_prefix); |
|
185 | + unset( $form_prefix ); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | if ( $save ) { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | foreach ( $fields as $field ) { |
215 | 215 | if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) { |
216 | 216 | // Can't sort on checkboxes because they are stored serialized, or post fields |
217 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
217 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | break; |
238 | 238 | } |
239 | 239 | |
240 | - unset($form_prefix); |
|
240 | + unset( $form_prefix ); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
@@ -245,36 +245,36 @@ discard block |
||
245 | 245 | return $result; |
246 | 246 | } |
247 | 247 | |
248 | - $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
248 | + $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0; |
|
249 | 249 | $max_columns = 8; |
250 | 250 | if ( $i <= $max_columns ) { |
251 | 251 | return $result; |
252 | 252 | } |
253 | 253 | |
254 | 254 | global $frm_vars; |
255 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
256 | - $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
255 | + if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] ) { |
|
256 | + $frm_vars['current_form']->options = maybe_unserialize( $frm_vars['current_form']->options ); |
|
257 | 257 | } |
258 | 258 | |
259 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
259 | + if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) ) { |
|
260 | 260 | $result = $frm_vars['current_form']->options['hidden_cols']; |
261 | 261 | } else { |
262 | 262 | $cols = $frm_vars['cols']; |
263 | - $cols = array_reverse($cols, true); |
|
263 | + $cols = array_reverse( $cols, true ); |
|
264 | 264 | |
265 | 265 | $result[] = $form_id . '_id'; |
266 | - $i--; |
|
266 | + $i --; |
|
267 | 267 | |
268 | 268 | $result[] = $form_id . '_item_key'; |
269 | - $i--; |
|
269 | + $i --; |
|
270 | 270 | |
271 | 271 | foreach ( $cols as $col_key => $col ) { |
272 | 272 | if ( $i > $max_columns ) { |
273 | 273 | $result[] = $col_key; |
274 | 274 | } |
275 | 275 | //remove some columns by default |
276 | - $i--; |
|
277 | - unset($col_key, $col); |
|
276 | + $i --; |
|
277 | + unset( $col_key, $col ); |
|
278 | 278 | } |
279 | 279 | } |
280 | 280 | |
@@ -311,14 +311,14 @@ discard block |
||
311 | 311 | if ( $pagenum > $total_pages && $total_pages > 0 ) { |
312 | 312 | $url = add_query_arg( 'paged', $total_pages ); |
313 | 313 | if ( headers_sent() ) { |
314 | - echo FrmAppHelper::js_redirect($url); |
|
314 | + echo FrmAppHelper::js_redirect( $url ); |
|
315 | 315 | } else { |
316 | 316 | wp_redirect( esc_url_raw( $url ) ); |
317 | 317 | } |
318 | 318 | die(); |
319 | 319 | } |
320 | 320 | |
321 | - if ( empty($message) && isset($_GET['import-message']) ) { |
|
321 | + if ( empty( $message ) && isset( $_GET['import-message'] ) ) { |
|
322 | 322 | $message = __( 'Your import is complete', 'formidable' ); |
323 | 323 | } |
324 | 324 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | |
328 | 328 | /* Back End CRUD */ |
329 | 329 | public static function show( $id = 0 ) { |
330 | - FrmAppHelper::permission_check('frm_view_entries'); |
|
330 | + FrmAppHelper::permission_check( 'frm_view_entries' ); |
|
331 | 331 | |
332 | 332 | if ( ! $id ) { |
333 | 333 | $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
@@ -337,9 +337,9 @@ discard block |
||
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
340 | - $entry = FrmEntry::getOne($id, true); |
|
340 | + $entry = FrmEntry::getOne( $id, true ); |
|
341 | 341 | |
342 | - $data = maybe_unserialize($entry->description); |
|
342 | + $data = maybe_unserialize( $entry->description ); |
|
343 | 343 | if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) { |
344 | 344 | $data = array( 'referrer' => $data ); |
345 | 345 | } |
@@ -351,11 +351,11 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | public static function destroy() { |
354 | - FrmAppHelper::permission_check('frm_delete_entries'); |
|
354 | + FrmAppHelper::permission_check( 'frm_delete_entries' ); |
|
355 | 355 | |
356 | 356 | $params = FrmForm::get_admin_params(); |
357 | 357 | |
358 | - if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
358 | + if ( isset( $params['keep_post'] ) && $params['keep_post'] ) { |
|
359 | 359 | //unlink entry from post |
360 | 360 | global $wpdb; |
361 | 361 | $wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
@@ -433,9 +433,9 @@ discard block |
||
433 | 433 | if ( ! isset( $frm_vars['form_params'] ) ) { |
434 | 434 | $frm_vars['form_params'] = array(); |
435 | 435 | } |
436 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
436 | + $frm_vars['form_params'][$form->id] = $params; |
|
437 | 437 | |
438 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
438 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
439 | 439 | return; |
440 | 440 | } |
441 | 441 | |
@@ -450,13 +450,13 @@ discard block |
||
450 | 450 | */ |
451 | 451 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
452 | 452 | |
453 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
453 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
454 | 454 | |
455 | 455 | if ( empty( $errors ) ) { |
456 | 456 | $_POST['frm_skip_cookie'] = 1; |
457 | 457 | if ( $params['action'] == 'create' ) { |
458 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
459 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
|
458 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
459 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); |
|
460 | 460 | } |
461 | 461 | } |
462 | 462 | |
@@ -491,28 +491,28 @@ discard block |
||
491 | 491 | } |
492 | 492 | |
493 | 493 | public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
494 | - $field = FrmField::getOne($meta->field_id); |
|
494 | + $field = FrmField::getOne( $meta->field_id ); |
|
495 | 495 | if ( ! $field ) { |
496 | 496 | return $value; |
497 | 497 | } |
498 | 498 | |
499 | - $value = self::filter_display_value($value, $field, $atts); |
|
499 | + $value = self::filter_display_value( $value, $field, $atts ); |
|
500 | 500 | return $value; |
501 | 501 | } |
502 | 502 | |
503 | 503 | public static function &filter_shortcode_value( $value, $tag, $atts, $field ) { |
504 | - $plain_text = add_filter('frm_plain_text_email', true); |
|
504 | + $plain_text = add_filter( 'frm_plain_text_email', true ); |
|
505 | 505 | FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value ); |
506 | 506 | |
507 | - if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
507 | + if ( isset( $atts['show'] ) && $atts['show'] == 'value' ) { |
|
508 | 508 | return $value; |
509 | 509 | } |
510 | 510 | |
511 | - return self::filter_display_value($value, $field, $atts); |
|
511 | + return self::filter_display_value( $value, $field, $atts ); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | public static function &filter_display_value( $value, $field, $atts = array() ) { |
515 | - $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
515 | + $saved_value = ( isset( $atts['saved_value'] ) && $atts['saved_value'] ) ? true : false; |
|
516 | 516 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) { |
517 | 517 | return $value; |
518 | 518 | } |
@@ -520,29 +520,29 @@ discard block |
||
520 | 520 | $f_values = $f_labels = array(); |
521 | 521 | |
522 | 522 | foreach ( $field->options as $opt_key => $opt ) { |
523 | - if ( ! is_array($opt) ) { |
|
523 | + if ( ! is_array( $opt ) ) { |
|
524 | 524 | continue; |
525 | 525 | } |
526 | 526 | |
527 | - $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
528 | - $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
529 | - if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
530 | - unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
527 | + $f_labels[$opt_key] = isset( $opt['label'] ) ? $opt['label'] : reset( $opt ); |
|
528 | + $f_values[$opt_key] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[$opt_key]; |
|
529 | + if ( $f_labels[$opt_key] == $f_values[$opt_key] ) { |
|
530 | + unset( $f_values[$opt_key], $f_labels[$opt_key] ); |
|
531 | 531 | } |
532 | - unset($opt_key, $opt); |
|
532 | + unset( $opt_key, $opt ); |
|
533 | 533 | } |
534 | 534 | |
535 | - if ( ! empty($f_values) ) { |
|
535 | + if ( ! empty( $f_values ) ) { |
|
536 | 536 | foreach ( (array) $value as $v_key => $val ) { |
537 | - if ( in_array($val, $f_values) ) { |
|
538 | - $opt = array_search($val, $f_values); |
|
539 | - if ( is_array($value) ) { |
|
540 | - $value[ $v_key ] = $f_labels[ $opt ]; |
|
537 | + if ( in_array( $val, $f_values ) ) { |
|
538 | + $opt = array_search( $val, $f_values ); |
|
539 | + if ( is_array( $value ) ) { |
|
540 | + $value[$v_key] = $f_labels[$opt]; |
|
541 | 541 | } else { |
542 | - $value = $f_labels[ $opt ]; |
|
542 | + $value = $f_labels[$opt]; |
|
543 | 543 | } |
544 | 544 | } |
545 | - unset($v_key, $val); |
|
545 | + unset( $v_key, $val ); |
|
546 | 546 | } |
547 | 547 | } |
548 | 548 | |
@@ -555,9 +555,9 @@ discard block |
||
555 | 555 | } |
556 | 556 | |
557 | 557 | public static function entry_sidebar( $entry ) { |
558 | - $data = maybe_unserialize($entry->description); |
|
559 | - $date_format = get_option('date_format'); |
|
560 | - $time_format = get_option('time_format'); |
|
558 | + $data = maybe_unserialize( $entry->description ); |
|
559 | + $date_format = get_option( 'date_format' ); |
|
560 | + $time_format = get_option( 'time_format' ); |
|
561 | 561 | if ( isset( $data['browser'] ) ) { |
562 | 562 | $browser = FrmEntryFormat::get_browser( $data['browser'] ); |
563 | 563 | } |
@@ -2,201 +2,201 @@ discard block |
||
2 | 2 | |
3 | 3 | class FrmEntriesController { |
4 | 4 | |
5 | - public static function menu() { |
|
5 | + public static function menu() { |
|
6 | 6 | FrmAppHelper::force_capability( 'frm_view_entries' ); |
7 | 7 | |
8 | - add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
8 | + add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
9 | 9 | |
10 | 10 | if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) { |
11 | 11 | $menu_name = FrmAppHelper::get_menu_name(); |
12 | 12 | add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' ); |
13 | 13 | add_filter( 'get_user_option_manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' ); |
14 | 14 | add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' ); |
15 | - } |
|
16 | - } |
|
15 | + } |
|
16 | + } |
|
17 | 17 | |
18 | - /* Display in Back End */ |
|
19 | - public static function route() { |
|
18 | + /* Display in Back End */ |
|
19 | + public static function route() { |
|
20 | 20 | $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
21 | 21 | |
22 | - switch ( $action ) { |
|
23 | - case 'show': |
|
24 | - case 'destroy': |
|
25 | - case 'destroy_all': |
|
26 | - return self::$action(); |
|
22 | + switch ( $action ) { |
|
23 | + case 'show': |
|
24 | + case 'destroy': |
|
25 | + case 'destroy_all': |
|
26 | + return self::$action(); |
|
27 | 27 | |
28 | - default: |
|
29 | - do_action( 'frm_entry_action_route', $action ); |
|
30 | - if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
31 | - return; |
|
32 | - } |
|
28 | + default: |
|
29 | + do_action( 'frm_entry_action_route', $action ); |
|
30 | + if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
31 | + return; |
|
32 | + } |
|
33 | 33 | |
34 | - return self::display_list(); |
|
35 | - } |
|
36 | - } |
|
34 | + return self::display_list(); |
|
35 | + } |
|
36 | + } |
|
37 | 37 | |
38 | 38 | public static function contextual_help( $help, $screen_id, $screen ) { |
39 | - // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
40 | - if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
41 | - return $help; |
|
42 | - } |
|
39 | + // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
40 | + if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
41 | + return $help; |
|
42 | + } |
|
43 | 43 | |
44 | 44 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
45 | 45 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
46 | 46 | if ( $page != 'formidable-entries' || ( ! empty( $action ) && $action != 'list' ) ) { |
47 | - return $help; |
|
48 | - } |
|
47 | + return $help; |
|
48 | + } |
|
49 | 49 | |
50 | 50 | unset( $action, $page ); |
51 | 51 | |
52 | - $screen->add_help_tab( array( |
|
53 | - 'id' => 'formidable-entries-tab', |
|
54 | - 'title' => __( 'Overview', 'formidable' ), |
|
52 | + $screen->add_help_tab( array( |
|
53 | + 'id' => 'formidable-entries-tab', |
|
54 | + 'title' => __( 'Overview', 'formidable' ), |
|
55 | 55 | 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
56 | - )); |
|
56 | + )); |
|
57 | 57 | |
58 | - $screen->set_help_sidebar( |
|
58 | + $screen->set_help_sidebar( |
|
59 | 59 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
60 | 60 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' . |
61 | 61 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>' |
62 | - ); |
|
62 | + ); |
|
63 | 63 | |
64 | - return $help; |
|
65 | - } |
|
64 | + return $help; |
|
65 | + } |
|
66 | 66 | |
67 | 67 | public static function manage_columns( $columns ) { |
68 | - global $frm_vars, $wpdb; |
|
68 | + global $frm_vars, $wpdb; |
|
69 | 69 | $form_id = FrmForm::get_current_form_id(); |
70 | 70 | |
71 | 71 | $columns[ $form_id . '_id' ] = 'ID'; |
72 | 72 | $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
73 | 73 | |
74 | - if ( ! $form_id ) { |
|
75 | - return $columns; |
|
76 | - } |
|
74 | + if ( ! $form_id ) { |
|
75 | + return $columns; |
|
76 | + } |
|
77 | 77 | |
78 | - $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
78 | + $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
79 | 79 | |
80 | - foreach ( $form_cols as $form_col ) { |
|
80 | + foreach ( $form_cols as $form_col ) { |
|
81 | 81 | if ( FrmField::is_no_save_field( $form_col->type ) ) { |
82 | - continue; |
|
83 | - } |
|
82 | + continue; |
|
83 | + } |
|
84 | 84 | |
85 | - if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) { |
|
85 | + if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) { |
|
86 | 86 | $sub_form_cols = FrmField::get_all_for_form( $form_col->field_options['form_select'] ); |
87 | 87 | |
88 | - if ( $sub_form_cols ) { |
|
89 | - foreach ( $sub_form_cols as $k => $sub_form_col ) { |
|
88 | + if ( $sub_form_cols ) { |
|
89 | + foreach ( $sub_form_cols as $k => $sub_form_col ) { |
|
90 | 90 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
91 | - unset( $sub_form_cols[ $k ] ); |
|
92 | - continue; |
|
93 | - } |
|
91 | + unset( $sub_form_cols[ $k ] ); |
|
92 | + continue; |
|
93 | + } |
|
94 | 94 | $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
95 | - unset($sub_form_col); |
|
96 | - } |
|
97 | - } |
|
98 | - unset($sub_form_cols); |
|
99 | - } else { |
|
100 | - $col_id = $form_col->field_key; |
|
101 | - if ( $form_col->form_id != $form_id ) { |
|
95 | + unset($sub_form_col); |
|
96 | + } |
|
97 | + } |
|
98 | + unset($sub_form_cols); |
|
99 | + } else { |
|
100 | + $col_id = $form_col->field_key; |
|
101 | + if ( $form_col->form_id != $form_id ) { |
|
102 | 102 | $col_id .= '-_-form' . $form_col->form_id; |
103 | - } |
|
103 | + } |
|
104 | 104 | |
105 | - if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
105 | + if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
106 | 106 | $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
107 | - } |
|
107 | + } |
|
108 | 108 | $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
109 | - } |
|
110 | - } |
|
109 | + } |
|
110 | + } |
|
111 | 111 | |
112 | 112 | $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' ); |
113 | 113 | $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
114 | 114 | $columns[ $form_id . '_ip' ] = 'IP'; |
115 | 115 | |
116 | - $frm_vars['cols'] = $columns; |
|
116 | + $frm_vars['cols'] = $columns; |
|
117 | 117 | |
118 | 118 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
119 | 119 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) { |
120 | 120 | add_screen_option( 'per_page', array( 'label' => __( 'Entries', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_entries_per_page' ) ); |
121 | - } |
|
121 | + } |
|
122 | 122 | |
123 | - return $columns; |
|
124 | - } |
|
123 | + return $columns; |
|
124 | + } |
|
125 | 125 | |
126 | 126 | public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) { |
127 | 127 | $menu_name = FrmAppHelper::get_menu_name(); |
128 | 128 | $this_page_name = 'manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden'; |
129 | 129 | if ( $meta_key != $this_page_name || $meta_value == $prev_value ) { |
130 | - return $check; |
|
131 | - } |
|
130 | + return $check; |
|
131 | + } |
|
132 | 132 | |
133 | 133 | if ( empty( $prev_value ) ) { |
134 | 134 | $prev_value = get_metadata( 'user', $object_id, $meta_key, true ); |
135 | 135 | } |
136 | 136 | |
137 | - global $frm_vars; |
|
138 | - //add a check so we don't create a loop |
|
139 | - $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
137 | + global $frm_vars; |
|
138 | + //add a check so we don't create a loop |
|
139 | + $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
140 | 140 | |
141 | - return $check; |
|
142 | - } |
|
141 | + return $check; |
|
142 | + } |
|
143 | 143 | |
144 | - //add hidden columns back from other forms |
|
144 | + //add hidden columns back from other forms |
|
145 | 145 | public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) { |
146 | 146 | $menu_name = FrmAppHelper::get_menu_name(); |
147 | 147 | $sanitized = sanitize_title( $menu_name ); |
148 | 148 | $this_page_name = 'manage' . $sanitized . '_page_formidable-entriescolumnshidden'; |
149 | 149 | if ( $meta_key != $this_page_name ) { |
150 | - return; |
|
151 | - } |
|
152 | - |
|
153 | - global $frm_vars; |
|
154 | - if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
155 | - return; //don't continue if there's no previous value |
|
156 | - } |
|
157 | - |
|
158 | - foreach ( $meta_value as $mk => $mv ) { |
|
159 | - //remove blank values |
|
160 | - if ( empty( $mv ) ) { |
|
161 | - unset( $meta_value[ $mk ] ); |
|
162 | - } |
|
163 | - } |
|
164 | - |
|
165 | - $cur_form_prefix = reset($meta_value); |
|
166 | - $cur_form_prefix = explode('_', $cur_form_prefix); |
|
167 | - $cur_form_prefix = $cur_form_prefix[0]; |
|
168 | - $save = false; |
|
169 | - |
|
170 | - foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
150 | + return; |
|
151 | + } |
|
152 | + |
|
153 | + global $frm_vars; |
|
154 | + if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
155 | + return; //don't continue if there's no previous value |
|
156 | + } |
|
157 | + |
|
158 | + foreach ( $meta_value as $mk => $mv ) { |
|
159 | + //remove blank values |
|
160 | + if ( empty( $mv ) ) { |
|
161 | + unset( $meta_value[ $mk ] ); |
|
162 | + } |
|
163 | + } |
|
164 | + |
|
165 | + $cur_form_prefix = reset($meta_value); |
|
166 | + $cur_form_prefix = explode('_', $cur_form_prefix); |
|
167 | + $cur_form_prefix = $cur_form_prefix[0]; |
|
168 | + $save = false; |
|
169 | + |
|
170 | + foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
171 | 171 | if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) { |
172 | - //don't add blank cols or process included cols |
|
173 | - continue; |
|
174 | - } |
|
172 | + //don't add blank cols or process included cols |
|
173 | + continue; |
|
174 | + } |
|
175 | 175 | |
176 | 176 | $form_prefix = explode( '_', $prev_hidden ); |
177 | - $form_prefix = $form_prefix[0]; |
|
178 | - if ( $form_prefix == $cur_form_prefix ) { |
|
179 | - //don't add back columns that are meant to be hidden |
|
180 | - continue; |
|
181 | - } |
|
177 | + $form_prefix = $form_prefix[0]; |
|
178 | + if ( $form_prefix == $cur_form_prefix ) { |
|
179 | + //don't add back columns that are meant to be hidden |
|
180 | + continue; |
|
181 | + } |
|
182 | 182 | |
183 | - $meta_value[] = $prev_hidden; |
|
184 | - $save = true; |
|
185 | - unset($form_prefix); |
|
186 | - } |
|
183 | + $meta_value[] = $prev_hidden; |
|
184 | + $save = true; |
|
185 | + unset($form_prefix); |
|
186 | + } |
|
187 | 187 | |
188 | 188 | if ( $save ) { |
189 | - $user = wp_get_current_user(); |
|
189 | + $user = wp_get_current_user(); |
|
190 | 190 | update_user_option( $user->ID, $this_page_name, $meta_value, true ); |
191 | - } |
|
192 | - } |
|
191 | + } |
|
192 | + } |
|
193 | 193 | |
194 | 194 | public static function save_per_page( $save, $option, $value ) { |
195 | - if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
196 | - $save = (int) $value; |
|
197 | - } |
|
198 | - return $save; |
|
199 | - } |
|
195 | + if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
196 | + $save = (int) $value; |
|
197 | + } |
|
198 | + return $save; |
|
199 | + } |
|
200 | 200 | |
201 | 201 | public static function sortable_columns() { |
202 | 202 | $form_id = FrmForm::get_current_form_id(); |
@@ -222,122 +222,122 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | public static function hidden_columns( $result ) { |
225 | - global $frm_vars; |
|
225 | + global $frm_vars; |
|
226 | 226 | |
227 | 227 | $form_id = FrmForm::get_current_form_id(); |
228 | 228 | |
229 | - $return = false; |
|
230 | - foreach ( (array) $result as $r ) { |
|
231 | - if ( ! empty( $r ) ) { |
|
232 | - $form_prefix = explode( '_', $r ); |
|
233 | - $form_prefix = $form_prefix[0]; |
|
229 | + $return = false; |
|
230 | + foreach ( (array) $result as $r ) { |
|
231 | + if ( ! empty( $r ) ) { |
|
232 | + $form_prefix = explode( '_', $r ); |
|
233 | + $form_prefix = $form_prefix[0]; |
|
234 | 234 | |
235 | - if ( (int) $form_prefix == (int) $form_id ) { |
|
236 | - $return = true; |
|
237 | - break; |
|
238 | - } |
|
235 | + if ( (int) $form_prefix == (int) $form_id ) { |
|
236 | + $return = true; |
|
237 | + break; |
|
238 | + } |
|
239 | 239 | |
240 | - unset($form_prefix); |
|
241 | - } |
|
242 | - } |
|
240 | + unset($form_prefix); |
|
241 | + } |
|
242 | + } |
|
243 | 243 | |
244 | - if ( $return ) { |
|
244 | + if ( $return ) { |
|
245 | 245 | return $result; |
246 | 246 | } |
247 | 247 | |
248 | - $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
249 | - $max_columns = 8; |
|
250 | - if ( $i <= $max_columns ) { |
|
248 | + $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
249 | + $max_columns = 8; |
|
250 | + if ( $i <= $max_columns ) { |
|
251 | 251 | return $result; |
252 | 252 | } |
253 | 253 | |
254 | - global $frm_vars; |
|
255 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
256 | - $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
257 | - } |
|
254 | + global $frm_vars; |
|
255 | + if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
256 | + $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
257 | + } |
|
258 | 258 | |
259 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
260 | - $result = $frm_vars['current_form']->options['hidden_cols']; |
|
261 | - } else { |
|
262 | - $cols = $frm_vars['cols']; |
|
263 | - $cols = array_reverse($cols, true); |
|
259 | + if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
260 | + $result = $frm_vars['current_form']->options['hidden_cols']; |
|
261 | + } else { |
|
262 | + $cols = $frm_vars['cols']; |
|
263 | + $cols = array_reverse($cols, true); |
|
264 | 264 | |
265 | 265 | $result[] = $form_id . '_id'; |
266 | - $i--; |
|
266 | + $i--; |
|
267 | 267 | |
268 | 268 | $result[] = $form_id . '_item_key'; |
269 | - $i--; |
|
269 | + $i--; |
|
270 | 270 | |
271 | 271 | foreach ( $cols as $col_key => $col ) { |
272 | - if ( $i > $max_columns ) { |
|
272 | + if ( $i > $max_columns ) { |
|
273 | 273 | $result[] = $col_key; |
274 | 274 | } |
275 | - //remove some columns by default |
|
276 | - $i--; |
|
277 | - unset($col_key, $col); |
|
278 | - } |
|
279 | - } |
|
275 | + //remove some columns by default |
|
276 | + $i--; |
|
277 | + unset($col_key, $col); |
|
278 | + } |
|
279 | + } |
|
280 | 280 | |
281 | - return $result; |
|
282 | - } |
|
281 | + return $result; |
|
282 | + } |
|
283 | 283 | |
284 | 284 | public static function display_list( $message = '', $errors = array() ) { |
285 | - global $wpdb, $frm_vars; |
|
285 | + global $wpdb, $frm_vars; |
|
286 | 286 | |
287 | 287 | $form = FrmForm::get_current_form(); |
288 | 288 | $params = FrmForm::get_admin_params( $form ); |
289 | 289 | |
290 | - if ( $form ) { |
|
291 | - $params['form'] = $form->id; |
|
292 | - $frm_vars['current_form'] = $form; |
|
290 | + if ( $form ) { |
|
291 | + $params['form'] = $form->id; |
|
292 | + $frm_vars['current_form'] = $form; |
|
293 | 293 | |
294 | - if ( 'trash' == $form->status ) { |
|
295 | - $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); |
|
296 | - $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) ); |
|
297 | - $errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete ); |
|
298 | - unset( $time_to_delete, $delete_timestamp ); |
|
299 | - } |
|
294 | + if ( 'trash' == $form->status ) { |
|
295 | + $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); |
|
296 | + $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) ); |
|
297 | + $errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete ); |
|
298 | + unset( $time_to_delete, $delete_timestamp ); |
|
299 | + } |
|
300 | 300 | } |
301 | 301 | |
302 | - $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
302 | + $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
303 | 303 | |
304 | - $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
304 | + $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
305 | 305 | |
306 | - $pagenum = $wp_list_table->get_pagenum(); |
|
306 | + $pagenum = $wp_list_table->get_pagenum(); |
|
307 | 307 | |
308 | - $wp_list_table->prepare_items(); |
|
308 | + $wp_list_table->prepare_items(); |
|
309 | 309 | |
310 | - $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
311 | - if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
310 | + $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
311 | + if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
312 | 312 | $url = add_query_arg( 'paged', $total_pages ); |
313 | - if ( headers_sent() ) { |
|
314 | - echo FrmAppHelper::js_redirect($url); |
|
315 | - } else { |
|
316 | - wp_redirect( esc_url_raw( $url ) ); |
|
317 | - } |
|
318 | - die(); |
|
319 | - } |
|
320 | - |
|
321 | - if ( empty($message) && isset($_GET['import-message']) ) { |
|
322 | - $message = __( 'Your import is complete', 'formidable' ); |
|
323 | - } |
|
313 | + if ( headers_sent() ) { |
|
314 | + echo FrmAppHelper::js_redirect($url); |
|
315 | + } else { |
|
316 | + wp_redirect( esc_url_raw( $url ) ); |
|
317 | + } |
|
318 | + die(); |
|
319 | + } |
|
320 | + |
|
321 | + if ( empty($message) && isset($_GET['import-message']) ) { |
|
322 | + $message = __( 'Your import is complete', 'formidable' ); |
|
323 | + } |
|
324 | 324 | |
325 | 325 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' ); |
326 | - } |
|
326 | + } |
|
327 | 327 | |
328 | - /* Back End CRUD */ |
|
328 | + /* Back End CRUD */ |
|
329 | 329 | public static function show( $id = 0 ) { |
330 | - FrmAppHelper::permission_check('frm_view_entries'); |
|
330 | + FrmAppHelper::permission_check('frm_view_entries'); |
|
331 | 331 | |
332 | - if ( ! $id ) { |
|
332 | + if ( ! $id ) { |
|
333 | 333 | $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
334 | 334 | |
335 | - if ( ! $id ) { |
|
335 | + if ( ! $id ) { |
|
336 | 336 | $id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' ); |
337 | - } |
|
338 | - } |
|
337 | + } |
|
338 | + } |
|
339 | 339 | |
340 | - $entry = FrmEntry::getOne($id, true); |
|
340 | + $entry = FrmEntry::getOne($id, true); |
|
341 | 341 | if ( ! $entry ) { |
342 | 342 | echo '<div id="form_show_entry_page" class="wrap">' . |
343 | 343 | __( 'You are trying to view an entry that does not exist.', 'formidable' ) . |
@@ -345,110 +345,110 @@ discard block |
||
345 | 345 | return; |
346 | 346 | } |
347 | 347 | |
348 | - $data = maybe_unserialize($entry->description); |
|
348 | + $data = maybe_unserialize($entry->description); |
|
349 | 349 | if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) { |
350 | 350 | $data = array( 'referrer' => $data ); |
351 | 351 | } |
352 | 352 | |
353 | 353 | $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' ); |
354 | - $to_emails = array(); |
|
354 | + $to_emails = array(); |
|
355 | 355 | |
356 | 356 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' ); |
357 | - } |
|
357 | + } |
|
358 | 358 | |
359 | - public static function destroy() { |
|
360 | - FrmAppHelper::permission_check('frm_delete_entries'); |
|
359 | + public static function destroy() { |
|
360 | + FrmAppHelper::permission_check('frm_delete_entries'); |
|
361 | 361 | |
362 | 362 | $params = FrmForm::get_admin_params(); |
363 | 363 | |
364 | - if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
365 | - //unlink entry from post |
|
366 | - global $wpdb; |
|
364 | + if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
365 | + //unlink entry from post |
|
366 | + global $wpdb; |
|
367 | 367 | $wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
368 | - } |
|
368 | + } |
|
369 | 369 | |
370 | - $message = ''; |
|
371 | - if ( FrmEntry::destroy( $params['id'] ) ) { |
|
372 | - $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
373 | - } |
|
370 | + $message = ''; |
|
371 | + if ( FrmEntry::destroy( $params['id'] ) ) { |
|
372 | + $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
373 | + } |
|
374 | 374 | |
375 | - self::display_list( $message ); |
|
376 | - } |
|
375 | + self::display_list( $message ); |
|
376 | + } |
|
377 | 377 | |
378 | - public static function destroy_all() { |
|
379 | - if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
380 | - $frm_settings = FrmAppHelper::get_settings(); |
|
381 | - wp_die( $frm_settings->admin_permission ); |
|
382 | - } |
|
378 | + public static function destroy_all() { |
|
379 | + if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
380 | + $frm_settings = FrmAppHelper::get_settings(); |
|
381 | + wp_die( $frm_settings->admin_permission ); |
|
382 | + } |
|
383 | 383 | |
384 | - global $wpdb; |
|
384 | + global $wpdb; |
|
385 | 385 | $params = FrmForm::get_admin_params(); |
386 | - $message = ''; |
|
387 | - $errors = array(); |
|
388 | - $form_id = (int) $params['form']; |
|
386 | + $message = ''; |
|
387 | + $errors = array(); |
|
388 | + $form_id = (int) $params['form']; |
|
389 | 389 | |
390 | - if ( $form_id ) { |
|
391 | - $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
390 | + if ( $form_id ) { |
|
391 | + $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
392 | 392 | $action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 ); |
393 | 393 | |
394 | - if ( $action ) { |
|
395 | - // this action takes a while, so only trigger it if there are posts to delete |
|
396 | - foreach ( $entry_ids as $entry_id ) { |
|
397 | - do_action( 'frm_before_destroy_entry', $entry_id ); |
|
398 | - unset( $entry_id ); |
|
399 | - } |
|
400 | - } |
|
401 | - |
|
402 | - $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) ); |
|
403 | - $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) ); |
|
404 | - if ( $results ) { |
|
394 | + if ( $action ) { |
|
395 | + // this action takes a while, so only trigger it if there are posts to delete |
|
396 | + foreach ( $entry_ids as $entry_id ) { |
|
397 | + do_action( 'frm_before_destroy_entry', $entry_id ); |
|
398 | + unset( $entry_id ); |
|
399 | + } |
|
400 | + } |
|
401 | + |
|
402 | + $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) ); |
|
403 | + $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) ); |
|
404 | + if ( $results ) { |
|
405 | 405 | FrmEntry::clear_cache(); |
406 | - $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
407 | - } |
|
408 | - } else { |
|
409 | - $errors = __( 'No entries were specified', 'formidable' ); |
|
410 | - } |
|
411 | - |
|
412 | - self::display_list( $message, $errors ); |
|
413 | - } |
|
414 | - |
|
415 | - public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
416 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
417 | - return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
418 | - } |
|
419 | - |
|
420 | - public static function get_form( $filename, $form, $title, $description ) { |
|
421 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
422 | - return FrmFormsController::get_form( $form, $title, $description ); |
|
423 | - } |
|
424 | - |
|
425 | - public static function process_entry( $errors = '', $ajax = false ) { |
|
406 | + $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
407 | + } |
|
408 | + } else { |
|
409 | + $errors = __( 'No entries were specified', 'formidable' ); |
|
410 | + } |
|
411 | + |
|
412 | + self::display_list( $message, $errors ); |
|
413 | + } |
|
414 | + |
|
415 | + public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
416 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
417 | + return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
418 | + } |
|
419 | + |
|
420 | + public static function get_form( $filename, $form, $title, $description ) { |
|
421 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
422 | + return FrmFormsController::get_form( $form, $title, $description ); |
|
423 | + } |
|
424 | + |
|
425 | + public static function process_entry( $errors = '', $ajax = false ) { |
|
426 | 426 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
427 | 427 | if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { |
428 | - return; |
|
429 | - } |
|
428 | + return; |
|
429 | + } |
|
430 | 430 | |
431 | - global $frm_vars; |
|
431 | + global $frm_vars; |
|
432 | 432 | |
433 | 433 | $form = FrmForm::getOne( $form_id ); |
434 | - if ( ! $form ) { |
|
435 | - return; |
|
436 | - } |
|
434 | + if ( ! $form ) { |
|
435 | + return; |
|
436 | + } |
|
437 | 437 | |
438 | 438 | $params = FrmForm::get_params( $form ); |
439 | 439 | |
440 | - if ( ! isset( $frm_vars['form_params'] ) ) { |
|
441 | - $frm_vars['form_params'] = array(); |
|
442 | - } |
|
440 | + if ( ! isset( $frm_vars['form_params'] ) ) { |
|
441 | + $frm_vars['form_params'] = array(); |
|
442 | + } |
|
443 | 443 | $frm_vars['form_params'][ $form->id ] = $params; |
444 | 444 | |
445 | 445 | if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
446 | - return; |
|
447 | - } |
|
446 | + return; |
|
447 | + } |
|
448 | 448 | |
449 | - if ( $errors == '' && ! $ajax ) { |
|
449 | + if ( $errors == '' && ! $ajax ) { |
|
450 | 450 | $errors = FrmEntryValidate::validate( $_POST ); |
451 | - } |
|
451 | + } |
|
452 | 452 | |
453 | 453 | /** |
454 | 454 | * Use this filter to add trigger actions and add errors after |
@@ -459,102 +459,102 @@ discard block |
||
459 | 459 | |
460 | 460 | $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
461 | 461 | |
462 | - if ( empty( $errors ) ) { |
|
462 | + if ( empty( $errors ) ) { |
|
463 | 463 | $_POST['frm_skip_cookie'] = 1; |
464 | - if ( $params['action'] == 'create' ) { |
|
464 | + if ( $params['action'] == 'create' ) { |
|
465 | 465 | if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
466 | 466 | $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
467 | - } |
|
468 | - } |
|
467 | + } |
|
468 | + } |
|
469 | 469 | |
470 | - do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
470 | + do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
471 | 471 | unset( $_POST['frm_skip_cookie'] ); |
472 | - } |
|
473 | - } |
|
474 | - |
|
475 | - public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
476 | - self::_delete_entry( $atts['id'], $form ); |
|
477 | - return $url; |
|
478 | - } |
|
479 | - |
|
480 | - //Delete entry if not redirected |
|
481 | - public static function delete_entry_after_save( $atts ) { |
|
482 | - self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
483 | - } |
|
484 | - |
|
485 | - private static function _delete_entry( $entry_id, $form ) { |
|
486 | - if ( ! $form ) { |
|
487 | - return; |
|
488 | - } |
|
489 | - |
|
490 | - $form->options = maybe_unserialize( $form->options ); |
|
491 | - if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
492 | - FrmEntry::destroy( $entry_id ); |
|
493 | - } |
|
494 | - } |
|
472 | + } |
|
473 | + } |
|
474 | + |
|
475 | + public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
476 | + self::_delete_entry( $atts['id'], $form ); |
|
477 | + return $url; |
|
478 | + } |
|
479 | + |
|
480 | + //Delete entry if not redirected |
|
481 | + public static function delete_entry_after_save( $atts ) { |
|
482 | + self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
483 | + } |
|
484 | + |
|
485 | + private static function _delete_entry( $entry_id, $form ) { |
|
486 | + if ( ! $form ) { |
|
487 | + return; |
|
488 | + } |
|
489 | + |
|
490 | + $form->options = maybe_unserialize( $form->options ); |
|
491 | + if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
492 | + FrmEntry::destroy( $entry_id ); |
|
493 | + } |
|
494 | + } |
|
495 | 495 | |
496 | 496 | public static function show_entry_shortcode( $atts ) { |
497 | 497 | return FrmEntryFormat::show_entry( $atts ); |
498 | 498 | } |
499 | 499 | |
500 | - public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
|
501 | - $field = FrmField::getOne($meta->field_id); |
|
502 | - if ( ! $field ) { |
|
503 | - return $value; |
|
504 | - } |
|
500 | + public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
|
501 | + $field = FrmField::getOne($meta->field_id); |
|
502 | + if ( ! $field ) { |
|
503 | + return $value; |
|
504 | + } |
|
505 | 505 | |
506 | - $value = self::filter_display_value($value, $field, $atts); |
|
507 | - return $value; |
|
508 | - } |
|
506 | + $value = self::filter_display_value($value, $field, $atts); |
|
507 | + return $value; |
|
508 | + } |
|
509 | 509 | |
510 | 510 | public static function &filter_shortcode_value( $value, $tag, $atts, $field ) { |
511 | - $plain_text = add_filter('frm_plain_text_email', true); |
|
511 | + $plain_text = add_filter('frm_plain_text_email', true); |
|
512 | 512 | FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value ); |
513 | 513 | |
514 | - if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
515 | - return $value; |
|
516 | - } |
|
514 | + if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
515 | + return $value; |
|
516 | + } |
|
517 | 517 | |
518 | - return self::filter_display_value($value, $field, $atts); |
|
519 | - } |
|
518 | + return self::filter_display_value($value, $field, $atts); |
|
519 | + } |
|
520 | 520 | |
521 | - public static function &filter_display_value( $value, $field, $atts = array() ) { |
|
522 | - $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
521 | + public static function &filter_display_value( $value, $field, $atts = array() ) { |
|
522 | + $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
523 | 523 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) { |
524 | - return $value; |
|
525 | - } |
|
526 | - |
|
527 | - $f_values = $f_labels = array(); |
|
528 | - |
|
529 | - foreach ( $field->options as $opt_key => $opt ) { |
|
530 | - if ( ! is_array($opt) ) { |
|
531 | - continue; |
|
532 | - } |
|
533 | - |
|
534 | - $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
535 | - $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
536 | - if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
537 | - unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
538 | - } |
|
539 | - unset($opt_key, $opt); |
|
540 | - } |
|
541 | - |
|
542 | - if ( ! empty($f_values) ) { |
|
543 | - foreach ( (array) $value as $v_key => $val ) { |
|
544 | - if ( in_array($val, $f_values) ) { |
|
545 | - $opt = array_search($val, $f_values); |
|
546 | - if ( is_array($value) ) { |
|
547 | - $value[ $v_key ] = $f_labels[ $opt ]; |
|
548 | - } else { |
|
549 | - $value = $f_labels[ $opt ]; |
|
550 | - } |
|
551 | - } |
|
552 | - unset($v_key, $val); |
|
553 | - } |
|
554 | - } |
|
555 | - |
|
556 | - return $value; |
|
557 | - } |
|
524 | + return $value; |
|
525 | + } |
|
526 | + |
|
527 | + $f_values = $f_labels = array(); |
|
528 | + |
|
529 | + foreach ( $field->options as $opt_key => $opt ) { |
|
530 | + if ( ! is_array($opt) ) { |
|
531 | + continue; |
|
532 | + } |
|
533 | + |
|
534 | + $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
535 | + $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
536 | + if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
537 | + unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
538 | + } |
|
539 | + unset($opt_key, $opt); |
|
540 | + } |
|
541 | + |
|
542 | + if ( ! empty($f_values) ) { |
|
543 | + foreach ( (array) $value as $v_key => $val ) { |
|
544 | + if ( in_array($val, $f_values) ) { |
|
545 | + $opt = array_search($val, $f_values); |
|
546 | + if ( is_array($value) ) { |
|
547 | + $value[ $v_key ] = $f_labels[ $opt ]; |
|
548 | + } else { |
|
549 | + $value = $f_labels[ $opt ]; |
|
550 | + } |
|
551 | + } |
|
552 | + unset($v_key, $val); |
|
553 | + } |
|
554 | + } |
|
555 | + |
|
556 | + return $value; |
|
557 | + } |
|
558 | 558 | |
559 | 559 | public static function get_params( $form = null ) { |
560 | 560 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_params' ); |
@@ -562,13 +562,13 @@ discard block |
||
562 | 562 | } |
563 | 563 | |
564 | 564 | public static function entry_sidebar( $entry ) { |
565 | - $data = maybe_unserialize($entry->description); |
|
566 | - $date_format = get_option('date_format'); |
|
567 | - $time_format = get_option('time_format'); |
|
565 | + $data = maybe_unserialize($entry->description); |
|
566 | + $date_format = get_option('date_format'); |
|
567 | + $time_format = get_option('time_format'); |
|
568 | 568 | if ( isset( $data['browser'] ) ) { |
569 | 569 | $browser = FrmEntryFormat::get_browser( $data['browser'] ); |
570 | 570 | } |
571 | 571 | |
572 | 572 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' ); |
573 | - } |
|
573 | + } |
|
574 | 574 | } |
@@ -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,42 +54,42 @@ 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 ( strpos( $setting, 'color' ) !== false || in_array( $setting, array( 'error_bg', 'error_border', 'error_text' ) ) ) { |
81 | - //if is a color |
|
81 | + //if is a color |
|
82 | 82 | $new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] ); |
83 | 83 | } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) { |
84 | 84 | $new_instance['post_content'][ $setting ] = 0; |
85 | - } else if ( $setting == 'font' ) { |
|
86 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
87 | - } |
|
88 | - } |
|
85 | + } else if ( $setting == 'font' ) { |
|
86 | + $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
87 | + } |
|
88 | + } |
|
89 | 89 | |
90 | 90 | $all_instances[ $number ] = $new_instance; |
91 | 91 | |
92 | - $action_ids[] = $this->save($new_instance); |
|
92 | + $action_ids[] = $this->save($new_instance); |
|
93 | 93 | |
94 | 94 | } |
95 | 95 | |
@@ -98,27 +98,27 @@ discard block |
||
98 | 98 | return $action_ids; |
99 | 99 | } |
100 | 100 | |
101 | - /** |
|
102 | - * Create static css file |
|
103 | - */ |
|
101 | + /** |
|
102 | + * Create static css file |
|
103 | + */ |
|
104 | 104 | public function save_settings() { |
105 | 105 | $filename = FrmAppHelper::plugin_path() . '/css/custom_theme.css.php'; |
106 | 106 | update_option( 'frm_last_style_update', date('njGi') ); |
107 | 107 | |
108 | - if ( ! is_file($filename) ) { |
|
109 | - return; |
|
110 | - } |
|
108 | + if ( ! is_file($filename) ) { |
|
109 | + return; |
|
110 | + } |
|
111 | 111 | |
112 | 112 | $css = $this->get_css_content( $filename ); |
113 | 113 | |
114 | 114 | $create_file = new FrmCreateFile( array( 'folder_name' => 'formidable/css', 'file_name' => 'formidablepro.css' ) ); |
115 | 115 | $create_file->create_file( $css ); |
116 | 116 | |
117 | - update_option('frmpro_css', $css); |
|
117 | + update_option('frmpro_css', $css); |
|
118 | 118 | |
119 | 119 | $this->clear_cache(); |
120 | 120 | |
121 | - set_transient('frmpro_css', $css); |
|
121 | + set_transient('frmpro_css', $css); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | private function get_css_content( $filename ) { |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | $saving = true; |
128 | 128 | $frm_style = $this; |
129 | 129 | |
130 | - ob_start(); |
|
131 | - include( $filename ); |
|
130 | + ob_start(); |
|
131 | + include( $filename ); |
|
132 | 132 | $css .= preg_replace( '/\/\*(.|\s)*?\*\//', '', str_replace( array( "\r\n", "\r", "\n", "\t", ' ' ), '', ob_get_contents() ) ); |
133 | - ob_end_clean(); |
|
133 | + ob_end_clean(); |
|
134 | 134 | |
135 | 135 | return $css; |
136 | 136 | } |
@@ -150,272 +150,272 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | public function destroy( $id ) { |
153 | - return wp_delete_post($id); |
|
154 | - } |
|
153 | + return wp_delete_post($id); |
|
154 | + } |
|
155 | 155 | |
156 | - public function get_one() { |
|
157 | - if ( 'default' == $this->id ) { |
|
158 | - $style = $this->get_default_style(); |
|
159 | - if ( $style ) { |
|
160 | - $this->id = $style->ID; |
|
161 | - } else { |
|
162 | - $this->id = 0; |
|
163 | - } |
|
164 | - return $style; |
|
165 | - } |
|
156 | + public function get_one() { |
|
157 | + if ( 'default' == $this->id ) { |
|
158 | + $style = $this->get_default_style(); |
|
159 | + if ( $style ) { |
|
160 | + $this->id = $style->ID; |
|
161 | + } else { |
|
162 | + $this->id = 0; |
|
163 | + } |
|
164 | + return $style; |
|
165 | + } |
|
166 | 166 | |
167 | - $style = get_post($this->id); |
|
167 | + $style = get_post($this->id); |
|
168 | 168 | |
169 | - if ( ! $style ) { |
|
170 | - return $style; |
|
171 | - } |
|
169 | + if ( ! $style ) { |
|
170 | + return $style; |
|
171 | + } |
|
172 | 172 | |
173 | - $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
173 | + $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
174 | 174 | |
175 | - $default_values = $this->get_defaults(); |
|
175 | + $default_values = $this->get_defaults(); |
|
176 | 176 | |
177 | - // fill default values |
|
178 | - $style->post_content = $this->override_defaults($style->post_content); |
|
179 | - $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
177 | + // fill default values |
|
178 | + $style->post_content = $this->override_defaults($style->post_content); |
|
179 | + $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
180 | 180 | |
181 | - return $style; |
|
182 | - } |
|
181 | + return $style; |
|
182 | + } |
|
183 | 183 | |
184 | - public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) { |
|
185 | - $post_atts = array( |
|
184 | + public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) { |
|
185 | + $post_atts = array( |
|
186 | 186 | 'post_type' => FrmStylesController::$post_type, |
187 | 187 | 'post_status' => 'publish', |
188 | 188 | 'numberposts' => $limit, |
189 | 189 | 'orderby' => $orderby, |
190 | 190 | 'order' => $order, |
191 | - ); |
|
191 | + ); |
|
192 | 192 | |
193 | - $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts'); |
|
193 | + $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts'); |
|
194 | 194 | |
195 | - if ( empty($temp_styles) ) { |
|
196 | - global $wpdb; |
|
197 | - // make sure there wasn't a conflict with the query |
|
195 | + if ( empty($temp_styles) ) { |
|
196 | + global $wpdb; |
|
197 | + // make sure there wasn't a conflict with the query |
|
198 | 198 | $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' ); |
199 | - $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results'); |
|
200 | - |
|
201 | - if ( empty($temp_styles) ) { |
|
202 | - // create a new style if there are none |
|
203 | - $new = $this->get_new(); |
|
204 | - $new->post_title = $new->post_name = __( 'Formidable Style', 'formidable' ); |
|
205 | - $new->menu_order = 1; |
|
206 | - $new = $this->save( (array) $new); |
|
207 | - $this->update('default'); |
|
208 | - |
|
209 | - $post_atts['include'] = $new; |
|
210 | - |
|
211 | - $temp_styles = get_posts( $post_atts ); |
|
212 | - } |
|
213 | - } |
|
214 | - |
|
215 | - $default_values = $this->get_defaults(); |
|
216 | - $default_style = false; |
|
217 | - |
|
218 | - $styles = array(); |
|
219 | - foreach ( $temp_styles as $style ) { |
|
220 | - $this->id = $style->ID; |
|
221 | - if ( $style->menu_order ) { |
|
222 | - if ( $default_style ) { |
|
223 | - // only return one default |
|
224 | - $style->menu_order = 0; |
|
225 | - } else { |
|
226 | - // check for a default style |
|
227 | - $default_style = $style->ID; |
|
228 | - } |
|
229 | - } |
|
230 | - |
|
231 | - $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
232 | - |
|
233 | - // fill default values |
|
234 | - $style->post_content = $this->override_defaults($style->post_content); |
|
235 | - $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
199 | + $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results'); |
|
200 | + |
|
201 | + if ( empty($temp_styles) ) { |
|
202 | + // create a new style if there are none |
|
203 | + $new = $this->get_new(); |
|
204 | + $new->post_title = $new->post_name = __( 'Formidable Style', 'formidable' ); |
|
205 | + $new->menu_order = 1; |
|
206 | + $new = $this->save( (array) $new); |
|
207 | + $this->update('default'); |
|
208 | + |
|
209 | + $post_atts['include'] = $new; |
|
210 | + |
|
211 | + $temp_styles = get_posts( $post_atts ); |
|
212 | + } |
|
213 | + } |
|
214 | + |
|
215 | + $default_values = $this->get_defaults(); |
|
216 | + $default_style = false; |
|
217 | + |
|
218 | + $styles = array(); |
|
219 | + foreach ( $temp_styles as $style ) { |
|
220 | + $this->id = $style->ID; |
|
221 | + if ( $style->menu_order ) { |
|
222 | + if ( $default_style ) { |
|
223 | + // only return one default |
|
224 | + $style->menu_order = 0; |
|
225 | + } else { |
|
226 | + // check for a default style |
|
227 | + $default_style = $style->ID; |
|
228 | + } |
|
229 | + } |
|
230 | + |
|
231 | + $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
232 | + |
|
233 | + // fill default values |
|
234 | + $style->post_content = $this->override_defaults($style->post_content); |
|
235 | + $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
236 | 236 | |
237 | 237 | $styles[ $style->ID ] = $style; |
238 | - } |
|
238 | + } |
|
239 | 239 | |
240 | - if ( ! $default_style ) { |
|
241 | - $default_style = reset($styles); |
|
240 | + if ( ! $default_style ) { |
|
241 | + $default_style = reset($styles); |
|
242 | 242 | $styles[ $default_style->ID ]->menu_order = 1; |
243 | - } |
|
243 | + } |
|
244 | 244 | |
245 | - return $styles; |
|
246 | - } |
|
245 | + return $styles; |
|
246 | + } |
|
247 | 247 | |
248 | 248 | public function get_default_style( $styles = null ) { |
249 | - if ( ! isset($styles) ) { |
|
249 | + if ( ! isset($styles) ) { |
|
250 | 250 | $styles = $this->get_all( 'menu_order', 'DESC', 1 ); |
251 | - } |
|
251 | + } |
|
252 | 252 | |
253 | - foreach ( $styles as $style ) { |
|
254 | - if ( $style->menu_order ) { |
|
255 | - return $style; |
|
256 | - } |
|
257 | - } |
|
258 | - } |
|
253 | + foreach ( $styles as $style ) { |
|
254 | + if ( $style->menu_order ) { |
|
255 | + return $style; |
|
256 | + } |
|
257 | + } |
|
258 | + } |
|
259 | 259 | |
260 | 260 | public function override_defaults( $settings ) { |
261 | - if ( ! is_array($settings) ) { |
|
262 | - return $settings; |
|
263 | - } |
|
264 | - |
|
265 | - $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height']; |
|
266 | - |
|
267 | - if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) { |
|
268 | - $settings['form_desc_size'] = $settings['description_font_size']; |
|
269 | - $settings['form_desc_color'] = $settings['description_color']; |
|
270 | - $settings['title_color'] = $settings['label_color']; |
|
271 | - } |
|
272 | - |
|
273 | - if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) { |
|
274 | - $settings['section_color'] = $settings['label_color']; |
|
275 | - $settings['section_border_color'] = $settings['border_color']; |
|
276 | - } |
|
277 | - |
|
278 | - if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) { |
|
279 | - $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
|
280 | - $settings['submit_hover_color'] = $settings['submit_text_color']; |
|
281 | - $settings['submit_hover_border_color'] = $settings['submit_border_color']; |
|
282 | - |
|
283 | - $settings['submit_active_bg_color'] = $settings['submit_bg_color']; |
|
284 | - $settings['submit_active_color'] = $settings['submit_text_color']; |
|
285 | - $settings['submit_active_border_color'] = $settings['submit_border_color']; |
|
286 | - } |
|
287 | - |
|
288 | - return $settings; |
|
261 | + if ( ! is_array($settings) ) { |
|
262 | + return $settings; |
|
263 | + } |
|
264 | + |
|
265 | + $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height']; |
|
266 | + |
|
267 | + if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) { |
|
268 | + $settings['form_desc_size'] = $settings['description_font_size']; |
|
269 | + $settings['form_desc_color'] = $settings['description_color']; |
|
270 | + $settings['title_color'] = $settings['label_color']; |
|
271 | + } |
|
272 | + |
|
273 | + if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) { |
|
274 | + $settings['section_color'] = $settings['label_color']; |
|
275 | + $settings['section_border_color'] = $settings['border_color']; |
|
276 | + } |
|
277 | + |
|
278 | + if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) { |
|
279 | + $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
|
280 | + $settings['submit_hover_color'] = $settings['submit_text_color']; |
|
281 | + $settings['submit_hover_border_color'] = $settings['submit_border_color']; |
|
282 | + |
|
283 | + $settings['submit_active_bg_color'] = $settings['submit_bg_color']; |
|
284 | + $settings['submit_active_color'] = $settings['submit_text_color']; |
|
285 | + $settings['submit_active_border_color'] = $settings['submit_border_color']; |
|
286 | + } |
|
287 | + |
|
288 | + return $settings; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | public function get_defaults() { |
292 | - return array( |
|
293 | - 'theme_css' => 'ui-lightness', |
|
294 | - 'theme_name' => 'UI Lightness', |
|
292 | + return array( |
|
293 | + 'theme_css' => 'ui-lightness', |
|
294 | + 'theme_name' => 'UI Lightness', |
|
295 | 295 | |
296 | 296 | 'center_form' => '', |
297 | - 'form_width' => '100%', |
|
298 | - 'form_align' => 'left', |
|
299 | - 'direction' => is_rtl() ? 'rtl' : 'ltr', |
|
300 | - 'fieldset' => '0px', |
|
301 | - 'fieldset_color' => '000000', |
|
302 | - 'fieldset_padding' => '0 0 15px 0', |
|
303 | - 'fieldset_bg_color' => '', |
|
304 | - |
|
305 | - 'title_size' => '20px', |
|
306 | - 'title_color' => '444444', |
|
297 | + 'form_width' => '100%', |
|
298 | + 'form_align' => 'left', |
|
299 | + 'direction' => is_rtl() ? 'rtl' : 'ltr', |
|
300 | + 'fieldset' => '0px', |
|
301 | + 'fieldset_color' => '000000', |
|
302 | + 'fieldset_padding' => '0 0 15px 0', |
|
303 | + 'fieldset_bg_color' => '', |
|
304 | + |
|
305 | + 'title_size' => '20px', |
|
306 | + 'title_color' => '444444', |
|
307 | 307 | 'title_margin_top' => '10px', |
308 | 308 | 'title_margin_bottom' => '10px', |
309 | - 'form_desc_size' => '14px', |
|
310 | - 'form_desc_color' => '666666', |
|
309 | + 'form_desc_size' => '14px', |
|
310 | + 'form_desc_color' => '666666', |
|
311 | 311 | 'form_desc_margin_top' => '10px', |
312 | 312 | 'form_desc_margin_bottom' => '25px', |
313 | 313 | |
314 | - 'font' => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif', |
|
315 | - 'font_size' => '14px', |
|
316 | - 'label_color' => '444444', |
|
317 | - 'weight' => 'bold', |
|
318 | - 'position' => 'none', |
|
319 | - 'align' => 'left', |
|
320 | - 'width' => '150px', |
|
321 | - 'required_color' => 'B94A48', |
|
322 | - 'required_weight' => 'bold', |
|
323 | - 'label_padding' => '0 0 3px 0', |
|
324 | - |
|
325 | - 'description_font_size' => '12px', |
|
326 | - 'description_color' => '666666', |
|
327 | - 'description_weight' => 'normal', |
|
328 | - 'description_style' => 'normal', |
|
329 | - 'description_align' => 'left', |
|
314 | + 'font' => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif', |
|
315 | + 'font_size' => '14px', |
|
316 | + 'label_color' => '444444', |
|
317 | + 'weight' => 'bold', |
|
318 | + 'position' => 'none', |
|
319 | + 'align' => 'left', |
|
320 | + 'width' => '150px', |
|
321 | + 'required_color' => 'B94A48', |
|
322 | + 'required_weight' => 'bold', |
|
323 | + 'label_padding' => '0 0 3px 0', |
|
324 | + |
|
325 | + 'description_font_size' => '12px', |
|
326 | + 'description_color' => '666666', |
|
327 | + 'description_weight' => 'normal', |
|
328 | + 'description_style' => 'normal', |
|
329 | + 'description_align' => 'left', |
|
330 | 330 | 'description_margin' => '0', |
331 | 331 | |
332 | - 'field_font_size' => '14px', |
|
333 | - 'field_height' => '32px', |
|
334 | - 'line_height' => 'normal', |
|
335 | - 'field_width' => '100%', |
|
336 | - 'auto_width' => false, |
|
337 | - 'field_pad' => '6px 10px', |
|
338 | - 'field_margin' => '20px', |
|
332 | + 'field_font_size' => '14px', |
|
333 | + 'field_height' => '32px', |
|
334 | + 'line_height' => 'normal', |
|
335 | + 'field_width' => '100%', |
|
336 | + 'auto_width' => false, |
|
337 | + 'field_pad' => '6px 10px', |
|
338 | + 'field_margin' => '20px', |
|
339 | 339 | 'field_weight' => 'normal', |
340 | - 'text_color' => '555555', |
|
341 | - //'border_color_hv' => 'cccccc', |
|
342 | - 'border_color' => 'cccccc', |
|
343 | - 'field_border_width' => '1px', |
|
344 | - 'field_border_style' => 'solid', |
|
345 | - |
|
346 | - 'bg_color' => 'ffffff', |
|
347 | - //'bg_color_hv' => 'ffffff', |
|
340 | + 'text_color' => '555555', |
|
341 | + //'border_color_hv' => 'cccccc', |
|
342 | + 'border_color' => 'cccccc', |
|
343 | + 'field_border_width' => '1px', |
|
344 | + 'field_border_style' => 'solid', |
|
345 | + |
|
346 | + 'bg_color' => 'ffffff', |
|
347 | + //'bg_color_hv' => 'ffffff', |
|
348 | 348 | 'remove_box_shadow' => '', |
349 | - 'bg_color_active' => 'ffffff', |
|
349 | + 'bg_color_active' => 'ffffff', |
|
350 | 350 | 'border_color_active' => '66afe9', |
351 | 351 | 'remove_box_shadow_active' => '', |
352 | - 'text_color_error' => '444444', |
|
353 | - 'bg_color_error' => 'ffffff', |
|
352 | + 'text_color_error' => '444444', |
|
353 | + 'bg_color_error' => 'ffffff', |
|
354 | 354 | 'border_color_error' => 'B94A48', |
355 | 355 | 'border_width_error' => '1px', |
356 | 356 | 'border_style_error' => 'solid', |
357 | - 'bg_color_disabled' => 'ffffff', |
|
358 | - 'border_color_disabled' => 'E5E5E5', |
|
359 | - 'text_color_disabled' => 'A1A1A1', |
|
360 | - |
|
361 | - 'radio_align' => 'block', |
|
362 | - 'check_align' => 'block', |
|
363 | - 'check_font_size' => '13px', |
|
364 | - 'check_label_color' => '444444', |
|
365 | - 'check_weight' => 'normal', |
|
366 | - |
|
367 | - 'section_font_size' => '18px', |
|
368 | - 'section_color' => '444444', |
|
369 | - 'section_weight' => 'bold', |
|
370 | - 'section_pad' => '15px 0 3px 0', |
|
371 | - 'section_mar_top' => '15px', |
|
357 | + 'bg_color_disabled' => 'ffffff', |
|
358 | + 'border_color_disabled' => 'E5E5E5', |
|
359 | + 'text_color_disabled' => 'A1A1A1', |
|
360 | + |
|
361 | + 'radio_align' => 'block', |
|
362 | + 'check_align' => 'block', |
|
363 | + 'check_font_size' => '13px', |
|
364 | + 'check_label_color' => '444444', |
|
365 | + 'check_weight' => 'normal', |
|
366 | + |
|
367 | + 'section_font_size' => '18px', |
|
368 | + 'section_color' => '444444', |
|
369 | + 'section_weight' => 'bold', |
|
370 | + 'section_pad' => '15px 0 3px 0', |
|
371 | + 'section_mar_top' => '15px', |
|
372 | 372 | 'section_mar_bottom' => '12px', |
373 | - 'section_bg_color' => '', |
|
374 | - 'section_border_color' => 'e8e8e8', |
|
375 | - 'section_border_width' => '2px', |
|
376 | - 'section_border_style' => 'solid', |
|
377 | - 'section_border_loc' => '-top', |
|
378 | - 'collapse_icon' => '6', |
|
379 | - 'collapse_pos' => 'after', |
|
380 | - 'repeat_icon' => '1', |
|
381 | - |
|
382 | - 'submit_style' => false, |
|
383 | - 'submit_font_size' => '14px', |
|
384 | - 'submit_width' => 'auto', |
|
385 | - 'submit_height' => 'auto', |
|
386 | - 'submit_bg_color' => 'ffffff', |
|
387 | - 'submit_border_color' => 'cccccc', |
|
388 | - 'submit_border_width' => '1px', |
|
389 | - 'submit_text_color' => '444444', |
|
390 | - 'submit_weight' => 'normal', |
|
391 | - 'submit_border_radius' => '4px', |
|
392 | - 'submit_bg_img' => '', |
|
393 | - 'submit_margin' => '10px', |
|
394 | - 'submit_padding' => '6px 11px', |
|
395 | - 'submit_shadow_color' => 'eeeeee', |
|
396 | - 'submit_hover_bg_color' => 'efefef', |
|
397 | - 'submit_hover_color' => '444444', |
|
398 | - 'submit_hover_border_color' => 'cccccc', |
|
399 | - 'submit_active_bg_color' => 'efefef', |
|
400 | - 'submit_active_color' => '444444', |
|
401 | - 'submit_active_border_color' => 'cccccc', |
|
402 | - |
|
403 | - 'border_radius' => '4px', |
|
404 | - 'error_bg' => 'F2DEDE', |
|
405 | - 'error_border' => 'EBCCD1', |
|
406 | - 'error_text' => 'B94A48', |
|
407 | - 'error_font_size' => '14px', |
|
408 | - |
|
409 | - 'success_bg_color' => 'DFF0D8', |
|
410 | - 'success_border_color' => 'D6E9C6', |
|
411 | - 'success_text_color' => '468847', |
|
412 | - 'success_font_size' => '14px', |
|
413 | - |
|
414 | - 'important_style' => false, |
|
415 | - |
|
416 | - 'custom_css' => '', |
|
417 | - ); |
|
418 | - } |
|
373 | + 'section_bg_color' => '', |
|
374 | + 'section_border_color' => 'e8e8e8', |
|
375 | + 'section_border_width' => '2px', |
|
376 | + 'section_border_style' => 'solid', |
|
377 | + 'section_border_loc' => '-top', |
|
378 | + 'collapse_icon' => '6', |
|
379 | + 'collapse_pos' => 'after', |
|
380 | + 'repeat_icon' => '1', |
|
381 | + |
|
382 | + 'submit_style' => false, |
|
383 | + 'submit_font_size' => '14px', |
|
384 | + 'submit_width' => 'auto', |
|
385 | + 'submit_height' => 'auto', |
|
386 | + 'submit_bg_color' => 'ffffff', |
|
387 | + 'submit_border_color' => 'cccccc', |
|
388 | + 'submit_border_width' => '1px', |
|
389 | + 'submit_text_color' => '444444', |
|
390 | + 'submit_weight' => 'normal', |
|
391 | + 'submit_border_radius' => '4px', |
|
392 | + 'submit_bg_img' => '', |
|
393 | + 'submit_margin' => '10px', |
|
394 | + 'submit_padding' => '6px 11px', |
|
395 | + 'submit_shadow_color' => 'eeeeee', |
|
396 | + 'submit_hover_bg_color' => 'efefef', |
|
397 | + 'submit_hover_color' => '444444', |
|
398 | + 'submit_hover_border_color' => 'cccccc', |
|
399 | + 'submit_active_bg_color' => 'efefef', |
|
400 | + 'submit_active_color' => '444444', |
|
401 | + 'submit_active_border_color' => 'cccccc', |
|
402 | + |
|
403 | + 'border_radius' => '4px', |
|
404 | + 'error_bg' => 'F2DEDE', |
|
405 | + 'error_border' => 'EBCCD1', |
|
406 | + 'error_text' => 'B94A48', |
|
407 | + 'error_font_size' => '14px', |
|
408 | + |
|
409 | + 'success_bg_color' => 'DFF0D8', |
|
410 | + 'success_border_color' => 'D6E9C6', |
|
411 | + 'success_text_color' => '468847', |
|
412 | + 'success_font_size' => '14px', |
|
413 | + |
|
414 | + 'important_style' => false, |
|
415 | + |
|
416 | + 'custom_css' => '', |
|
417 | + ); |
|
418 | + } |
|
419 | 419 | |
420 | 420 | public function get_field_name( $field_name, $post_field = 'post_content' ) { |
421 | 421 | 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,10 +67,10 @@ 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 | |
@@ -79,17 +79,17 @@ discard block |
||
79 | 79 | foreach ( $default_settings as $setting => $default ) { |
80 | 80 | if ( strpos( $setting, 'color' ) !== false || in_array( $setting, array( 'error_bg', 'error_border', 'error_text' ) ) ) { |
81 | 81 | //if is a color |
82 | - $new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] ); |
|
83 | - } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
84 | - $new_instance['post_content'][ $setting ] = 0; |
|
82 | + $new_instance['post_content'][$setting] = str_replace( '#', '', $new_instance['post_content'][$setting] ); |
|
83 | + } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][$setting] ) ) { |
|
84 | + $new_instance['post_content'][$setting] = 0; |
|
85 | 85 | } else if ( $setting == 'font' ) { |
86 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
86 | + $new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] ); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | - $all_instances[ $number ] = $new_instance; |
|
90 | + $all_instances[$number] = $new_instance; |
|
91 | 91 | |
92 | - $action_ids[] = $this->save($new_instance); |
|
92 | + $action_ids[] = $this->save( $new_instance ); |
|
93 | 93 | |
94 | 94 | } |
95 | 95 | |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function save_settings() { |
105 | 105 | $filename = FrmAppHelper::plugin_path() . '/css/custom_theme.css.php'; |
106 | - update_option( 'frm_last_style_update', date('njGi') ); |
|
106 | + update_option( 'frm_last_style_update', date( 'njGi' ) ); |
|
107 | 107 | |
108 | - if ( ! is_file($filename) ) { |
|
108 | + if ( ! is_file( $filename ) ) { |
|
109 | 109 | return; |
110 | 110 | } |
111 | 111 | |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | $create_file = new FrmCreateFile( array( 'folder_name' => 'formidable/css', 'file_name' => 'formidablepro.css' ) ); |
115 | 115 | $create_file->create_file( $css ); |
116 | 116 | |
117 | - update_option('frmpro_css', $css); |
|
117 | + update_option( 'frmpro_css', $css ); |
|
118 | 118 | |
119 | 119 | $this->clear_cache(); |
120 | 120 | |
121 | - set_transient('frmpro_css', $css); |
|
121 | + set_transient( 'frmpro_css', $css ); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | private function get_css_content( $filename ) { |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | public function destroy( $id ) { |
153 | - return wp_delete_post($id); |
|
153 | + return wp_delete_post( $id ); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | public function get_one() { |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | return $style; |
165 | 165 | } |
166 | 166 | |
167 | - $style = get_post($this->id); |
|
167 | + $style = get_post( $this->id ); |
|
168 | 168 | |
169 | 169 | if ( ! $style ) { |
170 | 170 | return $style; |
171 | 171 | } |
172 | 172 | |
173 | - $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
173 | + $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content ); |
|
174 | 174 | |
175 | 175 | $default_values = $this->get_defaults(); |
176 | 176 | |
177 | 177 | // fill default values |
178 | - $style->post_content = $this->override_defaults($style->post_content); |
|
179 | - $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
178 | + $style->post_content = $this->override_defaults( $style->post_content ); |
|
179 | + $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
|
180 | 180 | |
181 | 181 | return $style; |
182 | 182 | } |
@@ -190,21 +190,21 @@ discard block |
||
190 | 190 | 'order' => $order, |
191 | 191 | ); |
192 | 192 | |
193 | - $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts'); |
|
193 | + $temp_styles = FrmAppHelper::check_cache( serialize( $post_atts ), 'frm_styles', $post_atts, 'get_posts' ); |
|
194 | 194 | |
195 | - if ( empty($temp_styles) ) { |
|
195 | + if ( empty( $temp_styles ) ) { |
|
196 | 196 | global $wpdb; |
197 | 197 | // make sure there wasn't a conflict with the query |
198 | 198 | $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' ); |
199 | - $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results'); |
|
199 | + $temp_styles = FrmAppHelper::check_cache( 'frm_backup_style_check', 'frm_styles', $query, 'get_results' ); |
|
200 | 200 | |
201 | - if ( empty($temp_styles) ) { |
|
201 | + if ( empty( $temp_styles ) ) { |
|
202 | 202 | // create a new style if there are none |
203 | 203 | $new = $this->get_new(); |
204 | 204 | $new->post_title = $new->post_name = __( 'Formidable Style', 'formidable' ); |
205 | 205 | $new->menu_order = 1; |
206 | - $new = $this->save( (array) $new); |
|
207 | - $this->update('default'); |
|
206 | + $new = $this->save( (array) $new ); |
|
207 | + $this->update( 'default' ); |
|
208 | 208 | |
209 | 209 | $post_atts['include'] = $new; |
210 | 210 | |
@@ -228,25 +228,25 @@ discard block |
||
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | - $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
231 | + $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content ); |
|
232 | 232 | |
233 | 233 | // fill default values |
234 | - $style->post_content = $this->override_defaults($style->post_content); |
|
235 | - $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
234 | + $style->post_content = $this->override_defaults( $style->post_content ); |
|
235 | + $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
|
236 | 236 | |
237 | - $styles[ $style->ID ] = $style; |
|
237 | + $styles[$style->ID] = $style; |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | if ( ! $default_style ) { |
241 | - $default_style = reset($styles); |
|
242 | - $styles[ $default_style->ID ]->menu_order = 1; |
|
241 | + $default_style = reset( $styles ); |
|
242 | + $styles[$default_style->ID]->menu_order = 1; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | return $styles; |
246 | 246 | } |
247 | 247 | |
248 | 248 | public function get_default_style( $styles = null ) { |
249 | - if ( ! isset($styles) ) { |
|
249 | + if ( ! isset( $styles ) ) { |
|
250 | 250 | $styles = $this->get_all( 'menu_order', 'DESC', 1 ); |
251 | 251 | } |
252 | 252 | |
@@ -258,24 +258,24 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | public function override_defaults( $settings ) { |
261 | - if ( ! is_array($settings) ) { |
|
261 | + if ( ! is_array( $settings ) ) { |
|
262 | 262 | return $settings; |
263 | 263 | } |
264 | 264 | |
265 | - $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height']; |
|
265 | + $settings['line_height'] = ( ! isset( $settings['field_height'] ) || $settings['field_height'] == '' || $settings['field_height'] == 'auto' ) ? 'normal' : $settings['field_height']; |
|
266 | 266 | |
267 | - if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) { |
|
267 | + if ( ! isset( $settings['form_desc_size'] ) && isset( $settings['description_font_size'] ) ) { |
|
268 | 268 | $settings['form_desc_size'] = $settings['description_font_size']; |
269 | 269 | $settings['form_desc_color'] = $settings['description_color']; |
270 | 270 | $settings['title_color'] = $settings['label_color']; |
271 | 271 | } |
272 | 272 | |
273 | - if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) { |
|
273 | + if ( ! isset( $settings['section_color'] ) && isset( $settings['label_color'] ) ) { |
|
274 | 274 | $settings['section_color'] = $settings['label_color']; |
275 | 275 | $settings['section_border_color'] = $settings['border_color']; |
276 | 276 | } |
277 | 277 | |
278 | - if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) { |
|
278 | + if ( ! isset( $settings['submit_hover_bg_color'] ) && isset( $settings['submit_bg_color'] ) ) { |
|
279 | 279 | $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
280 | 280 | $settings['submit_hover_color'] = $settings['submit_text_color']; |
281 | 281 | $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,12 +1,12 @@ |
||
1 | 1 | <li id="frm_delete_field_<?php echo esc_attr( $field['id'] ); ?>-<?php echo esc_attr( $opt_key ) ?>_container" class="frm_single_option"> |
2 | 2 | <a href="javascript:void(0)" class="frm_single_visible_hover frm_icon_font frm_delete_icon" data-fid="<?php echo esc_attr( $field['id'] ); ?>"> </a> |
3 | 3 | <?php if ( $field['type'] != 'select' ) { ?> |
4 | - <input type="<?php echo esc_attr( $field['type'] ) ?>" name="<?php echo esc_attr( $field_name ) ?><?php echo ( $field['type'] == 'checkbox' ) ? '[]' : ''; ?>" value="<?php echo esc_attr($field_val) ?>"<?php echo isset( $checked ) ? $checked : ''; ?>/> |
|
4 | + <input type="<?php echo esc_attr( $field['type'] ) ?>" name="<?php echo esc_attr( $field_name ) ?><?php echo ( $field['type'] == 'checkbox' ) ? '[]' : ''; ?>" value="<?php echo esc_attr( $field_val ) ?>"<?php echo isset( $checked ) ? $checked : ''; ?>/> |
|
5 | 5 | <?php } ?> |
6 | - <label class="frm_ipe_field_option field_<?php echo esc_attr( $field['id'] ) ?>_option <?php echo esc_attr( $field['separate_value'] ? 'frm_with_key' : '' ); ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>"><?php echo ($opt == '') ? __( '(Blank)', 'formidable' ) : $opt ?></label> |
|
6 | + <label class="frm_ipe_field_option field_<?php echo esc_attr( $field['id'] ) ?>_option <?php echo esc_attr( $field['separate_value'] ? 'frm_with_key' : '' ); ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>"><?php echo ( $opt == '' ) ? __( '(Blank)', 'formidable' ) : $opt ?></label> |
|
7 | 7 | <span class="frm_option_key field_<?php echo esc_attr( $field['id'] ) ?>_option_key<?php echo esc_attr( $field['separate_value'] ? '' : ' frm_hidden' ); ?>"> |
8 | 8 | <label class="frm-show-click frm_ipe_field_option_key" id="field_key_<?php echo esc_attr( $field['id'] . '-' . $opt_key ) ?>"><?php echo ( $field_val == '' ) ? esc_html__( '(Blank)', 'formidable' ) : $field_val ?></label> |
9 | 9 | </span> |
10 | 10 | </li> |
11 | 11 | <?php |
12 | -unset($field_val, $opt, $opt_key); |
|
12 | +unset( $field_val, $opt, $opt_key ); |
@@ -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> |