@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | class FrmFieldsController { |
4 | 4 | |
5 | 5 | public static function load_field() { |
6 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
6 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
7 | 7 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
8 | 8 | |
9 | 9 | $fields = $_POST['field']; |
@@ -34,17 +34,17 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | $field_name = 'item_meta[' . $field_id . ']'; |
37 | - $html_id = FrmFieldsHelper::get_html_id($field); |
|
37 | + $html_id = FrmFieldsHelper::get_html_id( $field ); |
|
38 | 38 | |
39 | 39 | ob_start(); |
40 | 40 | include( $path . '/classes/views/frm-forms/add_field.php' ); |
41 | - $field_html[ $field_id ] = ob_get_contents(); |
|
41 | + $field_html[$field_id] = ob_get_contents(); |
|
42 | 42 | ob_end_clean(); |
43 | 43 | } |
44 | 44 | |
45 | - unset($path); |
|
45 | + unset( $path ); |
|
46 | 46 | |
47 | - echo json_encode($field_html); |
|
47 | + echo json_encode( $field_html ); |
|
48 | 48 | |
49 | 49 | wp_die(); |
50 | 50 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * Create a new field with ajax |
54 | 54 | */ |
55 | 55 | public static function create() { |
56 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
56 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
57 | 57 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
58 | 58 | |
59 | 59 | $field_type = FrmAppHelper::get_post_param( 'field_type', '', 'sanitize_text_field' ); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $field = self::include_new_field( $field_type, $form_id, $section_id ); |
64 | 64 | |
65 | 65 | // this hook will allow for multiple fields to be added at once |
66 | - do_action('frm_after_field_created', $field, $form_id); |
|
66 | + do_action( 'frm_after_field_created', $field, $form_id ); |
|
67 | 67 | |
68 | 68 | wp_die(); |
69 | 69 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public static function include_new_field( $field_type, $form_id, $section_id = 0 ) { |
80 | 80 | $values = array(); |
81 | 81 | if ( FrmAppHelper::pro_is_installed() ) { |
82 | - $values['post_type'] = FrmProFormsHelper::post_type($form_id); |
|
82 | + $values['post_type'] = FrmProFormsHelper::post_type( $form_id ); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | $field_values = FrmFieldsHelper::setup_new_vars( $field_type, $form_id ); |
@@ -92,27 +92,27 @@ discard block |
||
92 | 92 | return false; |
93 | 93 | } |
94 | 94 | |
95 | - $field = self::include_single_field($field_id, $values, $form_id); |
|
95 | + $field = self::include_single_field( $field_id, $values, $form_id ); |
|
96 | 96 | |
97 | 97 | return $field; |
98 | 98 | } |
99 | 99 | |
100 | 100 | public static function edit_name( $field = 'name', $id = '' ) { |
101 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
101 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
102 | 102 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
103 | 103 | |
104 | - if ( empty($field) ) { |
|
104 | + if ( empty( $field ) ) { |
|
105 | 105 | $field = 'name'; |
106 | 106 | } |
107 | 107 | |
108 | - if ( empty($id) ) { |
|
108 | + if ( empty( $id ) ) { |
|
109 | 109 | $id = FrmAppHelper::get_post_param( 'element_id', '', 'sanitize_title' ); |
110 | 110 | $id = str_replace( 'field_label_', '', $id ); |
111 | 111 | } |
112 | 112 | |
113 | 113 | $value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_kses_post' ); |
114 | 114 | $value = trim( $value ); |
115 | - if ( trim(strip_tags($value)) == '' ) { |
|
115 | + if ( trim( strip_tags( $value ) ) == '' ) { |
|
116 | 116 | // set blank value if there is no content |
117 | 117 | $value = ''; |
118 | 118 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | public static function update_ajax_option() { |
129 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
129 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
130 | 130 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
131 | 131 | |
132 | 132 | $field_id = FrmAppHelper::get_post_param( 'field', 0, 'absint' ); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | if ( isset( $_POST['separate_value'] ) ) { |
140 | 140 | $new_val = FrmField::is_option_true( $field, 'separate_value' ) ? 0 : 1; |
141 | 141 | $field->field_options['separate_value'] = $new_val; |
142 | - unset($new_val); |
|
142 | + unset( $new_val ); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | FrmField::update( $field_id, array( |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | public static function duplicate() { |
153 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
153 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
154 | 154 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
155 | 155 | |
156 | 156 | global $wpdb; |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | |
174 | 174 | $values['field_order'] = $field_count + 1; |
175 | 175 | |
176 | - if ( ! $field_id = FrmField::create($values) ) { |
|
176 | + if ( ! $field_id = FrmField::create( $values ) ) { |
|
177 | 177 | wp_die(); |
178 | 178 | } |
179 | 179 | |
180 | - self::include_single_field($field_id, $values); |
|
180 | + self::include_single_field( $field_id, $values ); |
|
181 | 181 | |
182 | 182 | wp_die(); |
183 | 183 | } |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | * Load a single field in the form builder along with all needed variables |
187 | 187 | */ |
188 | 188 | public static function include_single_field( $field_id, $values, $form_id = 0 ) { |
189 | - $field = FrmFieldsHelper::setup_edit_vars(FrmField::getOne($field_id)); |
|
189 | + $field = FrmFieldsHelper::setup_edit_vars( FrmField::getOne( $field_id ) ); |
|
190 | 190 | $field_name = 'item_meta[' . $field_id . ']'; |
191 | - $html_id = FrmFieldsHelper::get_html_id($field); |
|
191 | + $html_id = FrmFieldsHelper::get_html_id( $field ); |
|
192 | 192 | $id = $form_id ? $form_id : $field['form_id']; |
193 | 193 | if ( $field['type'] == 'html' ) { |
194 | 194 | $field['stop_filter'] = true; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | } |
201 | 201 | |
202 | 202 | public static function destroy() { |
203 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
203 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
204 | 204 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
205 | 205 | |
206 | 206 | $field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | |
213 | 213 | //Add Single Option or Other Option |
214 | 214 | public static function add_option() { |
215 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
215 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
216 | 216 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
217 | 217 | |
218 | 218 | $id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
219 | 219 | $opt_type = FrmAppHelper::get_post_param( 'opt_type', '', 'sanitize_text_field' ); |
220 | 220 | |
221 | 221 | //Get the field |
222 | - $field = FrmField::getOne($id); |
|
222 | + $field = FrmField::getOne( $id ); |
|
223 | 223 | |
224 | 224 | if ( ! empty( $field->options ) ) { |
225 | 225 | $keys = array_keys( $field->options ); |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | $first_opt = reset( $field->options ); |
243 | 243 | $next_opt = count( $field->options ); |
244 | 244 | if ( $first_opt != '' ) { |
245 | - $next_opt++; |
|
245 | + $next_opt ++; |
|
246 | 246 | } |
247 | 247 | $opt = esc_html__( 'Option', 'formidable' ) . ' ' . $next_opt; |
248 | - unset($next_opt); |
|
248 | + unset( $next_opt ); |
|
249 | 249 | } |
250 | 250 | $field_val = $opt; |
251 | - $field->options[ $opt_key ] = $opt; |
|
251 | + $field->options[$opt_key] = $opt; |
|
252 | 252 | |
253 | 253 | //Update options in DB |
254 | 254 | FrmField::update( $id, array( 'options' => $field->options ) ); |
@@ -257,13 +257,13 @@ discard block |
||
257 | 257 | $field = array( |
258 | 258 | 'type' => $field_data->type, |
259 | 259 | 'id' => $id, |
260 | - 'separate_value' => isset($field_data->field_options['separate_value']) ? $field_data->field_options['separate_value'] : 0, |
|
260 | + 'separate_value' => isset( $field_data->field_options['separate_value'] ) ? $field_data->field_options['separate_value'] : 0, |
|
261 | 261 | 'form_id' => $field_data->form_id, |
262 | 262 | 'field_key' => $field_data->field_key, |
263 | 263 | ); |
264 | 264 | |
265 | 265 | $field_name = 'item_meta[' . $id . ']'; |
266 | - $html_id = FrmFieldsHelper::get_html_id($field); |
|
266 | + $html_id = FrmFieldsHelper::get_html_id( $field ); |
|
267 | 267 | $checked = ''; |
268 | 268 | |
269 | 269 | if ( 'other' == $opt_type ) { |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | } |
276 | 276 | |
277 | 277 | public static function edit_option() { |
278 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
278 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
279 | 279 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
280 | 280 | |
281 | 281 | $element_id = FrmAppHelper::get_post_param( 'element_id', '', 'sanitize_title' ); |
@@ -289,28 +289,28 @@ discard block |
||
289 | 289 | $new_label = $update_value; |
290 | 290 | } |
291 | 291 | |
292 | - $field = FrmField::getOne($id); |
|
292 | + $field = FrmField::getOne( $id ); |
|
293 | 293 | $separate_values = FrmField::is_option_true( $field, 'separate_value' ); |
294 | 294 | |
295 | - $this_opt_id = end($ids); |
|
296 | - $this_opt = (array) $field->options[ $this_opt_id ]; |
|
297 | - $other_opt = ( $this_opt_id && strpos( $this_opt_id, 'other') !== false ); |
|
295 | + $this_opt_id = end( $ids ); |
|
296 | + $this_opt = (array) $field->options[$this_opt_id]; |
|
297 | + $other_opt = ( $this_opt_id && strpos( $this_opt_id, 'other' ) !== false ); |
|
298 | 298 | |
299 | - $label = isset($this_opt['label']) ? $this_opt['label'] : reset($this_opt); |
|
300 | - $value = isset($this_opt['value']) ? $this_opt['value'] : ''; |
|
299 | + $label = isset( $this_opt['label'] ) ? $this_opt['label'] : reset( $this_opt ); |
|
300 | + $value = isset( $this_opt['value'] ) ? $this_opt['value'] : ''; |
|
301 | 301 | |
302 | 302 | if ( ! isset( $new_label ) ) { |
303 | 303 | $new_label = $label; |
304 | 304 | } |
305 | 305 | |
306 | - if ( isset($new_value) || isset($value) ) { |
|
307 | - $update_value = isset($new_value) ? $new_value : $value; |
|
306 | + if ( isset( $new_value ) || isset( $value ) ) { |
|
307 | + $update_value = isset( $new_value ) ? $new_value : $value; |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | if ( $update_value != $new_label && $other_opt === false && $separate_values ) { |
311 | - $field->options[ $this_opt_id ] = array( 'value' => $update_value, 'label' => $new_label ); |
|
311 | + $field->options[$this_opt_id] = array( 'value' => $update_value, 'label' => $new_label ); |
|
312 | 312 | } else { |
313 | - $field->options[ $this_opt_id ] = $orig_update_value; |
|
313 | + $field->options[$this_opt_id] = $orig_update_value; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | FrmField::update( $field->id, array( 'options' => $field->options ) ); |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | } |
320 | 320 | |
321 | 321 | public static function delete_option() { |
322 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
322 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
323 | 323 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
324 | 324 | |
325 | 325 | $field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | $opt_key = FrmAppHelper::get_post_param( 'opt_key', 0, 'sanitize_title' ); |
329 | 329 | |
330 | 330 | $options = $field->options; |
331 | - unset( $options[ $opt_key ] ); |
|
331 | + unset( $options[$opt_key] ); |
|
332 | 332 | $response = array( 'other' => true ); |
333 | 333 | |
334 | 334 | //If the deleted option is an "other" option |
@@ -394,9 +394,9 @@ discard block |
||
394 | 394 | |
395 | 395 | $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
396 | 396 | $prepop = array(); |
397 | - FrmFieldsHelper::get_bulk_prefilled_opts($prepop); |
|
397 | + FrmFieldsHelper::get_bulk_prefilled_opts( $prepop ); |
|
398 | 398 | |
399 | - $field = FrmField::getOne($field_id); |
|
399 | + $field = FrmField::getOne( $field_id ); |
|
400 | 400 | |
401 | 401 | wp_enqueue_script( 'utils' ); |
402 | 402 | wp_enqueue_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css' ); |
@@ -407,33 +407,33 @@ discard block |
||
407 | 407 | } |
408 | 408 | |
409 | 409 | public static function import_options() { |
410 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
410 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
411 | 411 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
412 | 412 | |
413 | - if ( ! is_admin() || ! current_user_can('frm_edit_forms') ) { |
|
413 | + if ( ! is_admin() || ! current_user_can( 'frm_edit_forms' ) ) { |
|
414 | 414 | return; |
415 | 415 | } |
416 | 416 | |
417 | 417 | $field_id = absint( $_POST['field_id'] ); |
418 | - $field = FrmField::getOne($field_id); |
|
418 | + $field = FrmField::getOne( $field_id ); |
|
419 | 419 | |
420 | 420 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'select' ) ) ) { |
421 | 421 | return; |
422 | 422 | } |
423 | 423 | |
424 | - $field = FrmFieldsHelper::setup_edit_vars($field); |
|
425 | - $opts = stripslashes_deep($_POST['opts']); |
|
426 | - $opts = explode("\n", rtrim($opts, "\n")); |
|
424 | + $field = FrmFieldsHelper::setup_edit_vars( $field ); |
|
425 | + $opts = stripslashes_deep( $_POST['opts'] ); |
|
426 | + $opts = explode( "\n", rtrim( $opts, "\n" ) ); |
|
427 | 427 | if ( $field['separate_value'] ) { |
428 | 428 | foreach ( $opts as $opt_key => $opt ) { |
429 | - if ( strpos($opt, '|') !== false ) { |
|
430 | - $vals = explode('|', $opt); |
|
429 | + if ( strpos( $opt, '|' ) !== false ) { |
|
430 | + $vals = explode( '|', $opt ); |
|
431 | 431 | if ( $vals[0] != $vals[1] ) { |
432 | - $opts[ $opt_key ] = array( 'label' => trim( $vals[0] ), 'value' => trim( $vals[1] ) ); |
|
432 | + $opts[$opt_key] = array( 'label' => trim( $vals[0] ), 'value' => trim( $vals[1] ) ); |
|
433 | 433 | } |
434 | - unset($vals); |
|
434 | + unset( $vals ); |
|
435 | 435 | } |
436 | - unset($opt_key, $opt); |
|
436 | + unset( $opt_key, $opt ); |
|
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
@@ -442,12 +442,12 @@ discard block |
||
442 | 442 | $other_array = array(); |
443 | 443 | foreach ( $field['options'] as $opt_key => $opt ) { |
444 | 444 | if ( $opt_key && strpos( $opt_key, 'other' ) !== false ) { |
445 | - $other_array[ $opt_key ] = $opt; |
|
445 | + $other_array[$opt_key] = $opt; |
|
446 | 446 | } |
447 | - unset($opt_key, $opt); |
|
447 | + unset( $opt_key, $opt ); |
|
448 | 448 | } |
449 | - if ( ! empty($other_array) ) { |
|
450 | - $opts = array_merge( $opts, $other_array); |
|
449 | + if ( ! empty( $other_array ) ) { |
|
450 | + $opts = array_merge( $opts, $other_array ); |
|
451 | 451 | } |
452 | 452 | } |
453 | 453 | |
@@ -462,14 +462,14 @@ discard block |
||
462 | 462 | if ( $field['type'] == 'radio' || $field['type'] == 'checkbox' ) { |
463 | 463 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php' ); |
464 | 464 | } else { |
465 | - FrmFieldsHelper::show_single_option($field); |
|
465 | + FrmFieldsHelper::show_single_option( $field ); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | wp_die(); |
469 | 469 | } |
470 | 470 | |
471 | 471 | public static function update_order() { |
472 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
472 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
473 | 473 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
474 | 474 | |
475 | 475 | $fields = FrmAppHelper::get_post_param( 'frm_field_id' ); |
@@ -486,13 +486,13 @@ discard block |
||
486 | 486 | 'rte' => 'textarea', |
487 | 487 | 'website' => 'url', |
488 | 488 | ); |
489 | - if ( isset( $type_switch[ $type ] ) ) { |
|
490 | - $type = $type_switch[ $type ]; |
|
489 | + if ( isset( $type_switch[$type] ) ) { |
|
490 | + $type = $type_switch[$type]; |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | $frm_field_selection = FrmField::field_selection(); |
494 | - $types = array_keys($frm_field_selection); |
|
495 | - if ( ! in_array($type, $types) && $type != 'captcha' ) { |
|
494 | + $types = array_keys( $frm_field_selection ); |
|
495 | + if ( ! in_array( $type, $types ) && $type != 'captcha' ) { |
|
496 | 496 | $type = 'text'; |
497 | 497 | } |
498 | 498 | |
@@ -531,19 +531,19 @@ discard block |
||
531 | 531 | |
532 | 532 | public static function input_html( $field, $echo = true ) { |
533 | 533 | $class = array(); //$field['type']; |
534 | - self::add_input_classes($field, $class); |
|
534 | + self::add_input_classes( $field, $class ); |
|
535 | 535 | |
536 | 536 | $add_html = array(); |
537 | - self::add_html_size($field, $add_html); |
|
538 | - self::add_html_length($field, $add_html); |
|
539 | - self::add_html_placeholder($field, $add_html, $class); |
|
537 | + self::add_html_size( $field, $add_html ); |
|
538 | + self::add_html_length( $field, $add_html ); |
|
539 | + self::add_html_placeholder( $field, $add_html, $class ); |
|
540 | 540 | self::add_validation_messages( $field, $add_html ); |
541 | 541 | |
542 | - $class = apply_filters('frm_field_classes', implode(' ', $class), $field); |
|
542 | + $class = apply_filters( 'frm_field_classes', implode( ' ', $class ), $field ); |
|
543 | 543 | |
544 | 544 | FrmFormsHelper::add_html_attr( $class, 'class', $add_html ); |
545 | 545 | |
546 | - self::add_shortcodes_to_html($field, $add_html); |
|
546 | + self::add_shortcodes_to_html( $field, $add_html ); |
|
547 | 547 | |
548 | 548 | $add_html = apply_filters( 'frm_field_extra_html', $add_html, $field ); |
549 | 549 | $add_html = ' ' . implode( ' ', $add_html ) . ' '; |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | } |
557 | 557 | |
558 | 558 | private static function add_input_classes( $field, array &$class ) { |
559 | - if ( isset($field['input_class']) && ! empty($field['input_class']) ) { |
|
559 | + if ( isset( $field['input_class'] ) && ! empty( $field['input_class'] ) ) { |
|
560 | 560 | $class[] = $field['input_class']; |
561 | 561 | } |
562 | 562 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | $class[] = 'dyn_default_value'; |
570 | 570 | } |
571 | 571 | |
572 | - if ( isset($field['size']) && $field['size'] > 0 ) { |
|
572 | + if ( isset( $field['size'] ) && $field['size'] > 0 ) { |
|
573 | 573 | $class[] = 'auto_width'; |
574 | 574 | } |
575 | 575 | } |
@@ -579,19 +579,19 @@ discard block |
||
579 | 579 | return; |
580 | 580 | } |
581 | 581 | |
582 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
582 | + if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
|
583 | 583 | return; |
584 | 584 | } |
585 | 585 | |
586 | - if ( is_numeric($field['size']) ) { |
|
586 | + if ( is_numeric( $field['size'] ) ) { |
|
587 | 587 | $field['size'] .= 'px'; |
588 | 588 | } |
589 | 589 | |
590 | - $important = apply_filters('frm_use_important_width', 1, $field); |
|
590 | + $important = apply_filters( 'frm_use_important_width', 1, $field ); |
|
591 | 591 | // Note: This inline styling must stay since we cannot realistically set a class for every possible field size |
592 | 592 | $add_html['style'] = 'style="width:' . esc_attr( $field['size'] ) . ( $important ? ' !important' : '' ) . '"'; |
593 | 593 | |
594 | - self::add_html_cols($field, $add_html); |
|
594 | + self::add_html_cols( $field, $add_html ); |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | private static function add_html_cols( $field, array &$add_html ) { |
@@ -608,13 +608,13 @@ discard block |
||
608 | 608 | ); |
609 | 609 | |
610 | 610 | // include "col" for valid html |
611 | - $unit = trim(preg_replace('/[0-9]+/', '', $field['size'])); |
|
611 | + $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
|
612 | 612 | |
613 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
613 | + if ( ! isset( $calc[$unit] ) ) { |
|
614 | 614 | return; |
615 | 615 | } |
616 | 616 | |
617 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
617 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit]; |
|
618 | 618 | |
619 | 619 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
620 | 620 | } |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | return; |
626 | 626 | } |
627 | 627 | |
628 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
628 | + if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
|
629 | 629 | // don't load on form builder page |
630 | 630 | return; |
631 | 631 | } |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | if ( $frm_settings->use_html && ! in_array( $field['type'], array( 'select', 'radio', 'checkbox', 'hidden' ) ) ) { |
658 | 658 | // use HMTL5 placeholder with js fallback |
659 | 659 | $add_html['placeholder'] = 'placeholder="' . esc_attr( $field['default_value'] ) . '"'; |
660 | - wp_enqueue_script('jquery-placeholder'); |
|
660 | + wp_enqueue_script( 'jquery-placeholder' ); |
|
661 | 661 | } else if ( ! $frm_settings->use_html ) { |
662 | 662 | $val = str_replace( array( "\r\n", "\n" ), '\r', addslashes( str_replace( ''', "'", esc_attr( $field['default_value'] ) ) ) ); |
663 | 663 | $add_html['data-frmval'] = 'data-frmval="' . esc_attr( $val ) . '"'; |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | $format = FrmEntryValidate::phone_format( $field ); |
685 | 685 | $format = substr( $format, 2, -2 ); |
686 | 686 | $key = 'pattern'; |
687 | - $add_html[ $key ] = $key . '="' . esc_attr( $format ) . '"'; |
|
687 | + $add_html[$key] = $key . '="' . esc_attr( $format ) . '"'; |
|
688 | 688 | } |
689 | 689 | } |
690 | 690 | |
@@ -698,15 +698,15 @@ discard block |
||
698 | 698 | continue; |
699 | 699 | } |
700 | 700 | |
701 | - if ( is_numeric($k) && strpos($v, '=') ) { |
|
701 | + if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
|
702 | 702 | $add_html[] = $v; |
703 | - } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
704 | - $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
|
703 | + } else if ( ! empty( $k ) && isset( $add_html[$k] ) ) { |
|
704 | + $add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] ); |
|
705 | 705 | } else { |
706 | - $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
|
706 | + $add_html[$k] = $k . '="' . esc_attr( $v ) . '"'; |
|
707 | 707 | } |
708 | 708 | |
709 | - unset($k, $v); |
|
709 | + unset( $k, $v ); |
|
710 | 710 | } |
711 | 711 | } |
712 | 712 | |
@@ -722,8 +722,8 @@ discard block |
||
722 | 722 | } |
723 | 723 | |
724 | 724 | public static function check_label( $opt ) { |
725 | - if ( is_array($opt) ) { |
|
726 | - $opt = (isset($opt['label']) ? $opt['label'] : reset($opt)); |
|
725 | + if ( is_array( $opt ) ) { |
|
726 | + $opt = ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) ); |
|
727 | 727 | } |
728 | 728 | |
729 | 729 | return $opt; |