@@ -309,8 +309,8 @@ discard block |
||
| 309 | 309 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 310 | 310 | } |
| 311 | 311 | $plugins = get_plugins(); |
| 312 | - if ( isset( $plugins[ $plugin ] ) && ! empty( $plugins[ $plugin ]['Version'] ) ) { |
|
| 313 | - return $plugins[ $plugin ]['Version']; |
|
| 312 | + if ( isset( $plugins[$plugin] ) && ! empty( $plugins[$plugin]['Version'] ) ) { |
|
| 313 | + return $plugins[$plugin]['Version']; |
|
| 314 | 314 | } |
| 315 | 315 | return false; |
| 316 | 316 | } |
@@ -383,8 +383,8 @@ discard block |
||
| 383 | 383 | $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); |
| 384 | 384 | |
| 385 | 385 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 386 | - if ( isset( $values[ $col ] ) ) { |
|
| 387 | - $new_values[ $col ] = $values[ $col ]; |
|
| 386 | + if ( isset( $values[$col] ) ) { |
|
| 387 | + $new_values[$col] = $values[$col]; |
|
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
| 397 | 397 | |
| 398 | 398 | if ( isset( $values['id'] ) ) { |
| 399 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
| 399 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
| 400 | 400 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
| 401 | 401 | } |
| 402 | 402 | |
@@ -405,9 +405,9 @@ discard block |
||
| 405 | 405 | foreach ( $new_values as $k => $v ) { |
| 406 | 406 | if ( is_array( $v ) ) { |
| 407 | 407 | if ( $k === 'default_value' ) { |
| 408 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 408 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 409 | 409 | } else { |
| 410 | - $new_values[ $k ] = serialize( $v ); |
|
| 410 | + $new_values[$k] = serialize( $v ); |
|
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | unset( $k, $v ); |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | if ( isset( $values['id'] ) ) { |
| 430 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
| 430 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | return $new_id; |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | * @param array $match Shortcode data. |
| 479 | 479 | * @return string |
| 480 | 480 | */ |
| 481 | - function ( $match ) { |
|
| 481 | + function( $match ) { |
|
| 482 | 482 | $attr = shortcode_parse_atts( $match[3] ); |
| 483 | 483 | |
| 484 | 484 | if ( ! is_array( $attr ) ) { |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | if ( FrmAppHelper::input_key_is_safe( $key, 'update' ) ) { |
| 506 | - $safe_atts[ $key ] = $value; |
|
| 506 | + $safe_atts[$key] = $value; |
|
| 507 | 507 | } |
| 508 | 508 | } |
| 509 | 509 | |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
| 562 | 562 | global $frm_duplicate_ids; |
| 563 | 563 | |
| 564 | - $where = array( |
|
| 564 | + $where = array( |
|
| 565 | 565 | array( |
| 566 | 566 | 'or' => 1, |
| 567 | 567 | 'fi.form_id' => $old_form_id, |
@@ -607,8 +607,8 @@ discard block |
||
| 607 | 607 | |
| 608 | 608 | $values = apply_filters( 'frm_duplicated_field', $values ); |
| 609 | 609 | $new_id = self::create( $values ); |
| 610 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
| 611 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
| 610 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
| 611 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
| 612 | 612 | unset( $field ); |
| 613 | 613 | }//end foreach |
| 614 | 614 | } |
@@ -657,11 +657,11 @@ discard block |
||
| 657 | 657 | |
| 658 | 658 | // serialize array values |
| 659 | 659 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
| 660 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 660 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 661 | 661 | if ( 'field_options' === $opt ) { |
| 662 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
| 662 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
| 663 | 663 | } |
| 664 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 664 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 665 | 665 | } |
| 666 | 666 | } |
| 667 | 667 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -848,8 +848,8 @@ discard block |
||
| 848 | 848 | continue; |
| 849 | 849 | } |
| 850 | 850 | |
| 851 | - $fields[ $result->id ] = $result; |
|
| 852 | - ++$count; |
|
| 851 | + $fields[$result->id] = $result; |
|
| 852 | + ++ $count; |
|
| 853 | 853 | if ( $limit == 1 ) { |
| 854 | 854 | $fields = $result; |
| 855 | 855 | break; |
@@ -900,8 +900,8 @@ discard block |
||
| 900 | 900 | $fields = array(); |
| 901 | 901 | $count = 0; |
| 902 | 902 | foreach ( $results as $result ) { |
| 903 | - ++$count; |
|
| 904 | - $fields[ $result->id ] = $result; |
|
| 903 | + ++ $count; |
|
| 904 | + $fields[$result->id] = $result; |
|
| 905 | 905 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 906 | 906 | break; |
| 907 | 907 | } |
@@ -1015,7 +1015,7 @@ discard block |
||
| 1015 | 1015 | $query_type = $limit === ' LIMIT 1' || $limit == 1 ? 'row' : 'results'; |
| 1016 | 1016 | |
| 1017 | 1017 | if ( is_array( $where ) ) { |
| 1018 | - $args = array( |
|
| 1018 | + $args = array( |
|
| 1019 | 1019 | 'order_by' => $order_by, |
| 1020 | 1020 | 'limit' => $limit, |
| 1021 | 1021 | ); |
@@ -1048,9 +1048,9 @@ discard block |
||
| 1048 | 1048 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
| 1049 | 1049 | |
| 1050 | 1050 | self::prepare_options( $result ); |
| 1051 | - $results[ $r_key ]->field_options = $result->field_options; |
|
| 1052 | - $results[ $r_key ]->options = $result->options; |
|
| 1053 | - $results[ $r_key ]->default_value = $result->default_value; |
|
| 1051 | + $results[$r_key]->field_options = $result->field_options; |
|
| 1052 | + $results[$r_key]->options = $result->options; |
|
| 1053 | + $results[$r_key]->default_value = $result->default_value; |
|
| 1054 | 1054 | |
| 1055 | 1055 | unset( $r_key, $result ); |
| 1056 | 1056 | } |
@@ -1129,7 +1129,7 @@ discard block |
||
| 1129 | 1129 | |
| 1130 | 1130 | if ( count( $next_fields ) >= self::$transient_size ) { |
| 1131 | 1131 | // if this transient is full, check for another |
| 1132 | - ++$next; |
|
| 1132 | + ++ $next; |
|
| 1133 | 1133 | self::get_next_transient( $fields, $base_name, $next ); |
| 1134 | 1134 | } |
| 1135 | 1135 | } |
@@ -1157,7 +1157,7 @@ discard block |
||
| 1157 | 1157 | return; |
| 1158 | 1158 | } |
| 1159 | 1159 | |
| 1160 | - ++$next; |
|
| 1160 | + ++ $next; |
|
| 1161 | 1161 | } |
| 1162 | 1162 | } |
| 1163 | 1163 | |
@@ -1305,7 +1305,7 @@ discard block |
||
| 1305 | 1305 | * @return bool |
| 1306 | 1306 | */ |
| 1307 | 1307 | public static function is_option_true_in_array( $field, $option ) { |
| 1308 | - return ! empty( $field[ $option ] ); |
|
| 1308 | + return ! empty( $field[$option] ); |
|
| 1309 | 1309 | } |
| 1310 | 1310 | |
| 1311 | 1311 | /** |
@@ -1314,7 +1314,7 @@ discard block |
||
| 1314 | 1314 | * @return bool |
| 1315 | 1315 | */ |
| 1316 | 1316 | public static function is_option_true_in_object( $field, $option ) { |
| 1317 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 1317 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 1318 | 1318 | } |
| 1319 | 1319 | |
| 1320 | 1320 | /** |
@@ -1323,7 +1323,7 @@ discard block |
||
| 1323 | 1323 | * @return bool |
| 1324 | 1324 | */ |
| 1325 | 1325 | public static function is_option_empty_in_array( $field, $option ) { |
| 1326 | - return empty( $field[ $option ] ); |
|
| 1326 | + return empty( $field[$option] ); |
|
| 1327 | 1327 | } |
| 1328 | 1328 | |
| 1329 | 1329 | /** |
@@ -1332,7 +1332,7 @@ discard block |
||
| 1332 | 1332 | * @return bool |
| 1333 | 1333 | */ |
| 1334 | 1334 | public static function is_option_empty_in_object( $field, $option ) { |
| 1335 | - return empty( $field->field_options[ $option ] ); |
|
| 1335 | + return empty( $field->field_options[$option] ); |
|
| 1336 | 1336 | } |
| 1337 | 1337 | |
| 1338 | 1338 | /** |
@@ -1341,7 +1341,7 @@ discard block |
||
| 1341 | 1341 | * @return bool |
| 1342 | 1342 | */ |
| 1343 | 1343 | public static function is_option_value_in_object( $field, $option ) { |
| 1344 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 1344 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 1345 | 1345 | } |
| 1346 | 1346 | |
| 1347 | 1347 | /** |
@@ -1367,10 +1367,10 @@ discard block |
||
| 1367 | 1367 | * @return mixed |
| 1368 | 1368 | */ |
| 1369 | 1369 | public static function get_option_in_array( $field, $option ) { |
| 1370 | - if ( isset( $field[ $option ] ) ) { |
|
| 1371 | - $this_option = $field[ $option ]; |
|
| 1372 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
| 1373 | - $this_option = $field['field_options'][ $option ]; |
|
| 1370 | + if ( isset( $field[$option] ) ) { |
|
| 1371 | + $this_option = $field[$option]; |
|
| 1372 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
| 1373 | + $this_option = $field['field_options'][$option]; |
|
| 1374 | 1374 | } else { |
| 1375 | 1375 | $this_option = ''; |
| 1376 | 1376 | } |
@@ -1384,7 +1384,7 @@ discard block |
||
| 1384 | 1384 | * @return mixed |
| 1385 | 1385 | */ |
| 1386 | 1386 | public static function get_option_in_object( $field, $option ) { |
| 1387 | - return $field->field_options[ $option ] ?? ''; |
|
| 1387 | + return $field->field_options[$option] ?? ''; |
|
| 1388 | 1388 | } |
| 1389 | 1389 | |
| 1390 | 1390 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | 'page' => '', |
| 46 | 46 | 'class' => 'frm-mt-0', |
| 47 | 47 | ); |
| 48 | - $tip = array_merge( $defaults, $tip ); |
|
| 48 | + $tip = array_merge( $defaults, $tip ); |
|
| 49 | 49 | |
| 50 | 50 | if ( isset( $tip['link'] ) && ! isset( $tip['link']['medium'] ) ) { |
| 51 | 51 | $tip['link']['medium'] = 'tip'; |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | public static function get_random_tip( $tips ) { |
| 394 | 394 | $random = random_int( 0, count( $tips ) - 1 ); |
| 395 | 395 | |
| 396 | - return $tips[ $random ]; |
|
| 396 | + return $tips[$random]; |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | /** |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | wp_enqueue_script( 'formidable_settings' ); |
| 29 | 29 | return FrmAppHelper::clip( |
| 30 | 30 | // @phpstan-ignore-next-line |
| 31 | - function () use ( $id, $name, $args ) { |
|
| 31 | + function() use ( $id, $name, $args ) { |
|
| 32 | 32 | require FrmAppHelper::plugin_path() . '/classes/views/shared/toggle.php'; |
| 33 | 33 | }, |
| 34 | 34 | $args['echo'] ?? false |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $input_number_attrs = array_merge( |
|
| 100 | + $input_number_attrs = array_merge( |
|
| 101 | 101 | $args['input_number_attrs'], |
| 102 | 102 | array( |
| 103 | 103 | 'type' => ! empty( $selected_unit ) ? 'number' : 'text', |
@@ -219,17 +219,17 @@ discard block |
||
| 219 | 219 | public static function populate_on_submit_data( &$form_options, $action = null, $event = 'create' ) { |
| 220 | 220 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
| 221 | 221 | if ( ! $action || ! is_object( $action ) ) { |
| 222 | - $form_options[ $opt . 'action' ] = self::get_default_action_type(); |
|
| 223 | - $form_options[ $opt . 'msg' ] = self::get_default_msg(); |
|
| 222 | + $form_options[$opt . 'action'] = self::get_default_action_type(); |
|
| 223 | + $form_options[$opt . 'msg'] = self::get_default_msg(); |
|
| 224 | 224 | |
| 225 | 225 | return; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - $form_options[ $opt . 'action' ] = $action->post_content['success_action'] ?? 'message'; |
|
| 228 | + $form_options[$opt . 'action'] = $action->post_content['success_action'] ?? 'message'; |
|
| 229 | 229 | |
| 230 | - switch ( $form_options[ $opt . 'action' ] ) { |
|
| 230 | + switch ( $form_options[$opt . 'action'] ) { |
|
| 231 | 231 | case 'redirect': |
| 232 | - $form_options[ $opt . 'url' ] = $action->post_content['success_url'] ?? ''; |
|
| 232 | + $form_options[$opt . 'url'] = $action->post_content['success_url'] ?? ''; |
|
| 233 | 233 | $form_options['open_in_new_tab'] = ! empty( $action->post_content['open_in_new_tab'] ); |
| 234 | 234 | $form_options['redirect_delay'] = ! empty( $action->post_content['redirect_delay'] ); |
| 235 | 235 | $form_options['redirect_delay_time'] = $action->post_content['redirect_delay_time']; |
@@ -237,11 +237,11 @@ discard block |
||
| 237 | 237 | break; |
| 238 | 238 | |
| 239 | 239 | case 'page': |
| 240 | - $form_options[ $opt . 'page_id' ] = $action->post_content['success_page_id'] ?? ''; |
|
| 240 | + $form_options[$opt . 'page_id'] = $action->post_content['success_page_id'] ?? ''; |
|
| 241 | 241 | break; |
| 242 | 242 | |
| 243 | 243 | default: |
| 244 | - $form_options[ $opt . 'msg' ] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : self::get_default_msg(); |
|
| 244 | + $form_options[$opt . 'msg'] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : self::get_default_msg(); |
|
| 245 | 245 | $form_options['show_form'] = ! empty( $action->post_content['show_form'] ); |
| 246 | 246 | } |
| 247 | 247 | } |
@@ -330,20 +330,20 @@ discard block |
||
| 330 | 330 | private static function get_on_submit_action_data_from_form_options( $form_options, $event = 'create' ) { |
| 331 | 331 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
| 332 | 332 | $data = array( |
| 333 | - 'success_action' => $form_options[ $opt . 'action' ] ?? self::get_default_action_type(), |
|
| 333 | + 'success_action' => $form_options[$opt . 'action'] ?? self::get_default_action_type(), |
|
| 334 | 334 | ); |
| 335 | 335 | |
| 336 | 336 | switch ( $data['success_action'] ) { |
| 337 | 337 | case 'redirect': |
| 338 | - $data['success_url'] = $form_options[ $opt . 'url' ] ?? ''; |
|
| 338 | + $data['success_url'] = $form_options[$opt . 'url'] ?? ''; |
|
| 339 | 339 | break; |
| 340 | 340 | |
| 341 | 341 | case 'page': |
| 342 | - $data['success_page_id'] = $form_options[ $opt . 'page_id' ] ?? ''; |
|
| 342 | + $data['success_page_id'] = $form_options[$opt . 'page_id'] ?? ''; |
|
| 343 | 343 | break; |
| 344 | 344 | |
| 345 | 345 | default: |
| 346 | - $data['success_msg'] = $form_options[ $opt . 'msg' ] ?? self::get_default_msg(); |
|
| 346 | + $data['success_msg'] = $form_options[$opt . 'msg'] ?? self::get_default_msg(); |
|
| 347 | 347 | $data['show_form'] = ! empty( $form_options['show_form'] ); |
| 348 | 348 | } |
| 349 | 349 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | 'class' => '', |
| 38 | 38 | 'inc_children' => 'exclude', |
| 39 | 39 | ); |
| 40 | - $args = wp_parse_args( $args, $defaults ); |
|
| 40 | + $args = wp_parse_args( $args, $defaults ); |
|
| 41 | 41 | |
| 42 | 42 | if ( ! $args['field_id'] ) { |
| 43 | 43 | $args['field_id'] = $field_name; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public static function add_html_attr( $class, $param, &$add_html ) { |
| 80 | 80 | if ( ! empty( $class ) ) { |
| 81 | - $add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 81 | + $add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
@@ -322,8 +322,8 @@ discard block |
||
| 322 | 322 | 'description' => '', |
| 323 | 323 | ); |
| 324 | 324 | foreach ( $defaults as $var => $default ) { |
| 325 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 326 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 325 | + if ( ! isset( $values[$var] ) ) { |
|
| 326 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | |
@@ -338,8 +338,8 @@ discard block |
||
| 338 | 338 | 'parent_form_id' => 0, |
| 339 | 339 | ); |
| 340 | 340 | foreach ( $defaults as $var => $default ) { |
| 341 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 342 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 341 | + if ( ! isset( $values[$var] ) ) { |
|
| 342 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | unset( $defaults ); |
@@ -376,16 +376,16 @@ discard block |
||
| 376 | 376 | $defaults = self::get_default_opts(); |
| 377 | 377 | foreach ( $defaults as $var => $default ) { |
| 378 | 378 | if ( is_array( $default ) ) { |
| 379 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 380 | - $values[ $var ] = $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : array(); |
|
| 379 | + if ( ! isset( $values[$var] ) ) { |
|
| 380 | + $values[$var] = $record && isset( $record->options[$var] ) ? $record->options[$var] : array(); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | foreach ( $default as $k => $v ) { |
| 384 | - $values[ $var ][ $k ] = $post_values && isset( $post_values[ $var ][ $k ] ) ? $post_values[ $var ][ $k ] : ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ? $record->options[ $var ][ $k ] : $v ); |
|
| 384 | + $values[$var][$k] = $post_values && isset( $post_values[$var][$k] ) ? $post_values[$var][$k] : ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) ? $record->options[$var][$k] : $v ); |
|
| 385 | 385 | |
| 386 | 386 | if ( is_array( $v ) ) { |
| 387 | 387 | foreach ( $v as $k1 => $v1 ) { |
| 388 | - $values[ $var ][ $k ][ $k1 ] = $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ? $post_values[ $var ][ $k ][ $k1 ] : ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 ); |
|
| 388 | + $values[$var][$k][$k1] = $post_values && isset( $post_values[$var][$k][$k1] ) ? $post_values[$var][$k][$k1] : ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) && isset( $record->options[$var][$k][$k1] ) ? $record->options[$var][$k][$k1] : $v1 ); |
|
| 389 | 389 | unset( $k1, $v1 ); |
| 390 | 390 | } |
| 391 | 391 | } |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | unset( $k, $v ); |
| 394 | 394 | } |
| 395 | 395 | } else { |
| 396 | - $values[ $var ] = $post_values && isset( $post_values['options'][ $var ] ) ? $post_values['options'][ $var ] : ( $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : $default ); |
|
| 396 | + $values[$var] = $post_values && isset( $post_values['options'][$var] ) ? $post_values['options'][$var] : ( $record && isset( $record->options[$var] ) ? $record->options[$var] : $default ); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | unset( $var, $default ); |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | public static function fill_form_options( &$options, $values ) { |
| 439 | 439 | $defaults = self::get_default_opts(); |
| 440 | 440 | foreach ( $defaults as $var => $default ) { |
| 441 | - $options[ $var ] = $values['options'][ $var ] ?? $default; |
|
| 441 | + $options[$var] = $values['options'][$var] ?? $default; |
|
| 442 | 442 | unset( $var, $default ); |
| 443 | 443 | } |
| 444 | 444 | } |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | public static function insert_opt_html( $args ) { |
| 616 | 616 | $class = $args['class'] ?? ''; |
| 617 | 617 | $fields = self::get_field_type_data_for_insert_opt_html(); |
| 618 | - $field = $fields[ $args['type'] ] ?? array(); |
|
| 618 | + $field = $fields[$args['type']] ?? array(); |
|
| 619 | 619 | |
| 620 | 620 | self::prepare_field_type( $field ); |
| 621 | 621 | |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | $last_field = false; |
| 748 | 748 | foreach ( $fields as $field ) { |
| 749 | 749 | if ( $prev_order === $field->field_order ) { |
| 750 | - ++$add_order; |
|
| 750 | + ++ $add_order; |
|
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | if ( $add_order ) { |
@@ -1221,8 +1221,8 @@ discard block |
||
| 1221 | 1221 | $link .= ' onclick="return confirm(\'' . esc_attr( $link_details['confirm'] ) . '\')"'; |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | - $label = ( $link_details[ $length ] ?? $link_details['label'] ); |
|
| 1225 | - if ( $length === 'icon' && isset( $link_details[ $length ] ) ) { |
|
| 1224 | + $label = ( $link_details[$length] ?? $link_details['label'] ); |
|
| 1225 | + if ( $length === 'icon' && isset( $link_details[$length] ) ) { |
|
| 1226 | 1226 | $label = '<span class="' . $label . '" title="' . esc_attr( $link_details['label'] ) . '" aria-hidden="true"></span>'; |
| 1227 | 1227 | $link .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"'; |
| 1228 | 1228 | } |
@@ -1369,7 +1369,7 @@ discard block |
||
| 1369 | 1369 | $status = 'publish'; |
| 1370 | 1370 | } |
| 1371 | 1371 | |
| 1372 | - $name = $nice_names[ $status ]; |
|
| 1372 | + $name = $nice_names[$status]; |
|
| 1373 | 1373 | |
| 1374 | 1374 | return $name; |
| 1375 | 1375 | } |
@@ -1433,7 +1433,7 @@ discard block |
||
| 1433 | 1433 | $icon = $icons['']; |
| 1434 | 1434 | if ( count( $categories ) === 1 ) { |
| 1435 | 1435 | $category = reset( $categories ); |
| 1436 | - $icon = $icons[ $category ] ?? $icon; |
|
| 1436 | + $icon = $icons[$category] ?? $icon; |
|
| 1437 | 1437 | } elseif ( ! empty( $categories ) ) { |
| 1438 | 1438 | $icons = array_intersect_key( $icons, array_flip( $categories ) ); |
| 1439 | 1439 | $icon = reset( $icons ); |
@@ -1555,7 +1555,7 @@ discard block |
||
| 1555 | 1555 | |
| 1556 | 1556 | foreach ( $item['categories'] as $k => $category ) { |
| 1557 | 1557 | if ( in_array( $category, $plans, true ) ) { |
| 1558 | - unset( $item['categories'][ $k ] ); |
|
| 1558 | + unset( $item['categories'][$k] ); |
|
| 1559 | 1559 | |
| 1560 | 1560 | $category = self::convert_legacy_package_names( $category ); |
| 1561 | 1561 | |
@@ -1594,7 +1594,7 @@ discard block |
||
| 1594 | 1594 | 'include_all' => true, |
| 1595 | 1595 | 'case_lower' => false, |
| 1596 | 1596 | ); |
| 1597 | - $args = wp_parse_args( $args, $defaults ); |
|
| 1597 | + $args = wp_parse_args( $args, $defaults ); |
|
| 1598 | 1598 | |
| 1599 | 1599 | $license_types = array( 'Basic', 'Plus', 'Business', 'Elite' ); |
| 1600 | 1600 | |
@@ -1797,9 +1797,9 @@ discard block |
||
| 1797 | 1797 | } |
| 1798 | 1798 | |
| 1799 | 1799 | foreach ( $shortcodes[0] as $key => $shortcode ) { |
| 1800 | - $options = trim( $shortcodes[3][ $key ] ); |
|
| 1800 | + $options = trim( $shortcodes[3][$key] ); |
|
| 1801 | 1801 | |
| 1802 | - if ( in_array( $shortcodes[1][ $key ], array( 'if ' ), true ) ) { |
|
| 1802 | + if ( in_array( $shortcodes[1][$key], array( 'if ' ), true ) ) { |
|
| 1803 | 1803 | // Skip if shortcodes. |
| 1804 | 1804 | continue; |
| 1805 | 1805 | } |
@@ -1809,7 +1809,7 @@ discard block |
||
| 1809 | 1809 | continue; |
| 1810 | 1810 | } |
| 1811 | 1811 | |
| 1812 | - $new_shortcode = '[' . $shortcodes[2][ $key ]; |
|
| 1812 | + $new_shortcode = '[' . $shortcodes[2][$key]; |
|
| 1813 | 1813 | if ( $options ) { |
| 1814 | 1814 | $new_shortcode .= ' ' . $options; |
| 1815 | 1815 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if ( isset( self::$messages[ $message['key'] ] ) && ! isset( $message['force'] ) ) { |
|
| 108 | + if ( isset( self::$messages[$message['key']] ) && ! isset( $message['force'] ) ) { |
|
| 109 | 109 | // Don't replace messages unless required. |
| 110 | 110 | return; |
| 111 | 111 | } |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | return; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if ( isset( self::$messages[ $message['key'] ] ) ) { |
|
| 117 | + if ( isset( self::$messages[$message['key']] ) ) { |
|
| 118 | 118 | // Move up and mark as new. |
| 119 | - unset( self::$messages[ $message['key'] ] ); |
|
| 119 | + unset( self::$messages[$message['key']] ); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $this->fill_message( $message ); |
| 123 | - self::$messages[ $message['key'] ] = $message; |
|
| 123 | + self::$messages[$message['key']] = $message; |
|
| 124 | 124 | |
| 125 | 125 | $this->update_list(); |
| 126 | 126 | |
@@ -157,11 +157,11 @@ discard block |
||
| 157 | 157 | private function clean_messages() { |
| 158 | 158 | $removed = false; |
| 159 | 159 | foreach ( self::$messages as $t => $message ) { |
| 160 | - $read = ! empty( $message['read'] ) && isset( $message['read'][ get_current_user_id() ] ) && $message['read'][ get_current_user_id() ] < strtotime( '-1 month' ); |
|
| 161 | - $dismissed = ! empty( $message['dismissed'] ) && isset( $message['dismissed'][ get_current_user_id() ] ) && $message['dismissed'][ get_current_user_id() ] < strtotime( '-1 week' ); |
|
| 160 | + $read = ! empty( $message['read'] ) && isset( $message['read'][get_current_user_id()] ) && $message['read'][get_current_user_id()] < strtotime( '-1 month' ); |
|
| 161 | + $dismissed = ! empty( $message['dismissed'] ) && isset( $message['dismissed'][get_current_user_id()] ) && $message['dismissed'][get_current_user_id()] < strtotime( '-1 week' ); |
|
| 162 | 162 | |
| 163 | 163 | if ( $read || $dismissed || ! $this->within_valid_timeframe( $message ) ) { |
| 164 | - unset( self::$messages[ $t ] ); |
|
| 164 | + unset( self::$messages[$t] ); |
|
| 165 | 165 | $removed = true; |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -179,11 +179,11 @@ discard block |
||
| 179 | 179 | public function filter_messages( &$messages, $type = 'unread' ) { |
| 180 | 180 | $user_id = get_current_user_id(); |
| 181 | 181 | foreach ( $messages as $k => $message ) { |
| 182 | - $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][ $user_id ] ); |
|
| 182 | + $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][$user_id] ); |
|
| 183 | 183 | if ( empty( $k ) || ! $this->within_valid_timeframe( $message ) || ( $type === 'dismissed' ) !== $dismissed ) { |
| 184 | - unset( $messages[ $k ] ); |
|
| 184 | + unset( $messages[$k] ); |
|
| 185 | 185 | } elseif ( ! $this->is_for_user( $message ) ) { |
| 186 | - unset( $messages[ $k ] ); |
|
| 186 | + unset( $messages[$k] ); |
|
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | $messages = apply_filters( 'frm_filter_inbox', $messages ); |
@@ -257,14 +257,14 @@ discard block |
||
| 257 | 257 | * @return void |
| 258 | 258 | */ |
| 259 | 259 | public function mark_read( $key ) { |
| 260 | - if ( ! $key || ! isset( self::$messages[ $key ] ) ) { |
|
| 260 | + if ( ! $key || ! isset( self::$messages[$key] ) ) { |
|
| 261 | 261 | return; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - if ( ! isset( self::$messages[ $key ]['read'] ) ) { |
|
| 265 | - self::$messages[ $key ]['read'] = array(); |
|
| 264 | + if ( ! isset( self::$messages[$key]['read'] ) ) { |
|
| 265 | + self::$messages[$key]['read'] = array(); |
|
| 266 | 266 | } |
| 267 | - self::$messages[ $key ]['read'][ get_current_user_id() ] = time(); |
|
| 267 | + self::$messages[$key]['read'][get_current_user_id()] = time(); |
|
| 268 | 268 | |
| 269 | 269 | $this->update_list(); |
| 270 | 270 | } |
@@ -276,9 +276,9 @@ discard block |
||
| 276 | 276 | * @return void |
| 277 | 277 | */ |
| 278 | 278 | public function mark_unread( $key ) { |
| 279 | - $is_read = isset( self::$messages[ $key ] ) && isset( self::$messages[ $key ]['read'] ) && isset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
| 279 | + $is_read = isset( self::$messages[$key] ) && isset( self::$messages[$key]['read'] ) && isset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
| 280 | 280 | if ( $is_read ) { |
| 281 | - unset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
| 281 | + unset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
| 282 | 282 | $this->update_list(); |
| 283 | 283 | } |
| 284 | 284 | } |
@@ -294,14 +294,14 @@ discard block |
||
| 294 | 294 | return; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - if ( ! isset( self::$messages[ $key ] ) ) { |
|
| 297 | + if ( ! isset( self::$messages[$key] ) ) { |
|
| 298 | 298 | return; |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - if ( ! isset( self::$messages[ $key ]['dismissed'] ) ) { |
|
| 302 | - self::$messages[ $key ]['dismissed'] = array(); |
|
| 301 | + if ( ! isset( self::$messages[$key]['dismissed'] ) ) { |
|
| 302 | + self::$messages[$key]['dismissed'] = array(); |
|
| 303 | 303 | } |
| 304 | - self::$messages[ $key ]['dismissed'][ get_current_user_id() ] = time(); |
|
| 304 | + self::$messages[$key]['dismissed'][get_current_user_id()] = time(); |
|
| 305 | 305 | |
| 306 | 306 | $this->update_list(); |
| 307 | 307 | } |
@@ -315,11 +315,11 @@ discard block |
||
| 315 | 315 | $user_id = get_current_user_id(); |
| 316 | 316 | foreach ( self::$messages as $key => $message ) { |
| 317 | 317 | if ( ! isset( $message['dismissed'] ) ) { |
| 318 | - self::$messages[ $key ]['dismissed'] = array(); |
|
| 318 | + self::$messages[$key]['dismissed'] = array(); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - if ( ! isset( $message['dismissed'][ $user_id ] ) ) { |
|
| 322 | - self::$messages[ $key ]['dismissed'][ $user_id ] = time(); |
|
| 321 | + if ( ! isset( $message['dismissed'][$user_id] ) ) { |
|
| 322 | + self::$messages[$key]['dismissed'][$user_id] = time(); |
|
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | $this->update_list(); |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | $messages = $this->get_messages( 'filter' ); |
| 330 | 330 | $user_id = get_current_user_id(); |
| 331 | 331 | foreach ( $messages as $t => $message ) { |
| 332 | - if ( isset( $message['read'] ) && isset( $message['read'][ $user_id ] ) ) { |
|
| 333 | - unset( $messages[ $t ] ); |
|
| 332 | + if ( isset( $message['read'] ) && isset( $message['read'][$user_id] ) ) { |
|
| 333 | + unset( $messages[$t] ); |
|
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | return $messages; |
@@ -369,8 +369,8 @@ discard block |
||
| 369 | 369 | * @return void |
| 370 | 370 | */ |
| 371 | 371 | public function remove( $key ) { |
| 372 | - if ( isset( self::$messages[ $key ] ) ) { |
|
| 373 | - unset( self::$messages[ $key ] ); |
|
| 372 | + if ( isset( self::$messages[$key] ) ) { |
|
| 373 | + unset( self::$messages[$key] ); |
|
| 374 | 374 | $this->update_list(); |
| 375 | 375 | } |
| 376 | 376 | } |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | * @param array $matches The regex results for a single match. |
| 417 | 417 | * @return string |
| 418 | 418 | */ |
| 419 | - function ( $matches ) { |
|
| 419 | + function( $matches ) { |
|
| 420 | 420 | $url = $matches[2]; |
| 421 | 421 | $parts = parse_url( $url ); |
| 422 | 422 | |
@@ -479,8 +479,8 @@ discard block |
||
| 479 | 479 | $inbox = new self(); |
| 480 | 480 | return array_filter( |
| 481 | 481 | $inbox->get_messages( 'filter' ), |
| 482 | - function ( $message ) use ( $key ) { |
|
| 483 | - return ! empty( $message[ $key ] ); |
|
| 482 | + function( $message ) use ( $key ) { |
|
| 483 | + return ! empty( $message[$key] ); |
|
| 484 | 484 | } |
| 485 | 485 | ); |
| 486 | 486 | } |
@@ -526,8 +526,8 @@ discard block |
||
| 526 | 526 | |
| 527 | 527 | return array_reduce( |
| 528 | 528 | $keys_to_return, |
| 529 | - function ( $total, $key ) use ( $message ) { |
|
| 530 | - $total[ $key ] = $message[ $key ] ?? ''; |
|
| 529 | + function( $total, $key ) use ( $message ) { |
|
| 530 | + $total[$key] = $message[$key] ?? ''; |
|
| 531 | 531 | return $total; |
| 532 | 532 | }, |
| 533 | 533 | array() |
@@ -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 | }//end foreach |
| 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 | |
@@ -360,22 +360,22 @@ discard block |
||
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | foreach ( $update_options as $opt => $default ) { |
| 363 | - $field->field_options[ $opt ] = $values['field_options'][ $opt . '_' . $field_id ] ?? $default; |
|
| 364 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 363 | + $field->field_options[$opt] = $values['field_options'][$opt . '_' . $field_id] ?? $default; |
|
| 364 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
| 368 | 368 | |
| 369 | 369 | $new_field = array( |
| 370 | 370 | 'field_options' => $field->field_options, |
| 371 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
| 371 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
| 372 | 372 | ); |
| 373 | 373 | |
| 374 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
| 375 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
| 374 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
| 375 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
| 376 | 376 | if ( is_array( $option ) ) { |
| 377 | 377 | foreach ( $option as $key => $item ) { |
| 378 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
| 378 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | } |
@@ -405,8 +405,8 @@ discard block |
||
| 405 | 405 | */ |
| 406 | 406 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
| 407 | 407 | if ( $field->type === 'textarea' && |
| 408 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
| 409 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 408 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
| 409 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 410 | 410 | |
| 411 | 411 | $new_field['field_options']['max'] = ''; |
| 412 | 412 | |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
| 415 | 415 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
| 416 | 416 | */ |
| 417 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
| 417 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | |
@@ -492,11 +492,11 @@ discard block |
||
| 492 | 492 | * Updating the settings page |
| 493 | 493 | */ |
| 494 | 494 | private static function get_settings_page_html( $values, &$field ) { |
| 495 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 495 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 496 | 496 | $prev_opts = array(); |
| 497 | 497 | $fallback_html = $field->field_options['custom_html'] ?? FrmFieldsHelper::get_default_html( $field->type ); |
| 498 | 498 | |
| 499 | - $field->field_options['custom_html'] = $values['field_options'][ 'custom_html_' . $field->id ] ?? $fallback_html; |
|
| 499 | + $field->field_options['custom_html'] = $values['field_options']['custom_html_' . $field->id] ?? $fallback_html; |
|
| 500 | 500 | } elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) { |
| 501 | 501 | $prev_opts = $field->field_options; |
| 502 | 502 | } |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | ); |
| 522 | 522 | foreach ( $field_cols as $col => $default ) { |
| 523 | 523 | $default = $default === '' ? $field->{$col} : $default; |
| 524 | - $new_field[ $col ] = $values['field_options'][ $col . '_' . $field->id ] ?? $default; |
|
| 524 | + $new_field[$col] = $values['field_options'][$col . '_' . $field->id] ?? $default; |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | if ( $field->type === 'submit' && isset( $new_field['field_order'] ) && (int) $new_field['field_order'] === FrmSubmitHelper::DEFAULT_ORDER ) { |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | if ( ! isset( $form->options['trash_time'] ) || $form->options['trash_time'] < $delete_timestamp ) { |
| 713 | 713 | self::destroy( $form->id ); |
| 714 | 714 | if ( empty( $form->parent_form_id ) ) { |
| 715 | - ++$count; |
|
| 715 | + ++ $count; |
|
| 716 | 716 | } |
| 717 | 717 | } |
| 718 | 718 | |
@@ -935,16 +935,16 @@ discard block |
||
| 935 | 935 | foreach ( $results as $row ) { |
| 936 | 936 | if ( 'trash' != $row->status ) { |
| 937 | 937 | if ( $row->is_template ) { |
| 938 | - ++$counts['template']; |
|
| 938 | + ++ $counts['template']; |
|
| 939 | 939 | } else { |
| 940 | - ++$counts['published']; |
|
| 940 | + ++ $counts['published']; |
|
| 941 | 941 | } |
| 942 | 942 | } else { |
| 943 | - ++$counts['trash']; |
|
| 943 | + ++ $counts['trash']; |
|
| 944 | 944 | } |
| 945 | 945 | |
| 946 | 946 | if ( 'draft' == $row->status ) { |
| 947 | - ++$counts['draft']; |
|
| 947 | + ++ $counts['draft']; |
|
| 948 | 948 | } |
| 949 | 949 | |
| 950 | 950 | unset( $row ); |
@@ -985,8 +985,8 @@ discard block |
||
| 985 | 985 | self::maybe_get_form( $form ); |
| 986 | 986 | } |
| 987 | 987 | |
| 988 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 989 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 988 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 989 | + return $frm_vars['form_params'][$form->id]; |
|
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1015,15 +1015,15 @@ discard block |
||
| 1015 | 1015 | // If there are two forms on the same page, make sure not to submit both. |
| 1016 | 1016 | foreach ( $default_values as $var => $default ) { |
| 1017 | 1017 | if ( $var === 'action' ) { |
| 1018 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1018 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1019 | 1019 | } else { |
| 1020 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1020 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1021 | 1021 | } |
| 1022 | 1022 | unset( $var, $default ); |
| 1023 | 1023 | } |
| 1024 | 1024 | } else { |
| 1025 | 1025 | foreach ( $default_values as $var => $default ) { |
| 1026 | - $values[ $var ] = $default; |
|
| 1026 | + $values[$var] = $default; |
|
| 1027 | 1027 | unset( $var, $default ); |
| 1028 | 1028 | } |
| 1029 | 1029 | } |
@@ -1049,7 +1049,7 @@ discard block |
||
| 1049 | 1049 | 'sdir' => '', |
| 1050 | 1050 | ); |
| 1051 | 1051 | foreach ( $defaults as $var => $default ) { |
| 1052 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1052 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | 1055 | return $values; |
@@ -1077,7 +1077,7 @@ discard block |
||
| 1077 | 1077 | 'keep_post' => '', |
| 1078 | 1078 | ); |
| 1079 | 1079 | foreach ( $defaults as $var => $default ) { |
| 1080 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1080 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | 1083 | return $values; |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | $form = $atts['form']; |
| 1181 | 1181 | $default = $atts['default'] ?? ''; |
| 1182 | 1182 | |
| 1183 | - return $form->options[ $atts['option'] ] ?? $default; |
|
| 1183 | + return $form->options[$atts['option']] ?? $default; |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | /** |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | unset( $filename ); |
| 156 | 156 | |
| 157 | - $comment_count = FrmDb::get_count( |
|
| 157 | + $comment_count = FrmDb::get_count( |
|
| 158 | 158 | 'frm_item_metas', |
| 159 | 159 | array( |
| 160 | 160 | 'item_id' => $atts['entry_ids'], |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | private static function prepare_csv_headings() { |
| 301 | 301 | $headings = array(); |
| 302 | 302 | self::csv_headings( $headings ); |
| 303 | - $headings = apply_filters( |
|
| 303 | + $headings = apply_filters( |
|
| 304 | 304 | 'frm_csv_columns', |
| 305 | 305 | $headings, |
| 306 | 306 | self::$form_id, |
@@ -324,15 +324,15 @@ discard block |
||
| 324 | 324 | $field_headings = array(); |
| 325 | 325 | $separate_values = array( 'user_id', 'file', 'data', 'date' ); |
| 326 | 326 | if ( ! empty( $col->field_options['separate_value'] ) && ! in_array( $col->type, $separate_values, true ) ) { |
| 327 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 327 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - if ( ! empty( $field_headings[ $col->id . '_label' ] ) ) { |
|
| 331 | - $field_headings[ $col->id ] = strip_tags( $col->name . ' ' . __( '(value)', 'formidable' ) ); |
|
| 330 | + if ( ! empty( $field_headings[$col->id . '_label'] ) ) { |
|
| 331 | + $field_headings[$col->id] = strip_tags( $col->name . ' ' . __( '(value)', 'formidable' ) ); |
|
| 332 | 332 | } else { |
| 333 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
| 333 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
| 334 | 334 | } |
| 335 | - $field_headings = apply_filters( |
|
| 335 | + $field_headings = apply_filters( |
|
| 336 | 336 | 'frm_csv_field_columns', |
| 337 | 337 | $field_headings, |
| 338 | 338 | array_merge( |
@@ -352,14 +352,14 @@ discard block |
||
| 352 | 352 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 353 | 353 | $repeater_id = $col->field_options['in_section']; |
| 354 | 354 | // Set a placeholder to maintain order for repeater fields. |
| 355 | - $headings[ 'repeater' . $repeater_id ] = array(); |
|
| 355 | + $headings['repeater' . $repeater_id] = array(); |
|
| 356 | 356 | |
| 357 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 358 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
| 357 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
| 358 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
| 359 | 359 | $repeater_ids[] = $repeater_id; |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
| 362 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
| 363 | 363 | |
| 364 | 364 | continue; |
| 365 | 365 | } |
@@ -378,8 +378,8 @@ discard block |
||
| 378 | 378 | $end = strpos( $row->meta_value, ':{' ); |
| 379 | 379 | $length = substr( $row->meta_value, $start, $end - $start ); |
| 380 | 380 | |
| 381 | - if ( $length > $max[ $row->field_id ] ) { |
|
| 382 | - $max[ $row->field_id ] = $length; |
|
| 381 | + if ( $length > $max[$row->field_id] ) { |
|
| 382 | + $max[$row->field_id] = $length; |
|
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | unset( $start, $end, $length, $row, $repeater_meta, $where ); |
@@ -390,17 +390,17 @@ discard block |
||
| 390 | 390 | $repeater_id = str_replace( 'repeater', '', $key ); |
| 391 | 391 | |
| 392 | 392 | $repeater_headings = array(); |
| 393 | - foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) { |
|
| 393 | + foreach ( $fields_by_repeater_id[$repeater_id] as $col ) { |
|
| 394 | 394 | $repeater_headings += self::field_headings( $col ); |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - for ( $i = 0; $i < $max[ $repeater_id ]; $i++ ) { |
|
| 397 | + for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) { |
|
| 398 | 398 | foreach ( $repeater_headings as $repeater_key => $repeater_name ) { |
| 399 | - $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name; |
|
| 399 | + $flat[$repeater_key . '[' . $i . ']'] = $repeater_name; |
|
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | } else { |
| 403 | - $flat[ $key ] = $heading; |
|
| 403 | + $flat[$key] = $heading; |
|
| 404 | 404 | } |
| 405 | 405 | } |
| 406 | 406 | |
@@ -413,10 +413,10 @@ discard block |
||
| 413 | 413 | }//end if |
| 414 | 414 | |
| 415 | 415 | if ( self::$comment_count ) { |
| 416 | - for ( $i = 0; $i < self::$comment_count; $i++ ) { |
|
| 417 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
| 418 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
| 419 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
| 416 | + for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
|
| 417 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
| 418 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
| 419 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
| 420 | 420 | } |
| 421 | 421 | unset( $i ); |
| 422 | 422 | } |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | |
| 462 | 462 | private static function prepare_next_csv_rows( $next_set ) { |
| 463 | 463 | if ( FrmAppHelper::pro_is_installed() ) { |
| 464 | - $where = array( |
|
| 464 | + $where = array( |
|
| 465 | 465 | 'or' => 1, |
| 466 | 466 | 'id' => $next_set, |
| 467 | 467 | 'parent_item_id' => $next_set, |
@@ -518,32 +518,32 @@ discard block |
||
| 518 | 518 | continue; |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | - if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) { |
|
| 522 | - $entries[ self::$entry->parent_item_id ] = new stdClass(); |
|
| 523 | - $entries[ self::$entry->parent_item_id ]->metas = array(); |
|
| 521 | + if ( ! isset( $entries[self::$entry->parent_item_id] ) ) { |
|
| 522 | + $entries[self::$entry->parent_item_id] = new stdClass(); |
|
| 523 | + $entries[self::$entry->parent_item_id]->metas = array(); |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 527 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
| 528 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 526 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 527 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
| 528 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 529 | 529 | // if the data is here, it should be an array but if this field has collected data |
| 530 | 530 | // both while inside and outside of the repeating section, it's possible this is a string. |
| 531 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
| 531 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | // Add the repeated values. |
| 535 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
| 535 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
| 536 | 536 | }//end foreach |
| 537 | 537 | |
| 538 | 538 | self::$entry->metas = self::fill_missing_repeater_metas( self::$entry->metas, $entries ); |
| 539 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
| 539 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
| 540 | 540 | }//end if |
| 541 | 541 | |
| 542 | 542 | // add the embedded form id |
| 543 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
| 544 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
| 543 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
| 544 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
| 545 | 545 | } |
| 546 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
| 546 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | /** |
@@ -564,19 +564,19 @@ discard block |
||
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | $repeater_id = $field->field_options['in_section']; |
| 567 | - if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 567 | + if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) { |
|
| 568 | 568 | return $metas; |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | - foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) { |
|
| 572 | - if ( ! isset( $metas[ $repeater_child->id ] ) ) { |
|
| 573 | - $metas[ $repeater_child->id ] = ''; |
|
| 571 | + foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) { |
|
| 572 | + if ( ! isset( $metas[$repeater_child->id] ) ) { |
|
| 573 | + $metas[$repeater_child->id] = ''; |
|
| 574 | 574 | |
| 575 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) || ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) ) { |
|
| 576 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] = array(); |
|
| 575 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) || ! is_array( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) ) { |
|
| 576 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] = array(); |
|
| 577 | 577 | } |
| 578 | 578 | |
| 579 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = ''; |
|
| 579 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = ''; |
|
| 580 | 580 | } |
| 581 | 581 | } |
| 582 | 582 | |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | |
| 596 | 596 | private static function add_field_values_to_csv( &$row ) { |
| 597 | 597 | foreach ( self::$fields as $col ) { |
| 598 | - $field_value = self::$entry->metas[ $col->id ] ?? false; |
|
| 598 | + $field_value = self::$entry->metas[$col->id] ?? false; |
|
| 599 | 599 | |
| 600 | 600 | FrmFieldsHelper::prepare_field_value( $field_value, $col->type ); |
| 601 | 601 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -614,20 +614,20 @@ discard block |
||
| 614 | 614 | if ( ! empty( $col->field_options['separate_value'] ) ) { |
| 615 | 615 | $label_key = $col->id . '_label'; |
| 616 | 616 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 617 | - $row[ $label_key ] = array(); |
|
| 617 | + $row[$label_key] = array(); |
|
| 618 | 618 | |
| 619 | 619 | if ( is_array( $field_value ) ) { |
| 620 | 620 | foreach ( $field_value as $value ) { |
| 621 | - $row[ $label_key ][] = self::get_separate_value_label( $value, $col ); |
|
| 621 | + $row[$label_key][] = self::get_separate_value_label( $value, $col ); |
|
| 622 | 622 | } |
| 623 | 623 | } |
| 624 | 624 | } else { |
| 625 | - $row[ $label_key ] = self::get_separate_value_label( $field_value, $col ); |
|
| 625 | + $row[$label_key] = self::get_separate_value_label( $field_value, $col ); |
|
| 626 | 626 | } |
| 627 | 627 | unset( $label_key ); |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | - $row[ $col->id ] = $field_value; |
|
| 630 | + $row[$col->id] = $field_value; |
|
| 631 | 631 | |
| 632 | 632 | unset( $col, $field_value ); |
| 633 | 633 | }//end foreach |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | 'show_icon' => false, |
| 651 | 651 | 'entry_id' => self::$entry->id, |
| 652 | 652 | 'sep' => self::$separator, |
| 653 | - '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, |
|
| 653 | + '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, |
|
| 654 | 654 | ) |
| 655 | 655 | ); |
| 656 | 656 | } |
@@ -665,8 +665,8 @@ discard block |
||
| 665 | 665 | // This is combo field inside repeater. The heading key has this format: [86_first[0]]. |
| 666 | 666 | foreach ( $sub_value as $sub_key => $sub_sub_value ) { |
| 667 | 667 | $column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']'; |
| 668 | - if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 669 | - $row[ $column_key ] = $sub_sub_value; |
|
| 668 | + if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) { |
|
| 669 | + $row[$column_key] = $sub_sub_value; |
|
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | 672 | |
@@ -674,8 +674,8 @@ discard block |
||
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | $column_key = $atts['col']->id . '_' . $key; |
| 677 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 678 | - $row[ $column_key ] = $sub_value; |
|
| 677 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
| 678 | + $row[$column_key] = $sub_value; |
|
| 679 | 679 | } |
| 680 | 680 | } |
| 681 | 681 | } |
@@ -700,18 +700,18 @@ discard block |
||
| 700 | 700 | $echo = 'echo' === self::$mode; |
| 701 | 701 | |
| 702 | 702 | foreach ( self::$headings as $k => $heading ) { |
| 703 | - if ( isset( $rows[ $k ] ) ) { |
|
| 704 | - $row = $rows[ $k ]; |
|
| 703 | + if ( isset( $rows[$k] ) ) { |
|
| 704 | + $row = $rows[$k]; |
|
| 705 | 705 | } else { |
| 706 | 706 | $row = ''; |
| 707 | 707 | // array indexed data is not at $rows[ $k ] |
| 708 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
| 708 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
| 709 | 709 | $start = strrpos( $k, '[' ); |
| 710 | - $key = substr( $k, 0, $start++ ); |
|
| 710 | + $key = substr( $k, 0, $start ++ ); |
|
| 711 | 711 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
| 712 | 712 | |
| 713 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
| 714 | - $row = $rows[ $key ][ $index ]; |
|
| 713 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
| 714 | + $row = $rows[$key][$index]; |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | unset( $start, $key, $index ); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | public static function get_current_action_from_global_var( $form_id ) { |
| 86 | 86 | global $frm_vars; |
| 87 | 87 | |
| 88 | - return $frm_vars['form_params'][ $form_id ]['action'] ?? 'create'; |
|
| 88 | + return $frm_vars['form_params'][$form_id]['action'] ?? 'create'; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | public static function remove_submit_field_from_list( &$fields ) { |
| 178 | 178 | foreach ( $fields as $key => $field ) { |
| 179 | 179 | if ( self::FIELD_TYPE === FrmField::get_field_type( $field ) ) { |
| 180 | - unset( $fields[ $key ] ); |
|
| 180 | + unset( $fields[$key] ); |
|
| 181 | 181 | return; |
| 182 | 182 | } |
| 183 | 183 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | array( 'field_order' => $new_order ) |
| 225 | 225 | ); |
| 226 | 226 | if ( false !== $updated ) { |
| 227 | - self::$last_row_fields_order[ $last_row_field_id ] = $new_order; |
|
| 227 | + self::$last_row_fields_order[$last_row_field_id] = $new_order; |
|
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | } |