@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public static function show_status( $status ) { |
| 71 | 71 | $statuses = array_merge( self::get_payment_statuses(), self::get_subscription_statuses() ); |
| 72 | - return $statuses[ $status ] ?? $status; |
|
| 72 | + return $statuses[$status] ?? $status; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public static function get_action_setting( $option, $atts ) { |
| 161 | 161 | $settings = self::get_action_settings( $atts ); |
| 162 | - return $settings[ $option ] ?? ''; |
|
| 162 | + return $settings[$option] ?? ''; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -271,8 +271,8 @@ discard block |
||
| 271 | 271 | public static function get_repeat_label_from_value( $value, $number ) { |
| 272 | 272 | $times = self::get_plural_repeat_times( $number ); |
| 273 | 273 | |
| 274 | - if ( isset( $times[ $value ] ) ) { |
|
| 275 | - $value = $times[ $value ]; |
|
| 274 | + if ( isset( $times[$value] ) ) { |
|
| 275 | + $value = $times[$value]; |
|
| 276 | 276 | } |
| 277 | 277 | return $value; |
| 278 | 278 | } |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | |
| 542 | 542 | foreach ( $payments as $payment ) { |
| 543 | 543 | if ( $payment->status === 'complete' ) { |
| 544 | - $count++; |
|
| 544 | + $count ++; |
|
| 545 | 545 | } |
| 546 | 546 | } |
| 547 | 547 | |
@@ -569,8 +569,8 @@ discard block |
||
| 569 | 569 | $gateway = reset( $gateway ); |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | - if ( isset( $gateways[ $gateway ] ) ) { |
|
| 573 | - $value = $gateways[ $gateway ][ $setting ]; |
|
| 572 | + if ( isset( $gateways[$gateway] ) ) { |
|
| 573 | + $value = $gateways[$gateway][$setting]; |
|
| 574 | 574 | } |
| 575 | 575 | return $value; |
| 576 | 576 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | 'class' => '', |
| 52 | 52 | 'inc_children' => 'exclude', |
| 53 | 53 | ); |
| 54 | - $args = wp_parse_args( $args, $defaults ); |
|
| 54 | + $args = wp_parse_args( $args, $defaults ); |
|
| 55 | 55 | |
| 56 | 56 | if ( ! $args['field_id'] ) { |
| 57 | 57 | $args['field_id'] = $field_name; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public static function add_html_attr( $class, $param, &$add_html ) { |
| 98 | 98 | if ( ! empty( $class ) ) { |
| 99 | - $add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 99 | + $add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
@@ -363,8 +363,8 @@ discard block |
||
| 363 | 363 | ); |
| 364 | 364 | |
| 365 | 365 | foreach ( $defaults as $var => $default ) { |
| 366 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 367 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 366 | + if ( ! isset( $values[$var] ) ) { |
|
| 367 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
@@ -380,8 +380,8 @@ discard block |
||
| 380 | 380 | ); |
| 381 | 381 | |
| 382 | 382 | foreach ( $defaults as $var => $default ) { |
| 383 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 384 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 383 | + if ( ! isset( $values[$var] ) ) { |
|
| 384 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | unset( $defaults ); |
@@ -432,16 +432,16 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | foreach ( $defaults as $var => $default ) { |
| 434 | 434 | if ( is_array( $default ) ) { |
| 435 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 436 | - $values[ $var ] = $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : array(); |
|
| 435 | + if ( ! isset( $values[$var] ) ) { |
|
| 436 | + $values[$var] = $record && isset( $record->options[$var] ) ? $record->options[$var] : array(); |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | foreach ( $default as $k => $v ) { |
| 440 | - $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 ); |
|
| 440 | + $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 ); |
|
| 441 | 441 | |
| 442 | 442 | if ( is_array( $v ) ) { |
| 443 | 443 | foreach ( $v as $k1 => $v1 ) { |
| 444 | - $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 ); |
|
| 444 | + $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 ); |
|
| 445 | 445 | unset( $k1, $v1 ); |
| 446 | 446 | } |
| 447 | 447 | } |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | unset( $k, $v ); |
| 450 | 450 | } |
| 451 | 451 | } else { |
| 452 | - $values[ $var ] = $post_values && isset( $post_values['options'][ $var ] ) ? $post_values['options'][ $var ] : ( $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : $default ); |
|
| 452 | + $values[$var] = $post_values && isset( $post_values['options'][$var] ) ? $post_values['options'][$var] : ( $record && isset( $record->options[$var] ) ? $record->options[$var] : $default ); |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | unset( $var, $default ); |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | $defaults = self::get_default_opts(); |
| 499 | 499 | |
| 500 | 500 | foreach ( $defaults as $var => $default ) { |
| 501 | - $options[ $var ] = $values['options'][ $var ] ?? $default; |
|
| 501 | + $options[$var] = $values['options'][$var] ?? $default; |
|
| 502 | 502 | unset( $var, $default ); |
| 503 | 503 | } |
| 504 | 504 | } |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | public static function insert_opt_html( $args ) { |
| 696 | 696 | $class = $args['class'] ?? ''; |
| 697 | 697 | $fields = self::get_field_type_data_for_insert_opt_html(); |
| 698 | - $field = $fields[ $args['type'] ] ?? array(); |
|
| 698 | + $field = $fields[$args['type']] ?? array(); |
|
| 699 | 699 | |
| 700 | 700 | self::prepare_field_type( $field ); |
| 701 | 701 | |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | |
| 837 | 837 | foreach ( $fields as $field ) { |
| 838 | 838 | if ( $prev_order === $field->field_order ) { |
| 839 | - ++$add_order; |
|
| 839 | + ++ $add_order; |
|
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | if ( $add_order ) { |
@@ -1382,9 +1382,9 @@ discard block |
||
| 1382 | 1382 | $link .= ' onclick="return confirm(\'' . esc_attr( $link_details['confirm'] ) . '\')"'; |
| 1383 | 1383 | } |
| 1384 | 1384 | |
| 1385 | - $label = ( $link_details[ $length ] ?? $link_details['label'] ); |
|
| 1385 | + $label = ( $link_details[$length] ?? $link_details['label'] ); |
|
| 1386 | 1386 | |
| 1387 | - if ( $length === 'icon' && isset( $link_details[ $length ] ) ) { |
|
| 1387 | + if ( $length === 'icon' && isset( $link_details[$length] ) ) { |
|
| 1388 | 1388 | $label = '<span class="' . $label . '" title="' . esc_attr( $link_details['label'] ) . '" aria-hidden="true"></span>'; |
| 1389 | 1389 | $link .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"'; |
| 1390 | 1390 | } |
@@ -1556,7 +1556,7 @@ discard block |
||
| 1556 | 1556 | $status = 'publish'; |
| 1557 | 1557 | } |
| 1558 | 1558 | |
| 1559 | - return $nice_names[ $status ]; |
|
| 1559 | + return $nice_names[$status]; |
|
| 1560 | 1560 | } |
| 1561 | 1561 | |
| 1562 | 1562 | /** |
@@ -1620,7 +1620,7 @@ discard block |
||
| 1620 | 1620 | |
| 1621 | 1621 | if ( count( $categories ) === 1 ) { |
| 1622 | 1622 | $category = reset( $categories ); |
| 1623 | - $icon = $icons[ $category ] ?? $icon; |
|
| 1623 | + $icon = $icons[$category] ?? $icon; |
|
| 1624 | 1624 | } elseif ( ! empty( $categories ) ) { |
| 1625 | 1625 | $icons = array_intersect_key( $icons, array_flip( $categories ) ); |
| 1626 | 1626 | $icon = reset( $icons ); |
@@ -1752,7 +1752,7 @@ discard block |
||
| 1752 | 1752 | |
| 1753 | 1753 | foreach ( $item['categories'] as $k => $category ) { |
| 1754 | 1754 | if ( in_array( $category, $plans, true ) ) { |
| 1755 | - unset( $item['categories'][ $k ] ); |
|
| 1755 | + unset( $item['categories'][$k] ); |
|
| 1756 | 1756 | |
| 1757 | 1757 | return self::convert_legacy_package_names( $category ); |
| 1758 | 1758 | } |
@@ -1792,7 +1792,7 @@ discard block |
||
| 1792 | 1792 | 'include_all' => true, |
| 1793 | 1793 | 'case_lower' => false, |
| 1794 | 1794 | ); |
| 1795 | - $args = wp_parse_args( $args, $defaults ); |
|
| 1795 | + $args = wp_parse_args( $args, $defaults ); |
|
| 1796 | 1796 | |
| 1797 | 1797 | $license_types = array( 'Basic', 'Plus', 'Business', 'Elite' ); |
| 1798 | 1798 | |
@@ -1999,9 +1999,9 @@ discard block |
||
| 1999 | 1999 | } |
| 2000 | 2000 | |
| 2001 | 2001 | foreach ( $shortcodes[0] as $key => $shortcode ) { |
| 2002 | - $options = trim( $shortcodes[3][ $key ] ); |
|
| 2002 | + $options = trim( $shortcodes[3][$key] ); |
|
| 2003 | 2003 | |
| 2004 | - if ( in_array( $shortcodes[1][ $key ], array( 'if ' ), true ) ) { |
|
| 2004 | + if ( in_array( $shortcodes[1][$key], array( 'if ' ), true ) ) { |
|
| 2005 | 2005 | // Skip if shortcodes. |
| 2006 | 2006 | continue; |
| 2007 | 2007 | } |
@@ -2011,7 +2011,7 @@ discard block |
||
| 2011 | 2011 | continue; |
| 2012 | 2012 | } |
| 2013 | 2013 | |
| 2014 | - $new_shortcode = '[' . $shortcodes[2][ $key ]; |
|
| 2014 | + $new_shortcode = '[' . $shortcodes[2][$key]; |
|
| 2015 | 2015 | |
| 2016 | 2016 | if ( $options ) { |
| 2017 | 2017 | $new_shortcode .= ' ' . $options; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | 'payments' => $frm_payment->get_count(), |
| 129 | 129 | 'subscriptions' => $frm_sub->get_count(), |
| 130 | 130 | ); |
| 131 | - $type = FrmAppHelper::get_simple_request( |
|
| 131 | + $type = FrmAppHelper::get_simple_request( |
|
| 132 | 132 | array( |
| 133 | 133 | 'param' => 'trans_type', |
| 134 | 134 | 'type' => 'request', |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | foreach ( $statuses as $status => $name ) { |
| 140 | 140 | $class = $status === $type ? ' class="current"' : ''; |
| 141 | 141 | |
| 142 | - if ( $counts[ $status ] || 'published' === $status ) { |
|
| 143 | - $links[ $status ] = '<a href="' . esc_url( '?page=formidable-payments&trans_type=' . $status ) . '" ' . $class . '>' |
|
| 142 | + if ( $counts[$status] || 'published' === $status ) { |
|
| 143 | + $links[$status] = '<a href="' . esc_url( '?page=formidable-payments&trans_type=' . $status ) . '" ' . $class . '>' |
|
| 144 | 144 | // translators: %1$s: Transaction type (Payments or Subscriptions), %2$s: Span start tag, %3$s: Count, %4$s: Span close tag. |
| 145 | - . sprintf( esc_html__( '%1$s %2$s(%3$s)%4$s', 'formidable' ), esc_html( $name ), '<span class="count">', number_format_i18n( $counts[ $status ] ), '</span>' ) |
|
| 145 | + . sprintf( esc_html__( '%1$s %2$s(%3$s)%4$s', 'formidable' ), esc_html( $name ), '<span class="count">', number_format_i18n( $counts[$status] ), '</span>' ) |
|
| 146 | 146 | . '</a>'; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | echo '<tr id="payment-' . esc_attr( $item->id ) . '" '; |
| 223 | 223 | |
| 224 | 224 | $is_alternate = 0 === $alt % 2; |
| 225 | - ++$alt; |
|
| 225 | + ++ $alt; |
|
| 226 | 226 | |
| 227 | 227 | if ( $is_alternate ) { |
| 228 | 228 | echo 'class="alternate"'; |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | $form_ids = array(); |
| 318 | 318 | |
| 319 | 319 | foreach ( $forms as $form ) { |
| 320 | - $form_ids[ $form->id ] = $form; |
|
| 320 | + $form_ids[$form->id] = $form; |
|
| 321 | 321 | unset( $form ); |
| 322 | 322 | } |
| 323 | 323 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | 'href' => esc_url( $link ), |
| 371 | 371 | 'title' => __( 'View', 'formidable' ), |
| 372 | 372 | ); |
| 373 | - $link = '<a ' . FrmAppHelper::array_to_html_params( $link_params ) . '>' |
|
| 373 | + $link = '<a ' . FrmAppHelper::array_to_html_params( $link_params ) . '>' |
|
| 374 | 374 | . $item->{$field} |
| 375 | 375 | . '</a>'; |
| 376 | 376 | |
@@ -428,8 +428,8 @@ discard block |
||
| 428 | 428 | * @return mixed |
| 429 | 429 | */ |
| 430 | 430 | private function get_form_id_column( $item, $atts ) { |
| 431 | - if ( isset( $atts['form_ids'][ $item->item_id ] ) ) { |
|
| 432 | - return FrmFormsHelper::edit_form_link( $atts['form_ids'][ $item->item_id ]->form_id ); |
|
| 431 | + if ( isset( $atts['form_ids'][$item->item_id] ) ) { |
|
| 432 | + return FrmFormsHelper::edit_form_link( $atts['form_ids'][$item->item_id]->form_id ); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | return ''; |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | */ |
| 512 | 512 | private function get_processing_tooltip() { |
| 513 | 513 | return FrmAppHelper::clip( |
| 514 | - function () { |
|
| 514 | + function() { |
|
| 515 | 515 | FrmAppHelper::tooltip_icon( __( 'This payment method may take between 4-5 business days to process.', 'formidable' ) ); |
| 516 | 516 | } |
| 517 | 517 | ); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | if ( $new_val !== $value ) { |
| 234 | - $new_values[ $key ] = $new_val; |
|
| 234 | + $new_values[$key] = $new_val; |
|
| 235 | 235 | } |
| 236 | 236 | }//end foreach |
| 237 | 237 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | foreach ( $values as $value_key => $value ) { |
| 270 | 270 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
| 271 | - $new_values[ $value_key ] = $value; |
|
| 271 | + $new_values[$value_key] = $value; |
|
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
@@ -358,20 +358,20 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | foreach ( $all_fields as $fid ) { |
| 360 | 360 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
| 361 | - $values['item_meta'][ $fid->id ] = ''; |
|
| 361 | + $values['item_meta'][$fid->id] = ''; |
|
| 362 | 362 | } |
| 363 | - $field_array[ $fid->id ] = $fid; |
|
| 363 | + $field_array[$fid->id] = $fid; |
|
| 364 | 364 | } |
| 365 | 365 | unset( $all_fields ); |
| 366 | 366 | |
| 367 | 367 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
| 368 | - $field = $field_array[ $field_id ] ?? FrmField::getOne( $field_id ); |
|
| 368 | + $field = $field_array[$field_id] ?? FrmField::getOne( $field_id ); |
|
| 369 | 369 | |
| 370 | 370 | if ( ! $field ) { |
| 371 | 371 | continue; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
| 374 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
| 375 | 375 | |
| 376 | 376 | if ( $is_settings_page ) { |
| 377 | 377 | self::get_settings_page_html( $values, $field ); |
@@ -392,22 +392,22 @@ discard block |
||
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | foreach ( $update_options as $opt => $default ) { |
| 395 | - $field->field_options[ $opt ] = $values['field_options'][ $opt . '_' . $field_id ] ?? $default; |
|
| 396 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 395 | + $field->field_options[$opt] = $values['field_options'][$opt . '_' . $field_id] ?? $default; |
|
| 396 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
| 400 | 400 | |
| 401 | 401 | $new_field = array( |
| 402 | 402 | 'field_options' => $field->field_options, |
| 403 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
| 403 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
| 404 | 404 | ); |
| 405 | 405 | |
| 406 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
| 407 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
| 406 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
| 407 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
| 408 | 408 | if ( is_array( $option ) ) { |
| 409 | 409 | foreach ( $option as $key => $item ) { |
| 410 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
| 410 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | } |
@@ -438,8 +438,8 @@ discard block |
||
| 438 | 438 | */ |
| 439 | 439 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
| 440 | 440 | if ( $field->type === 'textarea' && |
| 441 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
| 442 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 441 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
| 442 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 443 | 443 | |
| 444 | 444 | $new_field['field_options']['max'] = ''; |
| 445 | 445 | |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
| 448 | 448 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
| 449 | 449 | */ |
| 450 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
| 450 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | |
@@ -528,11 +528,11 @@ discard block |
||
| 528 | 528 | * @return void |
| 529 | 529 | */ |
| 530 | 530 | private static function get_settings_page_html( $values, &$field ) { |
| 531 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 531 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 532 | 532 | $prev_opts = array(); |
| 533 | 533 | $fallback_html = $field->field_options['custom_html'] ?? FrmFieldsHelper::get_default_html( $field->type ); |
| 534 | 534 | |
| 535 | - $field->field_options['custom_html'] = $values['field_options'][ 'custom_html_' . $field->id ] ?? $fallback_html; |
|
| 535 | + $field->field_options['custom_html'] = $values['field_options']['custom_html_' . $field->id] ?? $fallback_html; |
|
| 536 | 536 | } elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) { |
| 537 | 537 | $prev_opts = $field->field_options; |
| 538 | 538 | } |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | |
| 567 | 567 | foreach ( $field_cols as $col => $default ) { |
| 568 | 568 | $default = $default === '' ? $field->{$col} : $default; |
| 569 | - $new_field[ $col ] = $values['field_options'][ $col . '_' . $field->id ] ?? $default; |
|
| 569 | + $new_field[$col] = $values['field_options'][$col . '_' . $field->id] ?? $default; |
|
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if ( $field->type === 'submit' && isset( $new_field['field_order'] ) && (int) $new_field['field_order'] === FrmSubmitHelper::DEFAULT_ORDER ) { |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | self::destroy( $form->id ); |
| 776 | 776 | |
| 777 | 777 | if ( empty( $form->parent_form_id ) ) { |
| 778 | - ++$count; |
|
| 778 | + ++ $count; |
|
| 779 | 779 | } |
| 780 | 780 | } |
| 781 | 781 | |
@@ -1004,16 +1004,16 @@ discard block |
||
| 1004 | 1004 | foreach ( $results as $row ) { |
| 1005 | 1005 | if ( 'trash' != $row->status ) { |
| 1006 | 1006 | if ( $row->is_template ) { |
| 1007 | - ++$counts['template']; |
|
| 1007 | + ++ $counts['template']; |
|
| 1008 | 1008 | } else { |
| 1009 | - ++$counts['published']; |
|
| 1009 | + ++ $counts['published']; |
|
| 1010 | 1010 | } |
| 1011 | 1011 | } else { |
| 1012 | - ++$counts['trash']; |
|
| 1012 | + ++ $counts['trash']; |
|
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | 1015 | if ( 'draft' == $row->status ) { |
| 1016 | - ++$counts['draft']; |
|
| 1016 | + ++ $counts['draft']; |
|
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | 1019 | unset( $row ); |
@@ -1062,8 +1062,8 @@ discard block |
||
| 1062 | 1062 | self::maybe_get_form( $form ); |
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 1066 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 1065 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 1066 | + return $frm_vars['form_params'][$form->id]; |
|
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | 1069 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1093,15 +1093,15 @@ discard block |
||
| 1093 | 1093 | // If there are two forms on the same page, make sure not to submit both. |
| 1094 | 1094 | foreach ( $default_values as $var => $default ) { |
| 1095 | 1095 | if ( $var === 'action' ) { |
| 1096 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1096 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1097 | 1097 | } else { |
| 1098 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1098 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1099 | 1099 | } |
| 1100 | 1100 | unset( $var, $default ); |
| 1101 | 1101 | } |
| 1102 | 1102 | } else { |
| 1103 | 1103 | foreach ( $default_values as $var => $default ) { |
| 1104 | - $values[ $var ] = $default; |
|
| 1104 | + $values[$var] = $default; |
|
| 1105 | 1105 | unset( $var, $default ); |
| 1106 | 1106 | } |
| 1107 | 1107 | } |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | ); |
| 1132 | 1132 | |
| 1133 | 1133 | foreach ( $defaults as $var => $default ) { |
| 1134 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1134 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | return $values; |
@@ -1166,7 +1166,7 @@ discard block |
||
| 1166 | 1166 | ); |
| 1167 | 1167 | |
| 1168 | 1168 | foreach ( $defaults as $var => $default ) { |
| 1169 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1169 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1170 | 1170 | } |
| 1171 | 1171 | |
| 1172 | 1172 | return $values; |
@@ -1311,7 +1311,7 @@ discard block |
||
| 1311 | 1311 | $form = $atts['form']; |
| 1312 | 1312 | $default = $atts['default'] ?? ''; |
| 1313 | 1313 | |
| 1314 | - return $form->options[ $atts['option'] ] ?? $default; |
|
| 1314 | + return $form->options[$atts['option']] ?? $default; |
|
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | 1317 | /** |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | return $this->get_pagenum(); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - return $this->_pagination_args[ $key ] ?? null; |
|
| 249 | + return $this->_pagination_args[$key] ?? null; |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -295,8 +295,8 @@ discard block |
||
| 295 | 295 | * @return void |
| 296 | 296 | */ |
| 297 | 297 | private function hidden_search_inputs( $param_name ) { |
| 298 | - if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
|
| 299 | - $value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) ); |
|
| 298 | + if ( ! empty( $_REQUEST[$param_name] ) ) { |
|
| 299 | + $value = sanitize_text_field( wp_unslash( $_REQUEST[$param_name] ) ); |
|
| 300 | 300 | echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $value ) . '" />'; |
| 301 | 301 | } |
| 302 | 302 | } |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | echo "<ul class='subsubsub'>\n"; |
| 340 | 340 | |
| 341 | 341 | foreach ( $views as $class => $view ) { |
| 342 | - $views[ $class ] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 342 | + $views[$class] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 343 | 343 | } |
| 344 | 344 | echo implode( " |</li>\n", $views ) . "</li>\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 345 | 345 | echo '</ul>'; |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">'; |
| 510 | 510 | |
| 511 | 511 | foreach ( $actions as $action => $link ) { |
| 512 | - ++$i; |
|
| 512 | + ++ $i; |
|
| 513 | 513 | $sep = $i === $action_count ? '' : ' | '; |
| 514 | 514 | $out .= "<span class='$action'>$link$sep</span>"; |
| 515 | 515 | } |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | 'next' => __( 'Next page', 'formidable' ), |
| 748 | 748 | ); |
| 749 | 749 | |
| 750 | - return $labels[ $link ]; |
|
| 750 | + return $labels[$link]; |
|
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | private function current_url() { |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | |
| 847 | 847 | // If the primary column doesn't exist fall back to the |
| 848 | 848 | // first non-checkbox column. |
| 849 | - if ( ! isset( $columns[ $default ] ) ) { |
|
| 849 | + if ( ! isset( $columns[$default] ) ) { |
|
| 850 | 850 | $default = self::get_default_primary_column_name(); |
| 851 | 851 | } |
| 852 | 852 | |
@@ -860,7 +860,7 @@ discard block |
||
| 860 | 860 | */ |
| 861 | 861 | $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); |
| 862 | 862 | |
| 863 | - if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { |
|
| 863 | + if ( empty( $column ) || ! isset( $columns[$column] ) ) { |
|
| 864 | 864 | $column = $default; |
| 865 | 865 | } |
| 866 | 866 | |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | $column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); |
| 883 | 883 | |
| 884 | 884 | foreach ( $this->_column_headers as $key => $value ) { |
| 885 | - $column_headers[ $key ] = $value; |
|
| 885 | + $column_headers[$key] = $value; |
|
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | return $column_headers; |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | $data[1] = false; |
| 918 | 918 | } |
| 919 | 919 | |
| 920 | - $sortable[ $id ] = $data; |
|
| 920 | + $sortable[$id] = $data; |
|
| 921 | 921 | } |
| 922 | 922 | |
| 923 | 923 | $primary = $this->get_primary_column_name(); |
@@ -968,7 +968,7 @@ discard block |
||
| 968 | 968 | static $cb_counter = 1; |
| 969 | 969 | $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All', 'formidable' ) . '</label>'; |
| 970 | 970 | $columns['cb'] .= '<input id="cb-select-all-' . esc_attr( $cb_counter ) . '" type="checkbox" />'; |
| 971 | - ++$cb_counter; |
|
| 971 | + ++ $cb_counter; |
|
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | foreach ( $columns as $column_key => $column_display_name ) { |
@@ -990,8 +990,8 @@ discard block |
||
| 990 | 990 | $class[] = 'column-primary'; |
| 991 | 991 | } |
| 992 | 992 | |
| 993 | - if ( isset( $sortable[ $column_key ] ) ) { |
|
| 994 | - list( $orderby, $desc_first ) = $sortable[ $column_key ]; |
|
| 993 | + if ( isset( $sortable[$column_key] ) ) { |
|
| 994 | + list( $orderby, $desc_first ) = $sortable[$column_key]; |
|
| 995 | 995 | |
| 996 | 996 | if ( $current_orderby == $orderby ) { |
| 997 | 997 | // The sorted column. The `aria-sort` attribute must be set only on the sorted column. |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | * @return bool Returns true if the setting is not set or if it is not false; otherwise, returns false. |
| 1112 | 1112 | */ |
| 1113 | 1113 | protected function should_display( $args, $settings ) { |
| 1114 | - return ! isset( $args[ $settings ] ) || false !== $args[ $settings ]; |
|
| 1114 | + return ! isset( $args[$settings] ) || false !== $args[$settings]; |
|
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | 1117 | /** |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | * @return array |
| 179 | 179 | */ |
| 180 | 180 | private function prepare_array_property( $index, $atts ) { |
| 181 | - if ( ! empty( $atts[ $index ] ) ) { |
|
| 182 | - return is_array( $atts[ $index ] ) ? $atts[ $index ] : explode( ',', $atts[ $index ] ); |
|
| 181 | + if ( ! empty( $atts[$index] ) ) { |
|
| 182 | + return is_array( $atts[$index] ) ? $atts[$index] : explode( ',', $atts[$index] ); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | return array(); |
@@ -256,11 +256,11 @@ discard block |
||
| 256 | 256 | ); |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - $ip = array( |
|
| 259 | + $ip = array( |
|
| 260 | 260 | 'label' => __( 'IP Address', 'formidable' ), |
| 261 | 261 | 'value' => $this->entry->ip, |
| 262 | 262 | ); |
| 263 | - $browser = array( |
|
| 263 | + $browser = array( |
|
| 264 | 264 | 'label' => __( 'User-Agent (Browser/OS)', 'formidable' ), |
| 265 | 265 | 'value' => isset( $entry_description['browser'] ) ? FrmEntriesHelper::get_browser( $entry_description['browser'] ) : '', |
| 266 | 266 | ); |
@@ -349,6 +349,6 @@ discard block |
||
| 349 | 349 | * @return void |
| 350 | 350 | */ |
| 351 | 351 | protected function add_field_values( $field ) { |
| 352 | - $this->field_values[ $field->id ] = new FrmFieldValue( $field, $this->entry ); |
|
| 352 | + $this->field_values[$field->id] = new FrmFieldValue( $field, $this->entry ); |
|
| 353 | 353 | } |
| 354 | 354 | } |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | // This may occasionally skip one level/order e.g. after adding a |
| 321 | 321 | // list field, as field_order would already be prepared to be used. |
| 322 | - ++$field_order; |
|
| 322 | + ++ $field_order; |
|
| 323 | 323 | |
| 324 | 324 | if ( ! empty( $new_field['fields'] ) && is_array( $new_field['fields'] ) ) { |
| 325 | 325 | // we have (inner) fields to merge |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | $order = 0; |
| 372 | 372 | |
| 373 | 373 | foreach ( $fields as $field ) { |
| 374 | - ++$order; |
|
| 374 | + ++ $order; |
|
| 375 | 375 | $type = $this->get_field_type( $field ); |
| 376 | 376 | $new_type = $this->convert_field_type( $type, $field ); |
| 377 | 377 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $sub['name'] = __( 'Section Buttons', 'formidable' ); |
| 408 | 408 | $subs = array( $sub ); |
| 409 | 409 | $this->insert_fields_in_array( $subs, $order, 0, $fields ); |
| 410 | - ++$order; |
|
| 410 | + ++ $order; |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | protected function create_fields( $form_id, &$form ) { |
| 522 | 522 | foreach ( $form['fields'] as $key => $new_field ) { |
| 523 | 523 | $new_field['form_id'] = $form_id; |
| 524 | - $form['fields'][ $key ]['id'] = FrmField::create( $new_field ); |
|
| 524 | + $form['fields'][$key]['id'] = FrmField::create( $new_field ); |
|
| 525 | 525 | } |
| 526 | 526 | } |
| 527 | 527 | |
@@ -564,9 +564,9 @@ discard block |
||
| 564 | 564 | } elseif ( $key === 'the_post_title' ) { |
| 565 | 565 | $new_action->post_content['post_title'] = $value; |
| 566 | 566 | } elseif ( is_string( $value ) ) { |
| 567 | - $new_action->post_content[ $key ] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 567 | + $new_action->post_content[$key] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 568 | 568 | } else { |
| 569 | - $new_action->post_content[ $key ] = $value; |
|
| 569 | + $new_action->post_content[$key] = $value; |
|
| 570 | 570 | } |
| 571 | 571 | } |
| 572 | 572 | |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | |
| 588 | 588 | $imported = $this->get_tracked_import(); |
| 589 | 589 | |
| 590 | - $imported[ $this->slug ][ $new_form_id ] = $source_id; |
|
| 590 | + $imported[$this->slug][$new_form_id] = $source_id; |
|
| 591 | 591 | |
| 592 | 592 | update_option( $this->tracking, $imported, false ); |
| 593 | 593 | } |
@@ -608,11 +608,11 @@ discard block |
||
| 608 | 608 | $imported = $this->get_tracked_import(); |
| 609 | 609 | $new_form_id = 0; |
| 610 | 610 | |
| 611 | - if ( ! isset( $imported[ $this->slug ] ) || ! in_array( $source_id, $imported[ $this->slug ] ) ) { |
|
| 611 | + if ( ! isset( $imported[$this->slug] ) || ! in_array( $source_id, $imported[$this->slug] ) ) { |
|
| 612 | 612 | return $new_form_id; |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - $new_form_id = array_search( $source_id, array_reverse( $imported[ $this->slug ], true ) ); |
|
| 615 | + $new_form_id = array_search( $source_id, array_reverse( $imported[$this->slug], true ) ); |
|
| 616 | 616 | |
| 617 | 617 | if ( ! empty( $new_form_id ) && empty( FrmForm::get_key_by_id( $new_form_id ) ) ) { |
| 618 | 618 | // Allow reimport if the form was deleted. |
@@ -352,11 +352,11 @@ discard block |
||
| 352 | 352 | 'ranking' => '2024-03-12', |
| 353 | 353 | ); |
| 354 | 354 | |
| 355 | - if ( ! isset( $release_dates[ $type ] ) ) { |
|
| 355 | + if ( ! isset( $release_dates[$type] ) ) { |
|
| 356 | 356 | return false; |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - $release_date = $release_dates[ $type ]; |
|
| 359 | + $release_date = $release_dates[$type]; |
|
| 360 | 360 | |
| 361 | 361 | $three_months_after_release = gmdate( 'Y-m-d', strtotime( $release_date . ' + 90 days' ) ); |
| 362 | 362 | return gmdate( 'Y-m-d' ) < $three_months_after_release; |
@@ -390,8 +390,8 @@ discard block |
||
| 390 | 390 | $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); |
| 391 | 391 | |
| 392 | 392 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 393 | - if ( isset( $values[ $col ] ) ) { |
|
| 394 | - $new_values[ $col ] = $values[ $col ]; |
|
| 393 | + if ( isset( $values[$col] ) ) { |
|
| 394 | + $new_values[$col] = $values[$col]; |
|
| 395 | 395 | } |
| 396 | 396 | } |
| 397 | 397 | |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
| 404 | 404 | |
| 405 | 405 | if ( isset( $values['id'] ) ) { |
| 406 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
| 406 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
| 407 | 407 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
| 408 | 408 | } |
| 409 | 409 | |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | |
| 412 | 412 | foreach ( $new_values as $k => $v ) { |
| 413 | 413 | if ( is_array( $v ) ) { |
| 414 | - $new_values[ $k ] = $k === 'default_value' ? FrmAppHelper::maybe_json_encode( $v ) : serialize( $v ); |
|
| 414 | + $new_values[$k] = $k === 'default_value' ? FrmAppHelper::maybe_json_encode( $v ) : serialize( $v ); |
|
| 415 | 415 | } |
| 416 | 416 | unset( $k, $v ); |
| 417 | 417 | } |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | if ( isset( $values['id'] ) ) { |
| 433 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
| 433 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | return $new_id; |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | * |
| 485 | 485 | * @return string |
| 486 | 486 | */ |
| 487 | - function ( $match ) { |
|
| 487 | + function( $match ) { |
|
| 488 | 488 | $attr = shortcode_parse_atts( $match[3] ); |
| 489 | 489 | |
| 490 | 490 | if ( ! is_array( $attr ) ) { |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | if ( FrmAppHelper::input_key_is_safe( $key, 'update' ) ) { |
| 515 | - $safe_atts[ $key ] = $value; |
|
| 515 | + $safe_atts[$key] = $value; |
|
| 516 | 516 | } |
| 517 | 517 | }//end foreach |
| 518 | 518 | |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
| 585 | 585 | global $frm_duplicate_ids; |
| 586 | 586 | |
| 587 | - $where = array( |
|
| 587 | + $where = array( |
|
| 588 | 588 | array( |
| 589 | 589 | 'or' => 1, |
| 590 | 590 | 'fi.form_id' => $old_form_id, |
@@ -631,8 +631,8 @@ discard block |
||
| 631 | 631 | |
| 632 | 632 | $values = apply_filters( 'frm_duplicated_field', $values ); |
| 633 | 633 | $new_id = self::create( $values ); |
| 634 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
| 635 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
| 634 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
| 635 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
| 636 | 636 | unset( $field ); |
| 637 | 637 | }//end foreach |
| 638 | 638 | } |
@@ -682,11 +682,11 @@ discard block |
||
| 682 | 682 | |
| 683 | 683 | // serialize array values |
| 684 | 684 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
| 685 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 685 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 686 | 686 | if ( 'field_options' === $opt ) { |
| 687 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
| 687 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
| 688 | 688 | } |
| 689 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 689 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | 692 | |
@@ -899,8 +899,8 @@ discard block |
||
| 899 | 899 | continue; |
| 900 | 900 | } |
| 901 | 901 | |
| 902 | - $fields[ $result->id ] = $result; |
|
| 903 | - ++$count; |
|
| 902 | + $fields[$result->id] = $result; |
|
| 903 | + ++ $count; |
|
| 904 | 904 | |
| 905 | 905 | if ( $limit == 1 ) { |
| 906 | 906 | $fields = $result; |
@@ -955,8 +955,8 @@ discard block |
||
| 955 | 955 | $count = 0; |
| 956 | 956 | |
| 957 | 957 | foreach ( $results as $result ) { |
| 958 | - ++$count; |
|
| 959 | - $fields[ $result->id ] = $result; |
|
| 958 | + ++ $count; |
|
| 959 | + $fields[$result->id] = $result; |
|
| 960 | 960 | |
| 961 | 961 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 962 | 962 | break; |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | $query_type = $limit === ' LIMIT 1' || $limit == 1 ? 'row' : 'results'; |
| 1090 | 1090 | |
| 1091 | 1091 | if ( is_array( $where ) ) { |
| 1092 | - $args = array( |
|
| 1092 | + $args = array( |
|
| 1093 | 1093 | 'order_by' => $order_by, |
| 1094 | 1094 | 'limit' => $limit, |
| 1095 | 1095 | ); |
@@ -1126,9 +1126,9 @@ discard block |
||
| 1126 | 1126 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
| 1127 | 1127 | |
| 1128 | 1128 | self::prepare_options( $result ); |
| 1129 | - $results[ $r_key ]->field_options = $result->field_options; |
|
| 1130 | - $results[ $r_key ]->options = $result->options; |
|
| 1131 | - $results[ $r_key ]->default_value = $result->default_value; |
|
| 1129 | + $results[$r_key]->field_options = $result->field_options; |
|
| 1130 | + $results[$r_key]->options = $result->options; |
|
| 1131 | + $results[$r_key]->default_value = $result->default_value; |
|
| 1132 | 1132 | |
| 1133 | 1133 | unset( $r_key, $result ); |
| 1134 | 1134 | } |
@@ -1224,7 +1224,7 @@ discard block |
||
| 1224 | 1224 | |
| 1225 | 1225 | if ( count( $next_fields ) >= self::$transient_size ) { |
| 1226 | 1226 | // if this transient is full, check for another |
| 1227 | - ++$next; |
|
| 1227 | + ++ $next; |
|
| 1228 | 1228 | self::get_next_transient( $fields, $base_name, $next ); |
| 1229 | 1229 | } |
| 1230 | 1230 | } |
@@ -1260,7 +1260,7 @@ discard block |
||
| 1260 | 1260 | return; |
| 1261 | 1261 | } |
| 1262 | 1262 | |
| 1263 | - ++$next; |
|
| 1263 | + ++ $next; |
|
| 1264 | 1264 | } |
| 1265 | 1265 | } |
| 1266 | 1266 | |
@@ -1418,7 +1418,7 @@ discard block |
||
| 1418 | 1418 | * @return bool |
| 1419 | 1419 | */ |
| 1420 | 1420 | public static function is_option_true_in_array( $field, $option ) { |
| 1421 | - return ! empty( $field[ $option ] ); |
|
| 1421 | + return ! empty( $field[$option] ); |
|
| 1422 | 1422 | } |
| 1423 | 1423 | |
| 1424 | 1424 | /** |
@@ -1428,7 +1428,7 @@ discard block |
||
| 1428 | 1428 | * @return bool |
| 1429 | 1429 | */ |
| 1430 | 1430 | public static function is_option_true_in_object( $field, $option ) { |
| 1431 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 1431 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 1432 | 1432 | } |
| 1433 | 1433 | |
| 1434 | 1434 | /** |
@@ -1438,7 +1438,7 @@ discard block |
||
| 1438 | 1438 | * @return bool |
| 1439 | 1439 | */ |
| 1440 | 1440 | public static function is_option_empty_in_array( $field, $option ) { |
| 1441 | - return empty( $field[ $option ] ); |
|
| 1441 | + return empty( $field[$option] ); |
|
| 1442 | 1442 | } |
| 1443 | 1443 | |
| 1444 | 1444 | /** |
@@ -1448,7 +1448,7 @@ discard block |
||
| 1448 | 1448 | * @return bool |
| 1449 | 1449 | */ |
| 1450 | 1450 | public static function is_option_empty_in_object( $field, $option ) { |
| 1451 | - return empty( $field->field_options[ $option ] ); |
|
| 1451 | + return empty( $field->field_options[$option] ); |
|
| 1452 | 1452 | } |
| 1453 | 1453 | |
| 1454 | 1454 | /** |
@@ -1458,7 +1458,7 @@ discard block |
||
| 1458 | 1458 | * @return bool |
| 1459 | 1459 | */ |
| 1460 | 1460 | public static function is_option_value_in_object( $field, $option ) { |
| 1461 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 1461 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | 1464 | /** |
@@ -1480,10 +1480,10 @@ discard block |
||
| 1480 | 1480 | * @return mixed |
| 1481 | 1481 | */ |
| 1482 | 1482 | public static function get_option_in_array( $field, $option ) { |
| 1483 | - if ( isset( $field[ $option ] ) ) { |
|
| 1484 | - $this_option = $field[ $option ]; |
|
| 1485 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
| 1486 | - $this_option = $field['field_options'][ $option ]; |
|
| 1483 | + if ( isset( $field[$option] ) ) { |
|
| 1484 | + $this_option = $field[$option]; |
|
| 1485 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
| 1486 | + $this_option = $field['field_options'][$option]; |
|
| 1487 | 1487 | } else { |
| 1488 | 1488 | $this_option = ''; |
| 1489 | 1489 | } |
@@ -1498,7 +1498,7 @@ discard block |
||
| 1498 | 1498 | * @return mixed |
| 1499 | 1499 | */ |
| 1500 | 1500 | public static function get_option_in_object( $field, $option ) { |
| 1501 | - return $field->field_options[ $option ] ?? ''; |
|
| 1501 | + return $field->field_options[$option] ?? ''; |
|
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | 1504 | /** |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | if ( is_object( $this->field ) ) { |
| 172 | 172 | $field_val = $this->field->{$column}; |
| 173 | - } elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) { |
|
| 174 | - $field_val = $this->field[ $column ]; |
|
| 173 | + } elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) { |
|
| 174 | + $field_val = $this->field[$column]; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | return $field_val; |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | if ( is_object( $this->field ) ) { |
| 188 | 188 | $this->field->{$column} = $value; |
| 189 | 189 | } elseif ( is_array( $this->field ) ) { |
| 190 | - $this->field[ $column ] = $value; |
|
| 190 | + $this->field[$column] = $value; |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | printf( |
| 731 | 731 | /* translators: %s: Field type */ |
| 732 | 732 | esc_html__( '%s Options', 'formidable' ), |
| 733 | - esc_html( $all_field_types[ $args['display']['type'] ]['name'] ) |
|
| 733 | + esc_html( $all_field_types[$args['display']['type']]['name'] ) |
|
| 734 | 734 | ); |
| 735 | 735 | FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown8_icon', array( 'aria-hidden' => 'true' ) ); |
| 736 | 736 | ?> |
@@ -872,8 +872,8 @@ discard block |
||
| 872 | 872 | |
| 873 | 873 | $fields = array_merge( $fields, $pro_fields ); |
| 874 | 874 | |
| 875 | - if ( isset( $fields[ $this->type ] ) ) { |
|
| 876 | - $name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ]; |
|
| 875 | + if ( isset( $fields[$this->type] ) ) { |
|
| 876 | + $name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type]; |
|
| 877 | 877 | } |
| 878 | 878 | |
| 879 | 879 | return $name; |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | * @return array |
| 891 | 891 | */ |
| 892 | 892 | public function get_default_field_options() { |
| 893 | - $opts = array( |
|
| 893 | + $opts = array( |
|
| 894 | 894 | 'size' => '', |
| 895 | 895 | 'max' => '', |
| 896 | 896 | 'label' => '', |
@@ -1149,7 +1149,7 @@ discard block |
||
| 1149 | 1149 | * @return void |
| 1150 | 1150 | */ |
| 1151 | 1151 | public function set_aria_invalid_error( &$shortcode_atts, $args ) { |
| 1152 | - $shortcode_atts['aria-invalid'] = isset( $args['errors'][ 'field' . $this->field_id ] ) ? 'true' : 'false'; |
|
| 1152 | + $shortcode_atts['aria-invalid'] = isset( $args['errors']['field' . $this->field_id] ) ? 'true' : 'false'; |
|
| 1153 | 1153 | } |
| 1154 | 1154 | |
| 1155 | 1155 | /** |
@@ -1342,11 +1342,11 @@ discard block |
||
| 1342 | 1342 | |
| 1343 | 1343 | $options = array_values( $this->field['options'] ); |
| 1344 | 1344 | |
| 1345 | - if ( ! isset( $options[ $opt ] ) ) { |
|
| 1345 | + if ( ! isset( $options[$opt] ) ) { |
|
| 1346 | 1346 | return $hidden; |
| 1347 | 1347 | } |
| 1348 | 1348 | |
| 1349 | - $option = $options[ $opt ]; |
|
| 1349 | + $option = $options[$opt]; |
|
| 1350 | 1350 | |
| 1351 | 1351 | if ( is_array( $option ) ) { |
| 1352 | 1352 | $option = $option['value']; |
@@ -1432,8 +1432,8 @@ discard block |
||
| 1432 | 1432 | $selected = $values['field_value']; |
| 1433 | 1433 | |
| 1434 | 1434 | if ( isset( $values['combo_name'] ) ) { |
| 1435 | - $options = $options[ $values['combo_name'] ]; |
|
| 1436 | - $selected = is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ? $selected[ $values['combo_name'] ] : ''; |
|
| 1435 | + $options = $options[$values['combo_name']]; |
|
| 1436 | + $selected = is_array( $selected ) && isset( $selected[$values['combo_name']] ) ? $selected[$values['combo_name']] : ''; |
|
| 1437 | 1437 | } |
| 1438 | 1438 | |
| 1439 | 1439 | $input = $this->select_tag( $values ); |
@@ -1504,7 +1504,7 @@ discard block |
||
| 1504 | 1504 | * @return array |
| 1505 | 1505 | */ |
| 1506 | 1506 | protected function fill_display_field_values( $args = array() ) { |
| 1507 | - $defaults = array( |
|
| 1507 | + $defaults = array( |
|
| 1508 | 1508 | 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', |
| 1509 | 1509 | 'field_id' => $this->get_field_column( 'id' ), |
| 1510 | 1510 | 'field_plus_id' => '', |
@@ -1565,7 +1565,7 @@ discard block |
||
| 1565 | 1565 | } |
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | - if ( isset( $args['errors'][ 'field' . $args['field_id'] ] ) && ! $custom_error_fields ) { |
|
| 1568 | + if ( isset( $args['errors']['field' . $args['field_id']] ) && ! $custom_error_fields ) { |
|
| 1569 | 1569 | if ( $error_comes_first ) { |
| 1570 | 1570 | array_unshift( $describedby, 'frm_error_' . $args['html_id'] ); |
| 1571 | 1571 | } else { |
@@ -1651,10 +1651,10 @@ discard block |
||
| 1651 | 1651 | $field_id = $this->get_field_column( 'id' ); |
| 1652 | 1652 | |
| 1653 | 1653 | if ( ! array_key_exists( $field_id, $frm_validated_unique_values ) ) { |
| 1654 | - $frm_validated_unique_values[ $field_id ] = array(); |
|
| 1654 | + $frm_validated_unique_values[$field_id] = array(); |
|
| 1655 | 1655 | return false; |
| 1656 | 1656 | } |
| 1657 | - return in_array( $value, $frm_validated_unique_values[ $field_id ], true ); |
|
| 1657 | + return in_array( $value, $frm_validated_unique_values[$field_id], true ); |
|
| 1658 | 1658 | } |
| 1659 | 1659 | |
| 1660 | 1660 | /** |
@@ -1682,7 +1682,7 @@ discard block |
||
| 1682 | 1682 | private function value_validated_as_unique( $value ) { |
| 1683 | 1683 | global $frm_validated_unique_values; |
| 1684 | 1684 | $field_id = $this->get_field_column( 'id' ); |
| 1685 | - $frm_validated_unique_values[ $field_id ][] = $value; |
|
| 1685 | + $frm_validated_unique_values[$field_id][] = $value; |
|
| 1686 | 1686 | } |
| 1687 | 1687 | |
| 1688 | 1688 | /** |
@@ -1728,8 +1728,8 @@ discard block |
||
| 1728 | 1728 | $value = $this->prepare_display_value( $value, $atts ); |
| 1729 | 1729 | |
| 1730 | 1730 | if ( is_array( $value ) ) { |
| 1731 | - if ( ! empty( $atts['show'] ) && isset( $value[ $atts['show'] ] ) ) { |
|
| 1732 | - $value = $value[ $atts['show'] ]; |
|
| 1731 | + if ( ! empty( $atts['show'] ) && isset( $value[$atts['show']] ) ) { |
|
| 1732 | + $value = $value[$atts['show']]; |
|
| 1733 | 1733 | } elseif ( empty( $atts['return_array'] ) ) { |
| 1734 | 1734 | $sep = $atts['sep'] ?? ', '; |
| 1735 | 1735 | $value = FrmAppHelper::safe_implode( $sep, $value ); |
@@ -1861,8 +1861,8 @@ discard block |
||
| 1861 | 1861 | $new_value = array(); |
| 1862 | 1862 | |
| 1863 | 1863 | foreach ( (array) $value as $old_child_id ) { |
| 1864 | - if ( isset( $saved_entries[ $old_child_id ] ) ) { |
|
| 1865 | - $new_value[] = $saved_entries[ $old_child_id ]; |
|
| 1864 | + if ( isset( $saved_entries[$old_child_id] ) ) { |
|
| 1865 | + $new_value[] = $saved_entries[$old_child_id]; |
|
| 1866 | 1866 | } |
| 1867 | 1867 | } |
| 1868 | 1868 | |