@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @param array $atts |
45 | 45 | */ |
46 | 46 | private function _set( $param, $atts ) { |
47 | - if ( isset( $atts[ $param ] ) ) { |
|
48 | - $this->{$param} = $atts[ $param ]; |
|
47 | + if ( isset( $atts[$param] ) ) { |
|
48 | + $this->{$param} = $atts[$param]; |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | |
90 | 90 | $exclude = array( 'field_obj', 'html' ); |
91 | 91 | foreach ( $exclude as $ex ) { |
92 | - if ( isset( $atts[ $ex ] ) ) { |
|
93 | - unset( $this->pass_args[ $ex ] ); |
|
92 | + if ( isset( $atts[$ex] ) ) { |
|
93 | + unset( $this->pass_args[$ex] ); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | * @param array $set |
103 | 103 | */ |
104 | 104 | private function set_from_field( $atts, $set ) { |
105 | - if ( isset( $atts[ $set['param'] ] ) ) { |
|
106 | - $this->{$set['param']} = $atts[ $set['param'] ]; |
|
105 | + if ( isset( $atts[$set['param']] ) ) { |
|
106 | + $this->{$set['param']} = $atts[$set['param']]; |
|
107 | 107 | } else { |
108 | 108 | $this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] ); |
109 | 109 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | private function replace_error_shortcode() { |
232 | 232 | $this->maybe_add_error_id(); |
233 | - $error = $this->pass_args['errors'][ 'field' . $this->field_id ] ?? false; |
|
233 | + $error = $this->pass_args['errors']['field' . $this->field_id] ?? false; |
|
234 | 234 | |
235 | 235 | if ( ! empty( $error ) && false === strpos( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) { |
236 | 236 | $error_body = self::get_error_body( $this->html ); |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @since 3.06.02 |
272 | 272 | */ |
273 | 273 | private function maybe_add_error_id() { |
274 | - if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
274 | + if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
275 | 275 | return; |
276 | 276 | } |
277 | 277 | |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER ); |
352 | 352 | |
353 | 353 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
354 | - $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
354 | + $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
355 | 355 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
356 | 356 | |
357 | 357 | $replace_with = ''; |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $replace_with = $this->replace_input_shortcode( $shortcode_atts ); |
363 | 363 | } |
364 | 364 | |
365 | - $this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html ); |
|
365 | + $this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html ); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | */ |
385 | 385 | private function prepare_input_shortcode_atts( $shortcode_atts ) { |
386 | 386 | if ( isset( $shortcode_atts['opt'] ) ) { |
387 | - --$shortcode_atts['opt']; |
|
387 | + -- $shortcode_atts['opt']; |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | $field_class = $shortcode_atts['class'] ?? ''; |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | */ |
449 | 449 | private function get_field_div_classes() { |
450 | 450 | // Add error class |
451 | - $classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : ''; |
|
451 | + $classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : ''; |
|
452 | 452 | |
453 | 453 | // Add label position class |
454 | 454 | $settings = $this->field_obj->display_field_settings(); |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | } |
528 | 528 | |
529 | 529 | // Add 'aria-invalid' attribute to the group if there are errors. |
530 | - if ( isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
530 | + if ( isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
531 | 531 | $attributes['aria-invalid'] = 'true'; |
532 | 532 | } |
533 | 533 |
@@ -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 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | public static function get_current_action_from_global_var( $form_id ) { |
79 | 79 | global $frm_vars; |
80 | 80 | |
81 | - return $frm_vars['form_params'][ $form_id ]['action'] ?? 'create'; |
|
81 | + return $frm_vars['form_params'][$form_id]['action'] ?? 'create'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | public static function remove_submit_field_from_list( &$fields ) { |
171 | 171 | foreach ( $fields as $key => $field ) { |
172 | 172 | if ( self::FIELD_TYPE === FrmField::get_field_type( $field ) ) { |
173 | - unset( $fields[ $key ] ); |
|
173 | + unset( $fields[$key] ); |
|
174 | 174 | return; |
175 | 175 | } |
176 | 176 | } |
@@ -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 | /** |
@@ -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,10 +324,10 @@ 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 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
330 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
331 | 331 | $field_headings = apply_filters( |
332 | 332 | 'frm_csv_field_columns', |
333 | 333 | $field_headings, |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
349 | 349 | $repeater_id = $col->field_options['in_section']; |
350 | 350 | // Set a placeholder to maintain order for repeater fields. |
351 | - $headings[ 'repeater' . $repeater_id ] = array(); |
|
351 | + $headings['repeater' . $repeater_id] = array(); |
|
352 | 352 | |
353 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
354 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
353 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
354 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
355 | 355 | $repeater_ids[] = $repeater_id; |
356 | 356 | } |
357 | 357 | |
358 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
358 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
359 | 359 | |
360 | 360 | continue; |
361 | 361 | } |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | $end = strpos( $row->meta_value, ':{' ); |
375 | 375 | $length = substr( $row->meta_value, $start, $end - $start ); |
376 | 376 | |
377 | - if ( $length > $max[ $row->field_id ] ) { |
|
378 | - $max[ $row->field_id ] = $length; |
|
377 | + if ( $length > $max[$row->field_id] ) { |
|
378 | + $max[$row->field_id] = $length; |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | unset( $start, $end, $length, $row, $repeater_meta, $where ); |
@@ -386,17 +386,17 @@ discard block |
||
386 | 386 | $repeater_id = str_replace( 'repeater', '', $key ); |
387 | 387 | |
388 | 388 | $repeater_headings = array(); |
389 | - foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) { |
|
389 | + foreach ( $fields_by_repeater_id[$repeater_id] as $col ) { |
|
390 | 390 | $repeater_headings += self::field_headings( $col ); |
391 | 391 | } |
392 | 392 | |
393 | - for ( $i = 0; $i < $max[ $repeater_id ]; $i++ ) { |
|
393 | + for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) { |
|
394 | 394 | foreach ( $repeater_headings as $repeater_key => $repeater_name ) { |
395 | - $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name; |
|
395 | + $flat[$repeater_key . '[' . $i . ']'] = $repeater_name; |
|
396 | 396 | } |
397 | 397 | } |
398 | 398 | } else { |
399 | - $flat[ $key ] = $heading; |
|
399 | + $flat[$key] = $heading; |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
@@ -409,10 +409,10 @@ discard block |
||
409 | 409 | }//end if |
410 | 410 | |
411 | 411 | if ( self::$comment_count ) { |
412 | - for ( $i = 0; $i < self::$comment_count; $i++ ) { |
|
413 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
414 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
415 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
412 | + for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
|
413 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
414 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
415 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
416 | 416 | } |
417 | 417 | unset( $i ); |
418 | 418 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | |
458 | 458 | private static function prepare_next_csv_rows( $next_set ) { |
459 | 459 | if ( FrmAppHelper::pro_is_installed() ) { |
460 | - $where = array( |
|
460 | + $where = array( |
|
461 | 461 | 'or' => 1, |
462 | 462 | 'id' => $next_set, |
463 | 463 | 'parent_item_id' => $next_set, |
@@ -514,32 +514,32 @@ discard block |
||
514 | 514 | continue; |
515 | 515 | } |
516 | 516 | |
517 | - if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) { |
|
518 | - $entries[ self::$entry->parent_item_id ] = new stdClass(); |
|
519 | - $entries[ self::$entry->parent_item_id ]->metas = array(); |
|
517 | + if ( ! isset( $entries[self::$entry->parent_item_id] ) ) { |
|
518 | + $entries[self::$entry->parent_item_id] = new stdClass(); |
|
519 | + $entries[self::$entry->parent_item_id]->metas = array(); |
|
520 | 520 | } |
521 | 521 | |
522 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
523 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
524 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
522 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
523 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
524 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
525 | 525 | // if the data is here, it should be an array but if this field has collected data |
526 | 526 | // both while inside and outside of the repeating section, it's possible this is a string. |
527 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
527 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | // Add the repeated values. |
531 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
531 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
532 | 532 | }//end foreach |
533 | 533 | |
534 | 534 | self::$entry->metas = self::fill_missing_repeater_metas( self::$entry->metas, $entries ); |
535 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
535 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
536 | 536 | }//end if |
537 | 537 | |
538 | 538 | // add the embedded form id |
539 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
540 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
539 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
540 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
541 | 541 | } |
542 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
542 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | /** |
@@ -560,19 +560,19 @@ discard block |
||
560 | 560 | } |
561 | 561 | |
562 | 562 | $repeater_id = $field->field_options['in_section']; |
563 | - if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) { |
|
563 | + if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) { |
|
564 | 564 | return $metas; |
565 | 565 | } |
566 | 566 | |
567 | - foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) { |
|
568 | - if ( ! isset( $metas[ $repeater_child->id ] ) ) { |
|
569 | - $metas[ $repeater_child->id ] = ''; |
|
567 | + foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) { |
|
568 | + if ( ! isset( $metas[$repeater_child->id] ) ) { |
|
569 | + $metas[$repeater_child->id] = ''; |
|
570 | 570 | |
571 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) || ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) ) { |
|
572 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] = array(); |
|
571 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) || ! is_array( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) ) { |
|
572 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] = array(); |
|
573 | 573 | } |
574 | 574 | |
575 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = ''; |
|
575 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = ''; |
|
576 | 576 | } |
577 | 577 | } |
578 | 578 | |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | |
592 | 592 | private static function add_field_values_to_csv( &$row ) { |
593 | 593 | foreach ( self::$fields as $col ) { |
594 | - $field_value = self::$entry->metas[ $col->id ] ?? false; |
|
594 | + $field_value = self::$entry->metas[$col->id] ?? false; |
|
595 | 595 | |
596 | 596 | FrmFieldsHelper::prepare_field_value( $field_value, $col->type ); |
597 | 597 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -610,20 +610,20 @@ discard block |
||
610 | 610 | if ( ! empty( $col->field_options['separate_value'] ) ) { |
611 | 611 | $label_key = $col->id . '_label'; |
612 | 612 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
613 | - $row[ $label_key ] = array(); |
|
613 | + $row[$label_key] = array(); |
|
614 | 614 | |
615 | 615 | if ( is_array( $field_value ) ) { |
616 | 616 | foreach ( $field_value as $value ) { |
617 | - $row[ $label_key ][] = self::get_separate_value_label( $value, $col ); |
|
617 | + $row[$label_key][] = self::get_separate_value_label( $value, $col ); |
|
618 | 618 | } |
619 | 619 | } |
620 | 620 | } else { |
621 | - $row[ $label_key ] = self::get_separate_value_label( $field_value, $col ); |
|
621 | + $row[$label_key] = self::get_separate_value_label( $field_value, $col ); |
|
622 | 622 | } |
623 | 623 | unset( $label_key ); |
624 | 624 | } |
625 | 625 | |
626 | - $row[ $col->id ] = $field_value; |
|
626 | + $row[$col->id] = $field_value; |
|
627 | 627 | |
628 | 628 | unset( $col, $field_value ); |
629 | 629 | }//end foreach |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | 'show_icon' => false, |
647 | 647 | 'entry_id' => self::$entry->id, |
648 | 648 | 'sep' => self::$separator, |
649 | - '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, |
|
649 | + '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, |
|
650 | 650 | ) |
651 | 651 | ); |
652 | 652 | } |
@@ -661,8 +661,8 @@ discard block |
||
661 | 661 | // This is combo field inside repeater. The heading key has this format: [86_first[0]]. |
662 | 662 | foreach ( $sub_value as $sub_key => $sub_sub_value ) { |
663 | 663 | $column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']'; |
664 | - if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) { |
|
665 | - $row[ $column_key ] = $sub_sub_value; |
|
664 | + if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) { |
|
665 | + $row[$column_key] = $sub_sub_value; |
|
666 | 666 | } |
667 | 667 | } |
668 | 668 | |
@@ -670,8 +670,8 @@ discard block |
||
670 | 670 | } |
671 | 671 | |
672 | 672 | $column_key = $atts['col']->id . '_' . $key; |
673 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
674 | - $row[ $column_key ] = $sub_value; |
|
673 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
674 | + $row[$column_key] = $sub_value; |
|
675 | 675 | } |
676 | 676 | } |
677 | 677 | } |
@@ -696,18 +696,18 @@ discard block |
||
696 | 696 | $echo = 'echo' === self::$mode; |
697 | 697 | |
698 | 698 | foreach ( self::$headings as $k => $heading ) { |
699 | - if ( isset( $rows[ $k ] ) ) { |
|
700 | - $row = $rows[ $k ]; |
|
699 | + if ( isset( $rows[$k] ) ) { |
|
700 | + $row = $rows[$k]; |
|
701 | 701 | } else { |
702 | 702 | $row = ''; |
703 | 703 | // array indexed data is not at $rows[ $k ] |
704 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
704 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
705 | 705 | $start = strrpos( $k, '[' ); |
706 | - $key = substr( $k, 0, $start++ ); |
|
706 | + $key = substr( $k, 0, $start ++ ); |
|
707 | 707 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
708 | 708 | |
709 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
710 | - $row = $rows[ $key ][ $index ]; |
|
709 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
710 | + $row = $rows[$key][$index]; |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | unset( $start, $key, $index ); |
@@ -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() |