@@ -87,7 +87,8 @@ |
||
87 | 87 | |
88 | 88 | if ( ! isset( $imported['form_status'] ) || empty( $imported['form_status'] ) ) { |
89 | 89 | // Check for an error message in the XML. |
90 | - if ( isset( $xml->Code ) && isset( $xml->Message ) ) { // phpcs:ignore WordPress.NamingConventions |
|
90 | + if ( isset( $xml->Code ) && isset( $xml->Message ) ) { |
|
91 | +// phpcs:ignore WordPress.NamingConventions |
|
91 | 92 | $imported['error'] = (string) $xml->Message; // phpcs:ignore WordPress.NamingConventions |
92 | 93 | } |
93 | 94 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | if ( $term && is_array( $term ) ) { |
140 | 140 | $imported['imported']['terms'] ++; |
141 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
141 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | unset( $term, $t ); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | // Keep track of whether this specific form was updated or not. |
197 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
197 | + $imported['form_status'][$form_id] = 'imported'; |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | // Update field ids/keys to new ones. |
210 | 210 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
211 | 211 | |
212 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
212 | + $imported['forms'][(int) $item->id] = $form_id; |
|
213 | 213 | |
214 | 214 | // Send pre 2.0 form options through function that creates actions. |
215 | 215 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
@@ -277,15 +277,15 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | // Keep track of whether this specific form was updated or not |
280 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
280 | + $imported['form_status'][$form_id] = 'updated'; |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | private static function get_form_fields( $form_id ) { |
284 | 284 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' ); |
285 | 285 | $old_fields = array(); |
286 | 286 | foreach ( $form_fields as $f ) { |
287 | - $old_fields[ $f->id ] = $f; |
|
288 | - $old_fields[ $f->field_key ] = $f->id; |
|
287 | + $old_fields[$f->id] = $f; |
|
288 | + $old_fields[$f->field_key] = $f->id; |
|
289 | 289 | unset( $f ); |
290 | 290 | } |
291 | 291 | $form_fields = $old_fields; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | */ |
343 | 343 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
344 | 344 | if ( $parent_form_id ) { |
345 | - $child_forms[ $form_id ] = $parent_form_id; |
|
345 | + $child_forms[$form_id] = $parent_form_id; |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | */ |
358 | 358 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
359 | 359 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
360 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && (int) $imported_forms[ $old_parent_form_id ] !== (int) $old_parent_form_id ) { |
|
360 | + if ( isset( $imported_forms[$old_parent_form_id] ) && (int) $imported_forms[$old_parent_form_id] !== (int) $old_parent_form_id ) { |
|
361 | 361 | // Update all children with this old parent_form_id |
362 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
362 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
363 | 363 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
364 | 364 | do_action( 'frm_update_child_form_parent_id', $child_form_id, $new_parent_form_id ); |
365 | 365 | } |
@@ -389,27 +389,27 @@ discard block |
||
389 | 389 | |
390 | 390 | if ( ! empty( $this_form ) ) { |
391 | 391 | // check for field to edit by field id |
392 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
392 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
393 | 393 | FrmField::update( $f['id'], $f ); |
394 | 394 | $imported['updated']['fields'] ++; |
395 | 395 | |
396 | - unset( $form_fields[ $f['id'] ] ); |
|
396 | + unset( $form_fields[$f['id']] ); |
|
397 | 397 | |
398 | 398 | //unset old field key |
399 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
400 | - unset( $form_fields[ $f['field_key'] ] ); |
|
399 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
400 | + unset( $form_fields[$f['field_key']] ); |
|
401 | 401 | } |
402 | - } elseif ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
403 | - $keys_by_original_field_id[ $f['id'] ] = $f['field_key']; |
|
402 | + } elseif ( isset( $form_fields[$f['field_key']] ) ) { |
|
403 | + $keys_by_original_field_id[$f['id']] = $f['field_key']; |
|
404 | 404 | |
405 | 405 | // check for field to edit by field key |
406 | 406 | unset( $f['id'] ); |
407 | 407 | |
408 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
408 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
409 | 409 | $imported['updated']['fields'] ++; |
410 | 410 | |
411 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); //unset old field id |
|
412 | - unset( $form_fields[ $f['field_key'] ] ); //unset old field key |
|
411 | + unset( $form_fields[$form_fields[$f['field_key']]] ); //unset old field id |
|
412 | + unset( $form_fields[$f['field_key']] ); //unset old field key |
|
413 | 413 | } else { |
414 | 414 | // if no matching field id or key in this form, create the field |
415 | 415 | self::create_imported_field( $f, $imported ); |
@@ -518,8 +518,8 @@ discard block |
||
518 | 518 | if ( $f['type'] == 'form' || ( $f['type'] == 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) { |
519 | 519 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
520 | 520 | $form_select = (int) $f['field_options']['form_select']; |
521 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
522 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
521 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
522 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
523 | 523 | } |
524 | 524 | } |
525 | 525 | } |
@@ -540,8 +540,8 @@ discard block |
||
540 | 540 | |
541 | 541 | if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) { |
542 | 542 | $old_form = $f['field_options']['get_values_form']; |
543 | - if ( isset( $imported['forms'][ $old_form ] ) ) { |
|
544 | - $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ]; |
|
543 | + if ( isset( $imported['forms'][$old_form] ) ) { |
|
544 | + $f['field_options']['get_values_form'] = $imported['forms'][$old_form]; |
|
545 | 545 | } |
546 | 546 | } |
547 | 547 | } |
@@ -562,12 +562,12 @@ discard block |
||
562 | 562 | private static function migrate_placeholders( &$f ) { |
563 | 563 | $update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' ); |
564 | 564 | foreach ( $update_values as $k => $v ) { |
565 | - $f[ $k ] = $v; |
|
565 | + $f[$k] = $v; |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | $update_values = self::migrate_field_placeholder( $f, 'default_blank' ); |
569 | 569 | foreach ( $update_values as $k => $v ) { |
570 | - $f[ $k ] = $v; |
|
570 | + $f[$k] = $v; |
|
571 | 571 | } |
572 | 572 | } |
573 | 573 | |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | public static function migrate_field_placeholder( $field, $type ) { |
582 | 582 | $field = (array) $field; |
583 | 583 | $field_options = $field['field_options']; |
584 | - if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) { |
|
584 | + if ( empty( $field_options[$type] ) || empty( $field['default_value'] ) ) { |
|
585 | 585 | return array(); |
586 | 586 | } |
587 | 587 | |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | } |
608 | 608 | |
609 | 609 | if ( $opt == $default_value ) { |
610 | - unset( $options[ $opt_key ] ); |
|
610 | + unset( $options[$opt_key] ); |
|
611 | 611 | break; |
612 | 612 | } |
613 | 613 | } |
@@ -809,27 +809,27 @@ discard block |
||
809 | 809 | } |
810 | 810 | |
811 | 811 | if ( false !== strpos( $post['post_content'], '[frm-display-data' ) || false !== strpos( $post['post_content'], '[formidable' ) ) { |
812 | - $posts_with_shortcodes[ $post_id ] = $post; |
|
812 | + $posts_with_shortcodes[$post_id] = $post; |
|
813 | 813 | } |
814 | 814 | |
815 | 815 | self::update_postmeta( $post, $post_id ); |
816 | 816 | self::update_layout( $post, $post_id ); |
817 | 817 | |
818 | 818 | $this_type = 'posts'; |
819 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
820 | - $this_type = $post_types[ $post['post_type'] ]; |
|
819 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
820 | + $this_type = $post_types[$post['post_type']]; |
|
821 | 821 | } |
822 | 822 | |
823 | 823 | if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) { |
824 | - $imported['updated'][ $this_type ] ++; |
|
824 | + $imported['updated'][$this_type] ++; |
|
825 | 825 | } else { |
826 | - $imported['imported'][ $this_type ] ++; |
|
826 | + $imported['imported'][$this_type] ++; |
|
827 | 827 | } |
828 | 828 | |
829 | - $imported['posts'][ (int) $old_id ] = $post_id; |
|
829 | + $imported['posts'][(int) $old_id] = $post_id; |
|
830 | 830 | |
831 | 831 | if ( $post['post_type'] === 'frm_display' ) { |
832 | - $view_ids[ (int) $old_id ] = $post_id; |
|
832 | + $view_ids[(int) $old_id] = $post_id; |
|
833 | 833 | } |
834 | 834 | |
835 | 835 | do_action( 'frm_after_import_view', $post_id, $post ); |
@@ -954,9 +954,9 @@ discard block |
||
954 | 954 | $post['attachment_url'] = (string) $item->attachment_url; |
955 | 955 | } |
956 | 956 | |
957 | - if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
957 | + if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
958 | 958 | // update to new form id |
959 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
959 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
960 | 960 | } |
961 | 961 | |
962 | 962 | // Don't allow default styles to take over a site's default style |
@@ -993,8 +993,8 @@ discard block |
||
993 | 993 | ); |
994 | 994 | |
995 | 995 | //switch old form and field ids to new ones |
996 | - if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
|
997 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
996 | + if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
997 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
998 | 998 | } else { |
999 | 999 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
1000 | 1000 | |
@@ -1005,15 +1005,15 @@ discard block |
||
1005 | 1005 | } elseif ( 'frm_options' === $m['key'] ) { |
1006 | 1006 | |
1007 | 1007 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
1008 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
1009 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
1008 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
1009 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
1010 | 1010 | } |
1011 | 1011 | } |
1012 | 1012 | |
1013 | 1013 | $check_dup_array = array(); |
1014 | 1014 | if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) { |
1015 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
1016 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
1015 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
1016 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
1017 | 1017 | } elseif ( is_array( $m['value']['order_by'] ) ) { |
1018 | 1018 | $check_dup_array[] = 'order_by'; |
1019 | 1019 | } |
@@ -1024,9 +1024,9 @@ discard block |
||
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | foreach ( $check_dup_array as $check_k ) { |
1027 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
1028 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
1029 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
1027 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
1028 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
1029 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
1030 | 1030 | } |
1031 | 1031 | unset( $mk, $mv ); |
1032 | 1032 | } |
@@ -1039,11 +1039,11 @@ discard block |
||
1039 | 1039 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
1040 | 1040 | } |
1041 | 1041 | |
1042 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
1042 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | 1045 | private static function populate_layout( &$post, $layout ) { |
1046 | - $post['layout'][ (string) $layout->type ] = (string) $layout->data; |
|
1046 | + $post['layout'][(string) $layout->type] = (string) $layout->data; |
|
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | /** |
@@ -1071,11 +1071,11 @@ discard block |
||
1071 | 1071 | $name = (string) $c; |
1072 | 1072 | } |
1073 | 1073 | |
1074 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
1075 | - $post['tax_input'][ $taxonomy ] = array(); |
|
1074 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
1075 | + $post['tax_input'][$taxonomy] = array(); |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
1078 | + $post['tax_input'][$taxonomy][] = $name; |
|
1079 | 1079 | unset( $name ); |
1080 | 1080 | } |
1081 | 1081 | } |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | |
1193 | 1193 | $message = '<ul>'; |
1194 | 1194 | foreach ( $result as $type => $results ) { |
1195 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
1195 | + if ( ! isset( $t_strings[$type] ) ) { |
|
1196 | 1196 | // only print imported and updated |
1197 | 1197 | continue; |
1198 | 1198 | } |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | } |
1205 | 1205 | |
1206 | 1206 | if ( ! empty( $s_message ) ) { |
1207 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
1207 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
1208 | 1208 | $message .= implode( ', ', $s_message ); |
1209 | 1209 | $message .= '</li>'; |
1210 | 1210 | } |
@@ -1256,8 +1256,8 @@ discard block |
||
1256 | 1256 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
1257 | 1257 | ); |
1258 | 1258 | |
1259 | - if ( isset( $strings[ $type ] ) ) { |
|
1260 | - $s_message[] = $strings[ $type ]; |
|
1259 | + if ( isset( $strings[$type] ) ) { |
|
1260 | + $s_message[] = $strings[$type]; |
|
1261 | 1261 | } else { |
1262 | 1262 | $string = ' ' . $m . ' ' . ucfirst( $type ); |
1263 | 1263 | |
@@ -1400,8 +1400,8 @@ discard block |
||
1400 | 1400 | */ |
1401 | 1401 | private static function remove_defaults( $defaults, &$saved ) { |
1402 | 1402 | foreach ( $saved as $key => $value ) { |
1403 | - if ( isset( $defaults[ $key ] ) && $defaults[ $key ] === $value ) { |
|
1404 | - unset( $saved[ $key ] ); |
|
1403 | + if ( isset( $defaults[$key] ) && $defaults[$key] === $value ) { |
|
1404 | + unset( $saved[$key] ); |
|
1405 | 1405 | } |
1406 | 1406 | } |
1407 | 1407 | } |
@@ -1412,14 +1412,14 @@ discard block |
||
1412 | 1412 | * @since 3.06 |
1413 | 1413 | */ |
1414 | 1414 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
1415 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
1415 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
1416 | 1416 | return; |
1417 | 1417 | } |
1418 | 1418 | |
1419 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
1420 | - $default_html = $defaults[ $html_name ]; |
|
1419 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
1420 | + $default_html = $defaults[$html_name]; |
|
1421 | 1421 | if ( $old_html == $default_html ) { |
1422 | - unset( $options[ $html_name ] ); |
|
1422 | + unset( $options[$html_name] ); |
|
1423 | 1423 | |
1424 | 1424 | return; |
1425 | 1425 | } |
@@ -1427,7 +1427,7 @@ discard block |
||
1427 | 1427 | // Account for some of the older field default HTML. |
1428 | 1428 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
1429 | 1429 | if ( $old_html == $default_html ) { |
1430 | - unset( $options[ $html_name ] ); |
|
1430 | + unset( $options[$html_name] ); |
|
1431 | 1431 | } |
1432 | 1432 | } |
1433 | 1433 | |
@@ -1514,8 +1514,8 @@ discard block |
||
1514 | 1514 | ); |
1515 | 1515 | |
1516 | 1516 | foreach ( $post_settings as $post_setting ) { |
1517 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
1518 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
1517 | + if ( isset( $form_options[$post_setting] ) ) { |
|
1518 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
1519 | 1519 | } |
1520 | 1520 | unset( $post_setting ); |
1521 | 1521 | } |
@@ -1586,11 +1586,11 @@ discard block |
||
1586 | 1586 | foreach ( $post_content as $key => $setting ) { |
1587 | 1587 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
1588 | 1588 | // Replace old IDs with new IDs |
1589 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
1589 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
1590 | 1590 | } elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
1591 | 1591 | foreach ( $setting as $k => $val ) { |
1592 | 1592 | // Replace old IDs with new IDs |
1593 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
1593 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
1594 | 1594 | } |
1595 | 1595 | } |
1596 | 1596 | unset( $key, $setting ); |
@@ -1666,8 +1666,8 @@ discard block |
||
1666 | 1666 | private static function remove_deprecated_notification_settings( $form_id, $form_options ) { |
1667 | 1667 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
1668 | 1668 | foreach ( $delete_settings as $index ) { |
1669 | - if ( isset( $form_options[ $index ] ) ) { |
|
1670 | - unset( $form_options[ $index ] ); |
|
1669 | + if ( isset( $form_options[$index] ) ) { |
|
1670 | + unset( $form_options[$index] ); |
|
1671 | 1671 | } |
1672 | 1672 | } |
1673 | 1673 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -1720,12 +1720,12 @@ discard block |
||
1720 | 1720 | 'reply_to_name' => '', |
1721 | 1721 | ); |
1722 | 1722 | foreach ( $reply_fields as $f => $val ) { |
1723 | - if ( isset( $notification[ $f ] ) ) { |
|
1724 | - $atts[ $f ] = $notification[ $f ]; |
|
1725 | - if ( 'custom' == $notification[ $f ] ) { |
|
1726 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
1727 | - } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
1728 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
1723 | + if ( isset( $notification[$f] ) ) { |
|
1724 | + $atts[$f] = $notification[$f]; |
|
1725 | + if ( 'custom' == $notification[$f] ) { |
|
1726 | + $atts[$f] = $notification['cust_' . $f]; |
|
1727 | + } elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
1728 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
1729 | 1729 | } |
1730 | 1730 | } |
1731 | 1731 | unset( $f, $val ); |
@@ -1756,13 +1756,13 @@ discard block |
||
1756 | 1756 | foreach ( $atts['email_to'] as $key => $email_field ) { |
1757 | 1757 | |
1758 | 1758 | if ( is_numeric( $email_field ) ) { |
1759 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
1759 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
1760 | 1760 | } |
1761 | 1761 | |
1762 | 1762 | if ( strpos( $email_field, '|' ) ) { |
1763 | 1763 | $email_opt = explode( '|', $email_field ); |
1764 | 1764 | if ( isset( $email_opt[0] ) ) { |
1765 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
1765 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
1766 | 1766 | } |
1767 | 1767 | unset( $email_opt ); |
1768 | 1768 | } |
@@ -1783,12 +1783,12 @@ discard block |
||
1783 | 1783 | // Add more fields to the new notification |
1784 | 1784 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
1785 | 1785 | foreach ( $add_fields as $add_field ) { |
1786 | - if ( isset( $notification[ $add_field ] ) ) { |
|
1787 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
1786 | + if ( isset( $notification[$add_field] ) ) { |
|
1787 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
1788 | 1788 | } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
1789 | - $new_notification['post_content'][ $add_field ] = 0; |
|
1789 | + $new_notification['post_content'][$add_field] = 0; |
|
1790 | 1790 | } else { |
1791 | - $new_notification['post_content'][ $add_field ] = ''; |
|
1791 | + $new_notification['post_content'][$add_field] = ''; |
|
1792 | 1792 | } |
1793 | 1793 | unset( $add_field ); |
1794 | 1794 | } |
@@ -1812,7 +1812,7 @@ discard block |
||
1812 | 1812 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
1813 | 1813 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
1814 | 1814 | if ( is_numeric( $email_key ) ) { |
1815 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
1815 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
1816 | 1816 | } |
1817 | 1817 | unset( $email_key, $val ); |
1818 | 1818 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @param array $keys |
40 | 40 | */ |
41 | - self::$keys = apply_filters( |
|
41 | + self::$keys = apply_filters( |
|
42 | 42 | 'frm_application_data_keys', |
43 | 43 | array( 'key', 'name', 'description', 'link', 'categories', 'views', 'forms' ) |
44 | 44 | ); |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | public function as_js_object() { |
101 | 101 | $application = array(); |
102 | 102 | foreach ( self::$keys as $key ) { |
103 | - $value = $this->api_data[ $key ]; |
|
103 | + $value = $this->api_data[$key]; |
|
104 | 104 | |
105 | 105 | if ( 'icon' === $key ) { |
106 | 106 | // Icon is an array. The first array item is the image URL. |
107 | - $application[ $key ] = reset( $value ); |
|
107 | + $application[$key] = reset( $value ); |
|
108 | 108 | } elseif ( 'categories' === $key ) { |
109 | - $application[ $key ] = array_values( |
|
109 | + $application[$key] = array_values( |
|
110 | 110 | array_filter( |
111 | 111 | $value, |
112 | 112 | function( $category ) { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | // Strip off the " Template" text at the end of the name as it takes up space. |
126 | 126 | $value = substr( $value, 0, -9 ); |
127 | 127 | } |
128 | - $application[ $key ] = $value; |
|
128 | + $application[$key] = $value; |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | |
19 | 19 | foreach ( $type as $tb_type ) { |
20 | 20 | |
21 | - if ( ! isset( $tables[ $tb_type ] ) ) { |
|
21 | + if ( ! isset( $tables[$tb_type] ) ) { |
|
22 | 22 | do_action( 'frm_xml_import_' . $tb_type, $args ); |
23 | 23 | continue; |
24 | 24 | } |
25 | 25 | |
26 | - if ( ! isset( $records[ $tb_type ] ) ) { |
|
26 | + if ( ! isset( $records[$tb_type] ) ) { |
|
27 | 27 | // No records. |
28 | 28 | continue; |
29 | 29 | } |
30 | 30 | |
31 | - $item_ids = $records[ $tb_type ]; |
|
31 | + $item_ids = $records[$tb_type]; |
|
32 | 32 | |
33 | 33 | if ( in_array( $tb_type, array( 'styles', 'actions' ), true ) ) { |
34 | 34 | include dirname( __FILE__ ) . '/posts_xml.php'; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | include FrmProAppHelper::plugin_path() . '/classes/views/xml/' . $tb_type . '_xml.php'; |
39 | 39 | } |
40 | 40 | |
41 | - unset( $item_ids, $records[ $tb_type ], $tb_type ); |
|
41 | + unset( $item_ids, $records[$tb_type], $tb_type ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |