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