@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $with_tags = $args['conditional_check'] ? 3 : 2; |
| 64 | - if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) { |
|
| 65 | - $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] ); |
|
| 64 | + if ( ! empty( $shortcodes[$with_tags][$short_key] ) ) { |
|
| 65 | + $tag = str_replace( '[' . $prefix, '', $shortcodes[0][$short_key] ); |
|
| 66 | 66 | $tag = str_replace( ']', '', $tag ); |
| 67 | 67 | $tag = str_replace( chr( 194 ) . chr( 160 ), ' ', $tag ); |
| 68 | 68 | $tags = preg_split( '/\s+/', $tag, 2 ); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $tag = $tags[0]; |
| 71 | 71 | } |
| 72 | 72 | } else { |
| 73 | - $tag = $shortcodes[ $with_tags - 1 ][ $short_key ]; |
|
| 73 | + $tag = $shortcodes[$with_tags - 1][$short_key]; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | return $tag; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | if ( $term && is_array( $term ) ) { |
| 118 | 118 | $imported['imported']['terms'] ++; |
| 119 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
| 119 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | unset( $term, $t ); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Keep track of whether this specific form was updated or not. |
| 175 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
| 175 | + $imported['form_status'][$form_id] = 'imported'; |
|
| 176 | 176 | self::track_imported_child_forms( (int) $form_id, $form['parent_form_id'], $child_forms ); |
| 177 | 177 | } |
| 178 | 178 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | // Update field ids/keys to new ones. |
| 185 | 185 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
| 186 | 186 | |
| 187 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
| 187 | + $imported['forms'][(int) $item->id] = $form_id; |
|
| 188 | 188 | |
| 189 | 189 | // Send pre 2.0 form options through function that creates actions. |
| 190 | 190 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
@@ -243,15 +243,15 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | // Keep track of whether this specific form was updated or not |
| 246 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
| 246 | + $imported['form_status'][$form_id] = 'updated'; |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | private static function get_form_fields( $form_id ) { |
| 250 | 250 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' ); |
| 251 | 251 | $old_fields = array(); |
| 252 | 252 | foreach ( $form_fields as $f ) { |
| 253 | - $old_fields[ $f->id ] = $f; |
|
| 254 | - $old_fields[ $f->field_key ] = $f->id; |
|
| 253 | + $old_fields[$f->id] = $f; |
|
| 254 | + $old_fields[$f->field_key] = $f->id; |
|
| 255 | 255 | unset( $f ); |
| 256 | 256 | } |
| 257 | 257 | $form_fields = $old_fields; |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
| 310 | 310 | if ( $parent_form_id ) { |
| 311 | - $child_forms[ $form_id ] = $parent_form_id; |
|
| 311 | + $child_forms[$form_id] = $parent_form_id; |
|
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | |
@@ -324,9 +324,9 @@ discard block |
||
| 324 | 324 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
| 325 | 325 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
| 326 | 326 | |
| 327 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && $imported_forms[ $old_parent_form_id ] != $old_parent_form_id ) { |
|
| 327 | + if ( isset( $imported_forms[$old_parent_form_id] ) && $imported_forms[$old_parent_form_id] != $old_parent_form_id ) { |
|
| 328 | 328 | // Update all children with this old parent_form_id |
| 329 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
| 329 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
| 330 | 330 | |
| 331 | 331 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
| 332 | 332 | } |
@@ -373,25 +373,25 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | if ( ! empty( $this_form ) ) { |
| 375 | 375 | // check for field to edit by field id |
| 376 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
| 376 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
| 377 | 377 | FrmField::update( $f['id'], $f ); |
| 378 | 378 | $imported['updated']['fields'] ++; |
| 379 | 379 | |
| 380 | - unset( $form_fields[ $f['id'] ] ); |
|
| 380 | + unset( $form_fields[$f['id']] ); |
|
| 381 | 381 | |
| 382 | 382 | //unset old field key |
| 383 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 384 | - unset( $form_fields[ $f['field_key'] ] ); |
|
| 383 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 384 | + unset( $form_fields[$f['field_key']] ); |
|
| 385 | 385 | } |
| 386 | - } elseif ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 386 | + } elseif ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 387 | 387 | // check for field to edit by field key |
| 388 | 388 | unset( $f['id'] ); |
| 389 | 389 | |
| 390 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
| 390 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
| 391 | 391 | $imported['updated']['fields'] ++; |
| 392 | 392 | |
| 393 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); //unset old field id |
|
| 394 | - unset( $form_fields[ $f['field_key'] ] ); //unset old field key |
|
| 393 | + unset( $form_fields[$form_fields[$f['field_key']]] ); //unset old field id |
|
| 394 | + unset( $form_fields[$f['field_key']] ); //unset old field key |
|
| 395 | 395 | } else { |
| 396 | 396 | // if no matching field id or key in this form, create the field |
| 397 | 397 | self::create_imported_field( $f, $imported ); |
@@ -460,8 +460,8 @@ discard block |
||
| 460 | 460 | if ( $f['type'] == 'form' || ( $f['type'] == 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) { |
| 461 | 461 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
| 462 | 462 | $form_select = (int) $f['field_options']['form_select']; |
| 463 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
| 464 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
| 463 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
| 464 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | } |
@@ -482,8 +482,8 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) { |
| 484 | 484 | $old_form = $f['field_options']['get_values_form']; |
| 485 | - if ( isset( $imported['forms'][ $old_form ] ) ) { |
|
| 486 | - $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ]; |
|
| 485 | + if ( isset( $imported['forms'][$old_form] ) ) { |
|
| 486 | + $f['field_options']['get_values_form'] = $imported['forms'][$old_form]; |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | } |
@@ -504,12 +504,12 @@ discard block |
||
| 504 | 504 | private static function migrate_placeholders( &$f ) { |
| 505 | 505 | $update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' ); |
| 506 | 506 | foreach ( $update_values as $k => $v ) { |
| 507 | - $f[ $k ] = $v; |
|
| 507 | + $f[$k] = $v; |
|
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | $update_values = self::migrate_field_placeholder( $f, 'default_blank' ); |
| 511 | 511 | foreach ( $update_values as $k => $v ) { |
| 512 | - $f[ $k ] = $v; |
|
| 512 | + $f[$k] = $v; |
|
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | 515 | |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | public static function migrate_field_placeholder( $field, $type ) { |
| 524 | 524 | $field = (array) $field; |
| 525 | 525 | $field_options = $field['field_options']; |
| 526 | - if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) { |
|
| 526 | + if ( empty( $field_options[$type] ) || empty( $field['default_value'] ) ) { |
|
| 527 | 527 | return array(); |
| 528 | 528 | } |
| 529 | 529 | |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | if ( $opt == $default_value ) { |
| 552 | - unset( $options[ $opt_key ] ); |
|
| 552 | + unset( $options[$opt_key] ); |
|
| 553 | 553 | break; |
| 554 | 554 | } |
| 555 | 555 | } |
@@ -704,17 +704,17 @@ discard block |
||
| 704 | 704 | self::update_postmeta( $post, $post_id ); |
| 705 | 705 | |
| 706 | 706 | $this_type = 'posts'; |
| 707 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
| 708 | - $this_type = $post_types[ $post['post_type'] ]; |
|
| 707 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
| 708 | + $this_type = $post_types[$post['post_type']]; |
|
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) { |
| 712 | - $imported['updated'][ $this_type ] ++; |
|
| 712 | + $imported['updated'][$this_type] ++; |
|
| 713 | 713 | } else { |
| 714 | - $imported['imported'][ $this_type ] ++; |
|
| 714 | + $imported['imported'][$this_type] ++; |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | - $imported['posts'][ (int) $old_id ] = $post_id; |
|
| 717 | + $imported['posts'][(int) $old_id] = $post_id; |
|
| 718 | 718 | |
| 719 | 719 | do_action( 'frm_after_import_view', $post_id, $post ); |
| 720 | 720 | |
@@ -731,9 +731,9 @@ discard block |
||
| 731 | 731 | $post['attachment_url'] = (string) $item->attachment_url; |
| 732 | 732 | } |
| 733 | 733 | |
| 734 | - if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
| 734 | + if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
| 735 | 735 | // update to new form id |
| 736 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
| 736 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | // Don't allow default styles to take over a site's default style |
@@ -760,8 +760,8 @@ discard block |
||
| 760 | 760 | ); |
| 761 | 761 | |
| 762 | 762 | //switch old form and field ids to new ones |
| 763 | - if ( $m['key'] == 'frm_form_id' && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
|
| 764 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
| 763 | + if ( $m['key'] == 'frm_form_id' && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
| 764 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
| 765 | 765 | } else { |
| 766 | 766 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 767 | 767 | |
@@ -772,15 +772,15 @@ discard block |
||
| 772 | 772 | } elseif ( $m['key'] == 'frm_options' ) { |
| 773 | 773 | |
| 774 | 774 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
| 775 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
| 776 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
| 775 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
| 776 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
| 777 | 777 | } |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | $check_dup_array = array(); |
| 781 | 781 | if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) { |
| 782 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
| 783 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
| 782 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
| 783 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
| 784 | 784 | } elseif ( is_array( $m['value']['order_by'] ) ) { |
| 785 | 785 | $check_dup_array[] = 'order_by'; |
| 786 | 786 | } |
@@ -791,9 +791,9 @@ discard block |
||
| 791 | 791 | } |
| 792 | 792 | |
| 793 | 793 | foreach ( $check_dup_array as $check_k ) { |
| 794 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
| 795 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
| 796 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
| 794 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
| 795 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
| 796 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
| 797 | 797 | } |
| 798 | 798 | unset( $mk, $mv ); |
| 799 | 799 | } |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
| 809 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
| 810 | 810 | } |
| 811 | 811 | |
| 812 | 812 | /** |
@@ -834,11 +834,11 @@ discard block |
||
| 834 | 834 | $name = (string) $c; |
| 835 | 835 | } |
| 836 | 836 | |
| 837 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
| 838 | - $post['tax_input'][ $taxonomy ] = array(); |
|
| 837 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
| 838 | + $post['tax_input'][$taxonomy] = array(); |
|
| 839 | 839 | } |
| 840 | 840 | |
| 841 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
| 841 | + $post['tax_input'][$taxonomy][] = $name; |
|
| 842 | 842 | unset( $name ); |
| 843 | 843 | } |
| 844 | 844 | } |
@@ -937,7 +937,7 @@ discard block |
||
| 937 | 937 | |
| 938 | 938 | $message = '<ul>'; |
| 939 | 939 | foreach ( $result as $type => $results ) { |
| 940 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
| 940 | + if ( ! isset( $t_strings[$type] ) ) { |
|
| 941 | 941 | // only print imported and updated |
| 942 | 942 | continue; |
| 943 | 943 | } |
@@ -949,7 +949,7 @@ discard block |
||
| 949 | 949 | } |
| 950 | 950 | |
| 951 | 951 | if ( ! empty( $s_message ) ) { |
| 952 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
| 952 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
| 953 | 953 | $message .= implode( ', ', $s_message ); |
| 954 | 954 | $message .= '</li>'; |
| 955 | 955 | } |
@@ -989,7 +989,7 @@ discard block |
||
| 989 | 989 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
| 990 | 990 | ); |
| 991 | 991 | |
| 992 | - $s_message[] = isset( $strings[ $type ] ) ? $strings[ $type ] : ' ' . $m . ' ' . ucfirst( $type ); |
|
| 992 | + $s_message[] = isset( $strings[$type] ) ? $strings[$type] : ' ' . $m . ' ' . ucfirst( $type ); |
|
| 993 | 993 | } |
| 994 | 994 | |
| 995 | 995 | /** |
@@ -1120,10 +1120,10 @@ discard block |
||
| 1120 | 1120 | $array_defaults = array_filter( $defaults, 'is_array' ); |
| 1121 | 1121 | foreach ( $array_defaults as $d => $default ) { |
| 1122 | 1122 | // compare array defaults |
| 1123 | - if ( $default == $saved[ $d ] ) { |
|
| 1124 | - unset( $saved[ $d ] ); |
|
| 1123 | + if ( $default == $saved[$d] ) { |
|
| 1124 | + unset( $saved[$d] ); |
|
| 1125 | 1125 | } |
| 1126 | - unset( $defaults[ $d ] ); |
|
| 1126 | + unset( $defaults[$d] ); |
|
| 1127 | 1127 | } |
| 1128 | 1128 | $saved = array_diff_assoc( (array) $saved, $defaults ); |
| 1129 | 1129 | } |
@@ -1134,14 +1134,14 @@ discard block |
||
| 1134 | 1134 | * @since 3.06 |
| 1135 | 1135 | */ |
| 1136 | 1136 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
| 1137 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
| 1137 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
| 1138 | 1138 | return; |
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
| 1142 | - $default_html = $defaults[ $html_name ]; |
|
| 1141 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
| 1142 | + $default_html = $defaults[$html_name]; |
|
| 1143 | 1143 | if ( $old_html == $default_html ) { |
| 1144 | - unset( $options[ $html_name ] ); |
|
| 1144 | + unset( $options[$html_name] ); |
|
| 1145 | 1145 | |
| 1146 | 1146 | return; |
| 1147 | 1147 | } |
@@ -1149,7 +1149,7 @@ discard block |
||
| 1149 | 1149 | // Account for some of the older field default HTML. |
| 1150 | 1150 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
| 1151 | 1151 | if ( $old_html == $default_html ) { |
| 1152 | - unset( $options[ $html_name ] ); |
|
| 1152 | + unset( $options[$html_name] ); |
|
| 1153 | 1153 | } |
| 1154 | 1154 | } |
| 1155 | 1155 | |
@@ -1235,8 +1235,8 @@ discard block |
||
| 1235 | 1235 | ); |
| 1236 | 1236 | |
| 1237 | 1237 | foreach ( $post_settings as $post_setting ) { |
| 1238 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
| 1239 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
| 1238 | + if ( isset( $form_options[$post_setting] ) ) { |
|
| 1239 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
| 1240 | 1240 | } |
| 1241 | 1241 | unset( $post_setting ); |
| 1242 | 1242 | } |
@@ -1306,11 +1306,11 @@ discard block |
||
| 1306 | 1306 | foreach ( $post_content as $key => $setting ) { |
| 1307 | 1307 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
| 1308 | 1308 | // Replace old IDs with new IDs |
| 1309 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
| 1309 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
| 1310 | 1310 | } elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
| 1311 | 1311 | foreach ( $setting as $k => $val ) { |
| 1312 | 1312 | // Replace old IDs with new IDs |
| 1313 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
| 1313 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
| 1314 | 1314 | } |
| 1315 | 1315 | } |
| 1316 | 1316 | unset( $key, $setting ); |
@@ -1386,8 +1386,8 @@ discard block |
||
| 1386 | 1386 | private static function remove_deprecated_notification_settings( $form_id, $form_options ) { |
| 1387 | 1387 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
| 1388 | 1388 | foreach ( $delete_settings as $index ) { |
| 1389 | - if ( isset( $form_options[ $index ] ) ) { |
|
| 1390 | - unset( $form_options[ $index ] ); |
|
| 1389 | + if ( isset( $form_options[$index] ) ) { |
|
| 1390 | + unset( $form_options[$index] ); |
|
| 1391 | 1391 | } |
| 1392 | 1392 | } |
| 1393 | 1393 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -1440,12 +1440,12 @@ discard block |
||
| 1440 | 1440 | 'reply_to_name' => '', |
| 1441 | 1441 | ); |
| 1442 | 1442 | foreach ( $reply_fields as $f => $val ) { |
| 1443 | - if ( isset( $notification[ $f ] ) ) { |
|
| 1444 | - $atts[ $f ] = $notification[ $f ]; |
|
| 1445 | - if ( 'custom' == $notification[ $f ] ) { |
|
| 1446 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
| 1447 | - } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
| 1448 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
| 1443 | + if ( isset( $notification[$f] ) ) { |
|
| 1444 | + $atts[$f] = $notification[$f]; |
|
| 1445 | + if ( 'custom' == $notification[$f] ) { |
|
| 1446 | + $atts[$f] = $notification['cust_' . $f]; |
|
| 1447 | + } elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
| 1448 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
| 1449 | 1449 | } |
| 1450 | 1450 | } |
| 1451 | 1451 | unset( $f, $val ); |
@@ -1476,13 +1476,13 @@ discard block |
||
| 1476 | 1476 | foreach ( $atts['email_to'] as $key => $email_field ) { |
| 1477 | 1477 | |
| 1478 | 1478 | if ( is_numeric( $email_field ) ) { |
| 1479 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
| 1479 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
| 1480 | 1480 | } |
| 1481 | 1481 | |
| 1482 | 1482 | if ( strpos( $email_field, '|' ) ) { |
| 1483 | 1483 | $email_opt = explode( '|', $email_field ); |
| 1484 | 1484 | if ( isset( $email_opt[0] ) ) { |
| 1485 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 1485 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 1486 | 1486 | } |
| 1487 | 1487 | unset( $email_opt ); |
| 1488 | 1488 | } |
@@ -1503,12 +1503,12 @@ discard block |
||
| 1503 | 1503 | // Add more fields to the new notification |
| 1504 | 1504 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
| 1505 | 1505 | foreach ( $add_fields as $add_field ) { |
| 1506 | - if ( isset( $notification[ $add_field ] ) ) { |
|
| 1507 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
| 1506 | + if ( isset( $notification[$add_field] ) ) { |
|
| 1507 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
| 1508 | 1508 | } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
| 1509 | - $new_notification['post_content'][ $add_field ] = 0; |
|
| 1509 | + $new_notification['post_content'][$add_field] = 0; |
|
| 1510 | 1510 | } else { |
| 1511 | - $new_notification['post_content'][ $add_field ] = ''; |
|
| 1511 | + $new_notification['post_content'][$add_field] = ''; |
|
| 1512 | 1512 | } |
| 1513 | 1513 | unset( $add_field ); |
| 1514 | 1514 | } |
@@ -1532,7 +1532,7 @@ discard block |
||
| 1532 | 1532 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
| 1533 | 1533 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
| 1534 | 1534 | if ( is_numeric( $email_key ) ) { |
| 1535 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 1535 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 1536 | 1536 | } |
| 1537 | 1537 | unset( $email_key, $val ); |
| 1538 | 1538 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $section['function'] = $original; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - $sections[ $key ] = $section; |
|
| 118 | + $sections[$key] = $section; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | return $sections; |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | $section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' ); |
| 129 | 129 | $sections = self::get_settings_tabs(); |
| 130 | - if ( ! isset( $sections[ $section ] ) ) { |
|
| 130 | + if ( ! isset( $sections[$section] ) ) { |
|
| 131 | 131 | wp_die(); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - $section = $sections[ $section ]; |
|
| 134 | + $section = $sections[$section]; |
|
| 135 | 135 | |
| 136 | 136 | if ( isset( $section['class'] ) ) { |
| 137 | 137 | call_user_func( array( $section['class'], $section['function'] ) ); |
@@ -98,19 +98,19 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | foreach ( $action_controls as $action ) { |
| 101 | - if ( isset( $groups[ $action->id_base ] ) || in_array( $action->id_base, $grouped ) ) { |
|
| 101 | + if ( isset( $groups[$action->id_base] ) || in_array( $action->id_base, $grouped ) ) { |
|
| 102 | 102 | continue; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | $this_group = $action->action_options['group']; |
| 106 | - if ( ! isset( $groups[ $this_group ] ) ) { |
|
| 106 | + if ( ! isset( $groups[$this_group] ) ) { |
|
| 107 | 107 | $this_group = 'misc'; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if ( ! isset( $groups[ $this_group ]['actions'] ) ) { |
|
| 111 | - $groups[ $this_group ]['actions'] = array(); |
|
| 110 | + if ( ! isset( $groups[$this_group]['actions'] ) ) { |
|
| 111 | + $groups[$this_group]['actions'] = array(); |
|
| 112 | 112 | } |
| 113 | - $groups[ $this_group ]['actions'][] = $action->id_base; |
|
| 113 | + $groups[$this_group]['actions'][] = $action->id_base; |
|
| 114 | 114 | |
| 115 | 115 | unset( $action ); |
| 116 | 116 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | return $a; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - $actions[ $a->id_base ] = $a; |
|
| 244 | + $actions[$a->id_base] = $a; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | return $actions; |
@@ -272,16 +272,16 @@ discard block |
||
| 272 | 272 | $action_map = array(); |
| 273 | 273 | |
| 274 | 274 | foreach ( $action_controls as $key => $control ) { |
| 275 | - $action_map[ $control->id_base ] = $key; |
|
| 275 | + $action_map[$control->id_base] = $key; |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | foreach ( $form_actions as $action ) { |
| 279 | - if ( ! isset( $action_map[ $action->post_excerpt ] ) ) { |
|
| 279 | + if ( ! isset( $action_map[$action->post_excerpt] ) ) { |
|
| 280 | 280 | // don't try and show settings if action no longer exists |
| 281 | 281 | continue; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values ); |
|
| 284 | + self::action_control( $action, $form, $action->ID, $action_controls[$action_map[$action->post_excerpt]], $values ); |
|
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | |
@@ -489,8 +489,8 @@ discard block |
||
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | // Store actions so they can be triggered with the correct priority. |
| 492 | - $stored_actions[ $action->ID ] = $action; |
|
| 493 | - $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority']; |
|
| 492 | + $stored_actions[$action->ID] = $action; |
|
| 493 | + $action_priority[$action->ID] = $link_settings[$action->post_excerpt]->action_options['priority']; |
|
| 494 | 494 | |
| 495 | 495 | unset( $action ); |
| 496 | 496 | } |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | new FrmNotification(); |
| 503 | 503 | |
| 504 | 504 | foreach ( $action_priority as $action_id => $priority ) { |
| 505 | - $action = $stored_actions[ $action_id ]; |
|
| 505 | + $action = $stored_actions[$action_id]; |
|
| 506 | 506 | do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event ); |
| 507 | 507 | do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form ); |
| 508 | 508 | |
@@ -549,12 +549,12 @@ discard block |
||
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | public function register( $action_class ) { |
| 552 | - $this->actions[ $action_class ] = new $action_class(); |
|
| 552 | + $this->actions[$action_class] = new $action_class(); |
|
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | public function unregister( $action_class ) { |
| 556 | - if ( isset( $this->actions[ $action_class ] ) ) { |
|
| 557 | - unset( $this->actions[ $action_class ] ); |
|
| 556 | + if ( isset( $this->actions[$action_class] ) ) { |
|
| 557 | + unset( $this->actions[$action_class] ); |
|
| 558 | 558 | } |
| 559 | 559 | } |
| 560 | 560 | |
@@ -563,8 +563,8 @@ discard block |
||
| 563 | 563 | |
| 564 | 564 | foreach ( $keys as $key ) { |
| 565 | 565 | // don't register new action if old action with the same id is already registered |
| 566 | - if ( ! isset( $this->actions[ $key ] ) ) { |
|
| 567 | - $this->actions[ $key ]->_register(); |
|
| 566 | + if ( ! isset( $this->actions[$key] ) ) { |
|
| 567 | + $this->actions[$key]->_register(); |
|
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | 570 | } |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | .<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_minus_icon:before{ |
| 88 | - content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['-'] : $minus_icons[1]['-'] ); ?>"; |
|
| 88 | + content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['-'] : $minus_icons[1]['-'] ); ?>"; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | .<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_plus_icon:before{ |
| 92 | - content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['+'] : $minus_icons[1]['+'] ); ?>"; |
|
| 92 | + content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['+'] : $minus_icons[1]['+'] ); ?>"; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | .<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_minus_icon:before, |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | .<?php echo esc_html( $style_class ); ?> .frm_trigger.active .frm_icon_font.frm_arrow_icon:before{ |
| 102 | - content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['-'] : $arrow_icons[1]['-'] ); ?>"; |
|
| 102 | + content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['-'] : $arrow_icons[1]['-'] ); ?>"; |
|
| 103 | 103 | color:<?php echo esc_html( $section_color . $important ); ?>; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | .<?php echo esc_html( $style_class ); ?> .frm_trigger .frm_icon_font.frm_arrow_icon:before{ |
| 107 | - content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['+'] : $arrow_icons[1]['+'] ); ?>"; |
|
| 107 | + content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['+'] : $arrow_icons[1]['+'] ); ?>"; |
|
| 108 | 108 | color:<?php echo esc_html( $section_color . $important ); ?>; |
| 109 | 109 | } |
| 110 | 110 | |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | </li> |
| 31 | 31 | <?php |
| 32 | 32 | foreach ( array( 20872734, 20874748, 20882522, 20874739 ) as $template ) { |
| 33 | - if ( ! isset( $templates[ $template ] ) ) { |
|
| 33 | + if ( ! isset( $templates[$template] ) ) { |
|
| 34 | 34 | continue; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $template = $templates[ $template ]; |
|
| 37 | + $template = $templates[$template]; |
|
| 38 | 38 | $plan_required = FrmFormsHelper::get_plan_required( $template ); |
| 39 | 39 | $link = FrmFormsHelper::get_template_install_link( $template, compact( 'pricing', 'license_type', 'plan_required' ) ); |
| 40 | 40 | ?> |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | </div> |
| 139 | 139 | </td> |
| 140 | 140 | </tr> |
| 141 | - <?php unset( $template, $templates[ $k ] ); ?> |
|
| 141 | + <?php unset( $template, $templates[$k] ); ?> |
|
| 142 | 142 | <?php } ?> |
| 143 | 143 | </tbody> |
| 144 | 144 | </table> |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | </div> |
| 239 | 239 | </td> |
| 240 | 240 | </tr> |
| 241 | - <?php unset( $template, $templates[ $k ] ); ?> |
|
| 241 | + <?php unset( $template, $templates[$k] ); ?> |
|
| 242 | 242 | <?php } ?> |
| 243 | 243 | </tbody> |
| 244 | 244 | </table> |
@@ -69,6 +69,9 @@ discard block |
||
| 69 | 69 | return $url; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | + /** |
|
| 73 | + * @return string |
|
| 74 | + */ |
|
| 72 | 75 | public static function get_affiliate() { |
| 73 | 76 | return absint( apply_filters( 'frm_affiliate_id', 0 ) ); |
| 74 | 77 | } |
@@ -129,6 +132,9 @@ discard block |
||
| 129 | 132 | return $frm_settings; |
| 130 | 133 | } |
| 131 | 134 | |
| 135 | + /** |
|
| 136 | + * @return string |
|
| 137 | + */ |
|
| 132 | 138 | public static function get_menu_name() { |
| 133 | 139 | $frm_settings = self::get_settings(); |
| 134 | 140 | |
@@ -410,6 +416,9 @@ discard block |
||
| 410 | 416 | return $value; |
| 411 | 417 | } |
| 412 | 418 | |
| 419 | + /** |
|
| 420 | + * @param string $param |
|
| 421 | + */ |
|
| 413 | 422 | public static function get_post_param( $param, $default = '', $sanitize = '', $serialized = false ) { |
| 414 | 423 | return self::get_simple_request( |
| 415 | 424 | array( |
@@ -1178,6 +1187,9 @@ discard block |
||
| 1178 | 1187 | return ( is_array( $values ) && in_array( $current, $values ) ) || ( ! is_array( $values ) && $values == $current ); |
| 1179 | 1188 | } |
| 1180 | 1189 | |
| 1190 | + /** |
|
| 1191 | + * @param string $function |
|
| 1192 | + */ |
|
| 1181 | 1193 | public static function recursive_function_map( $value, $function ) { |
| 1182 | 1194 | if ( is_array( $value ) ) { |
| 1183 | 1195 | $original_function = $function; |
@@ -1226,6 +1238,9 @@ discard block |
||
| 1226 | 1238 | return $return; |
| 1227 | 1239 | } |
| 1228 | 1240 | |
| 1241 | + /** |
|
| 1242 | + * @return string |
|
| 1243 | + */ |
|
| 1229 | 1244 | public static function esc_textarea( $text, $is_rich_text = false ) { |
| 1230 | 1245 | $safe_text = str_replace( '"', '"', $text ); |
| 1231 | 1246 | if ( ! $is_rich_text ) { |
@@ -1438,6 +1453,9 @@ discard block |
||
| 1438 | 1453 | return $values; |
| 1439 | 1454 | } |
| 1440 | 1455 | |
| 1456 | + /** |
|
| 1457 | + * @param string $fields |
|
| 1458 | + */ |
|
| 1441 | 1459 | private static function prepare_field_arrays( $fields, $record, array &$values, $args ) { |
| 1442 | 1460 | if ( ! empty( $fields ) ) { |
| 1443 | 1461 | foreach ( (array) $fields as $field ) { |
@@ -1631,6 +1649,9 @@ discard block |
||
| 1631 | 1649 | return $sub . ( ( $len < $original_len ) ? $continue : '' ); |
| 1632 | 1650 | } |
| 1633 | 1651 | |
| 1652 | + /** |
|
| 1653 | + * @param string[] $function_names |
|
| 1654 | + */ |
|
| 1634 | 1655 | public static function mb_function( $function_names, $args ) { |
| 1635 | 1656 | $mb_function_name = $function_names[0]; |
| 1636 | 1657 | $function_name = $function_names[1]; |
@@ -1665,6 +1686,9 @@ discard block |
||
| 1665 | 1686 | return $formatted; |
| 1666 | 1687 | } |
| 1667 | 1688 | |
| 1689 | + /** |
|
| 1690 | + * @param string $time_format |
|
| 1691 | + */ |
|
| 1668 | 1692 | private static function add_time_to_date( $time_format, $date ) { |
| 1669 | 1693 | if ( empty( $time_format ) ) { |
| 1670 | 1694 | $time_format = get_option( 'time_format' ); |
@@ -2090,6 +2114,7 @@ discard block |
||
| 2090 | 2114 | * If Pro is far outdated, show a message. |
| 2091 | 2115 | * |
| 2092 | 2116 | * @since 4.0.01 |
| 2117 | + * @param string $min_version |
|
| 2093 | 2118 | */ |
| 2094 | 2119 | public static function min_pro_version_notice( $min_version ) { |
| 2095 | 2120 | if ( ! self::is_formidable_admin() ) { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | 'fill' => '#4d4d4d', |
| 150 | 150 | 'orange' => '#f05a24', |
| 151 | 151 | ); |
| 152 | - $atts = array_merge( $defaults, $atts ); |
|
| 152 | + $atts = array_merge( $defaults, $atts ); |
|
| 153 | 153 | |
| 154 | 154 | return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 599.68 601.37" width="' . esc_attr( $atts['width'] ) . '" height="' . esc_attr( $atts['height'] ) . '"> |
| 155 | 155 | <path fill="' . esc_attr( $atts['orange'] ) . '" d="M289.6 384h140v76h-140z"/> |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | * @return string |
| 338 | 338 | */ |
| 339 | 339 | public static function get_server_value( $value ) { |
| 340 | - return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : ''; |
|
| 340 | + return isset( $_SERVER[$value] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[$value] ) ) : ''; |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | /** |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | ); |
| 361 | 361 | $ip = ''; |
| 362 | 362 | foreach ( $ip_options as $key ) { |
| 363 | - if ( ! isset( $_SERVER[ $key ] ) ) { |
|
| 363 | + if ( ! isset( $_SERVER[$key] ) ) { |
|
| 364 | 364 | continue; |
| 365 | 365 | } |
| 366 | 366 | |
@@ -385,10 +385,10 @@ discard block |
||
| 385 | 385 | |
| 386 | 386 | if ( $src == 'get' ) { |
| 387 | 387 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 388 | - $value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default ); |
|
| 389 | - if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) { |
|
| 388 | + $value = isset( $_POST[$param] ) ? wp_unslash( $_POST[$param] ) : ( isset( $_GET[$param] ) ? wp_unslash( $_GET[$param] ) : $default ); |
|
| 389 | + if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) { |
|
| 390 | 390 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 391 | - $value = htmlspecialchars_decode( wp_unslash( $_GET[ $param ] ) ); |
|
| 391 | + $value = htmlspecialchars_decode( wp_unslash( $_GET[$param] ) ); |
|
| 392 | 392 | } |
| 393 | 393 | self::sanitize_value( $sanitize, $value ); |
| 394 | 394 | } else { |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | $p = trim( $p, ']' ); |
| 412 | - $value = isset( $value[ $p ] ) ? $value[ $p ] : $default; |
|
| 412 | + $value = isset( $value[$p] ) ? $value[$p] : $default; |
|
| 413 | 413 | } |
| 414 | 414 | } |
| 415 | 415 | |
@@ -465,26 +465,26 @@ discard block |
||
| 465 | 465 | 'sanitize' => 'sanitize_text_field', |
| 466 | 466 | 'serialized' => false, |
| 467 | 467 | ); |
| 468 | - $args = wp_parse_args( $args, $defaults ); |
|
| 468 | + $args = wp_parse_args( $args, $defaults ); |
|
| 469 | 469 | |
| 470 | 470 | $value = $args['default']; |
| 471 | 471 | if ( $args['type'] == 'get' ) { |
| 472 | - if ( $_GET && isset( $_GET[ $args['param'] ] ) ) { |
|
| 472 | + if ( $_GET && isset( $_GET[$args['param']] ) ) { |
|
| 473 | 473 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 474 | - $value = wp_unslash( $_GET[ $args['param'] ] ); |
|
| 474 | + $value = wp_unslash( $_GET[$args['param']] ); |
|
| 475 | 475 | } |
| 476 | 476 | } elseif ( $args['type'] == 'post' ) { |
| 477 | - if ( isset( $_POST[ $args['param'] ] ) ) { |
|
| 477 | + if ( isset( $_POST[$args['param']] ) ) { |
|
| 478 | 478 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 479 | - $value = wp_unslash( $_POST[ $args['param'] ] ); |
|
| 479 | + $value = wp_unslash( $_POST[$args['param']] ); |
|
| 480 | 480 | if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) { |
| 481 | 481 | self::unserialize_or_decode( $value ); |
| 482 | 482 | } |
| 483 | 483 | } |
| 484 | 484 | } else { |
| 485 | - if ( isset( $_REQUEST[ $args['param'] ] ) ) { |
|
| 485 | + if ( isset( $_REQUEST[$args['param']] ) ) { |
|
| 486 | 486 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 487 | - $value = wp_unslash( $_REQUEST[ $args['param'] ] ); |
|
| 487 | + $value = wp_unslash( $_REQUEST[$args['param']] ); |
|
| 488 | 488 | } |
| 489 | 489 | } |
| 490 | 490 | |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | if ( is_array( $value ) ) { |
| 517 | 517 | $temp_values = $value; |
| 518 | 518 | foreach ( $temp_values as $k => $v ) { |
| 519 | - self::sanitize_value( $sanitize, $value[ $k ] ); |
|
| 519 | + self::sanitize_value( $sanitize, $value[$k] ); |
|
| 520 | 520 | } |
| 521 | 521 | } else { |
| 522 | 522 | $value = call_user_func( $sanitize, $value ); |
@@ -527,8 +527,8 @@ discard block |
||
| 527 | 527 | public static function sanitize_request( $sanitize_method, &$values ) { |
| 528 | 528 | $temp_values = $values; |
| 529 | 529 | foreach ( $temp_values as $k => $val ) { |
| 530 | - if ( isset( $sanitize_method[ $k ] ) ) { |
|
| 531 | - $values[ $k ] = call_user_func( $sanitize_method[ $k ], $val ); |
|
| 530 | + if ( isset( $sanitize_method[$k] ) ) { |
|
| 531 | + $values[$k] = call_user_func( $sanitize_method[$k], $val ); |
|
| 532 | 532 | } |
| 533 | 533 | } |
| 534 | 534 | } |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | if ( is_array( $value ) ) { |
| 552 | 552 | $temp_values = $value; |
| 553 | 553 | foreach ( $temp_values as $k => $v ) { |
| 554 | - self::decode_specialchars( $value[ $k ] ); |
|
| 554 | + self::decode_specialchars( $value[$k] ); |
|
| 555 | 555 | } |
| 556 | 556 | } else { |
| 557 | 557 | self::decode_amp( $value ); |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | $allowed_html = $html; |
| 629 | 629 | } elseif ( ! empty( $allowed ) ) { |
| 630 | 630 | foreach ( (array) $allowed as $a ) { |
| 631 | - $allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array(); |
|
| 631 | + $allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array(); |
|
| 632 | 632 | } |
| 633 | 633 | } |
| 634 | 634 | |
@@ -785,8 +785,8 @@ discard block |
||
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | global $wp_query; |
| 788 | - if ( isset( $wp_query->query_vars[ $param ] ) ) { |
|
| 789 | - $value = $wp_query->query_vars[ $param ]; |
|
| 788 | + if ( isset( $wp_query->query_vars[$param] ) ) { |
|
| 789 | + $value = $wp_query->query_vars[$param]; |
|
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | return $value; |
@@ -950,7 +950,7 @@ discard block |
||
| 950 | 950 | 'new_file_path' => self::plugin_path() . '/js', |
| 951 | 951 | ) |
| 952 | 952 | ); |
| 953 | - $new_file = new FrmCreateFile( $file_atts ); |
|
| 953 | + $new_file = new FrmCreateFile( $file_atts ); |
|
| 954 | 954 | |
| 955 | 955 | $files = array( |
| 956 | 956 | self::plugin_path() . '/js/jquery/jquery.placeholder.min.js', |
@@ -1208,8 +1208,8 @@ discard block |
||
| 1208 | 1208 | return $error; |
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | - $nonce_value = ( $_REQUEST && isset( $_REQUEST[ $nonce_name ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $nonce_name ] ) ) : ''; |
|
| 1212 | - if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
| 1211 | + $nonce_value = ( $_REQUEST && isset( $_REQUEST[$nonce_name] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[$nonce_name] ) ) : ''; |
|
| 1212 | + if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
| 1213 | 1213 | $frm_settings = self::get_settings(); |
| 1214 | 1214 | $error = $frm_settings->admin_permission; |
| 1215 | 1215 | } |
@@ -1244,7 +1244,7 @@ discard block |
||
| 1244 | 1244 | } else { |
| 1245 | 1245 | foreach ( $value as $k => $v ) { |
| 1246 | 1246 | if ( ! is_array( $v ) ) { |
| 1247 | - $value[ $k ] = call_user_func( $original_function, $v ); |
|
| 1247 | + $value[$k] = call_user_func( $original_function, $v ); |
|
| 1248 | 1248 | } |
| 1249 | 1249 | } |
| 1250 | 1250 | } |
@@ -1269,7 +1269,7 @@ discard block |
||
| 1269 | 1269 | $return = array_merge( $return, self::array_flatten( $value, $keys ) ); |
| 1270 | 1270 | } else { |
| 1271 | 1271 | if ( $keys == 'keep' ) { |
| 1272 | - $return[ $key ] = $value; |
|
| 1272 | + $return[$key] = $value; |
|
| 1273 | 1273 | } else { |
| 1274 | 1274 | $return[] = $value; |
| 1275 | 1275 | } |
@@ -1333,11 +1333,11 @@ discard block |
||
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | 1335 | $ver = $default; |
| 1336 | - if ( ! isset( $wp_scripts->registered[ $handle ] ) ) { |
|
| 1336 | + if ( ! isset( $wp_scripts->registered[$handle] ) ) { |
|
| 1337 | 1337 | return $ver; |
| 1338 | 1338 | } |
| 1339 | 1339 | |
| 1340 | - $query = $wp_scripts->registered[ $handle ]; |
|
| 1340 | + $query = $wp_scripts->registered[$handle]; |
|
| 1341 | 1341 | if ( is_object( $query ) && ! empty( $query->ver ) ) { |
| 1342 | 1342 | $ver = $query->ver; |
| 1343 | 1343 | } |
@@ -1472,7 +1472,7 @@ discard block |
||
| 1472 | 1472 | |
| 1473 | 1473 | foreach ( array( 'name', 'description' ) as $var ) { |
| 1474 | 1474 | $default_val = isset( $record->{$var} ) ? $record->{$var} : ''; |
| 1475 | - $values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
| 1475 | + $values[$var] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
| 1476 | 1476 | unset( $var, $default_val ); |
| 1477 | 1477 | } |
| 1478 | 1478 | |
@@ -1527,9 +1527,9 @@ discard block |
||
| 1527 | 1527 | } |
| 1528 | 1528 | } |
| 1529 | 1529 | |
| 1530 | - $field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type; |
|
| 1531 | - if ( isset( $post_values['item_meta'][ $field->id ] ) ) { |
|
| 1532 | - $new_value = $post_values['item_meta'][ $field->id ]; |
|
| 1530 | + $field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type; |
|
| 1531 | + if ( isset( $post_values['item_meta'][$field->id] ) ) { |
|
| 1532 | + $new_value = $post_values['item_meta'][$field->id]; |
|
| 1533 | 1533 | self::unserialize_or_decode( $new_value ); |
| 1534 | 1534 | } else { |
| 1535 | 1535 | $new_value = $meta_value; |
@@ -1550,7 +1550,7 @@ discard block |
||
| 1550 | 1550 | |
| 1551 | 1551 | $field_array = array_merge( $field->field_options, $field_array ); |
| 1552 | 1552 | |
| 1553 | - $values['fields'][ $field->id ] = $field_array; |
|
| 1553 | + $values['fields'][$field->id] = $field_array; |
|
| 1554 | 1554 | } |
| 1555 | 1555 | |
| 1556 | 1556 | /** |
@@ -1597,11 +1597,11 @@ discard block |
||
| 1597 | 1597 | } |
| 1598 | 1598 | |
| 1599 | 1599 | foreach ( $form->options as $opt => $value ) { |
| 1600 | - if ( isset( $post_values[ $opt ] ) ) { |
|
| 1601 | - $values[ $opt ] = $post_values[ $opt ]; |
|
| 1602 | - self::unserialize_or_decode( $values[ $opt ] ); |
|
| 1600 | + if ( isset( $post_values[$opt] ) ) { |
|
| 1601 | + $values[$opt] = $post_values[$opt]; |
|
| 1602 | + self::unserialize_or_decode( $values[$opt] ); |
|
| 1603 | 1603 | } else { |
| 1604 | - $values[ $opt ] = $value; |
|
| 1604 | + $values[$opt] = $value; |
|
| 1605 | 1605 | } |
| 1606 | 1606 | } |
| 1607 | 1607 | |
@@ -1615,8 +1615,8 @@ discard block |
||
| 1615 | 1615 | $form_defaults = FrmFormsHelper::get_default_opts(); |
| 1616 | 1616 | |
| 1617 | 1617 | foreach ( $form_defaults as $opt => $default ) { |
| 1618 | - if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) { |
|
| 1619 | - $values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default; |
|
| 1618 | + if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) { |
|
| 1619 | + $values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default; |
|
| 1620 | 1620 | } |
| 1621 | 1621 | |
| 1622 | 1622 | unset( $opt, $default ); |
@@ -1627,8 +1627,8 @@ discard block |
||
| 1627 | 1627 | } |
| 1628 | 1628 | |
| 1629 | 1629 | foreach ( array( 'before', 'after', 'submit' ) as $h ) { |
| 1630 | - if ( ! isset( $values[ $h . '_html' ] ) ) { |
|
| 1631 | - $values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) ); |
|
| 1630 | + if ( ! isset( $values[$h . '_html'] ) ) { |
|
| 1631 | + $values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) ); |
|
| 1632 | 1632 | } |
| 1633 | 1633 | unset( $h ); |
| 1634 | 1634 | } |
@@ -1778,10 +1778,10 @@ discard block |
||
| 1778 | 1778 | $time_strings = self::get_time_strings(); |
| 1779 | 1779 | |
| 1780 | 1780 | foreach ( $time_strings as $k => $v ) { |
| 1781 | - if ( $diff[ $k ] ) { |
|
| 1782 | - $time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] ); |
|
| 1781 | + if ( $diff[$k] ) { |
|
| 1782 | + $time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] ); |
|
| 1783 | 1783 | } else { |
| 1784 | - unset( $time_strings[ $k ] ); |
|
| 1784 | + unset( $time_strings[$k] ); |
|
| 1785 | 1785 | } |
| 1786 | 1786 | } |
| 1787 | 1787 | |
@@ -1862,17 +1862,17 @@ discard block |
||
| 1862 | 1862 | |
| 1863 | 1863 | case 1: |
| 1864 | 1864 | $l2 = $name; |
| 1865 | - self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] ); |
|
| 1865 | + self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] ); |
|
| 1866 | 1866 | break; |
| 1867 | 1867 | |
| 1868 | 1868 | case 2: |
| 1869 | 1869 | $l3 = $name; |
| 1870 | - self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] ); |
|
| 1870 | + self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] ); |
|
| 1871 | 1871 | break; |
| 1872 | 1872 | |
| 1873 | 1873 | case 3: |
| 1874 | 1874 | $l4 = $name; |
| 1875 | - self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] ); |
|
| 1875 | + self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] ); |
|
| 1876 | 1876 | } |
| 1877 | 1877 | |
| 1878 | 1878 | unset( $this_val, $n ); |
@@ -1891,8 +1891,8 @@ discard block |
||
| 1891 | 1891 | public static function add_value_to_array( $name, $l1, $val, &$vars ) { |
| 1892 | 1892 | if ( $name == '' ) { |
| 1893 | 1893 | $vars[] = $val; |
| 1894 | - } elseif ( ! isset( $vars[ $l1 ] ) ) { |
|
| 1895 | - $vars[ $l1 ] = $val; |
|
| 1894 | + } elseif ( ! isset( $vars[$l1] ) ) { |
|
| 1895 | + $vars[$l1] = $val; |
|
| 1896 | 1896 | } |
| 1897 | 1897 | } |
| 1898 | 1898 | |
@@ -1908,7 +1908,7 @@ discard block |
||
| 1908 | 1908 | 'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ), |
| 1909 | 1909 | ); |
| 1910 | 1910 | |
| 1911 | - if ( ! isset( $tooltips[ $name ] ) ) { |
|
| 1911 | + if ( ! isset( $tooltips[$name] ) ) { |
|
| 1912 | 1912 | return; |
| 1913 | 1913 | } |
| 1914 | 1914 | |
@@ -1918,7 +1918,7 @@ discard block |
||
| 1918 | 1918 | echo ' class="frm_help"'; |
| 1919 | 1919 | } |
| 1920 | 1920 | |
| 1921 | - echo ' title="' . esc_attr( $tooltips[ $name ] ); |
|
| 1921 | + echo ' title="' . esc_attr( $tooltips[$name] ); |
|
| 1922 | 1922 | |
| 1923 | 1923 | if ( 'open' != $class ) { |
| 1924 | 1924 | echo '"'; |
@@ -1971,13 +1971,13 @@ discard block |
||
| 1971 | 1971 | } |
| 1972 | 1972 | |
| 1973 | 1973 | private static function prepare_action_slashes( $val, $key, &$post_content ) { |
| 1974 | - if ( ! isset( $post_content[ $key ] ) ) { |
|
| 1974 | + if ( ! isset( $post_content[$key] ) ) { |
|
| 1975 | 1975 | return; |
| 1976 | 1976 | } |
| 1977 | 1977 | |
| 1978 | 1978 | if ( is_array( $val ) ) { |
| 1979 | 1979 | foreach ( $val as $k1 => $v1 ) { |
| 1980 | - self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] ); |
|
| 1980 | + self::prepare_action_slashes( $v1, $k1, $post_content[$key] ); |
|
| 1981 | 1981 | unset( $k1, $v1 ); |
| 1982 | 1982 | } |
| 1983 | 1983 | } else { |
@@ -1985,7 +1985,7 @@ discard block |
||
| 1985 | 1985 | $val = stripslashes( $val ); |
| 1986 | 1986 | |
| 1987 | 1987 | // Add backslashes before double quotes and forward slashes only |
| 1988 | - $post_content[ $key ] = addcslashes( $val, '"\\/' ); |
|
| 1988 | + $post_content[$key] = addcslashes( $val, '"\\/' ); |
|
| 1989 | 1989 | } |
| 1990 | 1990 | } |
| 1991 | 1991 | |
@@ -2044,14 +2044,14 @@ discard block |
||
| 2044 | 2044 | continue; |
| 2045 | 2045 | } |
| 2046 | 2046 | $key = $input['name']; |
| 2047 | - if ( isset( $formatted[ $key ] ) ) { |
|
| 2048 | - if ( is_array( $formatted[ $key ] ) ) { |
|
| 2049 | - $formatted[ $key ][] = $input['value']; |
|
| 2047 | + if ( isset( $formatted[$key] ) ) { |
|
| 2048 | + if ( is_array( $formatted[$key] ) ) { |
|
| 2049 | + $formatted[$key][] = $input['value']; |
|
| 2050 | 2050 | } else { |
| 2051 | - $formatted[ $key ] = array( $formatted[ $key ], $input['value'] ); |
|
| 2051 | + $formatted[$key] = array( $formatted[$key], $input['value'] ); |
|
| 2052 | 2052 | } |
| 2053 | 2053 | } else { |
| 2054 | - $formatted[ $key ] = $input['value']; |
|
| 2054 | + $formatted[$key] = $input['value']; |
|
| 2055 | 2055 | } |
| 2056 | 2056 | } |
| 2057 | 2057 | |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | |
| 330 | 330 | foreach ( (array) $fields as $f ) { |
| 331 | 331 | FrmAppHelper::unserialize_or_decode( $f->field_options ); |
| 332 | - $size = $f->field_options['size']; |
|
| 332 | + $size = $f->field_options['size']; |
|
| 333 | 333 | $this->maybe_convert_migrated_size( $size ); |
| 334 | 334 | |
| 335 | 335 | if ( $size === $f->field_options['size'] ) { |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | continue; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - $this->maybe_convert_migrated_size( $widgets[ $k ]['size'] ); |
|
| 395 | + $this->maybe_convert_migrated_size( $widgets[$k]['size'] ); |
|
| 396 | 396 | } |
| 397 | 397 | update_option( 'widget_frm_show_form', $widgets ); |
| 398 | 398 | } |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | if ( ! is_array( $widget ) || ! isset( $widget['size'] ) ) { |
| 492 | 492 | continue; |
| 493 | 493 | } |
| 494 | - $this->convert_character_to_px( $widgets[ $k ]['size'] ); |
|
| 494 | + $this->convert_character_to_px( $widgets[$k]['size'] ); |
|
| 495 | 495 | } |
| 496 | 496 | update_option( 'widget_frm_show_form', $widgets ); |
| 497 | 497 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | foreach ( $values as $value_key => $value ) { |
| 142 | 142 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
| 143 | - $new_values[ $value_key ] = $value; |
|
| 143 | + $new_values[$value_key] = $value; |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
@@ -210,15 +210,15 @@ discard block |
||
| 210 | 210 | $existing_keys = array_keys( $values['item_meta'] ); |
| 211 | 211 | foreach ( $all_fields as $fid ) { |
| 212 | 212 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
| 213 | - $values['item_meta'][ $fid->id ] = ''; |
|
| 213 | + $values['item_meta'][$fid->id] = ''; |
|
| 214 | 214 | } |
| 215 | - $field_array[ $fid->id ] = $fid; |
|
| 215 | + $field_array[$fid->id] = $fid; |
|
| 216 | 216 | } |
| 217 | 217 | unset( $all_fields ); |
| 218 | 218 | |
| 219 | 219 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
| 220 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
| 221 | - $field = $field_array[ $field_id ]; |
|
| 220 | + if ( isset( $field_array[$field_id] ) ) { |
|
| 221 | + $field = $field_array[$field_id]; |
|
| 222 | 222 | } else { |
| 223 | 223 | $field = FrmField::getOne( $field_id ); |
| 224 | 224 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | continue; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
| 230 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
| 231 | 231 | if ( $is_settings_page ) { |
| 232 | 232 | self::get_settings_page_html( $values, $field ); |
| 233 | 233 | |
@@ -242,15 +242,15 @@ discard block |
||
| 242 | 242 | $update_options = apply_filters( 'frm_field_options_to_update', $update_options ); |
| 243 | 243 | |
| 244 | 244 | foreach ( $update_options as $opt => $default ) { |
| 245 | - $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default; |
|
| 246 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 245 | + $field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default; |
|
| 246 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
| 250 | 250 | |
| 251 | 251 | $new_field = array( |
| 252 | 252 | 'field_options' => $field->field_options, |
| 253 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
| 253 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
| 254 | 254 | ); |
| 255 | 255 | |
| 256 | 256 | self::prepare_field_update_values( $field, $values, $new_field ); |
@@ -279,11 +279,11 @@ discard block |
||
| 279 | 279 | * Updating the settings page |
| 280 | 280 | */ |
| 281 | 281 | private static function get_settings_page_html( $values, &$field ) { |
| 282 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 282 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 283 | 283 | $prev_opts = array(); |
| 284 | 284 | $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); |
| 285 | 285 | |
| 286 | - $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; |
|
| 286 | + $field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html; |
|
| 287 | 287 | } elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) { |
| 288 | 288 | $prev_opts = $field->field_options; |
| 289 | 289 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | foreach ( $field_cols as $col => $default ) { |
| 310 | 310 | $default = ( $default === '' ) ? $field->{$col} : $default; |
| 311 | 311 | |
| 312 | - $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; |
|
| 312 | + $new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | // Don't save the template option. |
@@ -723,8 +723,8 @@ discard block |
||
| 723 | 723 | self::maybe_get_form( $form ); |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 727 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 726 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 727 | + return $frm_vars['form_params'][$form->id]; |
|
| 728 | 728 | } |
| 729 | 729 | |
| 730 | 730 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // WPCS: CSRF ok. |
@@ -753,15 +753,15 @@ discard block |
||
| 753 | 753 | //if there are two forms on the same page, make sure not to submit both |
| 754 | 754 | foreach ( $default_values as $var => $default ) { |
| 755 | 755 | if ( $var == 'action' ) { |
| 756 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 756 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 757 | 757 | } else { |
| 758 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 758 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 759 | 759 | } |
| 760 | 760 | unset( $var, $default ); |
| 761 | 761 | } |
| 762 | 762 | } else { |
| 763 | 763 | foreach ( $default_values as $var => $default ) { |
| 764 | - $values[ $var ] = $default; |
|
| 764 | + $values[$var] = $default; |
|
| 765 | 765 | unset( $var, $default ); |
| 766 | 766 | } |
| 767 | 767 | } |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | 'sdir' => '', |
| 788 | 788 | ); |
| 789 | 789 | foreach ( $defaults as $var => $default ) { |
| 790 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 790 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 791 | 791 | } |
| 792 | 792 | |
| 793 | 793 | return $values; |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | 'keep_post' => '', |
| 816 | 816 | ); |
| 817 | 817 | foreach ( $defaults as $var => $default ) { |
| 818 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 818 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 819 | 819 | } |
| 820 | 820 | |
| 821 | 821 | return $values; |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | public static function get_option( $atts ) { |
| 901 | 901 | $form = $atts['form']; |
| 902 | 902 | |
| 903 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $atts['default']; |
|
| 903 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $atts['default']; |
|
| 904 | 904 | } |
| 905 | 905 | |
| 906 | 906 | /** |