@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | /** |
| 9 | 9 | * @var bool |
| 10 | 10 | */ |
| 11 | - public static $use_cache = true; |
|
| 11 | + public static $use_cache = true; |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * @var int |
@@ -352,11 +352,11 @@ discard block |
||
| 352 | 352 | 'ranking' => '2024-03-12', |
| 353 | 353 | ); |
| 354 | 354 | |
| 355 | - if ( ! isset( $release_dates[ $type ] ) ) { |
|
| 355 | + if ( ! isset( $release_dates[$type] ) ) { |
|
| 356 | 356 | return false; |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - $release_date = $release_dates[ $type ]; |
|
| 359 | + $release_date = $release_dates[$type]; |
|
| 360 | 360 | |
| 361 | 361 | $three_months_after_release = gmdate( 'Y-m-d', strtotime( $release_date . ' + 90 days' ) ); |
| 362 | 362 | return gmdate( 'Y-m-d' ) < $three_months_after_release; |
@@ -390,8 +390,8 @@ discard block |
||
| 390 | 390 | $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); |
| 391 | 391 | |
| 392 | 392 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 393 | - if ( isset( $values[ $col ] ) ) { |
|
| 394 | - $new_values[ $col ] = $values[ $col ]; |
|
| 393 | + if ( isset( $values[$col] ) ) { |
|
| 394 | + $new_values[$col] = $values[$col]; |
|
| 395 | 395 | } |
| 396 | 396 | } |
| 397 | 397 | |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
| 404 | 404 | |
| 405 | 405 | if ( isset( $values['id'] ) ) { |
| 406 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
| 406 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
| 407 | 407 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
| 408 | 408 | } |
| 409 | 409 | |
@@ -412,9 +412,9 @@ discard block |
||
| 412 | 412 | foreach ( $new_values as $k => $v ) { |
| 413 | 413 | if ( is_array( $v ) ) { |
| 414 | 414 | if ( $k === 'default_value' ) { |
| 415 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 415 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 416 | 416 | } else { |
| 417 | - $new_values[ $k ] = serialize( $v ); |
|
| 417 | + $new_values[$k] = serialize( $v ); |
|
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | unset( $k, $v ); |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | if ( isset( $values['id'] ) ) { |
| 437 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
| 437 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | return $new_id; |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | * |
| 489 | 489 | * @return string |
| 490 | 490 | */ |
| 491 | - function ( $match ) { |
|
| 491 | + function( $match ) { |
|
| 492 | 492 | $attr = shortcode_parse_atts( $match[3] ); |
| 493 | 493 | |
| 494 | 494 | if ( ! is_array( $attr ) ) { |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | if ( FrmAppHelper::input_key_is_safe( $key, 'update' ) ) { |
| 519 | - $safe_atts[ $key ] = $value; |
|
| 519 | + $safe_atts[$key] = $value; |
|
| 520 | 520 | } |
| 521 | 521 | }//end foreach |
| 522 | 522 | |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
| 589 | 589 | global $frm_duplicate_ids; |
| 590 | 590 | |
| 591 | - $where = array( |
|
| 591 | + $where = array( |
|
| 592 | 592 | array( |
| 593 | 593 | 'or' => 1, |
| 594 | 594 | 'fi.form_id' => $old_form_id, |
@@ -635,8 +635,8 @@ discard block |
||
| 635 | 635 | |
| 636 | 636 | $values = apply_filters( 'frm_duplicated_field', $values ); |
| 637 | 637 | $new_id = self::create( $values ); |
| 638 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
| 639 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
| 638 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
| 639 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
| 640 | 640 | unset( $field ); |
| 641 | 641 | }//end foreach |
| 642 | 642 | } |
@@ -686,11 +686,11 @@ discard block |
||
| 686 | 686 | |
| 687 | 687 | // serialize array values |
| 688 | 688 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
| 689 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 689 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 690 | 690 | if ( 'field_options' === $opt ) { |
| 691 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
| 691 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
| 692 | 692 | } |
| 693 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 693 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 694 | 694 | } |
| 695 | 695 | } |
| 696 | 696 | |
@@ -909,8 +909,8 @@ discard block |
||
| 909 | 909 | continue; |
| 910 | 910 | } |
| 911 | 911 | |
| 912 | - $fields[ $result->id ] = $result; |
|
| 913 | - ++$count; |
|
| 912 | + $fields[$result->id] = $result; |
|
| 913 | + ++ $count; |
|
| 914 | 914 | |
| 915 | 915 | if ( $limit == 1 ) { |
| 916 | 916 | $fields = $result; |
@@ -965,8 +965,8 @@ discard block |
||
| 965 | 965 | $count = 0; |
| 966 | 966 | |
| 967 | 967 | foreach ( $results as $result ) { |
| 968 | - ++$count; |
|
| 969 | - $fields[ $result->id ] = $result; |
|
| 968 | + ++ $count; |
|
| 969 | + $fields[$result->id] = $result; |
|
| 970 | 970 | |
| 971 | 971 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 972 | 972 | break; |
@@ -1099,7 +1099,7 @@ discard block |
||
| 1099 | 1099 | $query_type = $limit === ' LIMIT 1' || $limit == 1 ? 'row' : 'results'; |
| 1100 | 1100 | |
| 1101 | 1101 | if ( is_array( $where ) ) { |
| 1102 | - $args = array( |
|
| 1102 | + $args = array( |
|
| 1103 | 1103 | 'order_by' => $order_by, |
| 1104 | 1104 | 'limit' => $limit, |
| 1105 | 1105 | ); |
@@ -1136,9 +1136,9 @@ discard block |
||
| 1136 | 1136 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
| 1137 | 1137 | |
| 1138 | 1138 | self::prepare_options( $result ); |
| 1139 | - $results[ $r_key ]->field_options = $result->field_options; |
|
| 1140 | - $results[ $r_key ]->options = $result->options; |
|
| 1141 | - $results[ $r_key ]->default_value = $result->default_value; |
|
| 1139 | + $results[$r_key]->field_options = $result->field_options; |
|
| 1140 | + $results[$r_key]->options = $result->options; |
|
| 1141 | + $results[$r_key]->default_value = $result->default_value; |
|
| 1142 | 1142 | |
| 1143 | 1143 | unset( $r_key, $result ); |
| 1144 | 1144 | } |
@@ -1234,7 +1234,7 @@ discard block |
||
| 1234 | 1234 | |
| 1235 | 1235 | if ( count( $next_fields ) >= self::$transient_size ) { |
| 1236 | 1236 | // if this transient is full, check for another |
| 1237 | - ++$next; |
|
| 1237 | + ++ $next; |
|
| 1238 | 1238 | self::get_next_transient( $fields, $base_name, $next ); |
| 1239 | 1239 | } |
| 1240 | 1240 | } |
@@ -1270,7 +1270,7 @@ discard block |
||
| 1270 | 1270 | return; |
| 1271 | 1271 | } |
| 1272 | 1272 | |
| 1273 | - ++$next; |
|
| 1273 | + ++ $next; |
|
| 1274 | 1274 | } |
| 1275 | 1275 | } |
| 1276 | 1276 | |
@@ -1432,7 +1432,7 @@ discard block |
||
| 1432 | 1432 | * @return bool |
| 1433 | 1433 | */ |
| 1434 | 1434 | public static function is_option_true_in_array( $field, $option ) { |
| 1435 | - return ! empty( $field[ $option ] ); |
|
| 1435 | + return ! empty( $field[$option] ); |
|
| 1436 | 1436 | } |
| 1437 | 1437 | |
| 1438 | 1438 | /** |
@@ -1442,7 +1442,7 @@ discard block |
||
| 1442 | 1442 | * @return bool |
| 1443 | 1443 | */ |
| 1444 | 1444 | public static function is_option_true_in_object( $field, $option ) { |
| 1445 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 1445 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 1446 | 1446 | } |
| 1447 | 1447 | |
| 1448 | 1448 | /** |
@@ -1452,7 +1452,7 @@ discard block |
||
| 1452 | 1452 | * @return bool |
| 1453 | 1453 | */ |
| 1454 | 1454 | public static function is_option_empty_in_array( $field, $option ) { |
| 1455 | - return empty( $field[ $option ] ); |
|
| 1455 | + return empty( $field[$option] ); |
|
| 1456 | 1456 | } |
| 1457 | 1457 | |
| 1458 | 1458 | /** |
@@ -1462,7 +1462,7 @@ discard block |
||
| 1462 | 1462 | * @return bool |
| 1463 | 1463 | */ |
| 1464 | 1464 | public static function is_option_empty_in_object( $field, $option ) { |
| 1465 | - return empty( $field->field_options[ $option ] ); |
|
| 1465 | + return empty( $field->field_options[$option] ); |
|
| 1466 | 1466 | } |
| 1467 | 1467 | |
| 1468 | 1468 | /** |
@@ -1472,7 +1472,7 @@ discard block |
||
| 1472 | 1472 | * @return bool |
| 1473 | 1473 | */ |
| 1474 | 1474 | public static function is_option_value_in_object( $field, $option ) { |
| 1475 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 1475 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 1476 | 1476 | } |
| 1477 | 1477 | |
| 1478 | 1478 | /** |
@@ -1500,10 +1500,10 @@ discard block |
||
| 1500 | 1500 | * @return mixed |
| 1501 | 1501 | */ |
| 1502 | 1502 | public static function get_option_in_array( $field, $option ) { |
| 1503 | - if ( isset( $field[ $option ] ) ) { |
|
| 1504 | - $this_option = $field[ $option ]; |
|
| 1505 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
| 1506 | - $this_option = $field['field_options'][ $option ]; |
|
| 1503 | + if ( isset( $field[$option] ) ) { |
|
| 1504 | + $this_option = $field[$option]; |
|
| 1505 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
| 1506 | + $this_option = $field['field_options'][$option]; |
|
| 1507 | 1507 | } else { |
| 1508 | 1508 | $this_option = ''; |
| 1509 | 1509 | } |
@@ -1518,7 +1518,7 @@ discard block |
||
| 1518 | 1518 | * @return mixed |
| 1519 | 1519 | */ |
| 1520 | 1520 | public static function get_option_in_object( $field, $option ) { |
| 1521 | - return $field->field_options[ $option ] ?? ''; |
|
| 1521 | + return $field->field_options[$option] ?? ''; |
|
| 1522 | 1522 | } |
| 1523 | 1523 | |
| 1524 | 1524 | /** |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | * @return void |
| 58 | 58 | */ |
| 59 | 59 | private static function flag_new_unique_key( $unique_id ) { |
| 60 | - if ( ! isset( self::$unique_id_match_checks[ $unique_id ] ) ) { |
|
| 61 | - self::$unique_id_match_checks[ $unique_id ] = false; |
|
| 60 | + if ( ! isset( self::$unique_id_match_checks[$unique_id] ) ) { |
|
| 61 | + self::$unique_id_match_checks[$unique_id] = false; |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | if ( 0 === (int) $meta->field_id ) { |
| 116 | 116 | continue; |
| 117 | 117 | } |
| 118 | - $field_metas[ $meta->field_id ] = $meta->meta_value; |
|
| 118 | + $field_metas[$meta->field_id] = $meta->meta_value; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $filtered_vals = array_filter( $values['item_meta'] ); |
@@ -183,8 +183,8 @@ discard block |
||
| 183 | 183 | return false; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - if ( isset( self::$unique_id_match_checks[ $unique_id ] ) ) { |
|
| 187 | - return self::$unique_id_match_checks[ $unique_id ]; |
|
| 186 | + if ( isset( self::$unique_id_match_checks[$unique_id] ) ) { |
|
| 187 | + return self::$unique_id_match_checks[$unique_id]; |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | $timestamp = strtotime( $created_at ); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | $timestamp = time(); |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - self::$unique_id_match_checks[ $unique_id ] = (bool) FrmDb::get_var( |
|
| 196 | + self::$unique_id_match_checks[$unique_id] = (bool) FrmDb::get_var( |
|
| 197 | 197 | 'frm_item_metas', |
| 198 | 198 | array( |
| 199 | 199 | 'field_id' => 0, |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | 'id' |
| 204 | 204 | ); |
| 205 | 205 | |
| 206 | - return self::$unique_id_match_checks[ $unique_id ]; |
|
| 206 | + return self::$unique_id_match_checks[$unique_id]; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
@@ -237,11 +237,11 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | foreach ( $filter_vals as $field_id => $value ) { |
| 239 | 239 | $field = FrmFieldFactory::get_field_object( $field_id ); |
| 240 | - $reduced[ $field_id ] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
| 241 | - $reduced[ $field_id ] = $field->set_value_before_save( $reduced[ $field_id ] ); |
|
| 240 | + $reduced[$field_id] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
| 241 | + $reduced[$field_id] = $field->set_value_before_save( $reduced[$field_id] ); |
|
| 242 | 242 | |
| 243 | - if ( '' === $reduced[ $field_id ] || ( is_array( $reduced[ $field_id ] ) && 0 === count( $reduced[ $field_id ] ) ) ) { |
|
| 244 | - unset( $reduced[ $field_id ] ); |
|
| 243 | + if ( '' === $reduced[$field_id] || ( is_array( $reduced[$field_id] ) && 0 === count( $reduced[$field_id] ) ) ) { |
|
| 244 | + unset( $reduced[$field_id] ); |
|
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | return $reduced; |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | private static function prepare_entries( &$entries ) { |
| 544 | 544 | foreach ( $entries as $k => $entry ) { |
| 545 | 545 | self::prepare_entry( $entry ); |
| 546 | - $entries[ $k ] = $entry; |
|
| 546 | + $entries[$k] = $entry; |
|
| 547 | 547 | } |
| 548 | 548 | } |
| 549 | 549 | |
@@ -575,20 +575,20 @@ discard block |
||
| 575 | 575 | FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type ); |
| 576 | 576 | |
| 577 | 577 | if ( $meta_val->item_id == $entry->id ) { |
| 578 | - $entry->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
| 578 | + $entry->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
| 579 | 579 | |
| 580 | 580 | if ( $include_key ) { |
| 581 | - $entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ]; |
|
| 581 | + $entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id]; |
|
| 582 | 582 | } |
| 583 | 583 | continue; |
| 584 | 584 | } |
| 585 | 585 | |
| 586 | 586 | // include sub entries in an array |
| 587 | - if ( ! isset( $entry->metas[ $meta_val->field_id ] ) ) { |
|
| 588 | - $entry->metas[ $meta_val->field_id ] = array(); |
|
| 587 | + if ( ! isset( $entry->metas[$meta_val->field_id] ) ) { |
|
| 588 | + $entry->metas[$meta_val->field_id] = array(); |
|
| 589 | 589 | } |
| 590 | 590 | |
| 591 | - $entry->metas[ $meta_val->field_id ][] = $meta_val->meta_value; |
|
| 591 | + $entry->metas[$meta_val->field_id][] = $meta_val->meta_value; |
|
| 592 | 592 | |
| 593 | 593 | unset( $meta_val ); |
| 594 | 594 | }//end foreach |
@@ -696,16 +696,16 @@ discard block |
||
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | foreach ( $metas as $m_key => $meta_val ) { |
| 699 | - if ( ! isset( $entries[ $meta_val->item_id ] ) ) { |
|
| 699 | + if ( ! isset( $entries[$meta_val->item_id] ) ) { |
|
| 700 | 700 | continue; |
| 701 | 701 | } |
| 702 | 702 | |
| 703 | - if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) { |
|
| 704 | - $entries[ $meta_val->item_id ]->metas = array(); |
|
| 703 | + if ( ! isset( $entries[$meta_val->item_id]->metas ) ) { |
|
| 704 | + $entries[$meta_val->item_id]->metas = array(); |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type ); |
| 708 | - $entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
| 708 | + $entries[$meta_val->item_id]->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
| 709 | 709 | unset( $m_key, $meta_val ); |
| 710 | 710 | } |
| 711 | 711 | |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | * @return mixed |
| 905 | 905 | */ |
| 906 | 906 | private static function get_entry_value( $values, $name, $default ) { |
| 907 | - return $values[ $name ] ?? $default; |
|
| 907 | + return $values[$name] ?? $default; |
|
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | /** |
@@ -1119,7 +1119,7 @@ discard block |
||
| 1119 | 1119 | global $frm_vars; |
| 1120 | 1120 | |
| 1121 | 1121 | if ( array_key_exists( 'captcha_scores', $frm_vars ) && array_key_exists( $form_id, $frm_vars['captcha_scores'] ) ) { |
| 1122 | - $captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][ $form_id ] ); |
|
| 1122 | + $captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][$form_id] ); |
|
| 1123 | 1123 | FrmEntryMeta::add_entry_meta( $entry_id, 0, '', maybe_serialize( $captcha_score_meta ) ); |
| 1124 | 1124 | } |
| 1125 | 1125 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $_GET['page'] = 'formidable'; |
| 28 | 28 | |
| 29 | - $values = array( |
|
| 29 | + $values = array( |
|
| 30 | 30 | 'id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ), |
| 31 | 31 | 'doing_ajax' => true, |
| 32 | 32 | ); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | ob_start(); |
| 52 | 52 | self::load_single_field( $field, $values ); |
| 53 | - $field_html[ absint( $field->id ) ] = ob_get_contents(); |
|
| 53 | + $field_html[absint( $field->id )] = ob_get_contents(); |
|
| 54 | 54 | ob_end_clean(); |
| 55 | 55 | }//end foreach |
| 56 | 56 | |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | foreach ( $opts as $opt_key => $opt ) { |
| 289 | 289 | if ( strpos( $opt, '|' ) !== false ) { |
| 290 | 290 | $vals = explode( '|', $opt ); |
| 291 | - $opts[ $opt_key ] = array( |
|
| 291 | + $opts[$opt_key] = array( |
|
| 292 | 292 | 'label' => trim( $vals[0] ), |
| 293 | 293 | 'value' => trim( $vals[1] ), |
| 294 | 294 | ); |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | |
| 305 | 305 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 306 | 306 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
| 307 | - $other_array[ $opt_key ] = $opt; |
|
| 307 | + $other_array[$opt_key] = $opt; |
|
| 308 | 308 | } |
| 309 | 309 | unset( $opt_key, $opt ); |
| 310 | 310 | } |
@@ -349,18 +349,18 @@ discard block |
||
| 349 | 349 | $frm_settings = FrmAppHelper::get_settings(); |
| 350 | 350 | $field_types = FrmFieldTypeOptionData::get_field_types( $field['type'] ); |
| 351 | 351 | |
| 352 | - if ( ! isset( $all_field_types[ $field['type'] ] ) ) { |
|
| 352 | + if ( ! isset( $all_field_types[$field['type']] ) ) { |
|
| 353 | 353 | // Add fallback for an add-on field type that has been deactivated. |
| 354 | - $all_field_types[ $field['type'] ] = array( |
|
| 354 | + $all_field_types[$field['type']] = array( |
|
| 355 | 355 | 'name' => ucfirst( $field['type'] ), |
| 356 | 356 | 'icon' => 'frm_icon_font frm_pencil_icon', |
| 357 | 357 | ); |
| 358 | - } elseif ( ! is_array( $all_field_types[ $field['type'] ] ) ) { |
|
| 358 | + } elseif ( ! is_array( $all_field_types[$field['type']] ) ) { |
|
| 359 | 359 | // Fallback for fields added in a more basic way. |
| 360 | - FrmFormsHelper::prepare_field_type( $all_field_types[ $field['type'] ] ); |
|
| 360 | + FrmFormsHelper::prepare_field_type( $all_field_types[$field['type']] ); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - $type_name = $all_field_types[ $field['type'] ]['name']; |
|
| 363 | + $type_name = $all_field_types[$field['type']]['name']; |
|
| 364 | 364 | |
| 365 | 365 | if ( $field['type'] === 'divider' && FrmField::is_option_true( $field, 'repeat' ) ) { |
| 366 | 366 | $type_name = $all_field_types['divider|repeat']['name']; |
@@ -439,14 +439,14 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | if ( FrmAppHelper::pro_is_connected() ) { |
| 441 | 441 | foreach ( $settings as $type ) { |
| 442 | - if ( ! empty( $field[ $type ] ) ) { |
|
| 442 | + if ( ! empty( $field[$type] ) ) { |
|
| 443 | 443 | $active = $type; |
| 444 | 444 | } |
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - $types[ $active ]['class'] .= ' current'; |
|
| 449 | - $types[ $active ]['current'] = true; |
|
| 448 | + $types[$active]['class'] .= ' current'; |
|
| 449 | + $types[$active]['current'] = true; |
|
| 450 | 450 | |
| 451 | 451 | return $types; |
| 452 | 452 | } |
@@ -466,8 +466,8 @@ discard block |
||
| 466 | 466 | 'image' => 'url', |
| 467 | 467 | ); |
| 468 | 468 | |
| 469 | - if ( isset( $type_switch[ $type ] ) ) { |
|
| 470 | - $type = $type_switch[ $type ]; |
|
| 469 | + if ( isset( $type_switch[$type] ) ) { |
|
| 470 | + $type = $type_switch[$type]; |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | $pro_fields = FrmField::pro_field_selection(); |
@@ -632,11 +632,11 @@ discard block |
||
| 632 | 632 | // include "col" for valid html |
| 633 | 633 | $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
| 634 | 634 | |
| 635 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
| 635 | + if ( ! isset( $calc[$unit] ) ) { |
|
| 636 | 636 | return; |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
| 639 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit]; |
|
| 640 | 640 | |
| 641 | 641 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
| 642 | 642 | } |
@@ -892,12 +892,12 @@ discard block |
||
| 892 | 892 | global $frm_vars; |
| 893 | 893 | |
| 894 | 894 | if ( ! empty( $frm_vars['js_validate_forms'] ) ) { |
| 895 | - if ( isset( $frm_vars['js_validate_forms'][ $field['form_id'] ] ) ) { |
|
| 896 | - return $frm_vars['js_validate_forms'][ $field['form_id'] ]; |
|
| 895 | + if ( isset( $frm_vars['js_validate_forms'][$field['form_id']] ) ) { |
|
| 896 | + return $frm_vars['js_validate_forms'][$field['form_id']]; |
|
| 897 | 897 | } |
| 898 | 898 | |
| 899 | - if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][ $field['parent_form_id'] ] ) ) { |
|
| 900 | - return $frm_vars['js_validate_forms'][ $field['parent_form_id'] ]; |
|
| 899 | + if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][$field['parent_form_id']] ) ) { |
|
| 900 | + return $frm_vars['js_validate_forms'][$field['parent_form_id']]; |
|
| 901 | 901 | } |
| 902 | 902 | } |
| 903 | 903 | return false; |
@@ -991,13 +991,13 @@ discard block |
||
| 991 | 991 | if ( isset( $field['subfield_name'] ) && 0 === strpos( $k, 'aria-invalid' ) ) { |
| 992 | 992 | $subfield_name = $field['subfield_name']; |
| 993 | 993 | |
| 994 | - if ( ! isset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] ) ) { |
|
| 994 | + if ( ! isset( $field['shortcodes']['aria-invalid-' . $subfield_name] ) ) { |
|
| 995 | 995 | continue; |
| 996 | 996 | } |
| 997 | 997 | // Change the key to the correct aria-invalid value so that $add_html is set correctly for the current subfield of a combo field. |
| 998 | 998 | $k = 'aria-invalid'; |
| 999 | - $v = $field['shortcodes'][ 'aria-invalid-' . $subfield_name ]; |
|
| 1000 | - unset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] ); |
|
| 999 | + $v = $field['shortcodes']['aria-invalid-' . $subfield_name]; |
|
| 1000 | + unset( $field['shortcodes']['aria-invalid-' . $subfield_name] ); |
|
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | 1003 | if ( 'opt' === $k || ! self::should_allow_input_attribute( $k ) ) { |
@@ -1006,10 +1006,10 @@ discard block |
||
| 1006 | 1006 | |
| 1007 | 1007 | if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
| 1008 | 1008 | $add_html[] = $v; |
| 1009 | - } elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 1010 | - $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
|
| 1009 | + } elseif ( ! empty( $k ) && isset( $add_html[$k] ) ) { |
|
| 1010 | + $add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] ); |
|
| 1011 | 1011 | } else { |
| 1012 | - $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 1012 | + $add_html[$k] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | 1015 | unset( $k, $v ); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | unset( $filename ); |
| 159 | 159 | |
| 160 | - $comment_count = FrmDb::get_count( |
|
| 160 | + $comment_count = FrmDb::get_count( |
|
| 161 | 161 | 'frm_item_metas', |
| 162 | 162 | array( |
| 163 | 163 | 'item_id' => $atts['entry_ids'], |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | private static function prepare_csv_headings() { |
| 323 | 323 | $headings = array(); |
| 324 | 324 | self::csv_headings( $headings ); |
| 325 | - $headings = apply_filters( |
|
| 325 | + $headings = apply_filters( |
|
| 326 | 326 | 'frm_csv_columns', |
| 327 | 327 | $headings, |
| 328 | 328 | self::$form_id, |
@@ -353,16 +353,16 @@ discard block |
||
| 353 | 353 | $separate_values = array( 'user_id', 'file', 'data', 'date' ); |
| 354 | 354 | |
| 355 | 355 | if ( ! empty( $col->field_options['separate_value'] ) && ! in_array( $col->type, $separate_values, true ) ) { |
| 356 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 356 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - if ( ! empty( $field_headings[ $col->id . '_label' ] ) ) { |
|
| 360 | - $field_headings[ $col->id ] = strip_tags( $col->name . ' ' . __( '(value)', 'formidable' ) ); |
|
| 359 | + if ( ! empty( $field_headings[$col->id . '_label'] ) ) { |
|
| 360 | + $field_headings[$col->id] = strip_tags( $col->name . ' ' . __( '(value)', 'formidable' ) ); |
|
| 361 | 361 | } else { |
| 362 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
| 362 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - $field_headings = apply_filters( |
|
| 365 | + $field_headings = apply_filters( |
|
| 366 | 366 | 'frm_csv_field_columns', |
| 367 | 367 | $field_headings, |
| 368 | 368 | array_merge( |
@@ -387,14 +387,14 @@ discard block |
||
| 387 | 387 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 388 | 388 | $repeater_id = $col->field_options['in_section']; |
| 389 | 389 | // Set a placeholder to maintain order for repeater fields. |
| 390 | - $headings[ 'repeater' . $repeater_id ] = array(); |
|
| 390 | + $headings['repeater' . $repeater_id] = array(); |
|
| 391 | 391 | |
| 392 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 393 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
| 392 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
| 393 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
| 394 | 394 | $repeater_ids[] = $repeater_id; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
| 397 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
| 398 | 398 | |
| 399 | 399 | continue; |
| 400 | 400 | } |
@@ -413,8 +413,8 @@ discard block |
||
| 413 | 413 | $end = strpos( $row->meta_value, ':{' ); |
| 414 | 414 | $length = substr( $row->meta_value, $start, $end - $start ); |
| 415 | 415 | |
| 416 | - if ( $length > $max[ $row->field_id ] ) { |
|
| 417 | - $max[ $row->field_id ] = $length; |
|
| 416 | + if ( $length > $max[$row->field_id] ) { |
|
| 417 | + $max[$row->field_id] = $length; |
|
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | unset( $start, $end, $length, $row, $repeater_meta, $where ); |
@@ -427,17 +427,17 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | $repeater_headings = array(); |
| 429 | 429 | |
| 430 | - foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) { |
|
| 430 | + foreach ( $fields_by_repeater_id[$repeater_id] as $col ) { |
|
| 431 | 431 | $repeater_headings += self::field_headings( $col ); |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | - for ( $i = 0; $i < $max[ $repeater_id ]; $i++ ) { |
|
| 434 | + for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) { |
|
| 435 | 435 | foreach ( $repeater_headings as $repeater_key => $repeater_name ) { |
| 436 | - $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name; |
|
| 436 | + $flat[$repeater_key . '[' . $i . ']'] = $repeater_name; |
|
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | } else { |
| 440 | - $flat[ $key ] = $heading; |
|
| 440 | + $flat[$key] = $heading; |
|
| 441 | 441 | } |
| 442 | 442 | } |
| 443 | 443 | |
@@ -450,10 +450,10 @@ discard block |
||
| 450 | 450 | }//end if |
| 451 | 451 | |
| 452 | 452 | if ( self::$comment_count ) { |
| 453 | - for ( $i = 0; $i < self::$comment_count; $i++ ) { |
|
| 454 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
| 455 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
| 456 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
| 453 | + for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
|
| 454 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
| 455 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
| 456 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
| 457 | 457 | } |
| 458 | 458 | unset( $i ); |
| 459 | 459 | } |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | */ |
| 509 | 509 | private static function prepare_next_csv_rows( $next_set ) { |
| 510 | 510 | if ( FrmAppHelper::pro_is_installed() ) { |
| 511 | - $where = array( |
|
| 511 | + $where = array( |
|
| 512 | 512 | 'or' => 1, |
| 513 | 513 | 'id' => $next_set, |
| 514 | 514 | 'parent_item_id' => $next_set, |
@@ -573,32 +573,32 @@ discard block |
||
| 573 | 573 | continue; |
| 574 | 574 | } |
| 575 | 575 | |
| 576 | - if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) { |
|
| 577 | - $entries[ self::$entry->parent_item_id ] = new stdClass(); |
|
| 578 | - $entries[ self::$entry->parent_item_id ]->metas = array(); |
|
| 576 | + if ( ! isset( $entries[self::$entry->parent_item_id] ) ) { |
|
| 577 | + $entries[self::$entry->parent_item_id] = new stdClass(); |
|
| 578 | + $entries[self::$entry->parent_item_id]->metas = array(); |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 582 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
| 583 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 581 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 582 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
| 583 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 584 | 584 | // if the data is here, it should be an array but if this field has collected data |
| 585 | 585 | // both while inside and outside of the repeating section, it's possible this is a string. |
| 586 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
| 586 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | // Add the repeated values. |
| 590 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
| 590 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
| 591 | 591 | }//end foreach |
| 592 | 592 | |
| 593 | 593 | self::$entry->metas = self::fill_missing_repeater_metas( self::$entry->metas, $entries ); |
| 594 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
| 594 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
| 595 | 595 | }//end if |
| 596 | 596 | |
| 597 | 597 | // add the embedded form id |
| 598 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
| 599 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
| 598 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
| 599 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
| 600 | 600 | } |
| 601 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
| 601 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | /** |
@@ -621,19 +621,19 @@ discard block |
||
| 621 | 621 | |
| 622 | 622 | $repeater_id = $field->field_options['in_section']; |
| 623 | 623 | |
| 624 | - if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 624 | + if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) { |
|
| 625 | 625 | return $metas; |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | - foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) { |
|
| 629 | - if ( ! isset( $metas[ $repeater_child->id ] ) ) { |
|
| 630 | - $metas[ $repeater_child->id ] = ''; |
|
| 628 | + foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) { |
|
| 629 | + if ( ! isset( $metas[$repeater_child->id] ) ) { |
|
| 630 | + $metas[$repeater_child->id] = ''; |
|
| 631 | 631 | |
| 632 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) || ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) ) { |
|
| 633 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] = array(); |
|
| 632 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) || ! is_array( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) ) { |
|
| 633 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] = array(); |
|
| 634 | 634 | } |
| 635 | 635 | |
| 636 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = ''; |
|
| 636 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = ''; |
|
| 637 | 637 | } |
| 638 | 638 | } |
| 639 | 639 | |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | */ |
| 664 | 664 | private static function add_field_values_to_csv( &$row ) { |
| 665 | 665 | foreach ( self::$fields as $col ) { |
| 666 | - $field_value = self::$entry->metas[ $col->id ] ?? false; |
|
| 666 | + $field_value = self::$entry->metas[$col->id] ?? false; |
|
| 667 | 667 | |
| 668 | 668 | FrmFieldsHelper::prepare_field_value( $field_value, $col->type ); |
| 669 | 669 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -683,20 +683,20 @@ discard block |
||
| 683 | 683 | $label_key = $col->id . '_label'; |
| 684 | 684 | |
| 685 | 685 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 686 | - $row[ $label_key ] = array(); |
|
| 686 | + $row[$label_key] = array(); |
|
| 687 | 687 | |
| 688 | 688 | if ( is_array( $field_value ) ) { |
| 689 | 689 | foreach ( $field_value as $value ) { |
| 690 | - $row[ $label_key ][] = self::get_separate_value_label( $value, $col ); |
|
| 690 | + $row[$label_key][] = self::get_separate_value_label( $value, $col ); |
|
| 691 | 691 | } |
| 692 | 692 | } |
| 693 | 693 | } else { |
| 694 | - $row[ $label_key ] = self::get_separate_value_label( $field_value, $col ); |
|
| 694 | + $row[$label_key] = self::get_separate_value_label( $field_value, $col ); |
|
| 695 | 695 | } |
| 696 | 696 | unset( $label_key ); |
| 697 | 697 | } |
| 698 | 698 | |
| 699 | - $row[ $col->id ] = $field_value; |
|
| 699 | + $row[$col->id] = $field_value; |
|
| 700 | 700 | |
| 701 | 701 | unset( $col, $field_value ); |
| 702 | 702 | }//end foreach |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | 'show_icon' => false, |
| 721 | 721 | 'entry_id' => self::$entry->id, |
| 722 | 722 | 'sep' => self::$separator, |
| 723 | - '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, |
|
| 723 | + '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, |
|
| 724 | 724 | ) |
| 725 | 725 | ); |
| 726 | 726 | } |
@@ -741,8 +741,8 @@ discard block |
||
| 741 | 741 | foreach ( $sub_value as $sub_key => $sub_sub_value ) { |
| 742 | 742 | $column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']'; |
| 743 | 743 | |
| 744 | - if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 745 | - $row[ $column_key ] = $sub_sub_value; |
|
| 744 | + if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) { |
|
| 745 | + $row[$column_key] = $sub_sub_value; |
|
| 746 | 746 | } |
| 747 | 747 | } |
| 748 | 748 | |
@@ -751,8 +751,8 @@ discard block |
||
| 751 | 751 | |
| 752 | 752 | $column_key = $atts['col']->id . '_' . $key; |
| 753 | 753 | |
| 754 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 755 | - $row[ $column_key ] = $sub_value; |
|
| 754 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
| 755 | + $row[$column_key] = $sub_value; |
|
| 756 | 756 | } |
| 757 | 757 | } |
| 758 | 758 | }//end if |
@@ -788,19 +788,19 @@ discard block |
||
| 788 | 788 | $echo = 'echo' === self::$mode; |
| 789 | 789 | |
| 790 | 790 | foreach ( self::$headings as $k => $heading ) { |
| 791 | - if ( isset( $rows[ $k ] ) ) { |
|
| 792 | - $row = $rows[ $k ]; |
|
| 791 | + if ( isset( $rows[$k] ) ) { |
|
| 792 | + $row = $rows[$k]; |
|
| 793 | 793 | } else { |
| 794 | 794 | $row = ''; |
| 795 | 795 | |
| 796 | 796 | // array indexed data is not at $rows[ $k ] |
| 797 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
| 797 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
| 798 | 798 | $start = strrpos( $k, '[' ); |
| 799 | - $key = substr( $k, 0, $start++ ); |
|
| 799 | + $key = substr( $k, 0, $start ++ ); |
|
| 800 | 800 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
| 801 | 801 | |
| 802 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
| 803 | - $row = $rows[ $key ][ $index ]; |
|
| 802 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
| 803 | + $row = $rows[$key][$index]; |
|
| 804 | 804 | } |
| 805 | 805 | |
| 806 | 806 | unset( $start, $key, $index ); |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | $buffer = ''; |
| 26 | 26 | |
| 27 | 27 | while ( $i < $length ) { |
| 28 | - $char = $css[ $i ]; |
|
| 28 | + $char = $css[$i]; |
|
| 29 | 29 | |
| 30 | 30 | if ( '@' === $char ) { |
| 31 | 31 | $brace_pos = strpos( $css, '{', $i ); |
| 32 | 32 | |
| 33 | 33 | if ( false === $brace_pos ) { |
| 34 | 34 | $buffer .= $char; |
| 35 | - ++$i; |
|
| 35 | + ++ $i; |
|
| 36 | 36 | continue; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | }//end if |
| 85 | 85 | |
| 86 | 86 | $buffer .= $char; |
| 87 | - ++$i; |
|
| 87 | + ++ $i; |
|
| 88 | 88 | }//end while |
| 89 | 89 | |
| 90 | 90 | return implode( '', $output ); |
@@ -112,14 +112,14 @@ discard block |
||
| 112 | 112 | $prefix_length = strlen( $prefix ); |
| 113 | 113 | |
| 114 | 114 | while ( $i < $length ) { |
| 115 | - $char = $css[ $i ]; |
|
| 115 | + $char = $css[$i]; |
|
| 116 | 116 | |
| 117 | 117 | if ( '@' === $char ) { |
| 118 | 118 | $brace_pos = strpos( $css, '{', $i ); |
| 119 | 119 | |
| 120 | 120 | if ( false === $brace_pos ) { |
| 121 | 121 | $buffer .= $char; |
| 122 | - ++$i; |
|
| 122 | + ++ $i; |
|
| 123 | 123 | |
| 124 | 124 | continue; |
| 125 | 125 | } |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | if ( '' !== $selector && '' !== trim( $declarations ) ) { |
| 149 | 149 | // Handle multiple selectors |
| 150 | - $selectors = array_filter( |
|
| 150 | + $selectors = array_filter( |
|
| 151 | 151 | array_map( 'trim', explode( ',', $selector ) ), |
| 152 | - function ( $s ) { |
|
| 152 | + function( $s ) { |
|
| 153 | 153 | return '' !== $s; |
| 154 | 154 | } |
| 155 | 155 | ); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | }//end if |
| 173 | 173 | |
| 174 | 174 | $buffer .= $char; |
| 175 | - ++$i; |
|
| 175 | + ++ $i; |
|
| 176 | 176 | }//end while |
| 177 | 177 | return implode( '', $output ); |
| 178 | 178 | } |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | $in_string = false; |
| 229 | 229 | $string_char = ''; |
| 230 | 230 | |
| 231 | - for ( $i = $open_pos + 1; $i < $length; $i++ ) { |
|
| 232 | - $char = $css[ $i ]; |
|
| 231 | + for ( $i = $open_pos + 1; $i < $length; $i ++ ) { |
|
| 232 | + $char = $css[$i]; |
|
| 233 | 233 | |
| 234 | 234 | // Handle string literals to avoid matching braces inside strings |
| 235 | - if ( ( '"' === $char || "'" === $char ) && ( 0 === $i || '\\' !== $css[ $i - 1 ] ) ) { |
|
| 235 | + if ( ( '"' === $char || "'" === $char ) && ( 0 === $i || '\\' !== $css[$i - 1] ) ) { |
|
| 236 | 236 | if ( ! $in_string ) { |
| 237 | 237 | $in_string = true; |
| 238 | 238 | $string_char = $char; |
@@ -248,9 +248,9 @@ discard block |
||
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | if ( '{' === $char ) { |
| 251 | - ++$level; |
|
| 251 | + ++ $level; |
|
| 252 | 252 | } elseif ( '}' === $char ) { |
| 253 | - --$level; |
|
| 253 | + -- $level; |
|
| 254 | 254 | |
| 255 | 255 | if ( 0 === $level ) { |
| 256 | 256 | return $i; |
@@ -227,9 +227,9 @@ discard block |
||
| 227 | 227 | $groups = FrmFormActionsController::form_action_groups(); |
| 228 | 228 | $group = 'misc'; |
| 229 | 229 | |
| 230 | - if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) { |
|
| 230 | + if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) { |
|
| 231 | 231 | $group = $action_options['group']; |
| 232 | - } elseif ( isset( $groups[ $this->id_base ] ) ) { |
|
| 232 | + } elseif ( isset( $groups[$this->id_base] ) ) { |
|
| 233 | 233 | $group = $this->id_base; |
| 234 | 234 | } else { |
| 235 | 235 | foreach ( $groups as $name => $check_group ) { |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - $groups[ $group ]['id'] = $group; |
|
| 244 | - return $groups[ $group ]; |
|
| 243 | + $groups[$group]['id'] = $group; |
|
| 244 | + return $groups[$group]; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | * @return int $post_id |
| 368 | 368 | */ |
| 369 | 369 | public function maybe_create_action( $action, $forms ) { |
| 370 | - if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] === 'updated' ) { |
|
| 370 | + if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] === 'updated' ) { |
|
| 371 | 371 | // Update action only |
| 372 | 372 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
| 373 | 373 | $post_id = $this->save_settings( $action ); |
@@ -393,18 +393,18 @@ discard block |
||
| 393 | 393 | $switch = $this->get_global_switch_fields(); |
| 394 | 394 | |
| 395 | 395 | foreach ( (array) $action->post_content as $key => $val ) { |
| 396 | - if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
|
| 397 | - $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
|
| 396 | + if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) { |
|
| 397 | + $action->post_content[$key] = $frm_duplicate_ids[$val]; |
|
| 398 | 398 | } elseif ( ! is_array( $val ) ) { |
| 399 | - $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
|
| 400 | - } elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
|
| 399 | + $action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val ); |
|
| 400 | + } elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) { |
|
| 401 | 401 | // loop through each value if empty |
| 402 | - if ( empty( $switch[ $key ] ) ) { |
|
| 403 | - $switch[ $key ] = array_keys( $val ); |
|
| 402 | + if ( empty( $switch[$key] ) ) { |
|
| 403 | + $switch[$key] = array_keys( $val ); |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - foreach ( $switch[ $key ] as $subkey ) { |
|
| 407 | - $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
|
| 406 | + foreach ( $switch[$key] as $subkey ) { |
|
| 407 | + $action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val ); |
|
| 408 | 408 | } |
| 409 | 409 | } |
| 410 | 410 | |
@@ -429,20 +429,20 @@ discard block |
||
| 429 | 429 | foreach ( $subkey as $subkey2 ) { |
| 430 | 430 | foreach ( (array) $val as $ck => $cv ) { |
| 431 | 431 | if ( is_array( $cv ) ) { |
| 432 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
|
| 433 | - } elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
|
| 434 | - $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
|
| 432 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv ); |
|
| 433 | + } elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) { |
|
| 434 | + $action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]]; |
|
| 435 | 435 | } |
| 436 | 436 | } |
| 437 | 437 | } |
| 438 | 438 | } else { |
| 439 | 439 | foreach ( (array) $val as $ck => $cv ) { |
| 440 | 440 | if ( is_array( $cv ) ) { |
| 441 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
|
| 442 | - } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
|
| 443 | - $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
|
| 441 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv ); |
|
| 442 | + } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) { |
|
| 443 | + $action[$ck] = $frm_duplicate_ids[$cv]; |
|
| 444 | 444 | } elseif ( $ck == $subkey ) { |
| 445 | - $action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] ); |
|
| 445 | + $action[$ck] = $this->maybe_switch_field_ids( $action[$ck] ); |
|
| 446 | 446 | } |
| 447 | 447 | } |
| 448 | 448 | }//end if |
@@ -470,10 +470,10 @@ discard block |
||
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 473 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
| 473 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
| 474 | 474 | // Sanitizing removes scripts and <email> type of values. |
| 475 | 475 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
| 476 | - $settings = wp_unslash( $_POST[ $this->option_name ] ); |
|
| 476 | + $settings = wp_unslash( $_POST[$this->option_name] ); |
|
| 477 | 477 | } else { |
| 478 | 478 | return; |
| 479 | 479 | } |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | foreach ( $settings as $number => $new_instance ) { |
| 484 | 484 | $this->_set( $number ); |
| 485 | 485 | |
| 486 | - $old_instance = $all_instances[ $number ] ?? array(); |
|
| 486 | + $old_instance = $all_instances[$number] ?? array(); |
|
| 487 | 487 | |
| 488 | 488 | if ( ! isset( $new_instance['post_status'] ) ) { |
| 489 | 489 | $new_instance['post_status'] = 'draft'; |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
| 523 | 523 | |
| 524 | 524 | if ( false !== $instance ) { |
| 525 | - $all_instances[ $number ] = $instance; |
|
| 525 | + $all_instances[$number] = $instance; |
|
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | $action_ids[] = $this->save_settings( $instance ); |
@@ -633,12 +633,12 @@ discard block |
||
| 633 | 633 | // some plugins/themes are formatting the post_excerpt |
| 634 | 634 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
| 635 | 635 | |
| 636 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
| 636 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
| 637 | 637 | continue; |
| 638 | 638 | } |
| 639 | 639 | |
| 640 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
| 641 | - $settings[ $action->ID ] = $action; |
|
| 640 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
| 641 | + $settings[$action->ID] = $action; |
|
| 642 | 642 | |
| 643 | 643 | if ( count( $settings ) >= $limit ) { |
| 644 | 644 | break; |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | * @return int The filtered limit value. |
| 665 | 665 | */ |
| 666 | 666 | public static function get_action_limit( $form_id, $limit = 99 ) { |
| 667 | - $type = 'all'; |
|
| 667 | + $type = 'all'; |
|
| 668 | 668 | return (int) apply_filters( 'frm_form_action_limit', (int) $limit, compact( 'type', 'form_id' ) ); |
| 669 | 669 | } |
| 670 | 670 | |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | 'limit' => 99, |
| 689 | 689 | 'post_status' => $default_status, |
| 690 | 690 | ); |
| 691 | - $args = wp_parse_args( $args, $defaults ); |
|
| 691 | + $args = wp_parse_args( $args, $defaults ); |
|
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | /** |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | |
| 769 | 769 | $action = $this->prepare_action( $action ); |
| 770 | 770 | |
| 771 | - $settings[ $action->ID ] = $action; |
|
| 771 | + $settings[$action->ID] = $action; |
|
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | if ( 1 === $limit ) { |
@@ -816,10 +816,10 @@ discard block |
||
| 816 | 816 | |
| 817 | 817 | foreach ( $default_values as $k => $vals ) { |
| 818 | 818 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
| 819 | - if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
| 819 | + if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
| 820 | 820 | continue; |
| 821 | 821 | } |
| 822 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
| 822 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
| 823 | 823 | } |
| 824 | 824 | } |
| 825 | 825 | |
@@ -923,9 +923,9 @@ discard block |
||
| 923 | 923 | |
| 924 | 924 | // fill with existing options |
| 925 | 925 | foreach ( $action->post_content as $name => $val ) { |
| 926 | - if ( isset( $form->options[ $name ] ) ) { |
|
| 927 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
| 928 | - unset( $form->options[ $name ] ); |
|
| 926 | + if ( isset( $form->options[$name] ) ) { |
|
| 927 | + $action->post_content[$name] = $form->options[$name]; |
|
| 928 | + unset( $form->options[$name] ); |
|
| 929 | 929 | } |
| 930 | 930 | } |
| 931 | 931 | |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'include' ); |
| 1036 | 1036 | return array_filter( |
| 1037 | 1037 | $form_fields, |
| 1038 | - function ( $form_field ) { |
|
| 1038 | + function( $form_field ) { |
|
| 1039 | 1039 | return ! FrmField::is_no_save_field( $form_field->type ); |
| 1040 | 1040 | } |
| 1041 | 1041 | ); |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | // Get posted data. |
| 89 | 89 | $plugin_slug = FrmAppHelper::get_post_param( 'plugin', '', 'sanitize_text_field' ); |
| 90 | 90 | |
| 91 | - if ( ! empty( get_plugins()[ $plugin_slug ] ) ) { |
|
| 91 | + if ( ! empty( get_plugins()[$plugin_slug] ) ) { |
|
| 92 | 92 | $activate = activate_plugin( $plugin_slug ); |
| 93 | 93 | } else { |
| 94 | 94 | // Include necessary files for plugin installation. |