@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | return $errors; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) { |
|
| 23 | + if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values['frm_submit_entry_' . $values['form_id']] ) || ! wp_verify_nonce( $values['frm_submit_entry_' . $values['form_id']], 'frm_submit_entry_nonce' ) ) ) { |
|
| 24 | 24 | $frm_settings = FrmAppHelper::get_settings(); |
| 25 | 25 | $errors['form'] = $frm_settings->admin_permission; |
| 26 | 26 | } |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | 'exclude' => array(), |
| 121 | 121 | |
| 122 | 122 | ); |
| 123 | - $args = wp_parse_args( $args, $defaults ); |
|
| 123 | + $args = wp_parse_args( $args, $defaults ); |
|
| 124 | 124 | |
| 125 | 125 | if ( empty( $args['parent_field_id'] ) ) { |
| 126 | - $value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : ''; |
|
| 126 | + $value = isset( $values['item_meta'][$args['id']] ) ? $values['item_meta'][$args['id']] : ''; |
|
| 127 | 127 | } else { |
| 128 | 128 | // value is from a nested form |
| 129 | 129 | $value = $values; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
| 147 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 147 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 148 | 148 | } elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 149 | 149 | self::maybe_add_item_name( $value, $posted_field ); |
| 150 | 150 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $pattern = self::phone_format( $field ); |
| 223 | 223 | |
| 224 | 224 | if ( ! preg_match( $pattern, $value ) ) { |
| 225 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 225 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | } |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | */ |
| 333 | 333 | private static function form_is_in_progress( $values ) { |
| 334 | 334 | return FrmAppHelper::pro_is_installed() && |
| 335 | - ( isset( $values[ 'frm_page_order_' . $values['form_id'] ] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
| 335 | + ( isset( $values['frm_page_order_' . $values['form_id']] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
| 336 | 336 | FrmField::get_all_types_in_form( $values['form_id'], 'break' ); |
| 337 | 337 | } |
| 338 | 338 | |
@@ -576,9 +576,9 @@ discard block |
||
| 576 | 576 | foreach ( $datas['missing_keys'] as $key_index => $key ) { |
| 577 | 577 | $found = self::is_akismet_guest_info_value( $key, $value, $field_id, $datas['name_field_ids'] ); |
| 578 | 578 | if ( $found ) { |
| 579 | - $datas[ $key ] = $value; |
|
| 579 | + $datas[$key] = $value; |
|
| 580 | 580 | $datas['frm_duplicated'][] = $field_id; |
| 581 | - unset( $datas['missing_keys'][ $key_index ] ); |
|
| 581 | + unset( $datas['missing_keys'][$key_index] ); |
|
| 582 | 582 | } |
| 583 | 583 | } |
| 584 | 584 | }//end foreach |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | |
| 625 | 625 | // Send any potentially useful $_SERVER vars, but avoid sending junk we don't need. |
| 626 | 626 | if ( $include_value ) { |
| 627 | - $datas[ $key ] = $value; |
|
| 627 | + $datas[$key] = $value; |
|
| 628 | 628 | } |
| 629 | 629 | unset( $key, $value ); |
| 630 | 630 | } |
@@ -641,10 +641,10 @@ discard block |
||
| 641 | 641 | private static function add_comment_content_to_akismet( &$datas, $values ) { |
| 642 | 642 | if ( isset( $datas['frm_duplicated'] ) ) { |
| 643 | 643 | foreach ( $datas['frm_duplicated'] as $index ) { |
| 644 | - if ( isset( $values['item_meta'][ $index ] ) ) { |
|
| 645 | - unset( $values['item_meta'][ $index ] ); |
|
| 644 | + if ( isset( $values['item_meta'][$index] ) ) { |
|
| 645 | + unset( $values['item_meta'][$index] ); |
|
| 646 | 646 | } else { |
| 647 | - unset( $values[ $index ] ); |
|
| 647 | + unset( $values[$index] ); |
|
| 648 | 648 | } |
| 649 | 649 | } |
| 650 | 650 | unset( $datas['frm_duplicated'] ); |
@@ -665,14 +665,14 @@ discard block |
||
| 665 | 665 | private static function skip_adding_values_to_akismet( &$values ) { |
| 666 | 666 | $skipped_fields = self::get_akismet_skipped_field_ids( $values ); |
| 667 | 667 | foreach ( $skipped_fields as $skipped_field ) { |
| 668 | - if ( ! isset( $values['item_meta'][ $skipped_field->id ] ) ) { |
|
| 668 | + if ( ! isset( $values['item_meta'][$skipped_field->id] ) ) { |
|
| 669 | 669 | continue; |
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | if ( self::should_really_skip_field( $skipped_field, $values ) ) { |
| 673 | - unset( $values['item_meta'][ $skipped_field->id ] ); |
|
| 674 | - if ( isset( $values['item_meta']['other'][ $skipped_field->id ] ) ) { |
|
| 675 | - unset( $values['item_meta']['other'][ $skipped_field->id ] ); |
|
| 673 | + unset( $values['item_meta'][$skipped_field->id] ); |
|
| 674 | + if ( isset( $values['item_meta']['other'][$skipped_field->id] ) ) { |
|
| 675 | + unset( $values['item_meta']['other'][$skipped_field->id] ); |
|
| 676 | 676 | } |
| 677 | 677 | } |
| 678 | 678 | } |
@@ -708,14 +708,14 @@ discard block |
||
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | // If a choice field has Other option, but Other is not selected. |
| 711 | - if ( empty( $values['item_meta']['other'][ $field_data->id ] ) ) { |
|
| 711 | + if ( empty( $values['item_meta']['other'][$field_data->id] ) ) { |
|
| 712 | 712 | return true; |
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | // Check if submitted value is same as one of field option. |
| 716 | 716 | foreach ( $field_data->options as $option ) { |
| 717 | 717 | $option_value = ! is_array( $option ) ? $option : ( isset( $option['value'] ) ? $option['value'] : '' ); |
| 718 | - if ( $values['item_meta']['other'][ $field_data->id ] === $option_value ) { |
|
| 718 | + if ( $values['item_meta']['other'][$field_data->id] === $option_value ) { |
|
| 719 | 719 | return true; |
| 720 | 720 | } |
| 721 | 721 | } |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | |
| 787 | 787 | // Convert name array to string. |
| 788 | 788 | if ( isset( $value['first'] ) && isset( $value['last'] ) ) { |
| 789 | - $values['item_meta'][ $field_id ] = trim( implode( ' ', $value ) ); |
|
| 789 | + $values['item_meta'][$field_id] = trim( implode( ' ', $value ) ); |
|
| 790 | 790 | $values['name_field_ids'][] = $field_id; |
| 791 | 791 | continue; |
| 792 | 792 | } |
@@ -807,8 +807,8 @@ discard block |
||
| 807 | 807 | continue; |
| 808 | 808 | } |
| 809 | 809 | |
| 810 | - if ( ! isset( $values['item_meta'][ $subsubindex ] ) ) { |
|
| 811 | - $values['item_meta'][ $subsubindex ] = array(); |
|
| 810 | + if ( ! isset( $values['item_meta'][$subsubindex] ) ) { |
|
| 811 | + $values['item_meta'][$subsubindex] = array(); |
|
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | // Convert name array to string. |
@@ -818,11 +818,11 @@ discard block |
||
| 818 | 818 | $values['name_field_ids'][] = $subsubindex; |
| 819 | 819 | } |
| 820 | 820 | |
| 821 | - $values['item_meta'][ $subsubindex ][] = $subsubvalue; |
|
| 821 | + $values['item_meta'][$subsubindex][] = $subsubvalue; |
|
| 822 | 822 | } |
| 823 | 823 | }//end foreach |
| 824 | 824 | |
| 825 | - unset( $values['item_meta'][ $field_id ] ); |
|
| 825 | + unset( $values['item_meta'][$field_id] ); |
|
| 826 | 826 | }//end foreach |
| 827 | 827 | |
| 828 | 828 | return $form_ids; |
@@ -145,7 +145,8 @@ |
||
| 145 | 145 | |
| 146 | 146 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
| 147 | 147 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
| 148 | - } elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 148 | + } elseif ( ! isset( $_POST['item_name'] ) ) { |
|
| 149 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 149 | 150 | self::maybe_add_item_name( $value, $posted_field ); |
| 150 | 151 | } |
| 151 | 152 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @param array $keys |
| 39 | 39 | */ |
| 40 | - self::$keys = apply_filters( |
|
| 40 | + self::$keys = apply_filters( |
|
| 41 | 41 | 'frm_application_data_keys', |
| 42 | 42 | array( 'key', 'name', 'description', 'link', 'categories', 'views', 'forms' ) |
| 43 | 43 | ); |
@@ -115,17 +115,17 @@ discard block |
||
| 115 | 115 | public function as_js_object() { |
| 116 | 116 | $application = array(); |
| 117 | 117 | foreach ( self::$keys as $key ) { |
| 118 | - if ( ! isset( $this->api_data[ $key ] ) ) { |
|
| 118 | + if ( ! isset( $this->api_data[$key] ) ) { |
|
| 119 | 119 | continue; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $value = $this->api_data[ $key ]; |
|
| 122 | + $value = $this->api_data[$key]; |
|
| 123 | 123 | |
| 124 | 124 | if ( 'icon' === $key ) { |
| 125 | 125 | // Icon is an array. The first array item is the image URL. |
| 126 | - $application[ $key ] = reset( $value ); |
|
| 126 | + $application[$key] = reset( $value ); |
|
| 127 | 127 | } elseif ( 'categories' === $key ) { |
| 128 | - $application[ $key ] = array_values( |
|
| 128 | + $application[$key] = array_values( |
|
| 129 | 129 | array_filter( |
| 130 | 130 | $value, |
| 131 | 131 | function( $category ) { |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | // Strip off the " Template" text at the end of the name as it takes up space. |
| 145 | 145 | $value = substr( $value, 0, -9 ); |
| 146 | 146 | } |
| 147 | - $application[ $key ] = $value; |
|
| 147 | + $application[$key] = $value; |
|
| 148 | 148 | }//end if |
| 149 | 149 | }//end foreach |
| 150 | 150 | |
@@ -208,9 +208,9 @@ discard block |
||
| 208 | 208 | $groups = FrmFormActionsController::form_action_groups(); |
| 209 | 209 | $group = 'misc'; |
| 210 | 210 | |
| 211 | - if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) { |
|
| 211 | + if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) { |
|
| 212 | 212 | $group = $action_options['group']; |
| 213 | - } elseif ( isset( $groups[ $this->id_base ] ) ) { |
|
| 213 | + } elseif ( isset( $groups[$this->id_base] ) ) { |
|
| 214 | 214 | $group = $this->id_base; |
| 215 | 215 | } else { |
| 216 | 216 | foreach ( $groups as $name => $check_group ) { |
@@ -221,8 +221,8 @@ discard block |
||
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - $groups[ $group ]['id'] = $group; |
|
| 225 | - return $groups[ $group ]; |
|
| 224 | + $groups[$group]['id'] = $group; |
|
| 225 | + return $groups[$group]; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | * @return integer $post_id |
| 334 | 334 | */ |
| 335 | 335 | public function maybe_create_action( $action, $forms ) { |
| 336 | - if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] == 'updated' ) { |
|
| 336 | + if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] == 'updated' ) { |
|
| 337 | 337 | // Update action only |
| 338 | 338 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
| 339 | 339 | $post_id = $this->save_settings( $action ); |
@@ -356,18 +356,18 @@ discard block |
||
| 356 | 356 | $switch = $this->get_global_switch_fields(); |
| 357 | 357 | |
| 358 | 358 | foreach ( (array) $action->post_content as $key => $val ) { |
| 359 | - if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
|
| 360 | - $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
|
| 359 | + if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) { |
|
| 360 | + $action->post_content[$key] = $frm_duplicate_ids[$val]; |
|
| 361 | 361 | } elseif ( ! is_array( $val ) ) { |
| 362 | - $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
|
| 363 | - } elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
|
| 362 | + $action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val ); |
|
| 363 | + } elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) { |
|
| 364 | 364 | // loop through each value if empty |
| 365 | - if ( empty( $switch[ $key ] ) ) { |
|
| 366 | - $switch[ $key ] = array_keys( $val ); |
|
| 365 | + if ( empty( $switch[$key] ) ) { |
|
| 366 | + $switch[$key] = array_keys( $val ); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - foreach ( $switch[ $key ] as $subkey ) { |
|
| 370 | - $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
|
| 369 | + foreach ( $switch[$key] as $subkey ) { |
|
| 370 | + $action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val ); |
|
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | |
@@ -385,20 +385,20 @@ discard block |
||
| 385 | 385 | foreach ( $subkey as $subkey2 ) { |
| 386 | 386 | foreach ( (array) $val as $ck => $cv ) { |
| 387 | 387 | if ( is_array( $cv ) ) { |
| 388 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
|
| 389 | - } elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
|
| 390 | - $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
|
| 388 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv ); |
|
| 389 | + } elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) { |
|
| 390 | + $action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]]; |
|
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | } else { |
| 395 | 395 | foreach ( (array) $val as $ck => $cv ) { |
| 396 | 396 | if ( is_array( $cv ) ) { |
| 397 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
|
| 398 | - } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
|
| 399 | - $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
|
| 397 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv ); |
|
| 398 | + } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) { |
|
| 399 | + $action[$ck] = $frm_duplicate_ids[$cv]; |
|
| 400 | 400 | } elseif ( $ck == $subkey ) { |
| 401 | - $action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] ); |
|
| 401 | + $action[$ck] = $this->maybe_switch_field_ids( $action[$ck] ); |
|
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | }//end if |
@@ -422,10 +422,10 @@ discard block |
||
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 425 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
| 425 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
| 426 | 426 | // Sanitizing removes scripts and <email> type of values. |
| 427 | 427 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
| 428 | - $settings = wp_unslash( $_POST[ $this->option_name ] ); |
|
| 428 | + $settings = wp_unslash( $_POST[$this->option_name] ); |
|
| 429 | 429 | } else { |
| 430 | 430 | return; |
| 431 | 431 | } |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | foreach ( $settings as $number => $new_instance ) { |
| 436 | 436 | $this->_set( $number ); |
| 437 | 437 | |
| 438 | - $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); |
|
| 438 | + $old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array(); |
|
| 439 | 439 | |
| 440 | 440 | if ( ! isset( $new_instance['post_status'] ) ) { |
| 441 | 441 | $new_instance['post_status'] = 'draft'; |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
| 474 | 474 | |
| 475 | 475 | if ( false !== $instance ) { |
| 476 | - $all_instances[ $number ] = $instance; |
|
| 476 | + $all_instances[$number] = $instance; |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | $action_ids[] = $this->save_settings( $instance ); |
@@ -555,12 +555,12 @@ discard block |
||
| 555 | 555 | // some plugins/themes are formatting the post_excerpt |
| 556 | 556 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
| 557 | 557 | |
| 558 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
| 558 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
| 559 | 559 | continue; |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
| 563 | - $settings[ $action->ID ] = $action; |
|
| 562 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
| 563 | + $settings[$action->ID] = $action; |
|
| 564 | 564 | |
| 565 | 565 | if ( count( $settings ) >= $limit ) { |
| 566 | 566 | break; |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | 'limit' => 99, |
| 594 | 594 | 'post_status' => $default_status, |
| 595 | 595 | ); |
| 596 | - $args = wp_parse_args( $args, $defaults ); |
|
| 596 | + $args = wp_parse_args( $args, $defaults ); |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | /** |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | |
| 660 | 660 | $action = $this->prepare_action( $action ); |
| 661 | 661 | |
| 662 | - $settings[ $action->ID ] = $action; |
|
| 662 | + $settings[$action->ID] = $action; |
|
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | if ( 1 === $limit ) { |
@@ -702,10 +702,10 @@ discard block |
||
| 702 | 702 | |
| 703 | 703 | foreach ( $default_values as $k => $vals ) { |
| 704 | 704 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
| 705 | - if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
| 705 | + if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
| 706 | 706 | continue; |
| 707 | 707 | } |
| 708 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
| 708 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
| 709 | 709 | } |
| 710 | 710 | } |
| 711 | 711 | |
@@ -788,14 +788,14 @@ discard block |
||
| 788 | 788 | * Migrate settings from form->options into new action. |
| 789 | 789 | */ |
| 790 | 790 | public function migrate_to_2( $form, $update = 'update' ) { |
| 791 | - $action = $this->prepare_new( $form->id ); |
|
| 791 | + $action = $this->prepare_new( $form->id ); |
|
| 792 | 792 | FrmAppHelper::unserialize_or_decode( $form->options ); |
| 793 | 793 | |
| 794 | 794 | // fill with existing options |
| 795 | 795 | foreach ( $action->post_content as $name => $val ) { |
| 796 | - if ( isset( $form->options[ $name ] ) ) { |
|
| 797 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
| 798 | - unset( $form->options[ $name ] ); |
|
| 796 | + if ( isset( $form->options[$name] ) ) { |
|
| 797 | + $action->post_content[$name] = $form->options[$name]; |
|
| 798 | + unset( $form->options[$name] ); |
|
| 799 | 799 | } |
| 800 | 800 | } |
| 801 | 801 | |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | $stop = $stop ? false : true; |
| 862 | 862 | } |
| 863 | 863 | |
| 864 | - $met[ $stop ] = $stop; |
|
| 864 | + $met[$stop] = $stop; |
|
| 865 | 865 | }//end foreach |
| 866 | 866 | |
| 867 | 867 | if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) { |
@@ -915,8 +915,8 @@ discard block |
||
| 915 | 915 | private static function get_value_from_entry( $entry, $field_id ) { |
| 916 | 916 | $observed_value = ''; |
| 917 | 917 | |
| 918 | - if ( isset( $entry->metas[ $field_id ] ) ) { |
|
| 919 | - $observed_value = $entry->metas[ $field_id ]; |
|
| 918 | + if ( isset( $entry->metas[$field_id] ) ) { |
|
| 919 | + $observed_value = $entry->metas[$field_id]; |
|
| 920 | 920 | } elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) { |
| 921 | 921 | $field = FrmField::getOne( $field_id ); |
| 922 | 922 | $observed_value = FrmProEntryMetaHelper::get_post_or_meta_value( |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * @param array $stats Statistics section data. |
| 141 | 141 | */ |
| 142 | 142 | protected function add_payments_data( &$stats ) { |
| 143 | - $payment_data = FrmEmailSummaryHelper::get_payments_data( $this->from_date, $this->to_date ); |
|
| 143 | + $payment_data = FrmEmailSummaryHelper::get_payments_data( $this->from_date, $this->to_date ); |
|
| 144 | 144 | $stats['payments_count'] = array( |
| 145 | 145 | 'label' => __( 'Payments collected', 'formidable' ), |
| 146 | 146 | 'count' => $payment_data['count'], |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | // Build total for each currency. |
| 151 | 151 | foreach ( $payment_data['total'] as $currency => $amount ) { |
| 152 | - $stats[ 'payments_total_' . $currency ] = array( |
|
| 152 | + $stats['payments_total_' . $currency] = array( |
|
| 153 | 153 | // translators: currency name. |
| 154 | 154 | 'label' => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ), |
| 155 | 155 | 'count' => $amount, |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if ( $this->has_comparison ) { |
| 162 | - $prev_payment_data = FrmEmailSummaryHelper::get_payments_data( $this->prev_from_date, $this->prev_to_date ); |
|
| 162 | + $prev_payment_data = FrmEmailSummaryHelper::get_payments_data( $this->prev_from_date, $this->prev_to_date ); |
|
| 163 | 163 | |
| 164 | 164 | if ( ! $payment_data['count'] && ! $prev_payment_data['count'] ) { |
| 165 | 165 | // Maybe this site doesn't collect payment, hide these sections. |
@@ -171,23 +171,23 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | // Compare total for each currency. |
| 173 | 173 | foreach ( $payment_data['total'] as $currency => $amount ) { |
| 174 | - if ( ! isset( $prev_payment_data['total'][ $currency ] ) ) { |
|
| 175 | - $stats[ 'payments_total_' . $currency ]['compare'] = 1; |
|
| 174 | + if ( ! isset( $prev_payment_data['total'][$currency] ) ) { |
|
| 175 | + $stats['payments_total_' . $currency]['compare'] = 1; |
|
| 176 | 176 | continue; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - $stats[ 'payments_total_' . $currency ]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][ $currency ] ); |
|
| 180 | - unset( $prev_payment_data['total'][ $currency ] ); |
|
| 179 | + $stats['payments_total_' . $currency]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][$currency] ); |
|
| 180 | + unset( $prev_payment_data['total'][$currency] ); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | // If prev month has more currencies. |
| 184 | 184 | foreach ( $prev_payment_data['total'] as $currency => $amount ) { |
| 185 | - $stats[ 'payments_total_' . $currency ] = array( |
|
| 185 | + $stats['payments_total_' . $currency] = array( |
|
| 186 | 186 | // translators: currency name. |
| 187 | 187 | 'label' => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ), |
| 188 | 188 | 'count' => 0, |
| 189 | 189 | 'display' => $this->get_formatted_price( 0, $currency ), |
| 190 | - 'compare' => -1, |
|
| 190 | + 'compare' => - 1, |
|
| 191 | 191 | ); |
| 192 | 192 | } |
| 193 | 193 | }//end if |
@@ -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 = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false; |
|
| 233 | + $error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $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 | |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | unset( $shortcode_atts['class'] ); |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - $shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? 'true' : 'false'; |
|
| 397 | + $shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? 'true' : 'false'; |
|
| 398 | 398 | |
| 399 | 399 | $this->field_obj->set_field_column( 'shortcodes', $shortcode_atts ); |
| 400 | 400 | |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | */ |
| 447 | 447 | private function get_field_div_classes() { |
| 448 | 448 | // Add error class |
| 449 | - $classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : ''; |
|
| 449 | + $classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : ''; |
|
| 450 | 450 | |
| 451 | 451 | // Add label position class |
| 452 | 452 | $settings = $this->field_obj->display_field_settings(); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | // Validate the number format. |
| 72 | 72 | if ( ! is_numeric( $args['value'] ) && '' !== $args['value'] ) { |
| 73 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 73 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // validate number settings |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | if ( $frm_settings->use_html && $maxnum !== '' && $minnum !== '' ) { |
| 83 | 83 | $value = (float) $args['value']; |
| 84 | 84 | if ( $value < $minnum ) { |
| 85 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a higher number', 'formidable' ); |
|
| 85 | + $errors['field' . $args['id']] = __( 'Please select a higher number', 'formidable' ); |
|
| 86 | 86 | } elseif ( $value > $maxnum ) { |
| 87 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a lower number', 'formidable' ); |
|
| 87 | + $errors['field' . $args['id']] = __( 'Please select a lower number', 'formidable' ); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @return void |
| 106 | 106 | */ |
| 107 | 107 | private function validate_step( &$errors, $args ) { |
| 108 | - if ( isset( $errors[ 'field' . $args['id'] ] ) ) { |
|
| 108 | + if ( isset( $errors['field' . $args['id']] ) ) { |
|
| 109 | 109 | // Don't need to check if value is invalid before. |
| 110 | 110 | return; |
| 111 | 111 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | return; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - $errors[ 'field' . $args['id'] ] = sprintf( |
|
| 123 | + $errors['field' . $args['id']] = sprintf( |
|
| 124 | 124 | // Translators: %1$s: the first nearest value; %2$s: the second nearest value. |
| 125 | 125 | __( 'Please enter a valid value. Two nearest valid values are %1$s and %2$s', 'formidable' ), |
| 126 | 126 | floatval( $result[0] ), |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | if ( $new_val !== $value ) { |
| 212 | - $new_values[ $key ] = $new_val; |
|
| 212 | + $new_values[$key] = $new_val; |
|
| 213 | 213 | } |
| 214 | 214 | }//end foreach |
| 215 | 215 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | foreach ( $values as $value_key => $value ) { |
| 242 | 242 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
| 243 | - $new_values[ $value_key ] = $value; |
|
| 243 | + $new_values[$value_key] = $value; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
@@ -323,15 +323,15 @@ discard block |
||
| 323 | 323 | $existing_keys = array_keys( $values['item_meta'] ); |
| 324 | 324 | foreach ( $all_fields as $fid ) { |
| 325 | 325 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
| 326 | - $values['item_meta'][ $fid->id ] = ''; |
|
| 326 | + $values['item_meta'][$fid->id] = ''; |
|
| 327 | 327 | } |
| 328 | - $field_array[ $fid->id ] = $fid; |
|
| 328 | + $field_array[$fid->id] = $fid; |
|
| 329 | 329 | } |
| 330 | 330 | unset( $all_fields ); |
| 331 | 331 | |
| 332 | 332 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
| 333 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
| 334 | - $field = $field_array[ $field_id ]; |
|
| 333 | + if ( isset( $field_array[$field_id] ) ) { |
|
| 334 | + $field = $field_array[$field_id]; |
|
| 335 | 335 | } else { |
| 336 | 336 | $field = FrmField::getOne( $field_id ); |
| 337 | 337 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | continue; |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
| 343 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
| 344 | 344 | if ( $is_settings_page ) { |
| 345 | 345 | self::get_settings_page_html( $values, $field ); |
| 346 | 346 | |
@@ -356,22 +356,22 @@ discard block |
||
| 356 | 356 | $update_options = apply_filters( 'frm_field_options_to_update', $update_options ); |
| 357 | 357 | |
| 358 | 358 | foreach ( $update_options as $opt => $default ) { |
| 359 | - $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default; |
|
| 360 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 359 | + $field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default; |
|
| 360 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
| 364 | 364 | |
| 365 | 365 | $new_field = array( |
| 366 | 366 | 'field_options' => $field->field_options, |
| 367 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
| 367 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
| 368 | 368 | ); |
| 369 | 369 | |
| 370 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
| 371 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
| 370 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
| 371 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
| 372 | 372 | if ( is_array( $option ) ) { |
| 373 | 373 | foreach ( $option as $key => $item ) { |
| 374 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
| 374 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | } |
@@ -401,8 +401,8 @@ discard block |
||
| 401 | 401 | */ |
| 402 | 402 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
| 403 | 403 | if ( $field->type === 'textarea' && |
| 404 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
| 405 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 404 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
| 405 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 406 | 406 | |
| 407 | 407 | $new_field['field_options']['max'] = ''; |
| 408 | 408 | |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
| 411 | 411 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
| 412 | 412 | */ |
| 413 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
| 413 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | |
@@ -486,11 +486,11 @@ discard block |
||
| 486 | 486 | * Updating the settings page |
| 487 | 487 | */ |
| 488 | 488 | private static function get_settings_page_html( $values, &$field ) { |
| 489 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 489 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 490 | 490 | $prev_opts = array(); |
| 491 | 491 | $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); |
| 492 | 492 | |
| 493 | - $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; |
|
| 493 | + $field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html; |
|
| 494 | 494 | } elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) { |
| 495 | 495 | $prev_opts = $field->field_options; |
| 496 | 496 | } |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | foreach ( $field_cols as $col => $default ) { |
| 517 | 517 | $default = ( $default === '' ) ? $field->{$col} : $default; |
| 518 | 518 | |
| 519 | - $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; |
|
| 519 | + $new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default; |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | // Don't save the template option. |
@@ -941,8 +941,8 @@ discard block |
||
| 941 | 941 | self::maybe_get_form( $form ); |
| 942 | 942 | } |
| 943 | 943 | |
| 944 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 945 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 944 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 945 | + return $frm_vars['form_params'][$form->id]; |
|
| 946 | 946 | } |
| 947 | 947 | |
| 948 | 948 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -971,15 +971,15 @@ discard block |
||
| 971 | 971 | // If there are two forms on the same page, make sure not to submit both. |
| 972 | 972 | foreach ( $default_values as $var => $default ) { |
| 973 | 973 | if ( $var == 'action' ) { |
| 974 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 974 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 975 | 975 | } else { |
| 976 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 976 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 977 | 977 | } |
| 978 | 978 | unset( $var, $default ); |
| 979 | 979 | } |
| 980 | 980 | } else { |
| 981 | 981 | foreach ( $default_values as $var => $default ) { |
| 982 | - $values[ $var ] = $default; |
|
| 982 | + $values[$var] = $default; |
|
| 983 | 983 | unset( $var, $default ); |
| 984 | 984 | } |
| 985 | 985 | } |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | 'sdir' => '', |
| 1006 | 1006 | ); |
| 1007 | 1007 | foreach ( $defaults as $var => $default ) { |
| 1008 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1008 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | 1011 | return $values; |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | 'keep_post' => '', |
| 1034 | 1034 | ); |
| 1035 | 1035 | foreach ( $defaults as $var => $default ) { |
| 1036 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1036 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | 1039 | return $values; |
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | $form = $atts['form']; |
| 1137 | 1137 | $default = isset( $atts['default'] ) ? $atts['default'] : ''; |
| 1138 | 1138 | |
| 1139 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default; |
|
| 1139 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default; |
|
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | 1142 | /** |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | class FrmFormTemplateApi extends FrmFormApi { |
| 7 | 7 | |
| 8 | - protected static $code_option_name = 'frm_free_license_code'; |
|
| 8 | + protected static $code_option_name = 'frm_free_license_code'; |
|
| 9 | 9 | |
| 10 | 10 | private static $base_api_url = 'https://formidableforms.com/wp-json/form-templates/v1/'; |
| 11 | 11 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $templates = $this->get_api_info(); |
| 91 | 91 | $contact_form = 20872734; |
| 92 | - return isset( $templates[ $contact_form ] ) && ! empty( $templates[ $contact_form ]['url'] ); |
|
| 92 | + return isset( $templates[$contact_form] ) && ! empty( $templates[$contact_form]['url'] ); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -164,15 +164,15 @@ discard block |
||
| 164 | 164 | continue; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - $data['urlByKey'][ $template['key'] ] = $template['url']; |
|
| 167 | + $data['urlByKey'][$template['key']] = $template['url']; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - if ( ! isset( $data['urlByKey'][ $key ] ) ) { |
|
| 170 | + if ( ! isset( $data['urlByKey'][$key] ) ) { |
|
| 171 | 171 | $error = new WP_Error( 400, 'We were unable to retrieve the template' ); |
| 172 | 172 | wp_send_json_error( $error ); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - $data['url'] = $data['urlByKey'][ $key ]; |
|
| 175 | + $data['url'] = $data['urlByKey'][$key]; |
|
| 176 | 176 | }//end if |
| 177 | 177 | |
| 178 | 178 | wp_send_json_success( $data ); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $to = $this->prepare_email_setting( $this->settings['email_to'], $user_id_args ); |
| 163 | 163 | $to = $this->explode_emails( $to ); |
| 164 | 164 | |
| 165 | - $where = array( |
|
| 165 | + $where = array( |
|
| 166 | 166 | 'it.field_id !' => 0, |
| 167 | 167 | 'it.item_id' => $this->entry->id, |
| 168 | 168 | ); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | 'entry' => $this->entry, |
| 173 | 173 | 'form' => $this->form, |
| 174 | 174 | ); |
| 175 | - $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
| 175 | + $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
| 176 | 176 | |
| 177 | 177 | $this->to = array_unique( (array) $to ); |
| 178 | 178 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | // Add the user info if it isn't already included |
| 410 | 410 | if ( $this->include_user_info && $prev_mail_body === $mail_body ) { |
| 411 | - $data = $this->entry->description; |
|
| 411 | + $data = $this->entry->description; |
|
| 412 | 412 | $mail_body .= "\r\n\r\n" . __( 'User Information', 'formidable' ) . "\r\n"; |
| 413 | 413 | $this->maybe_add_ip( $mail_body ); |
| 414 | 414 | $mail_body .= __( 'User-Agent (Browser/OS)', 'formidable' ) . ': ' . FrmEntriesHelper::get_browser( $data['browser'] ) . "\r\n"; |
@@ -702,12 +702,12 @@ discard block |
||
| 702 | 702 | $name = trim( str_replace( $email, '', $val ) ); |
| 703 | 703 | } else { |
| 704 | 704 | // If user enters a name without an email |
| 705 | - unset( $recipients[ $key ] ); |
|
| 705 | + unset( $recipients[$key] ); |
|
| 706 | 706 | continue; |
| 707 | 707 | } |
| 708 | 708 | } |
| 709 | 709 | |
| 710 | - $recipients[ $key ] = $this->format_from_email( $name, $email ); |
|
| 710 | + $recipients[$key] = $this->format_from_email( $name, $email ); |
|
| 711 | 711 | }//end foreach |
| 712 | 712 | |
| 713 | 713 | return $recipients; |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | ); |
| 858 | 858 | |
| 859 | 859 | // Remove phone number from to addresses |
| 860 | - unset( $this->to[ $key ] ); |
|
| 860 | + unset( $this->to[$key] ); |
|
| 861 | 861 | }//end if |
| 862 | 862 | }//end foreach |
| 863 | 863 | } |