@@ -38,7 +38,7 @@ |
||
| 38 | 38 | protected function is_option_on() { |
| 39 | 39 | $form = $this->get_form(); |
| 40 | 40 | $key = $this->get_option_key(); |
| 41 | - return ! empty( $form->options[ $key ] ) && 'off' !== $form->options[ $key ]; |
|
| 41 | + return ! empty( $form->options[$key] ) && 'off' !== $form->options[$key]; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -46,19 +46,19 @@ discard block |
||
| 46 | 46 | $result = array(); |
| 47 | 47 | |
| 48 | 48 | foreach ( $names as $name ) { |
| 49 | - if ( empty( $this->sub_fields[ $name ] ) ) { |
|
| 49 | + if ( empty( $this->sub_fields[$name] ) ) { |
|
| 50 | 50 | continue; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if ( ! isset( $this->sub_fields[ $name ]['wrapper_classes'] ) ) { |
|
| 54 | - $this->sub_fields[ $name ]['wrapper_classes'] = $col_class; |
|
| 55 | - } elseif ( is_array( $this->sub_fields[ $name ]['wrapper_classes'] ) ) { |
|
| 56 | - $this->sub_fields[ $name ]['wrapper_classes'] = implode( ' ', $this->sub_fields[ $name ]['wrapper_classes'] ) . ' ' . $col_class; |
|
| 53 | + if ( ! isset( $this->sub_fields[$name]['wrapper_classes'] ) ) { |
|
| 54 | + $this->sub_fields[$name]['wrapper_classes'] = $col_class; |
|
| 55 | + } elseif ( is_array( $this->sub_fields[$name]['wrapper_classes'] ) ) { |
|
| 56 | + $this->sub_fields[$name]['wrapper_classes'] = implode( ' ', $this->sub_fields[$name]['wrapper_classes'] ) . ' ' . $col_class; |
|
| 57 | 57 | } else { |
| 58 | - $this->sub_fields[ $name ]['wrapper_classes'] .= ' ' . $col_class; |
|
| 58 | + $this->sub_fields[$name]['wrapper_classes'] .= ' ' . $col_class; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - $result[ $name ] = $this->sub_fields[ $name ]; |
|
| 61 | + $result[$name] = $this->sub_fields[$name]; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | return $result; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // Default desc. |
| 91 | 91 | foreach ( $this->sub_fields as $name => $sub_field ) { |
| 92 | - $extra_options[ $name . '_desc' ] = $sub_field['label']; |
|
| 92 | + $extra_options[$name . '_desc'] = $sub_field['label']; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | return $extra_options; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $name_layout = $this->get_name_layout(); |
| 126 | 126 | |
| 127 | 127 | if ( ! empty( $atts['show'] ) ) { |
| 128 | - return isset( $value[ $atts['show'] ] ) ? $value[ $atts['show'] ] : ''; |
|
| 128 | + return isset( $value[$atts['show']] ) ? $value[$atts['show']] : ''; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | $value = wp_parse_args( |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $args['sub_fields'] = $this->sub_fields; |
| 199 | 199 | |
| 200 | 200 | foreach ( $hidden_fields as $name => $hidden_field ) { |
| 201 | - $args['sub_fields'][ $name ]['wrapper_classes'] .= ' frm_hidden'; |
|
| 201 | + $args['sub_fields'][$name]['wrapper_classes'] .= ' frm_hidden'; |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | $grid_helper = new FrmFieldGridHelper(); |
| 31 | 31 | $values['count'] = 0; |
| 32 | 32 | foreach ( $values['fields'] as $field ) { |
| 33 | - $values['count']++; |
|
| 33 | + $values['count'] ++; |
|
| 34 | 34 | $grid_helper->set_field( $field ); |
| 35 | 35 | $grid_helper->maybe_begin_field_wrapper(); |
| 36 | 36 | FrmFieldsController::load_single_field( $field, $values ); |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | |
| 87 | 87 | foreach ( $forms as $form ) { |
| 88 | 88 | $form_title = '' === $form->name ? __( '(no title)', 'formidable' ) : FrmAppHelper::truncate( $form->name, 50 ); |
| 89 | - $options[ $form->id ] = esc_html( $form_title ); |
|
| 89 | + $options[$form->id] = esc_html( $form_title ); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | return $options; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | $_GET['page'] = 'formidable'; |
| 20 | 20 | |
| 21 | - $values = array( |
|
| 21 | + $values = array( |
|
| 22 | 22 | 'id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ), |
| 23 | 23 | 'doing_ajax' => true, |
| 24 | 24 | ); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | ob_start(); |
| 43 | 43 | self::load_single_field( $field, $values ); |
| 44 | - $field_html[ absint( $field->id ) ] = ob_get_contents(); |
|
| 44 | + $field_html[absint( $field->id )] = ob_get_contents(); |
|
| 45 | 45 | ob_end_clean(); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | foreach ( $opts as $opt_key => $opt ) { |
| 257 | 257 | if ( strpos( $opt, '|' ) !== false ) { |
| 258 | 258 | $vals = explode( '|', $opt ); |
| 259 | - $opts[ $opt_key ] = array( |
|
| 259 | + $opts[$opt_key] = array( |
|
| 260 | 260 | 'label' => trim( $vals[0] ), |
| 261 | 261 | 'value' => trim( $vals[1] ), |
| 262 | 262 | ); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $other_array = array(); |
| 272 | 272 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 273 | 273 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
| 274 | - $other_array[ $opt_key ] = $opt; |
|
| 274 | + $other_array[$opt_key] = $opt; |
|
| 275 | 275 | } |
| 276 | 276 | unset( $opt_key, $opt ); |
| 277 | 277 | } |
@@ -313,18 +313,18 @@ discard block |
||
| 313 | 313 | $disabled_fields = FrmAppHelper::pro_is_installed() ? array() : $pro_field_selection; |
| 314 | 314 | $frm_settings = FrmAppHelper::get_settings(); |
| 315 | 315 | |
| 316 | - if ( ! isset( $all_field_types[ $field['type'] ] ) ) { |
|
| 316 | + if ( ! isset( $all_field_types[$field['type']] ) ) { |
|
| 317 | 317 | // Add fallback for an add-on field type that has been deactivated. |
| 318 | - $all_field_types[ $field['type'] ] = array( |
|
| 318 | + $all_field_types[$field['type']] = array( |
|
| 319 | 319 | 'name' => ucfirst( $field['type'] ), |
| 320 | 320 | 'icon' => 'frm_icon_font frm_pencil_icon', |
| 321 | 321 | ); |
| 322 | - } elseif ( ! is_array( $all_field_types[ $field['type'] ] ) ) { |
|
| 322 | + } elseif ( ! is_array( $all_field_types[$field['type']] ) ) { |
|
| 323 | 323 | // Fallback for fields added in a more basic way. |
| 324 | - FrmFormsHelper::prepare_field_type( $all_field_types[ $field['type'] ] ); |
|
| 324 | + FrmFormsHelper::prepare_field_type( $all_field_types[$field['type']] ); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - $type_name = $all_field_types[ $field['type'] ]['name']; |
|
| 327 | + $type_name = $all_field_types[$field['type']]['name']; |
|
| 328 | 328 | if ( $field['type'] === 'divider' && FrmField::is_option_true( $field, 'repeat' ) ) { |
| 329 | 329 | $type_name = $all_field_types['divider|repeat']['name']; |
| 330 | 330 | } |
@@ -387,13 +387,13 @@ discard block |
||
| 387 | 387 | $active = 'default_value'; |
| 388 | 388 | |
| 389 | 389 | foreach ( $settings as $type ) { |
| 390 | - if ( ! empty( $field[ $type ] ) ) { |
|
| 390 | + if ( ! empty( $field[$type] ) ) { |
|
| 391 | 391 | $active = $type; |
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - $types[ $active ]['class'] .= ' current'; |
|
| 396 | - $types[ $active ]['current'] = true; |
|
| 395 | + $types[$active]['class'] .= ' current'; |
|
| 396 | + $types[$active]['current'] = true; |
|
| 397 | 397 | |
| 398 | 398 | return $types; |
| 399 | 399 | } |
@@ -407,8 +407,8 @@ discard block |
||
| 407 | 407 | 'website' => 'url', |
| 408 | 408 | 'image' => 'url', |
| 409 | 409 | ); |
| 410 | - if ( isset( $type_switch[ $type ] ) ) { |
|
| 411 | - $type = $type_switch[ $type ]; |
|
| 410 | + if ( isset( $type_switch[$type] ) ) { |
|
| 411 | + $type = $type_switch[$type]; |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | $pro_fields = FrmField::pro_field_selection(); |
@@ -532,11 +532,11 @@ discard block |
||
| 532 | 532 | // include "col" for valid html |
| 533 | 533 | $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
| 534 | 534 | |
| 535 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
| 535 | + if ( ! isset( $calc[$unit] ) ) { |
|
| 536 | 536 | return; |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
| 539 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit]; |
|
| 540 | 540 | |
| 541 | 541 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
| 542 | 542 | } |
@@ -729,11 +729,11 @@ discard block |
||
| 729 | 729 | private static function get_form_for_js_validation( $field ) { |
| 730 | 730 | global $frm_vars; |
| 731 | 731 | if ( ! empty( $frm_vars['js_validate_forms'] ) ) { |
| 732 | - if ( isset( $frm_vars['js_validate_forms'][ $field['form_id'] ] ) ) { |
|
| 733 | - return $frm_vars['js_validate_forms'][ $field['form_id'] ]; |
|
| 732 | + if ( isset( $frm_vars['js_validate_forms'][$field['form_id']] ) ) { |
|
| 733 | + return $frm_vars['js_validate_forms'][$field['form_id']]; |
|
| 734 | 734 | } |
| 735 | - if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][ $field['parent_form_id'] ] ) ) { |
|
| 736 | - return $frm_vars['js_validate_forms'][ $field['parent_form_id'] ]; |
|
| 735 | + if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][$field['parent_form_id']] ) ) { |
|
| 736 | + return $frm_vars['js_validate_forms'][$field['parent_form_id']]; |
|
| 737 | 737 | } |
| 738 | 738 | } |
| 739 | 739 | return false; |
@@ -804,10 +804,10 @@ discard block |
||
| 804 | 804 | |
| 805 | 805 | if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
| 806 | 806 | $add_html[] = $v; |
| 807 | - } elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 808 | - $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
|
| 807 | + } elseif ( ! empty( $k ) && isset( $add_html[$k] ) ) { |
|
| 808 | + $add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] ); |
|
| 809 | 809 | } else { |
| 810 | - $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 810 | + $add_html[$k] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | unset( $k, $v ); |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); |
| 235 | 235 | |
| 236 | 236 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 237 | - $new_values[ $col ] = $values[ $col ]; |
|
| 237 | + $new_values[$col] = $values[$col]; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | $new_values['options'] = self::maybe_filter_options( $values['options'] ); |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
| 246 | 246 | |
| 247 | 247 | if ( isset( $values['id'] ) ) { |
| 248 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
| 248 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
| 249 | 249 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
| 250 | 250 | } |
| 251 | 251 | |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | foreach ( $new_values as $k => $v ) { |
| 255 | 255 | if ( is_array( $v ) ) { |
| 256 | 256 | if ( $k === 'default_value' ) { |
| 257 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 257 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 258 | 258 | } else { |
| 259 | - $new_values[ $k ] = serialize( $v ); |
|
| 259 | + $new_values[$k] = serialize( $v ); |
|
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | unset( $k, $v ); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | if ( $query_results ) { |
| 277 | 277 | if ( isset( $values['id'] ) ) { |
| 278 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
| 278 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | return $new_id; |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
| 339 | 339 | global $frm_duplicate_ids; |
| 340 | 340 | |
| 341 | - $where = array( |
|
| 341 | + $where = array( |
|
| 342 | 342 | array( |
| 343 | 343 | 'or' => 1, |
| 344 | 344 | 'fi.form_id' => $old_form_id, |
@@ -384,8 +384,8 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | $values = apply_filters( 'frm_duplicated_field', $values ); |
| 386 | 386 | $new_id = self::create( $values ); |
| 387 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
| 388 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
| 387 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
| 388 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
| 389 | 389 | unset( $field ); |
| 390 | 390 | } |
| 391 | 391 | } |
@@ -417,11 +417,11 @@ discard block |
||
| 417 | 417 | |
| 418 | 418 | // serialize array values |
| 419 | 419 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
| 420 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 420 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 421 | 421 | if ( 'field_options' === $opt ) { |
| 422 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
| 422 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
| 423 | 423 | } |
| 424 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 424 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | 427 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | 'id' => $id, |
| 574 | 574 | 'field_key' => $id, |
| 575 | 575 | ); |
| 576 | - $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 576 | + $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | return $type; |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | continue; |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | - $fields[ $result->id ] = $result; |
|
| 602 | + $fields[$result->id] = $result; |
|
| 603 | 603 | $count ++; |
| 604 | 604 | if ( $limit == 1 ) { |
| 605 | 605 | $fields = $result; |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | $count = 0; |
| 646 | 646 | foreach ( $results as $result ) { |
| 647 | 647 | $count ++; |
| 648 | - $fields[ $result->id ] = $result; |
|
| 648 | + $fields[$result->id] = $result; |
|
| 649 | 649 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 650 | 650 | break; |
| 651 | 651 | } |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | if ( ! empty( $sub_fields ) ) { |
| 717 | - $index = $k + $index_offset; |
|
| 717 | + $index = $k + $index_offset; |
|
| 718 | 718 | $index_offset += count( $sub_fields ); |
| 719 | 719 | array_splice( $results, $index, 0, $sub_fields ); |
| 720 | 720 | } |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; |
| 760 | 760 | |
| 761 | 761 | if ( is_array( $where ) ) { |
| 762 | - $args = array( |
|
| 762 | + $args = array( |
|
| 763 | 763 | 'order_by' => $order_by, |
| 764 | 764 | 'limit' => $limit, |
| 765 | 765 | ); |
@@ -790,9 +790,9 @@ discard block |
||
| 790 | 790 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
| 791 | 791 | |
| 792 | 792 | self::prepare_options( $result ); |
| 793 | - $results[ $r_key ]->field_options = $result->field_options; |
|
| 794 | - $results[ $r_key ]->options = $result->options; |
|
| 795 | - $results[ $r_key ]->default_value = $result->default_value; |
|
| 793 | + $results[$r_key]->field_options = $result->field_options; |
|
| 794 | + $results[$r_key]->options = $result->options; |
|
| 795 | + $results[$r_key]->default_value = $result->default_value; |
|
| 796 | 796 | |
| 797 | 797 | unset( $r_key, $result ); |
| 798 | 798 | } |
@@ -994,23 +994,23 @@ discard block |
||
| 994 | 994 | } |
| 995 | 995 | |
| 996 | 996 | public static function is_option_true_in_array( $field, $option ) { |
| 997 | - return isset( $field[ $option ] ) && $field[ $option ]; |
|
| 997 | + return isset( $field[$option] ) && $field[$option]; |
|
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | public static function is_option_true_in_object( $field, $option ) { |
| 1001 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 1001 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | public static function is_option_empty_in_array( $field, $option ) { |
| 1005 | - return ! isset( $field[ $option ] ) || empty( $field[ $option ] ); |
|
| 1005 | + return ! isset( $field[$option] ) || empty( $field[$option] ); |
|
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | 1008 | public static function is_option_empty_in_object( $field, $option ) { |
| 1009 | - return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] ); |
|
| 1009 | + return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] ); |
|
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | 1012 | public static function is_option_value_in_object( $field, $option ) { |
| 1013 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 1013 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 1014 | 1014 | } |
| 1015 | 1015 | |
| 1016 | 1016 | /** |
@@ -1028,10 +1028,10 @@ discard block |
||
| 1028 | 1028 | |
| 1029 | 1029 | public static function get_option_in_array( $field, $option ) { |
| 1030 | 1030 | |
| 1031 | - if ( isset( $field[ $option ] ) ) { |
|
| 1032 | - $this_option = $field[ $option ]; |
|
| 1033 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
| 1034 | - $this_option = $field['field_options'][ $option ]; |
|
| 1031 | + if ( isset( $field[$option] ) ) { |
|
| 1032 | + $this_option = $field[$option]; |
|
| 1033 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
| 1034 | + $this_option = $field['field_options'][$option]; |
|
| 1035 | 1035 | } else { |
| 1036 | 1036 | $this_option = ''; |
| 1037 | 1037 | } |
@@ -1040,7 +1040,7 @@ discard block |
||
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | public static function get_option_in_object( $field, $option ) { |
| 1043 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
| 1043 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
| 1044 | 1044 | } |
| 1045 | 1045 | |
| 1046 | 1046 | /** |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | return; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if ( isset( self::$messages[ $message['key'] ] ) && ! isset( $message['force'] ) ) { |
|
| 96 | + if ( isset( self::$messages[$message['key']] ) && ! isset( $message['force'] ) ) { |
|
| 97 | 97 | // Don't replace messages unless required. |
| 98 | 98 | return; |
| 99 | 99 | } |
@@ -102,13 +102,13 @@ discard block |
||
| 102 | 102 | return; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if ( isset( self::$messages[ $message['key'] ] ) ) { |
|
| 105 | + if ( isset( self::$messages[$message['key']] ) ) { |
|
| 106 | 106 | // Move up and mark as new. |
| 107 | - unset( self::$messages[ $message['key'] ] ); |
|
| 107 | + unset( self::$messages[$message['key']] ); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $this->fill_message( $message ); |
| 111 | - self::$messages[ $message['key'] ] = $message; |
|
| 111 | + self::$messages[$message['key']] = $message; |
|
| 112 | 112 | |
| 113 | 113 | $this->update_list(); |
| 114 | 114 | |
@@ -136,11 +136,11 @@ discard block |
||
| 136 | 136 | private function clean_messages() { |
| 137 | 137 | $removed = false; |
| 138 | 138 | foreach ( self::$messages as $t => $message ) { |
| 139 | - $read = isset( $message['read'] ) && ! empty( $message['read'] ) && isset( $message['read'][ get_current_user_id() ] ) && $message['read'][ get_current_user_id() ] < strtotime( '-1 month' ); |
|
| 140 | - $dismissed = isset( $message['dismissed'] ) && ! empty( $message['dismissed'] ) && isset( $message['dismissed'][ get_current_user_id() ] ) && $message['dismissed'][ get_current_user_id() ] < strtotime( '-1 week' ); |
|
| 139 | + $read = isset( $message['read'] ) && ! empty( $message['read'] ) && isset( $message['read'][get_current_user_id()] ) && $message['read'][get_current_user_id()] < strtotime( '-1 month' ); |
|
| 140 | + $dismissed = isset( $message['dismissed'] ) && ! empty( $message['dismissed'] ) && isset( $message['dismissed'][get_current_user_id()] ) && $message['dismissed'][get_current_user_id()] < strtotime( '-1 week' ); |
|
| 141 | 141 | $expired = $this->is_expired( $message ); |
| 142 | 142 | if ( $read || $expired || $dismissed ) { |
| 143 | - unset( self::$messages[ $t ] ); |
|
| 143 | + unset( self::$messages[$t] ); |
|
| 144 | 144 | $removed = true; |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -153,11 +153,11 @@ discard block |
||
| 153 | 153 | private function filter_messages( &$messages ) { |
| 154 | 154 | $user_id = get_current_user_id(); |
| 155 | 155 | foreach ( $messages as $k => $message ) { |
| 156 | - $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][ $user_id ] ); |
|
| 156 | + $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][$user_id] ); |
|
| 157 | 157 | if ( empty( $k ) || $this->is_expired( $message ) || $dismissed ) { |
| 158 | - unset( $messages[ $k ] ); |
|
| 158 | + unset( $messages[$k] ); |
|
| 159 | 159 | } elseif ( ! $this->is_for_user( $message ) ) { |
| 160 | - unset( $messages[ $k ] ); |
|
| 160 | + unset( $messages[$k] ); |
|
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | $messages = apply_filters( 'frm_filter_inbox', $messages ); |
@@ -196,14 +196,14 @@ discard block |
||
| 196 | 196 | * @param string $key |
| 197 | 197 | */ |
| 198 | 198 | public function mark_read( $key ) { |
| 199 | - if ( ! $key || ! isset( self::$messages[ $key ] ) ) { |
|
| 199 | + if ( ! $key || ! isset( self::$messages[$key] ) ) { |
|
| 200 | 200 | return; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - if ( ! isset( self::$messages[ $key ]['read'] ) ) { |
|
| 204 | - self::$messages[ $key ]['read'] = array(); |
|
| 203 | + if ( ! isset( self::$messages[$key]['read'] ) ) { |
|
| 204 | + self::$messages[$key]['read'] = array(); |
|
| 205 | 205 | } |
| 206 | - self::$messages[ $key ]['read'][ get_current_user_id() ] = time(); |
|
| 206 | + self::$messages[$key]['read'][get_current_user_id()] = time(); |
|
| 207 | 207 | |
| 208 | 208 | $this->update_list(); |
| 209 | 209 | } |
@@ -214,9 +214,9 @@ discard block |
||
| 214 | 214 | * @since 4.05.02 |
| 215 | 215 | */ |
| 216 | 216 | public function mark_unread( $key ) { |
| 217 | - $is_read = isset( self::$messages[ $key ] ) && isset( self::$messages[ $key ]['read'] ) && isset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
| 217 | + $is_read = isset( self::$messages[$key] ) && isset( self::$messages[$key]['read'] ) && isset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
| 218 | 218 | if ( $is_read ) { |
| 219 | - unset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
| 219 | + unset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
| 220 | 220 | $this->update_list(); |
| 221 | 221 | } |
| 222 | 222 | } |
@@ -230,14 +230,14 @@ discard block |
||
| 230 | 230 | return; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - if ( ! isset( self::$messages[ $key ] ) ) { |
|
| 233 | + if ( ! isset( self::$messages[$key] ) ) { |
|
| 234 | 234 | return; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - if ( ! isset( self::$messages[ $key ]['dismissed'] ) ) { |
|
| 238 | - self::$messages[ $key ]['dismissed'] = array(); |
|
| 237 | + if ( ! isset( self::$messages[$key]['dismissed'] ) ) { |
|
| 238 | + self::$messages[$key]['dismissed'] = array(); |
|
| 239 | 239 | } |
| 240 | - self::$messages[ $key ]['dismissed'][ get_current_user_id() ] = time(); |
|
| 240 | + self::$messages[$key]['dismissed'][get_current_user_id()] = time(); |
|
| 241 | 241 | |
| 242 | 242 | $this->update_list(); |
| 243 | 243 | } |
@@ -249,11 +249,11 @@ discard block |
||
| 249 | 249 | $user_id = get_current_user_id(); |
| 250 | 250 | foreach ( self::$messages as $key => $message ) { |
| 251 | 251 | if ( ! isset( $message['dismissed'] ) ) { |
| 252 | - self::$messages[ $key ]['dismissed'] = array(); |
|
| 252 | + self::$messages[$key]['dismissed'] = array(); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - if ( ! isset( $message['dismissed'][ $user_id ] ) ) { |
|
| 256 | - self::$messages[ $key ]['dismissed'][ $user_id ] = time(); |
|
| 255 | + if ( ! isset( $message['dismissed'][$user_id] ) ) { |
|
| 256 | + self::$messages[$key]['dismissed'][$user_id] = time(); |
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | $this->update_list(); |
@@ -263,8 +263,8 @@ discard block |
||
| 263 | 263 | $messages = $this->get_messages( 'filter' ); |
| 264 | 264 | $user_id = get_current_user_id(); |
| 265 | 265 | foreach ( $messages as $t => $message ) { |
| 266 | - if ( isset( $message['read'] ) && isset( $message['read'][ $user_id ] ) ) { |
|
| 267 | - unset( $messages[ $t ] ); |
|
| 266 | + if ( isset( $message['read'] ) && isset( $message['read'][$user_id] ) ) { |
|
| 267 | + unset( $messages[$t] ); |
|
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | return $messages; |
@@ -288,8 +288,8 @@ discard block |
||
| 288 | 288 | * @since 4.05.02 |
| 289 | 289 | */ |
| 290 | 290 | public function remove( $key ) { |
| 291 | - if ( isset( self::$messages[ $key ] ) ) { |
|
| 292 | - unset( self::$messages[ $key ] ); |
|
| 291 | + if ( isset( self::$messages[$key] ) ) { |
|
| 292 | + unset( self::$messages[$key] ); |
|
| 293 | 293 | $this->update_list(); |
| 294 | 294 | } |
| 295 | 295 | } |
@@ -42,7 +42,8 @@ |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // Only do this for single site installs. |
| 45 | - if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 45 | + if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { |
|
| 46 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 46 | 47 | return; |
| 47 | 48 | } |
| 48 | 49 | |
@@ -75,19 +75,19 @@ discard block |
||
| 75 | 75 | global $frm_vars; |
| 76 | 76 | $form_id = FrmForm::get_current_form_id(); |
| 77 | 77 | |
| 78 | - $columns[ $form_id . '_id' ] = 'ID'; |
|
| 79 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
| 78 | + $columns[$form_id . '_id'] = 'ID'; |
|
| 79 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
| 80 | 80 | |
| 81 | 81 | if ( $form_id ) { |
| 82 | 82 | self::get_columns_for_form( $form_id, $columns ); |
| 83 | 83 | } else { |
| 84 | - $columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' ); |
|
| 85 | - $columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' ); |
|
| 86 | - $columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' ); |
|
| 84 | + $columns[$form_id . '_form_id'] = __( 'Form', 'formidable' ); |
|
| 85 | + $columns[$form_id . '_name'] = __( 'Entry Name', 'formidable' ); |
|
| 86 | + $columns[$form_id . '_user_id'] = __( 'Created By', 'formidable' ); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
| 90 | - $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
| 89 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
| 90 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
| 91 | 91 | self::maybe_add_ip_col( $form_id, $columns ); |
| 92 | 92 | |
| 93 | 93 | $frm_vars['cols'] = $columns; |
@@ -145,10 +145,10 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
| 147 | 147 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
| 148 | - unset( $sub_form_cols[ $k ] ); |
|
| 148 | + unset( $sub_form_cols[$k] ); |
|
| 149 | 149 | continue; |
| 150 | 150 | } |
| 151 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
| 151 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
| 152 | 152 | unset( $sub_form_col ); |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -165,15 +165,15 @@ discard block |
||
| 165 | 165 | $has_separate_value = ! FrmField::is_option_empty( $field, 'separate_value' ); |
| 166 | 166 | $is_post_status = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] == 'post_status'; |
| 167 | 167 | if ( $has_separate_value && ! $is_post_status ) { |
| 168 | - $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 ); |
|
| 168 | + $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 ); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 ); |
|
| 171 | + $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 ); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | private static function maybe_add_ip_col( $form_id, &$columns ) { |
| 175 | 175 | if ( FrmAppHelper::ips_saved() ) { |
| 176 | - $columns[ $form_id . '_ip' ] = 'IP'; |
|
| 176 | + $columns[$form_id . '_ip'] = 'IP'; |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | foreach ( $meta_value as $mk => $mv ) { |
| 212 | 212 | // Remove blank values. |
| 213 | 213 | if ( empty( $mv ) ) { |
| 214 | - unset( $meta_value[ $mk ] ); |
|
| 214 | + unset( $meta_value[$mk] ); |
|
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | |
| 288 | 288 | foreach ( $fields as $field ) { |
| 289 | 289 | if ( self::field_supports_sorting( $field ) ) { |
| 290 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
| 290 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $atts['form_id'] . '_item_key' => '', |
| 364 | 364 | $atts['form_id'] . '_id' => '', |
| 365 | 365 | ); |
| 366 | - $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
| 366 | + $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
| 367 | 367 | |
| 368 | 368 | $i = $atts['i']; |
| 369 | 369 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) { |
| 376 | 376 | $result[] = $col_key; |
| 377 | - $i--; |
|
| 377 | + $i --; |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | unset( $col_key, $col ); |
@@ -507,9 +507,9 @@ discard block |
||
| 507 | 507 | if ( ! isset( $frm_vars['form_params'] ) ) { |
| 508 | 508 | $frm_vars['form_params'] = array(); |
| 509 | 509 | } |
| 510 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
| 510 | + $frm_vars['form_params'][$form->id] = $params; |
|
| 511 | 511 | |
| 512 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
| 512 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
| 513 | 513 | return; |
| 514 | 514 | } |
| 515 | 515 | |
@@ -525,16 +525,16 @@ discard block |
||
| 525 | 525 | */ |
| 526 | 526 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
| 527 | 527 | |
| 528 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
| 528 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
| 529 | 529 | |
| 530 | 530 | if ( empty( $errors ) ) { |
| 531 | 531 | $_POST['frm_skip_cookie'] = 1; |
| 532 | 532 | $do_success = false; |
| 533 | 533 | if ( $params['action'] === 'create' ) { |
| 534 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
| 535 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 534 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
| 535 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 536 | 536 | |
| 537 | - $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id']; |
|
| 537 | + $params['id'] = $frm_vars['created_entries'][$form_id]['entry_id']; |
|
| 538 | 538 | $do_success = true; |
| 539 | 539 | } |
| 540 | 540 | } |
@@ -491,7 +491,8 @@ |
||
| 491 | 491 | |
| 492 | 492 | public static function process_entry( $errors = '', $ajax = false ) { |
| 493 | 493 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
| 494 | - if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 494 | + if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { |
|
| 495 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 495 | 496 | return; |
| 496 | 497 | } |
| 497 | 498 | |