@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return; |
164 | 164 | } |
165 | 165 | |
166 | - $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][ $selected_form ] ) ? $form['xml'][ $selected_form ] : ''; |
|
166 | + $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][$selected_form] ) ? $form['xml'][$selected_form] : ''; |
|
167 | 167 | if ( empty( $selected_xml ) || strpos( $selected_xml, 'http' ) !== 0 ) { |
168 | 168 | return; |
169 | 169 | } |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | * @param string $value |
179 | 179 | */ |
180 | 180 | private static function get_selected_in_form( $form, $value = 'form' ) { |
181 | - if ( ! empty( $form ) && isset( $form[ $value ] ) && ! empty( $form[ $value ] ) ) { |
|
182 | - return $form[ $value ]; |
|
181 | + if ( ! empty( $form ) && isset( $form[$value] ) && ! empty( $form[$value] ) ) { |
|
182 | + return $form[$value]; |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | return ''; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | if ( $for === 'view' ) { |
211 | - $item_key = is_array( $view_keys ) ? $view_keys[ $form_key ] : $view_keys; |
|
211 | + $item_key = is_array( $view_keys ) ? $view_keys[$form_key] : $view_keys; |
|
212 | 212 | $shortcode = '[display-frm-data id=%1$s filter=limited]'; |
213 | 213 | } elseif ( $for === 'form' ) { |
214 | 214 | $item_key = $form_key; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | continue; |
224 | 224 | } |
225 | 225 | |
226 | - $page_ids[ $for ] = wp_insert_post( |
|
226 | + $page_ids[$for] = wp_insert_post( |
|
227 | 227 | array( |
228 | 228 | 'post_title' => $name, |
229 | 229 | 'post_type' => 'page', |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash |
378 | 378 | $file_type = sanitize_option( 'upload_path', $_FILES['frm_import_file']['name'] ); |
379 | 379 | $file_type = strtolower( pathinfo( $file_type, PATHINFO_EXTENSION ) ); |
380 | - if ( 'xml' !== $file_type && isset( $export_format[ $file_type ] ) ) { |
|
380 | + if ( 'xml' !== $file_type && isset( $export_format[$file_type] ) ) { |
|
381 | 381 | // allow other file types to be imported |
382 | 382 | do_action( 'frm_before_import_' . $file_type ); |
383 | 383 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | foreach ( $type as $tb_type ) { |
472 | 472 | $where = array(); |
473 | 473 | $join = ''; |
474 | - $table = $tables[ $tb_type ]; |
|
474 | + $table = $tables[$tb_type]; |
|
475 | 475 | |
476 | 476 | $select = $table . '.id'; |
477 | 477 | $query_vars = array(); |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | $table . '.parent_form_id' => $args['ids'], |
487 | 487 | ); |
488 | 488 | } else { |
489 | - $where[ $table . '.status !' ] = 'draft'; |
|
489 | + $where[$table . '.status !'] = 'draft'; |
|
490 | 490 | } |
491 | 491 | break; |
492 | 492 | case 'actions': |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | case 'items': |
500 | 500 | // $join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
501 | 501 | if ( $args['ids'] ) { |
502 | - $where[ $table . '.form_id' ] = $args['ids']; |
|
502 | + $where[$table . '.form_id'] = $args['ids']; |
|
503 | 503 | } |
504 | 504 | break; |
505 | 505 | case 'styles': |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | } |
541 | 541 | } |
542 | 542 | |
543 | - $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
|
543 | + $records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select ); |
|
544 | 544 | unset( $tb_type ); |
545 | 545 | } |
546 | 546 | |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | $no_export_fields = FrmField::no_save_fields(); |
712 | 712 | foreach ( $csv_fields as $k => $f ) { |
713 | 713 | if ( in_array( $f->type, $no_export_fields, true ) ) { |
714 | - unset( $csv_fields[ $k ] ); |
|
714 | + unset( $csv_fields[$k] ); |
|
715 | 715 | } |
716 | 716 | } |
717 | 717 |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | if ( $new_val !== $value ) { |
212 | - $new_values[ $key ] = $new_val; |
|
212 | + $new_values[$key] = $new_val; |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | foreach ( $values as $value_key => $value ) { |
242 | 242 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
243 | - $new_values[ $value_key ] = $value; |
|
243 | + $new_values[$value_key] = $value; |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
@@ -323,15 +323,15 @@ discard block |
||
323 | 323 | $existing_keys = array_keys( $values['item_meta'] ); |
324 | 324 | foreach ( $all_fields as $fid ) { |
325 | 325 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
326 | - $values['item_meta'][ $fid->id ] = ''; |
|
326 | + $values['item_meta'][$fid->id] = ''; |
|
327 | 327 | } |
328 | - $field_array[ $fid->id ] = $fid; |
|
328 | + $field_array[$fid->id] = $fid; |
|
329 | 329 | } |
330 | 330 | unset( $all_fields ); |
331 | 331 | |
332 | 332 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
333 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
334 | - $field = $field_array[ $field_id ]; |
|
333 | + if ( isset( $field_array[$field_id] ) ) { |
|
334 | + $field = $field_array[$field_id]; |
|
335 | 335 | } else { |
336 | 336 | $field = FrmField::getOne( $field_id ); |
337 | 337 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | continue; |
341 | 341 | } |
342 | 342 | |
343 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
343 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
344 | 344 | if ( $is_settings_page ) { |
345 | 345 | self::get_settings_page_html( $values, $field ); |
346 | 346 | |
@@ -355,22 +355,22 @@ discard block |
||
355 | 355 | $update_options = apply_filters( 'frm_field_options_to_update', $update_options ); |
356 | 356 | |
357 | 357 | foreach ( $update_options as $opt => $default ) { |
358 | - $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default; |
|
359 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
358 | + $field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default; |
|
359 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
363 | 363 | |
364 | 364 | $new_field = array( |
365 | 365 | 'field_options' => $field->field_options, |
366 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
366 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
367 | 367 | ); |
368 | 368 | |
369 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
370 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
369 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
370 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
371 | 371 | if ( is_array( $option ) ) { |
372 | 372 | foreach ( $option as $key => $item ) { |
373 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
373 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | } |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | */ |
401 | 401 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
402 | 402 | if ( $field->type === 'textarea' && |
403 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
404 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
403 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
404 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
405 | 405 | |
406 | 406 | $new_field['field_options']['max'] = ''; |
407 | 407 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
410 | 410 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
411 | 411 | */ |
412 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
412 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
@@ -484,11 +484,11 @@ discard block |
||
484 | 484 | * Updating the settings page |
485 | 485 | */ |
486 | 486 | private static function get_settings_page_html( $values, &$field ) { |
487 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
487 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
488 | 488 | $prev_opts = array(); |
489 | 489 | $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); |
490 | 490 | |
491 | - $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; |
|
491 | + $field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html; |
|
492 | 492 | } elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) { |
493 | 493 | $prev_opts = $field->field_options; |
494 | 494 | } |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | foreach ( $field_cols as $col => $default ) { |
515 | 515 | $default = ( $default === '' ) ? $field->{$col} : $default; |
516 | 516 | |
517 | - $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; |
|
517 | + $new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default; |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | // Don't save the template option. |
@@ -939,8 +939,8 @@ discard block |
||
939 | 939 | self::maybe_get_form( $form ); |
940 | 940 | } |
941 | 941 | |
942 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
943 | - return $frm_vars['form_params'][ $form->id ]; |
|
942 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
943 | + return $frm_vars['form_params'][$form->id]; |
|
944 | 944 | } |
945 | 945 | |
946 | 946 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -969,15 +969,15 @@ discard block |
||
969 | 969 | // If there are two forms on the same page, make sure not to submit both. |
970 | 970 | foreach ( $default_values as $var => $default ) { |
971 | 971 | if ( $var == 'action' ) { |
972 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
972 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
973 | 973 | } else { |
974 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
974 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
975 | 975 | } |
976 | 976 | unset( $var, $default ); |
977 | 977 | } |
978 | 978 | } else { |
979 | 979 | foreach ( $default_values as $var => $default ) { |
980 | - $values[ $var ] = $default; |
|
980 | + $values[$var] = $default; |
|
981 | 981 | unset( $var, $default ); |
982 | 982 | } |
983 | 983 | } |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | 'sdir' => '', |
1004 | 1004 | ); |
1005 | 1005 | foreach ( $defaults as $var => $default ) { |
1006 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1006 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1007 | 1007 | } |
1008 | 1008 | |
1009 | 1009 | return $values; |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | 'keep_post' => '', |
1032 | 1032 | ); |
1033 | 1033 | foreach ( $defaults as $var => $default ) { |
1034 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1034 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1035 | 1035 | } |
1036 | 1036 | |
1037 | 1037 | return $values; |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | $form = $atts['form']; |
1135 | 1135 | $default = isset( $atts['default'] ) ? $atts['default'] : ''; |
1136 | 1136 | |
1137 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default; |
|
1137 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default; |
|
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | /** |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | $groups = FrmFormActionsController::form_action_groups(); |
209 | 209 | $group = 'misc'; |
210 | 210 | |
211 | - if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) { |
|
211 | + if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) { |
|
212 | 212 | $group = $action_options['group']; |
213 | - } elseif ( isset( $groups[ $this->id_base ] ) ) { |
|
213 | + } elseif ( isset( $groups[$this->id_base] ) ) { |
|
214 | 214 | $group = $this->id_base; |
215 | 215 | } else { |
216 | 216 | foreach ( $groups as $name => $check_group ) { |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
224 | - $groups[ $group ]['id'] = $group; |
|
225 | - return $groups[ $group ]; |
|
224 | + $groups[$group]['id'] = $group; |
|
225 | + return $groups[$group]; |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @return integer $post_id |
334 | 334 | */ |
335 | 335 | public function maybe_create_action( $action, $forms ) { |
336 | - if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] == 'updated' ) { |
|
336 | + if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] == 'updated' ) { |
|
337 | 337 | // Update action only |
338 | 338 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
339 | 339 | $post_id = $this->save_settings( $action ); |
@@ -356,18 +356,18 @@ discard block |
||
356 | 356 | $switch = $this->get_global_switch_fields(); |
357 | 357 | |
358 | 358 | foreach ( (array) $action->post_content as $key => $val ) { |
359 | - if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
|
360 | - $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
|
359 | + if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) { |
|
360 | + $action->post_content[$key] = $frm_duplicate_ids[$val]; |
|
361 | 361 | } elseif ( ! is_array( $val ) ) { |
362 | - $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
|
363 | - } elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
|
362 | + $action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val ); |
|
363 | + } elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) { |
|
364 | 364 | // loop through each value if empty |
365 | - if ( empty( $switch[ $key ] ) ) { |
|
366 | - $switch[ $key ] = array_keys( $val ); |
|
365 | + if ( empty( $switch[$key] ) ) { |
|
366 | + $switch[$key] = array_keys( $val ); |
|
367 | 367 | } |
368 | 368 | |
369 | - foreach ( $switch[ $key ] as $subkey ) { |
|
370 | - $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
|
369 | + foreach ( $switch[$key] as $subkey ) { |
|
370 | + $action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val ); |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
@@ -385,20 +385,20 @@ discard block |
||
385 | 385 | foreach ( $subkey as $subkey2 ) { |
386 | 386 | foreach ( (array) $val as $ck => $cv ) { |
387 | 387 | if ( is_array( $cv ) ) { |
388 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
|
389 | - } elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
|
390 | - $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
|
388 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv ); |
|
389 | + } elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) { |
|
390 | + $action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]]; |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | } |
394 | 394 | } else { |
395 | 395 | foreach ( (array) $val as $ck => $cv ) { |
396 | 396 | if ( is_array( $cv ) ) { |
397 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
|
398 | - } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
|
399 | - $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
|
397 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv ); |
|
398 | + } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) { |
|
399 | + $action[$ck] = $frm_duplicate_ids[$cv]; |
|
400 | 400 | } elseif ( $ck == $subkey ) { |
401 | - $action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] ); |
|
401 | + $action[$ck] = $this->maybe_switch_field_ids( $action[$ck] ); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | } |
@@ -422,10 +422,10 @@ discard block |
||
422 | 422 | } |
423 | 423 | |
424 | 424 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
425 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
425 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
426 | 426 | // Sanitizing removes scripts and <email> type of values. |
427 | 427 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
428 | - $settings = wp_unslash( $_POST[ $this->option_name ] ); |
|
428 | + $settings = wp_unslash( $_POST[$this->option_name] ); |
|
429 | 429 | } else { |
430 | 430 | return; |
431 | 431 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | foreach ( $settings as $number => $new_instance ) { |
436 | 436 | $this->_set( $number ); |
437 | 437 | |
438 | - $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); |
|
438 | + $old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array(); |
|
439 | 439 | |
440 | 440 | if ( ! isset( $new_instance['post_status'] ) ) { |
441 | 441 | $new_instance['post_status'] = 'draft'; |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
474 | 474 | |
475 | 475 | if ( false !== $instance ) { |
476 | - $all_instances[ $number ] = $instance; |
|
476 | + $all_instances[$number] = $instance; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | $action_ids[] = $this->save_settings( $instance ); |
@@ -555,12 +555,12 @@ discard block |
||
555 | 555 | // some plugins/themes are formatting the post_excerpt |
556 | 556 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
557 | 557 | |
558 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
558 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
559 | 559 | continue; |
560 | 560 | } |
561 | 561 | |
562 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
563 | - $settings[ $action->ID ] = $action; |
|
562 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
563 | + $settings[$action->ID] = $action; |
|
564 | 564 | |
565 | 565 | if ( count( $settings ) >= $limit ) { |
566 | 566 | break; |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | 'limit' => 99, |
594 | 594 | 'post_status' => $default_status, |
595 | 595 | ); |
596 | - $args = wp_parse_args( $args, $defaults ); |
|
596 | + $args = wp_parse_args( $args, $defaults ); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | /** |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | |
660 | 660 | $action = $this->prepare_action( $action ); |
661 | 661 | |
662 | - $settings[ $action->ID ] = $action; |
|
662 | + $settings[$action->ID] = $action; |
|
663 | 663 | } |
664 | 664 | |
665 | 665 | if ( 1 === $limit ) { |
@@ -702,10 +702,10 @@ discard block |
||
702 | 702 | |
703 | 703 | foreach ( $default_values as $k => $vals ) { |
704 | 704 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
705 | - if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
705 | + if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
706 | 706 | continue; |
707 | 707 | } |
708 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
708 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
709 | 709 | } |
710 | 710 | } |
711 | 711 | |
@@ -788,14 +788,14 @@ discard block |
||
788 | 788 | * Migrate settings from form->options into new action. |
789 | 789 | */ |
790 | 790 | public function migrate_to_2( $form, $update = 'update' ) { |
791 | - $action = $this->prepare_new( $form->id ); |
|
791 | + $action = $this->prepare_new( $form->id ); |
|
792 | 792 | FrmAppHelper::unserialize_or_decode( $form->options ); |
793 | 793 | |
794 | 794 | // fill with existing options |
795 | 795 | foreach ( $action->post_content as $name => $val ) { |
796 | - if ( isset( $form->options[ $name ] ) ) { |
|
797 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
798 | - unset( $form->options[ $name ] ); |
|
796 | + if ( isset( $form->options[$name] ) ) { |
|
797 | + $action->post_content[$name] = $form->options[$name]; |
|
798 | + unset( $form->options[$name] ); |
|
799 | 799 | } |
800 | 800 | } |
801 | 801 | |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | $stop = $stop ? false : true; |
862 | 862 | } |
863 | 863 | |
864 | - $met[ $stop ] = $stop; |
|
864 | + $met[$stop] = $stop; |
|
865 | 865 | } |
866 | 866 | |
867 | 867 | if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) { |
@@ -915,8 +915,8 @@ discard block |
||
915 | 915 | private static function get_value_from_entry( $entry, $field_id ) { |
916 | 916 | $observed_value = ''; |
917 | 917 | |
918 | - if ( isset( $entry->metas[ $field_id ] ) ) { |
|
919 | - $observed_value = $entry->metas[ $field_id ]; |
|
918 | + if ( isset( $entry->metas[$field_id] ) ) { |
|
919 | + $observed_value = $entry->metas[$field_id]; |
|
920 | 920 | } elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) { |
921 | 921 | $field = FrmField::getOne( $field_id ); |
922 | 922 | $observed_value = FrmProEntryMetaHelper::get_post_or_meta_value( |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | public function insert_installed_addon( $plugins ) { |
45 | - $plugins[ $this->plugin_slug ] = $this; |
|
45 | + $plugins[$this->plugin_slug] = $this; |
|
46 | 46 | |
47 | 47 | return $plugins; |
48 | 48 | } |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | public static function get_addon( $plugin_slug ) { |
51 | 51 | $plugins = apply_filters( 'frm_installed_addons', array() ); |
52 | 52 | $plugin = false; |
53 | - if ( isset( $plugins[ $plugin_slug ] ) ) { |
|
54 | - $plugin = $plugins[ $plugin_slug ]; |
|
53 | + if ( isset( $plugins[$plugin_slug] ) ) { |
|
54 | + $plugin = $plugins[$plugin_slug]; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | return $plugin; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | } else { |
112 | 112 | $api = new FrmFormApi( $this->license ); |
113 | 113 | $plugins = $api->get_api_info(); |
114 | - $_data = $plugins[ $item_id ]; |
|
114 | + $_data = $plugins[$item_id]; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | $_data['sections'] = array( |
@@ -340,19 +340,19 @@ discard block |
||
340 | 340 | |
341 | 341 | if ( $this->is_current_version( $transient ) ) { |
342 | 342 | // Make sure it doesn't show there is an update if plugin is up-to-date. |
343 | - if ( isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
344 | - unset( $transient->response[ $this->plugin_folder ] ); |
|
343 | + if ( isset( $transient->response[$this->plugin_folder] ) ) { |
|
344 | + unset( $transient->response[$this->plugin_folder] ); |
|
345 | 345 | } |
346 | - } elseif ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
347 | - $this->prepare_update_details( $transient->response[ $this->plugin_folder ] ); |
|
346 | + } elseif ( isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) ) { |
|
347 | + $this->prepare_update_details( $transient->response[$this->plugin_folder] ); |
|
348 | 348 | |
349 | 349 | // if the transient has expired, clear the update and trigger it again |
350 | - if ( $transient->response[ $this->plugin_folder ] === false ) { |
|
350 | + if ( $transient->response[$this->plugin_folder] === false ) { |
|
351 | 351 | if ( ! $this->has_been_cleared() ) { |
352 | 352 | $this->cleared_plugins(); |
353 | 353 | $this->manually_queue_update(); |
354 | 354 | } |
355 | - unset( $transient->response[ $this->plugin_folder ] ); |
|
355 | + unset( $transient->response[$this->plugin_folder] ); |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | } |
441 | 441 | |
442 | 442 | private function is_current_version( $transient ) { |
443 | - if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) { |
|
443 | + if ( empty( $transient->checked ) || ! isset( $transient->checked[$this->plugin_folder] ) ) { |
|
444 | 444 | return false; |
445 | 445 | } |
446 | 446 | |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | return true; |
450 | 450 | } |
451 | 451 | |
452 | - return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] === $transient->response[ $this->plugin_folder ]->new_version; |
|
452 | + return isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) && $transient->checked[$this->plugin_folder] === $transient->response[$this->plugin_folder]->new_version; |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | private function has_been_cleared() { |
@@ -564,8 +564,8 @@ discard block |
||
564 | 564 | $response['message'] = $response['status']; |
565 | 565 | } else { |
566 | 566 | $messages = $this->get_messages(); |
567 | - if ( is_string( $response['status'] ) && isset( $messages[ $response['status'] ] ) ) { |
|
568 | - $response['message'] = $messages[ $response['status'] ]; |
|
567 | + if ( is_string( $response['status'] ) && isset( $messages[$response['status']] ) ) { |
|
568 | + $response['message'] = $messages[$response['status']]; |
|
569 | 569 | } else { |
570 | 570 | $response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) ); |
571 | 571 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | // Validate the number format. |
72 | 72 | if ( ! is_numeric( $args['value'] ) && '' !== $args['value'] ) { |
73 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
73 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | // validate number settings |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | if ( $frm_settings->use_html && $maxnum !== '' && $minnum !== '' ) { |
83 | 83 | $value = (float) $args['value']; |
84 | 84 | if ( $value < $minnum ) { |
85 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a higher number', 'formidable' ); |
|
85 | + $errors['field' . $args['id']] = __( 'Please select a higher number', 'formidable' ); |
|
86 | 86 | } elseif ( $value > $maxnum ) { |
87 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a lower number', 'formidable' ); |
|
87 | + $errors['field' . $args['id']] = __( 'Please select a lower number', 'formidable' ); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @return void |
106 | 106 | */ |
107 | 107 | private function validate_step( &$errors, $args ) { |
108 | - if ( isset( $errors[ 'field' . $args['id'] ] ) ) { |
|
108 | + if ( isset( $errors['field' . $args['id']] ) ) { |
|
109 | 109 | return; // Don't need to check if value is invalid before. |
110 | 110 | } |
111 | 111 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
122 | - $errors[ 'field' . $args['id'] ] = sprintf( |
|
122 | + $errors['field' . $args['id']] = sprintf( |
|
123 | 123 | // Translators: %1$s: the first nearest value; %2$s: the second nearest value. |
124 | 124 | __( 'Please enter a valid value. Two nearest valid values are %1$s and %2$s', 'formidable' ), |
125 | 125 | floatval( $result[0] ), |
@@ -76,7 +76,8 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | private function translate_settings( $settings ) { |
79 | - if ( $settings ) { // Workaround for W3 total cache conflict. |
|
79 | + if ( $settings ) { |
|
80 | +// Workaround for W3 total cache conflict. |
|
80 | 81 | return unserialize( serialize( $settings ) ); |
81 | 82 | } |
82 | 83 | |
@@ -88,7 +89,8 @@ discard block |
||
88 | 89 | } |
89 | 90 | |
90 | 91 | // If unserializing didn't work |
91 | - if ( $settings ) { // Workaround for W3 total cache conflict. |
|
92 | + if ( $settings ) { |
|
93 | +// Workaround for W3 total cache conflict. |
|
92 | 94 | $settings = unserialize( serialize( $settings ) ); |
93 | 95 | } else { |
94 | 96 | $settings = $this; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | if ( $term && is_array( $term ) ) { |
179 | 179 | $imported['imported']['terms'] ++; |
180 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
180 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | unset( $term, $t ); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | |
235 | 235 | // Keep track of whether this specific form was updated or not. |
236 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
236 | + $imported['form_status'][$form_id] = 'imported'; |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | // Update field ids/keys to new ones. |
249 | 249 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
250 | 250 | |
251 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
251 | + $imported['forms'][(int) $item->id] = $form_id; |
|
252 | 252 | |
253 | 253 | // Send pre 2.0 form options through function that creates actions. |
254 | 254 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
@@ -322,15 +322,15 @@ discard block |
||
322 | 322 | } |
323 | 323 | |
324 | 324 | // Keep track of whether this specific form was updated or not |
325 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
325 | + $imported['form_status'][$form_id] = 'updated'; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | private static function get_form_fields( $form_id ) { |
329 | 329 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' ); |
330 | 330 | $old_fields = array(); |
331 | 331 | foreach ( $form_fields as $f ) { |
332 | - $old_fields[ $f->id ] = $f; |
|
333 | - $old_fields[ $f->field_key ] = $f->id; |
|
332 | + $old_fields[$f->id] = $f; |
|
333 | + $old_fields[$f->field_key] = $f->id; |
|
334 | 334 | unset( $f ); |
335 | 335 | } |
336 | 336 | $form_fields = $old_fields; |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
389 | 389 | if ( $parent_form_id ) { |
390 | - $child_forms[ $form_id ] = $parent_form_id; |
|
390 | + $child_forms[$form_id] = $parent_form_id; |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
@@ -402,9 +402,9 @@ discard block |
||
402 | 402 | */ |
403 | 403 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
404 | 404 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
405 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && (int) $imported_forms[ $old_parent_form_id ] !== (int) $old_parent_form_id ) { |
|
405 | + if ( isset( $imported_forms[$old_parent_form_id] ) && (int) $imported_forms[$old_parent_form_id] !== (int) $old_parent_form_id ) { |
|
406 | 406 | // Update all children with this old parent_form_id |
407 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
407 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
408 | 408 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
409 | 409 | do_action( 'frm_update_child_form_parent_id', $child_form_id, $new_parent_form_id ); |
410 | 410 | } |
@@ -434,27 +434,27 @@ discard block |
||
434 | 434 | |
435 | 435 | if ( ! empty( $this_form ) ) { |
436 | 436 | // check for field to edit by field id |
437 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
437 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
438 | 438 | FrmField::update( $f['id'], $f ); |
439 | 439 | $imported['updated']['fields'] ++; |
440 | 440 | |
441 | - unset( $form_fields[ $f['id'] ] ); |
|
441 | + unset( $form_fields[$f['id']] ); |
|
442 | 442 | |
443 | 443 | // Unset old field key. |
444 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
445 | - unset( $form_fields[ $f['field_key'] ] ); |
|
444 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
445 | + unset( $form_fields[$f['field_key']] ); |
|
446 | 446 | } |
447 | - } elseif ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
448 | - $keys_by_original_field_id[ $f['id'] ] = $f['field_key']; |
|
447 | + } elseif ( isset( $form_fields[$f['field_key']] ) ) { |
|
448 | + $keys_by_original_field_id[$f['id']] = $f['field_key']; |
|
449 | 449 | |
450 | 450 | // check for field to edit by field key |
451 | 451 | unset( $f['id'] ); |
452 | 452 | |
453 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
453 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
454 | 454 | $imported['updated']['fields'] ++; |
455 | 455 | |
456 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); // Unset old field id. |
|
457 | - unset( $form_fields[ $f['field_key'] ] ); // Unset old field key. |
|
456 | + unset( $form_fields[$form_fields[$f['field_key']]] ); // Unset old field id. |
|
457 | + unset( $form_fields[$f['field_key']] ); // Unset old field key. |
|
458 | 458 | } else { |
459 | 459 | // If no matching field id or key in this form, create the field. |
460 | 460 | self::create_imported_field( $f, $imported ); |
@@ -563,8 +563,8 @@ discard block |
||
563 | 563 | if ( $f['type'] == 'form' || ( $f['type'] == 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) { |
564 | 564 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
565 | 565 | $form_select = (int) $f['field_options']['form_select']; |
566 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
567 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
566 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
567 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
568 | 568 | } |
569 | 569 | } |
570 | 570 | } |
@@ -585,8 +585,8 @@ discard block |
||
585 | 585 | |
586 | 586 | if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) { |
587 | 587 | $old_form = $f['field_options']['get_values_form']; |
588 | - if ( isset( $imported['forms'][ $old_form ] ) ) { |
|
589 | - $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ]; |
|
588 | + if ( isset( $imported['forms'][$old_form] ) ) { |
|
589 | + $f['field_options']['get_values_form'] = $imported['forms'][$old_form]; |
|
590 | 590 | } |
591 | 591 | } |
592 | 592 | } |
@@ -607,12 +607,12 @@ discard block |
||
607 | 607 | private static function migrate_placeholders( &$f ) { |
608 | 608 | $update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' ); |
609 | 609 | foreach ( $update_values as $k => $v ) { |
610 | - $f[ $k ] = $v; |
|
610 | + $f[$k] = $v; |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | $update_values = self::migrate_field_placeholder( $f, 'default_blank' ); |
614 | 614 | foreach ( $update_values as $k => $v ) { |
615 | - $f[ $k ] = $v; |
|
615 | + $f[$k] = $v; |
|
616 | 616 | } |
617 | 617 | } |
618 | 618 | |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | public static function migrate_field_placeholder( $field, $type ) { |
627 | 627 | $field = (array) $field; |
628 | 628 | $field_options = $field['field_options']; |
629 | - if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) { |
|
629 | + if ( empty( $field_options[$type] ) || empty( $field['default_value'] ) ) { |
|
630 | 630 | return array(); |
631 | 631 | } |
632 | 632 | |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | } |
653 | 653 | |
654 | 654 | if ( $opt == $default_value ) { |
655 | - unset( $options[ $opt_key ] ); |
|
655 | + unset( $options[$opt_key] ); |
|
656 | 656 | break; |
657 | 657 | } |
658 | 658 | } |
@@ -707,10 +707,10 @@ discard block |
||
707 | 707 | $field_object->type = 'file'; // Fake the file type as FrmProImport::import_attachment checks for file type. |
708 | 708 | |
709 | 709 | $image_id = FrmProFileImport::import_attachment( $option['src'], $field_object ); |
710 | - unset( $field['options'][ $key ]['src'] ); // Remove the src from options as it isn't required after import. |
|
710 | + unset( $field['options'][$key]['src'] ); // Remove the src from options as it isn't required after import. |
|
711 | 711 | |
712 | 712 | if ( is_numeric( $image_id ) ) { |
713 | - $field['options'][ $key ]['image'] = $image_id; |
|
713 | + $field['options'][$key]['image'] = $image_id; |
|
714 | 714 | } |
715 | 715 | } |
716 | 716 | |
@@ -878,8 +878,8 @@ discard block |
||
878 | 878 | } else { |
879 | 879 | if ( $post['post_type'] === 'frm_display' ) { |
880 | 880 | $post['post_content'] = self::maybe_prepare_json_view_content( $post['post_content'] ); |
881 | - } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][ $post['post_parent'] ] ) ) { |
|
882 | - $post['post_parent'] = $imported['posts'][ $post['post_parent'] ]; |
|
881 | + } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][$post['post_parent']] ) ) { |
|
882 | + $post['post_parent'] = $imported['posts'][$post['post_parent']]; |
|
883 | 883 | } |
884 | 884 | // Create/update post now |
885 | 885 | $post_id = wp_insert_post( $post ); |
@@ -890,27 +890,27 @@ discard block |
||
890 | 890 | } |
891 | 891 | |
892 | 892 | if ( false !== strpos( $post['post_content'], '[display-frm-data' ) || false !== strpos( $post['post_content'], '[formidable' ) ) { |
893 | - $posts_with_shortcodes[ $post_id ] = $post; |
|
893 | + $posts_with_shortcodes[$post_id] = $post; |
|
894 | 894 | } |
895 | 895 | |
896 | 896 | self::update_postmeta( $post, $post_id ); |
897 | 897 | self::update_layout( $post, $post_id ); |
898 | 898 | |
899 | 899 | $this_type = 'posts'; |
900 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
901 | - $this_type = $post_types[ $post['post_type'] ]; |
|
900 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
901 | + $this_type = $post_types[$post['post_type']]; |
|
902 | 902 | } |
903 | 903 | |
904 | 904 | if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) { |
905 | - $imported['updated'][ $this_type ] ++; |
|
905 | + $imported['updated'][$this_type] ++; |
|
906 | 906 | } else { |
907 | - $imported['imported'][ $this_type ] ++; |
|
907 | + $imported['imported'][$this_type] ++; |
|
908 | 908 | } |
909 | 909 | |
910 | - $imported['posts'][ (int) $old_id ] = $post_id; |
|
910 | + $imported['posts'][(int) $old_id] = $post_id; |
|
911 | 911 | |
912 | 912 | if ( $post['post_type'] === 'frm_display' ) { |
913 | - $view_ids[ (int) $old_id ] = $post_id; |
|
913 | + $view_ids[(int) $old_id] = $post_id; |
|
914 | 914 | } |
915 | 915 | |
916 | 916 | do_action( 'frm_after_import_view', $post_id, $post ); |
@@ -1071,9 +1071,9 @@ discard block |
||
1071 | 1071 | $post['attachment_url'] = (string) $item->attachment_url; |
1072 | 1072 | } |
1073 | 1073 | |
1074 | - if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
1074 | + if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
1075 | 1075 | // update to new form id |
1076 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
1076 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | // Don't allow default styles to take over a site's default style |
@@ -1110,8 +1110,8 @@ discard block |
||
1110 | 1110 | ); |
1111 | 1111 | |
1112 | 1112 | // Switch old form and field ids to new ones. |
1113 | - if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
|
1114 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
1113 | + if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
1114 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
1115 | 1115 | } else { |
1116 | 1116 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
1117 | 1117 | |
@@ -1122,15 +1122,15 @@ discard block |
||
1122 | 1122 | } elseif ( 'frm_options' === $m['key'] ) { |
1123 | 1123 | |
1124 | 1124 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
1125 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
1126 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
1125 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
1126 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
1127 | 1127 | } |
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | $check_dup_array = array(); |
1131 | 1131 | if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) { |
1132 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
1133 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
1132 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
1133 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
1134 | 1134 | } elseif ( is_array( $m['value']['order_by'] ) ) { |
1135 | 1135 | $check_dup_array[] = 'order_by'; |
1136 | 1136 | } |
@@ -1141,9 +1141,9 @@ discard block |
||
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | foreach ( $check_dup_array as $check_k ) { |
1144 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
1145 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
1146 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
1144 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
1145 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
1146 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
1147 | 1147 | } |
1148 | 1148 | unset( $mk, $mv ); |
1149 | 1149 | } |
@@ -1156,11 +1156,11 @@ discard block |
||
1156 | 1156 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
1157 | 1157 | } |
1158 | 1158 | |
1159 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
1159 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
1160 | 1160 | } |
1161 | 1161 | |
1162 | 1162 | private static function populate_layout( &$post, $layout ) { |
1163 | - $post['layout'][ (string) $layout->type ] = (string) $layout->data; |
|
1163 | + $post['layout'][(string) $layout->type] = (string) $layout->data; |
|
1164 | 1164 | } |
1165 | 1165 | |
1166 | 1166 | /** |
@@ -1188,11 +1188,11 @@ discard block |
||
1188 | 1188 | $name = (string) $c; |
1189 | 1189 | } |
1190 | 1190 | |
1191 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
1192 | - $post['tax_input'][ $taxonomy ] = array(); |
|
1191 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
1192 | + $post['tax_input'][$taxonomy] = array(); |
|
1193 | 1193 | } |
1194 | 1194 | |
1195 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
1195 | + $post['tax_input'][$taxonomy][] = $name; |
|
1196 | 1196 | unset( $name ); |
1197 | 1197 | } |
1198 | 1198 | } |
@@ -1331,7 +1331,7 @@ discard block |
||
1331 | 1331 | |
1332 | 1332 | $message = '<ul>'; |
1333 | 1333 | foreach ( $result as $type => $results ) { |
1334 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
1334 | + if ( ! isset( $t_strings[$type] ) ) { |
|
1335 | 1335 | // only print imported and updated |
1336 | 1336 | continue; |
1337 | 1337 | } |
@@ -1343,7 +1343,7 @@ discard block |
||
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | if ( ! empty( $s_message ) ) { |
1346 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
1346 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
1347 | 1347 | $message .= implode( ', ', $s_message ); |
1348 | 1348 | $message .= '</li>'; |
1349 | 1349 | } |
@@ -1395,8 +1395,8 @@ discard block |
||
1395 | 1395 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
1396 | 1396 | ); |
1397 | 1397 | |
1398 | - if ( isset( $strings[ $type ] ) ) { |
|
1399 | - $s_message[] = $strings[ $type ]; |
|
1398 | + if ( isset( $strings[$type] ) ) { |
|
1399 | + $s_message[] = $strings[$type]; |
|
1400 | 1400 | } else { |
1401 | 1401 | $string = ' ' . $m . ' ' . ucfirst( $type ); |
1402 | 1402 | |
@@ -1544,7 +1544,7 @@ discard block |
||
1544 | 1544 | |
1545 | 1545 | foreach ( $options as $key => $option ) { |
1546 | 1546 | if ( is_array( $option ) && ! empty( $option['image'] ) ) { |
1547 | - $options[ $key ]['src'] = wp_get_attachment_url( $option['image'] ); |
|
1547 | + $options[$key]['src'] = wp_get_attachment_url( $option['image'] ); |
|
1548 | 1548 | $updated = true; |
1549 | 1549 | } |
1550 | 1550 | } |
@@ -1573,8 +1573,8 @@ discard block |
||
1573 | 1573 | */ |
1574 | 1574 | private static function remove_defaults( $defaults, &$saved ) { |
1575 | 1575 | foreach ( $saved as $key => $value ) { |
1576 | - if ( isset( $defaults[ $key ] ) && $defaults[ $key ] === $value ) { |
|
1577 | - unset( $saved[ $key ] ); |
|
1576 | + if ( isset( $defaults[$key] ) && $defaults[$key] === $value ) { |
|
1577 | + unset( $saved[$key] ); |
|
1578 | 1578 | } |
1579 | 1579 | } |
1580 | 1580 | } |
@@ -1585,14 +1585,14 @@ discard block |
||
1585 | 1585 | * @since 3.06 |
1586 | 1586 | */ |
1587 | 1587 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
1588 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
1588 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
1589 | 1589 | return; |
1590 | 1590 | } |
1591 | 1591 | |
1592 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
1593 | - $default_html = $defaults[ $html_name ]; |
|
1592 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
1593 | + $default_html = $defaults[$html_name]; |
|
1594 | 1594 | if ( $old_html == $default_html ) { |
1595 | - unset( $options[ $html_name ] ); |
|
1595 | + unset( $options[$html_name] ); |
|
1596 | 1596 | |
1597 | 1597 | return; |
1598 | 1598 | } |
@@ -1600,7 +1600,7 @@ discard block |
||
1600 | 1600 | // Account for some of the older field default HTML. |
1601 | 1601 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
1602 | 1602 | if ( $old_html == $default_html ) { |
1603 | - unset( $options[ $html_name ] ); |
|
1603 | + unset( $options[$html_name] ); |
|
1604 | 1604 | } |
1605 | 1605 | } |
1606 | 1606 | |
@@ -1691,8 +1691,8 @@ discard block |
||
1691 | 1691 | ); |
1692 | 1692 | |
1693 | 1693 | foreach ( $post_settings as $post_setting ) { |
1694 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
1695 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
1694 | + if ( isset( $form_options[$post_setting] ) ) { |
|
1695 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
1696 | 1696 | } |
1697 | 1697 | unset( $post_setting ); |
1698 | 1698 | } |
@@ -1763,11 +1763,11 @@ discard block |
||
1763 | 1763 | foreach ( $post_content as $key => $setting ) { |
1764 | 1764 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
1765 | 1765 | // Replace old IDs with new IDs |
1766 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
1766 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
1767 | 1767 | } elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
1768 | 1768 | foreach ( $setting as $k => $val ) { |
1769 | 1769 | // Replace old IDs with new IDs |
1770 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
1770 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
1771 | 1771 | } |
1772 | 1772 | } |
1773 | 1773 | unset( $key, $setting ); |
@@ -1843,8 +1843,8 @@ discard block |
||
1843 | 1843 | private static function remove_deprecated_notification_settings( $form_id, $form_options ) { |
1844 | 1844 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
1845 | 1845 | foreach ( $delete_settings as $index ) { |
1846 | - if ( isset( $form_options[ $index ] ) ) { |
|
1847 | - unset( $form_options[ $index ] ); |
|
1846 | + if ( isset( $form_options[$index] ) ) { |
|
1847 | + unset( $form_options[$index] ); |
|
1848 | 1848 | } |
1849 | 1849 | } |
1850 | 1850 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -1897,12 +1897,12 @@ discard block |
||
1897 | 1897 | 'reply_to_name' => '', |
1898 | 1898 | ); |
1899 | 1899 | foreach ( $reply_fields as $f => $val ) { |
1900 | - if ( isset( $notification[ $f ] ) ) { |
|
1901 | - $atts[ $f ] = $notification[ $f ]; |
|
1902 | - if ( 'custom' == $notification[ $f ] ) { |
|
1903 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
1904 | - } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
1905 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
1900 | + if ( isset( $notification[$f] ) ) { |
|
1901 | + $atts[$f] = $notification[$f]; |
|
1902 | + if ( 'custom' == $notification[$f] ) { |
|
1903 | + $atts[$f] = $notification['cust_' . $f]; |
|
1904 | + } elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
1905 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
1906 | 1906 | } |
1907 | 1907 | } |
1908 | 1908 | unset( $f, $val ); |
@@ -1933,13 +1933,13 @@ discard block |
||
1933 | 1933 | foreach ( $atts['email_to'] as $key => $email_field ) { |
1934 | 1934 | |
1935 | 1935 | if ( is_numeric( $email_field ) ) { |
1936 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
1936 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
1937 | 1937 | } |
1938 | 1938 | |
1939 | 1939 | if ( strpos( $email_field, '|' ) ) { |
1940 | 1940 | $email_opt = explode( '|', $email_field ); |
1941 | 1941 | if ( isset( $email_opt[0] ) ) { |
1942 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
1942 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
1943 | 1943 | } |
1944 | 1944 | unset( $email_opt ); |
1945 | 1945 | } |
@@ -1960,12 +1960,12 @@ discard block |
||
1960 | 1960 | // Add more fields to the new notification |
1961 | 1961 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
1962 | 1962 | foreach ( $add_fields as $add_field ) { |
1963 | - if ( isset( $notification[ $add_field ] ) ) { |
|
1964 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
1963 | + if ( isset( $notification[$add_field] ) ) { |
|
1964 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
1965 | 1965 | } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
1966 | - $new_notification['post_content'][ $add_field ] = 0; |
|
1966 | + $new_notification['post_content'][$add_field] = 0; |
|
1967 | 1967 | } else { |
1968 | - $new_notification['post_content'][ $add_field ] = ''; |
|
1968 | + $new_notification['post_content'][$add_field] = ''; |
|
1969 | 1969 | } |
1970 | 1970 | unset( $add_field ); |
1971 | 1971 | } |
@@ -1989,7 +1989,7 @@ discard block |
||
1989 | 1989 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
1990 | 1990 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
1991 | 1991 | if ( is_numeric( $email_key ) ) { |
1992 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
1992 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
1993 | 1993 | } |
1994 | 1994 | unset( $email_key, $val ); |
1995 | 1995 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | unset( $filename ); |
131 | 131 | |
132 | - $comment_count = FrmDb::get_count( |
|
132 | + $comment_count = FrmDb::get_count( |
|
133 | 133 | 'frm_item_metas', |
134 | 134 | array( |
135 | 135 | 'item_id' => $atts['entry_ids'], |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | private static function prepare_csv_headings() { |
225 | 225 | $headings = array(); |
226 | 226 | self::csv_headings( $headings ); |
227 | - $headings = apply_filters( |
|
227 | + $headings = apply_filters( |
|
228 | 228 | 'frm_csv_columns', |
229 | 229 | $headings, |
230 | 230 | self::$form_id, |
@@ -247,10 +247,10 @@ discard block |
||
247 | 247 | $field_headings = array(); |
248 | 248 | $separate_values = array( 'user_id', 'file', 'data', 'date' ); |
249 | 249 | if ( ! empty( $col->field_options['separate_value'] ) && ! in_array( $col->type, $separate_values, true ) ) { |
250 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
250 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
251 | 251 | } |
252 | 252 | |
253 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
253 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
254 | 254 | $field_headings = apply_filters( |
255 | 255 | 'frm_csv_field_columns', |
256 | 256 | $field_headings, |
@@ -270,14 +270,14 @@ discard block |
||
270 | 270 | foreach ( self::$fields as $col ) { |
271 | 271 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
272 | 272 | $repeater_id = $col->field_options['in_section']; |
273 | - $headings[ 'repeater' . $repeater_id ] = array(); // set a placeholder to maintain order for repeater fields |
|
273 | + $headings['repeater' . $repeater_id] = array(); // set a placeholder to maintain order for repeater fields |
|
274 | 274 | |
275 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
276 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
275 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
276 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
277 | 277 | $repeater_ids[] = $repeater_id; |
278 | 278 | } |
279 | 279 | |
280 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
280 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
281 | 281 | |
282 | 282 | continue; |
283 | 283 | } |
@@ -296,8 +296,8 @@ discard block |
||
296 | 296 | $end = strpos( $row->meta_value, ':{' ); |
297 | 297 | $length = substr( $row->meta_value, $start, $end - $start ); |
298 | 298 | |
299 | - if ( $length > $max[ $row->field_id ] ) { |
|
300 | - $max[ $row->field_id ] = $length; |
|
299 | + if ( $length > $max[$row->field_id] ) { |
|
300 | + $max[$row->field_id] = $length; |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | unset( $start, $end, $length, $row, $repeater_meta, $where ); |
@@ -308,17 +308,17 @@ discard block |
||
308 | 308 | $repeater_id = str_replace( 'repeater', '', $key ); |
309 | 309 | |
310 | 310 | $repeater_headings = array(); |
311 | - foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) { |
|
311 | + foreach ( $fields_by_repeater_id[$repeater_id] as $col ) { |
|
312 | 312 | $repeater_headings += self::field_headings( $col ); |
313 | 313 | } |
314 | 314 | |
315 | - for ( $i = 0; $i < $max[ $repeater_id ]; $i ++ ) { |
|
315 | + for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) { |
|
316 | 316 | foreach ( $repeater_headings as $repeater_key => $repeater_name ) { |
317 | - $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name; |
|
317 | + $flat[$repeater_key . '[' . $i . ']'] = $repeater_name; |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | } else { |
321 | - $flat[ $key ] = $heading; |
|
321 | + $flat[$key] = $heading; |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
@@ -332,9 +332,9 @@ discard block |
||
332 | 332 | |
333 | 333 | if ( self::$comment_count ) { |
334 | 334 | for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
335 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
336 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
337 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
335 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
336 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
337 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
338 | 338 | } |
339 | 339 | unset( $i ); |
340 | 340 | } |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | |
380 | 380 | private static function prepare_next_csv_rows( $next_set ) { |
381 | 381 | // order by parent_item_id so children will be first |
382 | - $where = array( |
|
382 | + $where = array( |
|
383 | 383 | 'or' => 1, |
384 | 384 | 'id' => $next_set, |
385 | 385 | 'parent_item_id' => $next_set, |
@@ -425,32 +425,32 @@ discard block |
||
425 | 425 | continue; |
426 | 426 | } |
427 | 427 | |
428 | - if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) { |
|
429 | - $entries[ self::$entry->parent_item_id ] = new stdClass(); |
|
430 | - $entries[ self::$entry->parent_item_id ]->metas = array(); |
|
428 | + if ( ! isset( $entries[self::$entry->parent_item_id] ) ) { |
|
429 | + $entries[self::$entry->parent_item_id] = new stdClass(); |
|
430 | + $entries[self::$entry->parent_item_id]->metas = array(); |
|
431 | 431 | } |
432 | 432 | |
433 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
434 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
435 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
433 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
434 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
435 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
436 | 436 | // if the data is here, it should be an array but if this field has collected data |
437 | 437 | // both while inside and outside of the repeating section, it's possible this is a string. |
438 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
438 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | // Add the repeated values. |
442 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
442 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | self::$entry->metas = self::fill_missing_repeater_metas( self::$entry->metas, $entries ); |
446 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
446 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | // add the embedded form id |
450 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
451 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
450 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
451 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
452 | 452 | } |
453 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
453 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | /** |
@@ -471,19 +471,19 @@ discard block |
||
471 | 471 | } |
472 | 472 | |
473 | 473 | $repeater_id = $field->field_options['in_section']; |
474 | - if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) { |
|
474 | + if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) { |
|
475 | 475 | return $metas; |
476 | 476 | } |
477 | 477 | |
478 | - foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) { |
|
479 | - if ( ! isset( $metas[ $repeater_child->id ] ) ) { |
|
480 | - $metas[ $repeater_child->id ] = ''; |
|
478 | + foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) { |
|
479 | + if ( ! isset( $metas[$repeater_child->id] ) ) { |
|
480 | + $metas[$repeater_child->id] = ''; |
|
481 | 481 | |
482 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) || ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) ) { |
|
483 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] = array(); |
|
482 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) || ! is_array( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) ) { |
|
483 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] = array(); |
|
484 | 484 | } |
485 | 485 | |
486 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = ''; |
|
486 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = ''; |
|
487 | 487 | } |
488 | 488 | } |
489 | 489 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | |
503 | 503 | private static function add_field_values_to_csv( &$row ) { |
504 | 504 | foreach ( self::$fields as $col ) { |
505 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
505 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
506 | 506 | |
507 | 507 | FrmFieldsHelper::prepare_field_value( $field_value, $col->type ); |
508 | 508 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -521,20 +521,20 @@ discard block |
||
521 | 521 | if ( ! empty( $col->field_options['separate_value'] ) ) { |
522 | 522 | $label_key = $col->id . '_label'; |
523 | 523 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
524 | - $row[ $label_key ] = array(); |
|
524 | + $row[$label_key] = array(); |
|
525 | 525 | |
526 | 526 | if ( is_array( $field_value ) ) { |
527 | 527 | foreach ( $field_value as $value ) { |
528 | - $row[ $label_key ][] = self::get_separate_value_label( $value, $col ); |
|
528 | + $row[$label_key][] = self::get_separate_value_label( $value, $col ); |
|
529 | 529 | } |
530 | 530 | } |
531 | 531 | } else { |
532 | - $row[ $label_key ] = self::get_separate_value_label( $field_value, $col ); |
|
532 | + $row[$label_key] = self::get_separate_value_label( $field_value, $col ); |
|
533 | 533 | } |
534 | 534 | unset( $label_key ); |
535 | 535 | } |
536 | 536 | |
537 | - $row[ $col->id ] = $field_value; |
|
537 | + $row[$col->id] = $field_value; |
|
538 | 538 | |
539 | 539 | unset( $col, $field_value ); |
540 | 540 | } |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | 'show_icon' => false, |
558 | 558 | 'entry_id' => self::$entry->id, |
559 | 559 | 'sep' => self::$separator, |
560 | - 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0, |
|
560 | + 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0, |
|
561 | 561 | ) |
562 | 562 | ); |
563 | 563 | } |
@@ -572,8 +572,8 @@ discard block |
||
572 | 572 | // This is combo field inside repeater. The heading key has this format: [86_first[0]]. |
573 | 573 | foreach ( $sub_value as $sub_key => $sub_sub_value ) { |
574 | 574 | $column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']'; |
575 | - if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) { |
|
576 | - $row[ $column_key ] = $sub_sub_value; |
|
575 | + if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) { |
|
576 | + $row[$column_key] = $sub_sub_value; |
|
577 | 577 | } |
578 | 578 | } |
579 | 579 | |
@@ -581,8 +581,8 @@ discard block |
||
581 | 581 | } |
582 | 582 | |
583 | 583 | $column_key = $atts['col']->id . '_' . $key; |
584 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
585 | - $row[ $column_key ] = $sub_value; |
|
584 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
585 | + $row[$column_key] = $sub_value; |
|
586 | 586 | } |
587 | 587 | } |
588 | 588 | } |
@@ -607,18 +607,18 @@ discard block |
||
607 | 607 | $echo = 'echo' === self::$mode; |
608 | 608 | |
609 | 609 | foreach ( self::$headings as $k => $heading ) { |
610 | - if ( isset( $rows[ $k ] ) ) { |
|
611 | - $row = $rows[ $k ]; |
|
610 | + if ( isset( $rows[$k] ) ) { |
|
611 | + $row = $rows[$k]; |
|
612 | 612 | } else { |
613 | 613 | $row = ''; |
614 | 614 | // array indexed data is not at $rows[ $k ] |
615 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
615 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
616 | 616 | $start = strrpos( $k, '[' ); |
617 | 617 | $key = substr( $k, 0, $start ++ ); |
618 | 618 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
619 | 619 | |
620 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
621 | - $row = $rows[ $key ][ $index ]; |
|
620 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
621 | + $row = $rows[$key][$index]; |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | unset( $start, $key, $index ); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | '-' => 'down', |
127 | 127 | '+' => 'up', |
128 | 128 | ); |
129 | - $class = 'frm_arrow' . $arrow[ $icon ]; |
|
129 | + $class = 'frm_arrow' . $arrow[$icon]; |
|
130 | 130 | } else { |
131 | 131 | // frm_minus1_icon. |
132 | 132 | $key = str_replace( 'p', '', $key ); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | '-' => 'minus', |
135 | 135 | '+' => 'plus', |
136 | 136 | ); |
137 | - $class = 'frm_' . $plus[ $icon ]; |
|
137 | + $class = 'frm_' . $plus[$icon]; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | if ( $key ) { |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | ?> |
161 | 161 | <div class="btn-group" id="frm_<?php echo esc_attr( $name ); ?>_select"> |
162 | 162 | <button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button"> |
163 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ); ?> |
|
164 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ); ?> |
|
163 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '+', $type ) ); ?> |
|
164 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '-', $type ) ); ?> |
|
165 | 165 | <b class="caret"></b> |
166 | 166 | </button> |
167 | 167 | <ul class="multiselect-container frm-dropdown-menu"> |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | <li <?php echo ( $style->post_content['collapse_icon'] == $key ) ? 'class="active"' : ''; ?>> |
170 | 170 | <a href="javascript:void(0);"> |
171 | 171 | <label> |
172 | - <input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[ $name ], $key ); ?> /> |
|
172 | + <input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[$name], $key ); ?> /> |
|
173 | 173 | <span> |
174 | 174 | <?php |
175 | 175 | FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '+', $type ) ); |
@@ -306,15 +306,15 @@ discard block |
||
306 | 306 | $vars = array_diff( $vars, $remove ); |
307 | 307 | |
308 | 308 | foreach ( $vars as $var ) { |
309 | - if ( ! isset( $settings[ $var ] ) ) { |
|
309 | + if ( ! isset( $settings[$var] ) ) { |
|
310 | 310 | continue; |
311 | 311 | } |
312 | - if ( ! isset( $defaults[ $var ] ) ) { |
|
313 | - $defaults[ $var ] = ''; |
|
312 | + if ( ! isset( $defaults[$var] ) ) { |
|
313 | + $defaults[$var] = ''; |
|
314 | 314 | } |
315 | - $show = empty( $defaults ) || ( $settings[ $var ] !== '' && $settings[ $var ] !== $defaults[ $var ] ); |
|
315 | + $show = empty( $defaults ) || ( $settings[$var] !== '' && $settings[$var] !== $defaults[$var] ); |
|
316 | 316 | if ( $show ) { |
317 | - echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[ $var ] ) : esc_html( $settings[ $var ] ) ) . ';'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
317 | + echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[$var] ) : esc_html( $settings[$var] ) ) . ';'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | } |
@@ -363,8 +363,8 @@ discard block |
||
363 | 363 | |
364 | 364 | $checkbox_opts = array( 'important_style', 'auto_width', 'submit_style', 'collapse_icon', 'center_form' ); |
365 | 365 | foreach ( $checkbox_opts as $opt ) { |
366 | - if ( ! isset( $settings[ $opt ] ) ) { |
|
367 | - $settings[ $opt ] = 0; |
|
366 | + if ( ! isset( $settings[$opt] ) ) { |
|
367 | + $settings[$opt] = 0; |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $css = ''; |
393 | 393 | } |
394 | 394 | foreach ( $opts as $opt ) { |
395 | - self::get_color_output( $css, $settings[ $opt ] ); |
|
395 | + self::get_color_output( $css, $settings[$opt] ); |
|
396 | 396 | } |
397 | 397 | } |
398 | 398 | } |