@@ -982,6 +982,7 @@ discard block |
||
| 982 | 982 | * The line endings may prevent html from being equal when it should |
| 983 | 983 | * |
| 984 | 984 | * @since 3.06 |
| 985 | + * @param string $html_name |
|
| 985 | 986 | */ |
| 986 | 987 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
| 987 | 988 | if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
@@ -1053,6 +1054,7 @@ discard block |
||
| 1053 | 1054 | * Migrate post settings to form action |
| 1054 | 1055 | * |
| 1055 | 1056 | * @param string $post_type |
| 1057 | + * @param boolean $switch |
|
| 1056 | 1058 | */ |
| 1057 | 1059 | private static function migrate_post_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) { |
| 1058 | 1060 | if ( ! isset( $form_options['create_post'] ) || ! $form_options['create_post'] ) { |
@@ -1112,8 +1114,8 @@ discard block |
||
| 1112 | 1114 | * |
| 1113 | 1115 | * @since 2.0 |
| 1114 | 1116 | * @param array $post_content - check for old field IDs |
| 1115 | - * @param array $basic_fields - fields with string or int saved |
|
| 1116 | - * @param array $array_fields - fields with arrays saved |
|
| 1117 | + * @param string[] $basic_fields - fields with string or int saved |
|
| 1118 | + * @param string[] $array_fields - fields with arrays saved |
|
| 1117 | 1119 | * |
| 1118 | 1120 | * @return string $post_content - new field IDs |
| 1119 | 1121 | */ |
@@ -1147,6 +1149,10 @@ discard block |
||
| 1147 | 1149 | return $post_content; |
| 1148 | 1150 | } |
| 1149 | 1151 | |
| 1152 | + /** |
|
| 1153 | + * @param string $post_type |
|
| 1154 | + * @param boolean $switch |
|
| 1155 | + */ |
|
| 1150 | 1156 | private static function migrate_email_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) { |
| 1151 | 1157 | // No old notifications or autoresponders to carry over |
| 1152 | 1158 | if ( ! isset( $form_options['auto_responder'] ) && ! isset( $form_options['notification'] ) && ! isset( $form_options['email_to'] ) ) { |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | public static function import_xml( $file ) { |
| 26 | 26 | if ( ! defined( 'WP_IMPORTING' ) ) { |
| 27 | 27 | define( 'WP_IMPORTING', true ); |
| 28 | - } |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | if ( ! class_exists( 'DOMDocument' ) ) { |
| 31 | - return new WP_Error( 'SimpleXML_parse_error', __( 'Your server does not have XML enabled', 'formidable' ), libxml_get_errors() ); |
|
| 32 | - } |
|
| 31 | + return new WP_Error( 'SimpleXML_parse_error', __( 'Your server does not have XML enabled', 'formidable' ), libxml_get_errors() ); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | 34 | $dom = new DOMDocument(); |
| 35 | 35 | $success = $dom->loadXML( file_get_contents( $file ) ); |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | $imported = self::pre_import_data(); |
| 63 | 63 | |
| 64 | 64 | foreach ( array( 'term', 'form', 'view' ) as $item_type ) { |
| 65 | - // grab cats, tags, and terms, or forms or posts |
|
| 65 | + // grab cats, tags, and terms, or forms or posts |
|
| 66 | 66 | if ( isset( $xml->{$item_type} ) ) { |
| 67 | 67 | $function_name = 'import_xml_' . $item_type . 's'; |
| 68 | 68 | $imported = self::$function_name( $xml->{$item_type}, $imported ); |
| 69 | 69 | unset( $function_name, $xml->{$item_type} ); |
| 70 | - } |
|
| 71 | - } |
|
| 70 | + } |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | 73 | return apply_filters( 'frm_importing_xml', $imported, $xml ); |
| 74 | 74 | } |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | public static function import_xml_terms( $terms, $imported ) { |
| 100 | - foreach ( $terms as $t ) { |
|
| 100 | + foreach ( $terms as $t ) { |
|
| 101 | 101 | if ( term_exists( (string) $t->term_slug, (string) $t->term_taxonomy ) ) { |
| 102 | - continue; |
|
| 102 | + continue; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | $parent = self::get_term_parent_id( $t ); |
@@ -115,15 +115,15 @@ discard block |
||
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | 117 | if ( $term && is_array( $term ) ) { |
| 118 | - $imported['imported']['terms']++; |
|
| 118 | + $imported['imported']['terms']++; |
|
| 119 | 119 | $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
| 120 | - } |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | 122 | unset( $term, $t ); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return $imported; |
| 126 | - } |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | 128 | /** |
| 129 | 129 | * @since 2.0.8 |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | self::put_child_forms_first( $forms ); |
| 149 | 149 | |
| 150 | 150 | foreach ( $forms as $item ) { |
| 151 | - $form = self::fill_form( $item ); |
|
| 151 | + $form = self::fill_form( $item ); |
|
| 152 | 152 | |
| 153 | 153 | self::update_custom_style_setting_on_import( $form ); |
| 154 | 154 | |
| 155 | - $this_form = self::maybe_get_form( $form ); |
|
| 155 | + $this_form = self::maybe_get_form( $form ); |
|
| 156 | 156 | |
| 157 | 157 | $old_id = false; |
| 158 | 158 | $form_fields = false; |
@@ -164,25 +164,25 @@ discard block |
||
| 164 | 164 | $form_fields = self::get_form_fields( $form_id ); |
| 165 | 165 | } else { |
| 166 | 166 | $form_id = FrmForm::create( $form ); |
| 167 | - if ( $form_id ) { |
|
| 168 | - $imported['imported']['forms']++; |
|
| 169 | - // Keep track of whether this specific form was updated or not |
|
| 167 | + if ( $form_id ) { |
|
| 168 | + $imported['imported']['forms']++; |
|
| 169 | + // Keep track of whether this specific form was updated or not |
|
| 170 | 170 | $imported['form_status'][ $form_id ] = 'imported'; |
| 171 | 171 | self::track_imported_child_forms( (int) $form_id, $form['parent_form_id'], $child_forms ); |
| 172 | - } |
|
| 172 | + } |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | self::import_xml_fields( $item->field, $form_id, $this_form, $form_fields, $imported ); |
| 176 | 176 | |
| 177 | 177 | self::delete_removed_fields( $form_fields ); |
| 178 | 178 | |
| 179 | - // Update field ids/keys to new ones |
|
| 179 | + // Update field ids/keys to new ones |
|
| 180 | 180 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
| 181 | 181 | |
| 182 | 182 | $imported['forms'][ (int) $item->id ] = $form_id; |
| 183 | 183 | |
| 184 | - // Send pre 2.0 form options through function that creates actions |
|
| 185 | - self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
|
| 184 | + // Send pre 2.0 form options through function that creates actions |
|
| 185 | + self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
|
| 186 | 186 | |
| 187 | 187 | do_action( 'frm_after_import_form', $form_id, $form ); |
| 188 | 188 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | self::maybe_update_child_form_parent_id( $imported['forms'], $child_forms ); |
| 193 | 193 | |
| 194 | 194 | return $imported; |
| 195 | - } |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | 197 | private static function fill_form( $item ) { |
| 198 | 198 | $form = array( |
@@ -263,11 +263,11 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | - * Put child forms first so they will be imported before parents |
|
| 267 | - * |
|
| 268 | - * @since 2.0.16 |
|
| 269 | - * @param array $forms |
|
| 270 | - */ |
|
| 266 | + * Put child forms first so they will be imported before parents |
|
| 267 | + * |
|
| 268 | + * @since 2.0.16 |
|
| 269 | + * @param array $forms |
|
| 270 | + */ |
|
| 271 | 271 | private static function put_child_forms_first( &$forms ) { |
| 272 | 272 | $child_forms = array(); |
| 273 | 273 | $regular_forms = array(); |
@@ -286,13 +286,13 @@ discard block |
||
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | /** |
| 289 | - * Keep track of all imported child forms |
|
| 290 | - * |
|
| 291 | - * @since 2.0.16 |
|
| 292 | - * @param int $form_id |
|
| 293 | - * @param int $parent_form_id |
|
| 294 | - * @param array $child_forms |
|
| 295 | - */ |
|
| 289 | + * Keep track of all imported child forms |
|
| 290 | + * |
|
| 291 | + * @since 2.0.16 |
|
| 292 | + * @param int $form_id |
|
| 293 | + * @param int $parent_form_id |
|
| 294 | + * @param array $child_forms |
|
| 295 | + */ |
|
| 296 | 296 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
| 297 | 297 | if ( $parent_form_id ) { |
| 298 | 298 | $child_forms[ $form_id ] = $parent_form_id; |
@@ -300,13 +300,13 @@ discard block |
||
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
| 303 | - * Update the parent_form_id on imported child forms |
|
| 304 | - * Child forms are imported first so their parent_form_id will need to be updated after the parent is imported |
|
| 305 | - * |
|
| 306 | - * @since 2.0.6 |
|
| 307 | - * @param array $imported_forms |
|
| 308 | - * @param array $child_forms |
|
| 309 | - */ |
|
| 303 | + * Update the parent_form_id on imported child forms |
|
| 304 | + * Child forms are imported first so their parent_form_id will need to be updated after the parent is imported |
|
| 305 | + * |
|
| 306 | + * @since 2.0.6 |
|
| 307 | + * @param array $imported_forms |
|
| 308 | + * @param array $child_forms |
|
| 309 | + */ |
|
| 310 | 310 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
| 311 | 311 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
| 312 | 312 | |
@@ -320,12 +320,12 @@ discard block |
||
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | /** |
| 323 | - * Import all fields for a form |
|
| 323 | + * Import all fields for a form |
|
| 324 | 324 | * |
| 325 | - * @since 2.0.13 |
|
| 326 | - * |
|
| 327 | - * TODO: Cut down on params |
|
| 328 | - */ |
|
| 325 | + * @since 2.0.13 |
|
| 326 | + * |
|
| 327 | + * TODO: Cut down on params |
|
| 328 | + */ |
|
| 329 | 329 | private static function import_xml_fields( $xml_fields, $form_id, $this_form, &$form_fields, &$imported ) { |
| 330 | 330 | $in_section = 0; |
| 331 | 331 | |
@@ -418,12 +418,12 @@ discard block |
||
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | /** |
| 421 | - * Switch the form_select on a repeating field or embedded form if it needs to be switched |
|
| 422 | - * |
|
| 423 | - * @since 2.0.16 |
|
| 424 | - * @param array $f |
|
| 425 | - * @param array $imported |
|
| 426 | - */ |
|
| 421 | + * Switch the form_select on a repeating field or embedded form if it needs to be switched |
|
| 422 | + * |
|
| 423 | + * @since 2.0.16 |
|
| 424 | + * @param array $f |
|
| 425 | + * @param array $imported |
|
| 426 | + */ |
|
| 427 | 427 | private static function maybe_update_form_select( &$f, $imported ) { |
| 428 | 428 | if ( ! isset( $imported['forms'] ) ) { |
| 429 | 429 | return; |
@@ -475,12 +475,12 @@ discard block |
||
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | /** |
| 478 | - * Updates the custom style setting on import |
|
| 479 | - * Convert the post slug to an ID |
|
| 480 | - * |
|
| 481 | - * @since 2.0.19 |
|
| 482 | - * @param array $form |
|
| 483 | - */ |
|
| 478 | + * Updates the custom style setting on import |
|
| 479 | + * Convert the post slug to an ID |
|
| 480 | + * |
|
| 481 | + * @since 2.0.19 |
|
| 482 | + * @param array $form |
|
| 483 | + */ |
|
| 484 | 484 | private static function update_custom_style_setting_on_import( &$form ) { |
| 485 | 485 | if ( ! isset( $form['options']['custom_style'] ) ) { |
| 486 | 486 | return; |
@@ -534,16 +534,16 @@ discard block |
||
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | public static function import_xml_views( $views, $imported ) { |
| 537 | - $imported['posts'] = array(); |
|
| 538 | - $form_action_type = FrmFormActionsController::$action_post_type; |
|
| 537 | + $imported['posts'] = array(); |
|
| 538 | + $form_action_type = FrmFormActionsController::$action_post_type; |
|
| 539 | 539 | |
| 540 | - $post_types = array( |
|
| 541 | - 'frm_display' => 'views', |
|
| 542 | - $form_action_type => 'actions', |
|
| 543 | - 'frm_styles' => 'styles', |
|
| 544 | - ); |
|
| 540 | + $post_types = array( |
|
| 541 | + 'frm_display' => 'views', |
|
| 542 | + $form_action_type => 'actions', |
|
| 543 | + 'frm_styles' => 'styles', |
|
| 544 | + ); |
|
| 545 | 545 | |
| 546 | - foreach ( $views as $item ) { |
|
| 546 | + foreach ( $views as $item ) { |
|
| 547 | 547 | $post = array( |
| 548 | 548 | 'post_title' => (string) $item->title, |
| 549 | 549 | 'post_name' => (string) $item->post_name, |
@@ -562,52 +562,52 @@ discard block |
||
| 562 | 562 | 'post_date' => (string) $item->post_date, |
| 563 | 563 | 'post_date_gmt' => (string) $item->post_date_gmt, |
| 564 | 564 | 'ping_status' => (string) $item->ping_status, |
| 565 | - 'postmeta' => array(), |
|
| 566 | - 'tax_input' => array(), |
|
| 565 | + 'postmeta' => array(), |
|
| 566 | + 'tax_input' => array(), |
|
| 567 | 567 | ); |
| 568 | 568 | |
| 569 | - $old_id = $post['post_id']; |
|
| 569 | + $old_id = $post['post_id']; |
|
| 570 | 570 | self::populate_post( $post, $item, $imported ); |
| 571 | 571 | |
| 572 | 572 | unset( $item ); |
| 573 | 573 | |
| 574 | 574 | $post_id = false; |
| 575 | - if ( $post['post_type'] == $form_action_type ) { |
|
| 576 | - $action_control = FrmFormActionsController::get_form_actions( $post['post_excerpt'] ); |
|
| 575 | + if ( $post['post_type'] == $form_action_type ) { |
|
| 576 | + $action_control = FrmFormActionsController::get_form_actions( $post['post_excerpt'] ); |
|
| 577 | 577 | if ( $action_control && is_object( $action_control ) ) { |
| 578 | 578 | $post_id = $action_control->maybe_create_action( $post, $imported['form_status'] ); |
| 579 | 579 | } |
| 580 | 580 | unset( $action_control ); |
| 581 | - } else if ( $post['post_type'] == 'frm_styles' ) { |
|
| 582 | - // Properly encode post content before inserting the post |
|
| 583 | - $post['post_content'] = FrmAppHelper::maybe_json_decode( $post['post_content'] ); |
|
| 581 | + } else if ( $post['post_type'] == 'frm_styles' ) { |
|
| 582 | + // Properly encode post content before inserting the post |
|
| 583 | + $post['post_content'] = FrmAppHelper::maybe_json_decode( $post['post_content'] ); |
|
| 584 | 584 | $custom_css = isset( $post['post_content']['custom_css'] ) ? $post['post_content']['custom_css'] : ''; |
| 585 | - $post['post_content'] = FrmAppHelper::prepare_and_encode( $post['post_content'] ); |
|
| 585 | + $post['post_content'] = FrmAppHelper::prepare_and_encode( $post['post_content'] ); |
|
| 586 | 586 | |
| 587 | - // Create/update post now |
|
| 588 | - $post_id = wp_insert_post( $post ); |
|
| 587 | + // Create/update post now |
|
| 588 | + $post_id = wp_insert_post( $post ); |
|
| 589 | 589 | self::maybe_update_custom_css( $custom_css ); |
| 590 | - } else { |
|
| 591 | - // Create/update post now |
|
| 592 | - $post_id = wp_insert_post( $post ); |
|
| 593 | - } |
|
| 590 | + } else { |
|
| 591 | + // Create/update post now |
|
| 592 | + $post_id = wp_insert_post( $post ); |
|
| 593 | + } |
|
| 594 | 594 | |
| 595 | 595 | if ( ! is_numeric( $post_id ) ) { |
| 596 | - continue; |
|
| 597 | - } |
|
| 596 | + continue; |
|
| 597 | + } |
|
| 598 | 598 | |
| 599 | 599 | self::update_postmeta( $post, $post_id ); |
| 600 | 600 | |
| 601 | - $this_type = 'posts'; |
|
| 601 | + $this_type = 'posts'; |
|
| 602 | 602 | if ( isset( $post_types[ $post['post_type'] ] ) ) { |
| 603 | 603 | $this_type = $post_types[ $post['post_type'] ]; |
| 604 | - } |
|
| 604 | + } |
|
| 605 | 605 | |
| 606 | 606 | if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) { |
| 607 | - $imported['updated'][ $this_type ]++; |
|
| 608 | - } else { |
|
| 609 | - $imported['imported'][ $this_type ]++; |
|
| 610 | - } |
|
| 607 | + $imported['updated'][ $this_type ]++; |
|
| 608 | + } else { |
|
| 609 | + $imported['imported'][ $this_type ]++; |
|
| 610 | + } |
|
| 611 | 611 | |
| 612 | 612 | $imported['posts'][ (int) $old_id ] = $post_id; |
| 613 | 613 | |
@@ -619,16 +619,16 @@ discard block |
||
| 619 | 619 | self::maybe_update_stylesheet( $imported ); |
| 620 | 620 | |
| 621 | 621 | return $imported; |
| 622 | - } |
|
| 622 | + } |
|
| 623 | 623 | |
| 624 | - private static function populate_post( &$post, $item, $imported ) { |
|
| 624 | + private static function populate_post( &$post, $item, $imported ) { |
|
| 625 | 625 | if ( isset( $item->attachment_url ) ) { |
| 626 | 626 | $post['attachment_url'] = (string) $item->attachment_url; |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
| 630 | - // update to new form id |
|
| 631 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
| 630 | + // update to new form id |
|
| 631 | + $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | // Don't allow default styles to take over a site's default style |
@@ -644,57 +644,57 @@ discard block |
||
| 644 | 644 | self::populate_taxonomies( $post, $item ); |
| 645 | 645 | |
| 646 | 646 | self::maybe_editing_post( $post ); |
| 647 | - } |
|
| 647 | + } |
|
| 648 | 648 | |
| 649 | - private static function populate_postmeta( &$post, $meta, $imported ) { |
|
| 650 | - global $frm_duplicate_ids; |
|
| 649 | + private static function populate_postmeta( &$post, $meta, $imported ) { |
|
| 650 | + global $frm_duplicate_ids; |
|
| 651 | 651 | |
| 652 | - $m = array( |
|
| 652 | + $m = array( |
|
| 653 | 653 | 'key' => (string) $meta->meta_key, |
| 654 | 654 | 'value' => (string) $meta->meta_value, |
| 655 | 655 | ); |
| 656 | 656 | |
| 657 | 657 | //switch old form and field ids to new ones |
| 658 | 658 | if ( $m['key'] == 'frm_form_id' && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
| 659 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
| 659 | + $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
| 660 | 660 | } else { |
| 661 | - $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
|
| 661 | + $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
|
| 662 | 662 | |
| 663 | 663 | if ( ! empty( $frm_duplicate_ids ) ) { |
| 664 | 664 | |
| 665 | - if ( $m['key'] == 'frm_dyncontent' ) { |
|
| 665 | + if ( $m['key'] == 'frm_dyncontent' ) { |
|
| 666 | 666 | $m['value'] = FrmFieldsHelper::switch_field_ids( $m['value'] ); |
| 667 | - } else if ( $m['key'] == 'frm_options' ) { |
|
| 667 | + } else if ( $m['key'] == 'frm_options' ) { |
|
| 668 | 668 | |
| 669 | 669 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
| 670 | 670 | if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
| 671 | 671 | $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
| 672 | - } |
|
| 673 | - } |
|
| 674 | - |
|
| 675 | - $check_dup_array = array(); |
|
| 676 | - if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) { |
|
| 677 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
| 678 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
| 679 | - } else if ( is_array( $m['value']['order_by'] ) ) { |
|
| 680 | - $check_dup_array[] = 'order_by'; |
|
| 681 | - } |
|
| 682 | - } |
|
| 683 | - |
|
| 684 | - if ( isset( $m['value']['where'] ) && ! empty( $m['value']['where'] ) ) { |
|
| 685 | - $check_dup_array[] = 'where'; |
|
| 686 | - } |
|
| 687 | - |
|
| 688 | - foreach ( $check_dup_array as $check_k ) { |
|
| 672 | + } |
|
| 673 | + } |
|
| 674 | + |
|
| 675 | + $check_dup_array = array(); |
|
| 676 | + if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) { |
|
| 677 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
| 678 | + $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
| 679 | + } else if ( is_array( $m['value']['order_by'] ) ) { |
|
| 680 | + $check_dup_array[] = 'order_by'; |
|
| 681 | + } |
|
| 682 | + } |
|
| 683 | + |
|
| 684 | + if ( isset( $m['value']['where'] ) && ! empty( $m['value']['where'] ) ) { |
|
| 685 | + $check_dup_array[] = 'where'; |
|
| 686 | + } |
|
| 687 | + |
|
| 688 | + foreach ( $check_dup_array as $check_k ) { |
|
| 689 | 689 | foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
| 690 | 690 | if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
| 691 | 691 | $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
| 692 | - } |
|
| 692 | + } |
|
| 693 | 693 | unset( $mk, $mv ); |
| 694 | - } |
|
| 695 | - } |
|
| 696 | - } |
|
| 697 | - } |
|
| 694 | + } |
|
| 695 | + } |
|
| 696 | + } |
|
| 697 | + } |
|
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | if ( ! is_array( $m['value'] ) ) { |
@@ -702,32 +702,32 @@ discard block |
||
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
| 705 | - } |
|
| 705 | + } |
|
| 706 | 706 | |
| 707 | - /** |
|
| 708 | - * Add terms to post |
|
| 707 | + /** |
|
| 708 | + * Add terms to post |
|
| 709 | 709 | * |
| 710 | - * @param array $post by reference |
|
| 711 | - * @param object $item The XML object data |
|
| 712 | - */ |
|
| 713 | - private static function populate_taxonomies( &$post, $item ) { |
|
| 710 | + * @param array $post by reference |
|
| 711 | + * @param object $item The XML object data |
|
| 712 | + */ |
|
| 713 | + private static function populate_taxonomies( &$post, $item ) { |
|
| 714 | 714 | foreach ( $item->category as $c ) { |
| 715 | 715 | $att = $c->attributes(); |
| 716 | 716 | if ( ! isset( $att['nicename'] ) ) { |
| 717 | - continue; |
|
| 718 | - } |
|
| 717 | + continue; |
|
| 718 | + } |
|
| 719 | 719 | |
| 720 | - $taxonomy = (string) $att['domain']; |
|
| 720 | + $taxonomy = (string) $att['domain']; |
|
| 721 | 721 | if ( is_taxonomy_hierarchical( $taxonomy ) ) { |
| 722 | - $name = (string) $att['nicename']; |
|
| 722 | + $name = (string) $att['nicename']; |
|
| 723 | 723 | $h_term = get_term_by( 'slug', $name, $taxonomy ); |
| 724 | - if ( $h_term ) { |
|
| 725 | - $name = $h_term->term_id; |
|
| 726 | - } |
|
| 724 | + if ( $h_term ) { |
|
| 725 | + $name = $h_term->term_id; |
|
| 726 | + } |
|
| 727 | 727 | unset( $h_term ); |
| 728 | - } else { |
|
| 729 | - $name = (string) $c; |
|
| 730 | - } |
|
| 728 | + } else { |
|
| 729 | + $name = (string) $c; |
|
| 730 | + } |
|
| 731 | 731 | |
| 732 | 732 | if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
| 733 | 733 | $post['tax_input'][ $taxonomy ] = array(); |
@@ -736,21 +736,21 @@ discard block |
||
| 736 | 736 | $post['tax_input'][ $taxonomy ][] = $name; |
| 737 | 737 | unset( $name ); |
| 738 | 738 | } |
| 739 | - } |
|
| 739 | + } |
|
| 740 | 740 | |
| 741 | - /** |
|
| 742 | - * Edit post if the key and created time match |
|
| 743 | - */ |
|
| 744 | - private static function maybe_editing_post( &$post ) { |
|
| 741 | + /** |
|
| 742 | + * Edit post if the key and created time match |
|
| 743 | + */ |
|
| 744 | + private static function maybe_editing_post( &$post ) { |
|
| 745 | 745 | $match_by = array( |
| 746 | - 'post_type' => $post['post_type'], |
|
| 747 | - 'name' => $post['post_name'], |
|
| 748 | - 'post_status' => $post['post_status'], |
|
| 749 | - 'posts_per_page' => 1, |
|
| 746 | + 'post_type' => $post['post_type'], |
|
| 747 | + 'name' => $post['post_name'], |
|
| 748 | + 'post_status' => $post['post_status'], |
|
| 749 | + 'posts_per_page' => 1, |
|
| 750 | 750 | ); |
| 751 | 751 | |
| 752 | 752 | if ( in_array( $post['post_status'], array( 'trash', 'draft' ) ) ) { |
| 753 | - $match_by['include'] = $post['post_id']; |
|
| 753 | + $match_by['include'] = $post['post_id']; |
|
| 754 | 754 | unset( $match_by['name'] ); |
| 755 | 755 | } |
| 756 | 756 | |
@@ -760,23 +760,23 @@ discard block |
||
| 760 | 760 | // set the id of the post to edit |
| 761 | 761 | $post['ID'] = current( $editing )->ID; |
| 762 | 762 | } |
| 763 | - } |
|
| 763 | + } |
|
| 764 | 764 | |
| 765 | - private static function update_postmeta( &$post, $post_id ) { |
|
| 766 | - foreach ( $post['postmeta'] as $k => $v ) { |
|
| 767 | - if ( '_edit_last' == $k ) { |
|
| 765 | + private static function update_postmeta( &$post, $post_id ) { |
|
| 766 | + foreach ( $post['postmeta'] as $k => $v ) { |
|
| 767 | + if ( '_edit_last' == $k ) { |
|
| 768 | 768 | $v = FrmAppHelper::get_user_id_param( $v ); |
| 769 | - } else if ( '_thumbnail_id' == $k && FrmAppHelper::pro_is_installed() ) { |
|
| 770 | - //change the attachment ID |
|
| 769 | + } else if ( '_thumbnail_id' == $k && FrmAppHelper::pro_is_installed() ) { |
|
| 770 | + //change the attachment ID |
|
| 771 | 771 | $field_obj = FrmFieldFactory::get_field_type( 'file' ); |
| 772 | 772 | $v = $field_obj->get_file_id( $v ); |
| 773 | - } |
|
| 773 | + } |
|
| 774 | 774 | |
| 775 | 775 | update_post_meta( $post_id, $k, $v ); |
| 776 | 776 | |
| 777 | 777 | unset( $k, $v ); |
| 778 | - } |
|
| 779 | - } |
|
| 778 | + } |
|
| 779 | + } |
|
| 780 | 780 | |
| 781 | 781 | /** |
| 782 | 782 | * If a template includes custom css, let's include it. |
@@ -809,32 +809,32 @@ discard block |
||
| 809 | 809 | } |
| 810 | 810 | } |
| 811 | 811 | |
| 812 | - /** |
|
| 813 | - * @param string $message |
|
| 814 | - */ |
|
| 812 | + /** |
|
| 813 | + * @param string $message |
|
| 814 | + */ |
|
| 815 | 815 | public static function parse_message( $result, &$message, &$errors ) { |
| 816 | 816 | if ( is_wp_error( $result ) ) { |
| 817 | - $errors[] = $result->get_error_message(); |
|
| 818 | - } else if ( ! $result ) { |
|
| 819 | - return; |
|
| 820 | - } |
|
| 817 | + $errors[] = $result->get_error_message(); |
|
| 818 | + } else if ( ! $result ) { |
|
| 819 | + return; |
|
| 820 | + } |
|
| 821 | 821 | |
| 822 | 822 | if ( ! is_array( $result ) ) { |
| 823 | - $message = is_string( $result ) ? $result : htmlentities( print_r( $result, 1 ) ); |
|
| 824 | - return; |
|
| 825 | - } |
|
| 823 | + $message = is_string( $result ) ? $result : htmlentities( print_r( $result, 1 ) ); |
|
| 824 | + return; |
|
| 825 | + } |
|
| 826 | 826 | |
| 827 | - $t_strings = array( |
|
| 828 | - 'imported' => __( 'Imported', 'formidable' ), |
|
| 829 | - 'updated' => __( 'Updated', 'formidable' ), |
|
| 830 | - ); |
|
| 827 | + $t_strings = array( |
|
| 828 | + 'imported' => __( 'Imported', 'formidable' ), |
|
| 829 | + 'updated' => __( 'Updated', 'formidable' ), |
|
| 830 | + ); |
|
| 831 | 831 | |
| 832 | - $message = '<ul>'; |
|
| 833 | - foreach ( $result as $type => $results ) { |
|
| 832 | + $message = '<ul>'; |
|
| 833 | + foreach ( $result as $type => $results ) { |
|
| 834 | 834 | if ( ! isset( $t_strings[ $type ] ) ) { |
| 835 | - // only print imported and updated |
|
| 836 | - continue; |
|
| 837 | - } |
|
| 835 | + // only print imported and updated |
|
| 836 | + continue; |
|
| 837 | + } |
|
| 838 | 838 | |
| 839 | 839 | $s_message = array(); |
| 840 | 840 | foreach ( $results as $k => $m ) { |
@@ -847,34 +847,34 @@ discard block |
||
| 847 | 847 | $message .= implode( ', ', $s_message ); |
| 848 | 848 | $message .= '</li>'; |
| 849 | 849 | } |
| 850 | - } |
|
| 850 | + } |
|
| 851 | 851 | |
| 852 | - if ( $message == '<ul>' ) { |
|
| 853 | - $message = ''; |
|
| 854 | - $errors[] = __( 'Nothing was imported or updated', 'formidable' ); |
|
| 855 | - } else { |
|
| 856 | - $message .= '</ul>'; |
|
| 857 | - } |
|
| 858 | - } |
|
| 852 | + if ( $message == '<ul>' ) { |
|
| 853 | + $message = ''; |
|
| 854 | + $errors[] = __( 'Nothing was imported or updated', 'formidable' ); |
|
| 855 | + } else { |
|
| 856 | + $message .= '</ul>'; |
|
| 857 | + } |
|
| 858 | + } |
|
| 859 | 859 | |
| 860 | 860 | public static function item_count_message( $m, $type, &$s_message ) { |
| 861 | - if ( ! $m ) { |
|
| 862 | - return; |
|
| 863 | - } |
|
| 864 | - |
|
| 865 | - $strings = array( |
|
| 866 | - 'forms' => sprintf( _n( '%1$s Form', '%1$s Forms', $m, 'formidable' ), $m ), |
|
| 867 | - 'fields' => sprintf( _n( '%1$s Field', '%1$s Fields', $m, 'formidable' ), $m ), |
|
| 868 | - 'items' => sprintf( _n( '%1$s Entry', '%1$s Entries', $m, 'formidable' ), $m ), |
|
| 869 | - 'views' => sprintf( _n( '%1$s View', '%1$s Views', $m, 'formidable' ), $m ), |
|
| 870 | - 'posts' => sprintf( _n( '%1$s Post', '%1$s Posts', $m, 'formidable' ), $m ), |
|
| 871 | - 'styles' => sprintf( _n( '%1$s Style', '%1$s Styles', $m, 'formidable' ), $m ), |
|
| 872 | - 'terms' => sprintf( _n( '%1$s Term', '%1$s Terms', $m, 'formidable' ), $m ), |
|
| 873 | - 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
|
| 874 | - ); |
|
| 861 | + if ( ! $m ) { |
|
| 862 | + return; |
|
| 863 | + } |
|
| 864 | + |
|
| 865 | + $strings = array( |
|
| 866 | + 'forms' => sprintf( _n( '%1$s Form', '%1$s Forms', $m, 'formidable' ), $m ), |
|
| 867 | + 'fields' => sprintf( _n( '%1$s Field', '%1$s Fields', $m, 'formidable' ), $m ), |
|
| 868 | + 'items' => sprintf( _n( '%1$s Entry', '%1$s Entries', $m, 'formidable' ), $m ), |
|
| 869 | + 'views' => sprintf( _n( '%1$s View', '%1$s Views', $m, 'formidable' ), $m ), |
|
| 870 | + 'posts' => sprintf( _n( '%1$s Post', '%1$s Posts', $m, 'formidable' ), $m ), |
|
| 871 | + 'styles' => sprintf( _n( '%1$s Style', '%1$s Styles', $m, 'formidable' ), $m ), |
|
| 872 | + 'terms' => sprintf( _n( '%1$s Term', '%1$s Terms', $m, 'formidable' ), $m ), |
|
| 873 | + 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
|
| 874 | + ); |
|
| 875 | 875 | |
| 876 | 876 | $s_message[] = isset( $strings[ $type ] ) ? $strings[ $type ] : ' ' . $m . ' ' . ucfirst( $type ); |
| 877 | - } |
|
| 877 | + } |
|
| 878 | 878 | |
| 879 | 879 | /** |
| 880 | 880 | * Prepare the form options for export |
@@ -961,11 +961,11 @@ discard block |
||
| 961 | 961 | } |
| 962 | 962 | |
| 963 | 963 | /** |
| 964 | - * Compare the default array to the saved values and |
|
| 965 | - * remove if they are the same |
|
| 966 | - * |
|
| 967 | - * @since 3.06 |
|
| 968 | - */ |
|
| 964 | + * Compare the default array to the saved values and |
|
| 965 | + * remove if they are the same |
|
| 966 | + * |
|
| 967 | + * @since 3.06 |
|
| 968 | + */ |
|
| 969 | 969 | private static function remove_defaults( $defaults, &$saved ) { |
| 970 | 970 | $array_defaults = array_filter( $defaults, 'is_array' ); |
| 971 | 971 | foreach ( $array_defaults as $d => $default ) { |
@@ -979,10 +979,10 @@ discard block |
||
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | /** |
| 982 | - * The line endings may prevent html from being equal when it should |
|
| 983 | - * |
|
| 984 | - * @since 3.06 |
|
| 985 | - */ |
|
| 982 | + * The line endings may prevent html from being equal when it should |
|
| 983 | + * |
|
| 984 | + * @since 3.06 |
|
| 985 | + */ |
|
| 986 | 986 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
| 987 | 987 | if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
| 988 | 988 | return; |
@@ -1011,8 +1011,8 @@ discard block |
||
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | if ( is_numeric( $str ) ) { |
| 1014 | - return $str; |
|
| 1015 | - } |
|
| 1014 | + return $str; |
|
| 1015 | + } |
|
| 1016 | 1016 | |
| 1017 | 1017 | self::remove_invalid_characters_from_xml( $str ); |
| 1018 | 1018 | |
@@ -1033,54 +1033,54 @@ discard block |
||
| 1033 | 1033 | $str = str_replace( '\x1F', '', $str ); |
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | - public static function migrate_form_settings_to_actions( $form_options, $form_id, &$imported = array(), $switch = false ) { |
|
| 1037 | - // Get post type |
|
| 1038 | - $post_type = FrmFormActionsController::$action_post_type; |
|
| 1036 | + public static function migrate_form_settings_to_actions( $form_options, $form_id, &$imported = array(), $switch = false ) { |
|
| 1037 | + // Get post type |
|
| 1038 | + $post_type = FrmFormActionsController::$action_post_type; |
|
| 1039 | 1039 | |
| 1040 | - // Set up imported index, if not set up yet |
|
| 1041 | - if ( ! isset( $imported['imported']['actions'] ) ) { |
|
| 1042 | - $imported['imported']['actions'] = 0; |
|
| 1043 | - } |
|
| 1040 | + // Set up imported index, if not set up yet |
|
| 1041 | + if ( ! isset( $imported['imported']['actions'] ) ) { |
|
| 1042 | + $imported['imported']['actions'] = 0; |
|
| 1043 | + } |
|
| 1044 | 1044 | |
| 1045 | - // Migrate post settings to action |
|
| 1046 | - self::migrate_post_settings_to_action( $form_options, $form_id, $post_type, $imported, $switch ); |
|
| 1045 | + // Migrate post settings to action |
|
| 1046 | + self::migrate_post_settings_to_action( $form_options, $form_id, $post_type, $imported, $switch ); |
|
| 1047 | 1047 | |
| 1048 | - // Migrate email settings to action |
|
| 1049 | - self::migrate_email_settings_to_action( $form_options, $form_id, $post_type, $imported, $switch ); |
|
| 1050 | - } |
|
| 1048 | + // Migrate email settings to action |
|
| 1049 | + self::migrate_email_settings_to_action( $form_options, $form_id, $post_type, $imported, $switch ); |
|
| 1050 | + } |
|
| 1051 | 1051 | |
| 1052 | - /** |
|
| 1053 | - * Migrate post settings to form action |
|
| 1054 | - * |
|
| 1055 | - * @param string $post_type |
|
| 1056 | - */ |
|
| 1057 | - private static function migrate_post_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) { |
|
| 1052 | + /** |
|
| 1053 | + * Migrate post settings to form action |
|
| 1054 | + * |
|
| 1055 | + * @param string $post_type |
|
| 1056 | + */ |
|
| 1057 | + private static function migrate_post_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) { |
|
| 1058 | 1058 | if ( ! isset( $form_options['create_post'] ) || ! $form_options['create_post'] ) { |
| 1059 | - return; |
|
| 1060 | - } |
|
| 1059 | + return; |
|
| 1060 | + } |
|
| 1061 | 1061 | |
| 1062 | - $new_action = array( |
|
| 1063 | - 'post_type' => $post_type, |
|
| 1064 | - 'post_excerpt' => 'wppost', |
|
| 1062 | + $new_action = array( |
|
| 1063 | + 'post_type' => $post_type, |
|
| 1064 | + 'post_excerpt' => 'wppost', |
|
| 1065 | 1065 | 'post_title' => __( 'Create Posts', 'formidable' ), |
| 1066 | - 'menu_order' => $form_id, |
|
| 1067 | - 'post_status' => 'publish', |
|
| 1068 | - 'post_content' => array(), |
|
| 1066 | + 'menu_order' => $form_id, |
|
| 1067 | + 'post_status' => 'publish', |
|
| 1068 | + 'post_content' => array(), |
|
| 1069 | 1069 | 'post_name' => $form_id . '_wppost_1', |
| 1070 | - ); |
|
| 1070 | + ); |
|
| 1071 | 1071 | |
| 1072 | 1072 | $post_settings = array( 'post_type', 'post_category', 'post_content', 'post_excerpt', 'post_title', 'post_name', 'post_date', 'post_status', 'post_custom_fields', 'post_password' ); |
| 1073 | 1073 | |
| 1074 | - foreach ( $post_settings as $post_setting ) { |
|
| 1074 | + foreach ( $post_settings as $post_setting ) { |
|
| 1075 | 1075 | if ( isset( $form_options[ $post_setting ] ) ) { |
| 1076 | 1076 | $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
| 1077 | - } |
|
| 1077 | + } |
|
| 1078 | 1078 | unset( $post_setting ); |
| 1079 | - } |
|
| 1079 | + } |
|
| 1080 | 1080 | |
| 1081 | 1081 | $new_action['event'] = array( 'create', 'update' ); |
| 1082 | 1082 | |
| 1083 | - if ( $switch ) { |
|
| 1083 | + if ( $switch ) { |
|
| 1084 | 1084 | // Fields with string or int saved |
| 1085 | 1085 | $basic_fields = array( 'post_title', 'post_content', 'post_excerpt', 'post_password', 'post_date', 'post_status' ); |
| 1086 | 1086 | |
@@ -1088,7 +1088,7 @@ discard block |
||
| 1088 | 1088 | $array_fields = array( 'post_category', 'post_custom_fields' ); |
| 1089 | 1089 | |
| 1090 | 1090 | $new_action['post_content'] = self::switch_action_field_ids( $new_action['post_content'], $basic_fields, $array_fields ); |
| 1091 | - } |
|
| 1091 | + } |
|
| 1092 | 1092 | $new_action['post_content'] = json_encode( $new_action['post_content'] ); |
| 1093 | 1093 | |
| 1094 | 1094 | $exists = get_posts( |
@@ -1100,12 +1100,12 @@ discard block |
||
| 1100 | 1100 | ) |
| 1101 | 1101 | ); |
| 1102 | 1102 | |
| 1103 | - if ( ! $exists ) { |
|
| 1103 | + if ( ! $exists ) { |
|
| 1104 | 1104 | // this isn't an email, but we need to use a class that will always be included |
| 1105 | 1105 | FrmDb::save_json_post( $new_action ); |
| 1106 | - $imported['imported']['actions']++; |
|
| 1107 | - } |
|
| 1108 | - } |
|
| 1106 | + $imported['imported']['actions']++; |
|
| 1107 | + } |
|
| 1108 | + } |
|
| 1109 | 1109 | |
| 1110 | 1110 | /** |
| 1111 | 1111 | * Switch old field IDs for new field IDs in emails and post |
@@ -1118,71 +1118,71 @@ discard block |
||
| 1118 | 1118 | * @return string $post_content - new field IDs |
| 1119 | 1119 | */ |
| 1120 | 1120 | private static function switch_action_field_ids( $post_content, $basic_fields, $array_fields = array() ) { |
| 1121 | - global $frm_duplicate_ids; |
|
| 1121 | + global $frm_duplicate_ids; |
|
| 1122 | 1122 | |
| 1123 | - // If there aren't IDs that were switched, end now |
|
| 1124 | - if ( ! $frm_duplicate_ids ) { |
|
| 1125 | - return; |
|
| 1126 | - } |
|
| 1123 | + // If there aren't IDs that were switched, end now |
|
| 1124 | + if ( ! $frm_duplicate_ids ) { |
|
| 1125 | + return; |
|
| 1126 | + } |
|
| 1127 | 1127 | |
| 1128 | - // Get old IDs |
|
| 1129 | - $old = array_keys( $frm_duplicate_ids ); |
|
| 1128 | + // Get old IDs |
|
| 1129 | + $old = array_keys( $frm_duplicate_ids ); |
|
| 1130 | 1130 | |
| 1131 | - // Get new IDs |
|
| 1132 | - $new = array_values( $frm_duplicate_ids ); |
|
| 1131 | + // Get new IDs |
|
| 1132 | + $new = array_values( $frm_duplicate_ids ); |
|
| 1133 | 1133 | |
| 1134 | - // Do a str_replace with each item to set the new IDs |
|
| 1135 | - foreach ( $post_content as $key => $setting ) { |
|
| 1136 | - if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
|
| 1137 | - // Replace old IDs with new IDs |
|
| 1134 | + // Do a str_replace with each item to set the new IDs |
|
| 1135 | + foreach ( $post_content as $key => $setting ) { |
|
| 1136 | + if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
|
| 1137 | + // Replace old IDs with new IDs |
|
| 1138 | 1138 | $post_content[ $key ] = str_replace( $old, $new, $setting ); |
| 1139 | - } else if ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
|
| 1140 | - foreach ( $setting as $k => $val ) { |
|
| 1141 | - // Replace old IDs with new IDs |
|
| 1139 | + } else if ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
|
| 1140 | + foreach ( $setting as $k => $val ) { |
|
| 1141 | + // Replace old IDs with new IDs |
|
| 1142 | 1142 | $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
| 1143 | - } |
|
| 1144 | - } |
|
| 1145 | - unset( $key, $setting ); |
|
| 1146 | - } |
|
| 1147 | - return $post_content; |
|
| 1148 | - } |
|
| 1149 | - |
|
| 1150 | - private static function migrate_email_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) { |
|
| 1151 | - // No old notifications or autoresponders to carry over |
|
| 1143 | + } |
|
| 1144 | + } |
|
| 1145 | + unset( $key, $setting ); |
|
| 1146 | + } |
|
| 1147 | + return $post_content; |
|
| 1148 | + } |
|
| 1149 | + |
|
| 1150 | + private static function migrate_email_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) { |
|
| 1151 | + // No old notifications or autoresponders to carry over |
|
| 1152 | 1152 | if ( ! isset( $form_options['auto_responder'] ) && ! isset( $form_options['notification'] ) && ! isset( $form_options['email_to'] ) ) { |
| 1153 | - return; |
|
| 1154 | - } |
|
| 1153 | + return; |
|
| 1154 | + } |
|
| 1155 | 1155 | |
| 1156 | - // Initialize notifications array |
|
| 1157 | - $notifications = array(); |
|
| 1156 | + // Initialize notifications array |
|
| 1157 | + $notifications = array(); |
|
| 1158 | 1158 | |
| 1159 | - // Migrate regular notifications |
|
| 1160 | - self::migrate_notifications_to_action( $form_options, $form_id, $notifications ); |
|
| 1159 | + // Migrate regular notifications |
|
| 1160 | + self::migrate_notifications_to_action( $form_options, $form_id, $notifications ); |
|
| 1161 | 1161 | |
| 1162 | - // Migrate autoresponders |
|
| 1163 | - self::migrate_autoresponder_to_action( $form_options, $form_id, $notifications ); |
|
| 1162 | + // Migrate autoresponders |
|
| 1163 | + self::migrate_autoresponder_to_action( $form_options, $form_id, $notifications ); |
|
| 1164 | 1164 | |
| 1165 | - if ( empty( $notifications ) ) { |
|
| 1166 | - return; |
|
| 1167 | - } |
|
| 1165 | + if ( empty( $notifications ) ) { |
|
| 1166 | + return; |
|
| 1167 | + } |
|
| 1168 | 1168 | |
| 1169 | - foreach ( $notifications as $new_notification ) { |
|
| 1170 | - $new_notification['post_type'] = $post_type; |
|
| 1171 | - $new_notification['post_excerpt'] = 'email'; |
|
| 1169 | + foreach ( $notifications as $new_notification ) { |
|
| 1170 | + $new_notification['post_type'] = $post_type; |
|
| 1171 | + $new_notification['post_excerpt'] = 'email'; |
|
| 1172 | 1172 | $new_notification['post_title'] = __( 'Email Notification', 'formidable' ); |
| 1173 | - $new_notification['menu_order'] = $form_id; |
|
| 1174 | - $new_notification['post_status'] = 'publish'; |
|
| 1173 | + $new_notification['menu_order'] = $form_id; |
|
| 1174 | + $new_notification['post_status'] = 'publish'; |
|
| 1175 | 1175 | |
| 1176 | - // Switch field IDs and keys, if needed |
|
| 1177 | - if ( $switch ) { |
|
| 1176 | + // Switch field IDs and keys, if needed |
|
| 1177 | + if ( $switch ) { |
|
| 1178 | 1178 | |
| 1179 | 1179 | // Switch field IDs in email conditional logic |
| 1180 | 1180 | self::switch_email_contition_field_ids( $new_notification['post_content'] ); |
| 1181 | 1181 | |
| 1182 | 1182 | // Switch all other field IDs in email |
| 1183 | - $new_notification['post_content'] = FrmFieldsHelper::switch_field_ids( $new_notification['post_content'] ); |
|
| 1184 | - } |
|
| 1185 | - $new_notification['post_content'] = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] ); |
|
| 1183 | + $new_notification['post_content'] = FrmFieldsHelper::switch_field_ids( $new_notification['post_content'] ); |
|
| 1184 | + } |
|
| 1185 | + $new_notification['post_content'] = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] ); |
|
| 1186 | 1186 | |
| 1187 | 1187 | $exists = get_posts( |
| 1188 | 1188 | array( |
@@ -1195,13 +1195,13 @@ discard block |
||
| 1195 | 1195 | |
| 1196 | 1196 | if ( empty( $exists ) ) { |
| 1197 | 1197 | FrmDb::save_json_post( $new_notification ); |
| 1198 | - $imported['imported']['actions']++; |
|
| 1199 | - } |
|
| 1198 | + $imported['imported']['actions']++; |
|
| 1199 | + } |
|
| 1200 | 1200 | unset( $new_notification ); |
| 1201 | - } |
|
| 1201 | + } |
|
| 1202 | 1202 | |
| 1203 | 1203 | self::remove_deprecated_notification_settings( $form_id, $form_options ); |
| 1204 | - } |
|
| 1204 | + } |
|
| 1205 | 1205 | |
| 1206 | 1206 | /** |
| 1207 | 1207 | * Remove deprecated notification settings after migration |
@@ -1221,17 +1221,17 @@ discard block |
||
| 1221 | 1221 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | - private static function migrate_notifications_to_action( $form_options, $form_id, &$notifications ) { |
|
| 1225 | - if ( ! isset( $form_options['notification'] ) && isset( $form_options['email_to'] ) && ! empty( $form_options['email_to'] ) ) { |
|
| 1226 | - // add old settings into notification array |
|
| 1224 | + private static function migrate_notifications_to_action( $form_options, $form_id, &$notifications ) { |
|
| 1225 | + if ( ! isset( $form_options['notification'] ) && isset( $form_options['email_to'] ) && ! empty( $form_options['email_to'] ) ) { |
|
| 1226 | + // add old settings into notification array |
|
| 1227 | 1227 | $form_options['notification'] = array( 0 => $form_options ); |
| 1228 | - } else if ( isset( $form_options['notification']['email_to'] ) ) { |
|
| 1229 | - // make sure it's in the correct format |
|
| 1228 | + } else if ( isset( $form_options['notification']['email_to'] ) ) { |
|
| 1229 | + // make sure it's in the correct format |
|
| 1230 | 1230 | $form_options['notification'] = array( 0 => $form_options['notification'] ); |
| 1231 | - } |
|
| 1231 | + } |
|
| 1232 | 1232 | |
| 1233 | 1233 | if ( isset( $form_options['notification'] ) && is_array( $form_options['notification'] ) ) { |
| 1234 | - foreach ( $form_options['notification'] as $email_key => $notification ) { |
|
| 1234 | + foreach ( $form_options['notification'] as $email_key => $notification ) { |
|
| 1235 | 1235 | |
| 1236 | 1236 | $atts = array( |
| 1237 | 1237 | 'email_to' => '', |
@@ -1242,119 +1242,119 @@ discard block |
||
| 1242 | 1242 | 'email_key' => $email_key, |
| 1243 | 1243 | ); |
| 1244 | 1244 | |
| 1245 | - // Format the email data |
|
| 1246 | - self::format_email_data( $atts, $notification ); |
|
| 1245 | + // Format the email data |
|
| 1246 | + self::format_email_data( $atts, $notification ); |
|
| 1247 | 1247 | |
| 1248 | 1248 | if ( isset( $notification['twilio'] ) && $notification['twilio'] ) { |
| 1249 | 1249 | do_action( 'frm_create_twilio_action', $atts, $notification ); |
| 1250 | 1250 | } |
| 1251 | 1251 | |
| 1252 | - // Setup the new notification |
|
| 1253 | - $new_notification = array(); |
|
| 1254 | - self::setup_new_notification( $new_notification, $notification, $atts ); |
|
| 1252 | + // Setup the new notification |
|
| 1253 | + $new_notification = array(); |
|
| 1254 | + self::setup_new_notification( $new_notification, $notification, $atts ); |
|
| 1255 | 1255 | |
| 1256 | - $notifications[] = $new_notification; |
|
| 1257 | - } |
|
| 1258 | - } |
|
| 1259 | - } |
|
| 1256 | + $notifications[] = $new_notification; |
|
| 1257 | + } |
|
| 1258 | + } |
|
| 1259 | + } |
|
| 1260 | 1260 | |
| 1261 | - private static function format_email_data( &$atts, $notification ) { |
|
| 1262 | - // Format email_to |
|
| 1263 | - self::format_email_to_data( $atts, $notification ); |
|
| 1261 | + private static function format_email_data( &$atts, $notification ) { |
|
| 1262 | + // Format email_to |
|
| 1263 | + self::format_email_to_data( $atts, $notification ); |
|
| 1264 | 1264 | |
| 1265 | - // Format the reply to email and name |
|
| 1265 | + // Format the reply to email and name |
|
| 1266 | 1266 | $reply_fields = array( |
| 1267 | 1267 | 'reply_to' => '', |
| 1268 | 1268 | 'reply_to_name' => '', |
| 1269 | 1269 | ); |
| 1270 | - foreach ( $reply_fields as $f => $val ) { |
|
| 1270 | + foreach ( $reply_fields as $f => $val ) { |
|
| 1271 | 1271 | if ( isset( $notification[ $f ] ) ) { |
| 1272 | 1272 | $atts[ $f ] = $notification[ $f ]; |
| 1273 | 1273 | if ( 'custom' == $notification[ $f ] ) { |
| 1274 | 1274 | $atts[ $f ] = $notification[ 'cust_' . $f ]; |
| 1275 | 1275 | } else if ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
| 1276 | 1276 | $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
| 1277 | - } |
|
| 1278 | - } |
|
| 1279 | - unset( $f, $val ); |
|
| 1280 | - } |
|
| 1277 | + } |
|
| 1278 | + } |
|
| 1279 | + unset( $f, $val ); |
|
| 1280 | + } |
|
| 1281 | 1281 | |
| 1282 | - // Format event |
|
| 1282 | + // Format event |
|
| 1283 | 1283 | $atts['event'] = array( 'create' ); |
| 1284 | - if ( isset( $notification['update_email'] ) && 1 == $notification['update_email'] ) { |
|
| 1285 | - $atts['event'][] = 'update'; |
|
| 1284 | + if ( isset( $notification['update_email'] ) && 1 == $notification['update_email'] ) { |
|
| 1285 | + $atts['event'][] = 'update'; |
|
| 1286 | 1286 | } elseif ( isset( $notification['update_email'] ) && 2 == $notification['update_email'] ) { |
| 1287 | 1287 | $atts['event'] = array( 'update' ); |
| 1288 | - } |
|
| 1289 | - } |
|
| 1288 | + } |
|
| 1289 | + } |
|
| 1290 | 1290 | |
| 1291 | - private static function format_email_to_data( &$atts, $notification ) { |
|
| 1292 | - if ( isset( $notification['email_to'] ) ) { |
|
| 1291 | + private static function format_email_to_data( &$atts, $notification ) { |
|
| 1292 | + if ( isset( $notification['email_to'] ) ) { |
|
| 1293 | 1293 | $atts['email_to'] = preg_split( '/ (,|;) /', $notification['email_to'] ); |
| 1294 | - } else { |
|
| 1295 | - $atts['email_to'] = array(); |
|
| 1296 | - } |
|
| 1294 | + } else { |
|
| 1295 | + $atts['email_to'] = array(); |
|
| 1296 | + } |
|
| 1297 | 1297 | |
| 1298 | - if ( isset( $notification['also_email_to'] ) ) { |
|
| 1299 | - $email_fields = (array) $notification['also_email_to']; |
|
| 1300 | - $atts['email_to'] = array_merge( $email_fields, $atts['email_to'] ); |
|
| 1301 | - unset( $email_fields ); |
|
| 1302 | - } |
|
| 1298 | + if ( isset( $notification['also_email_to'] ) ) { |
|
| 1299 | + $email_fields = (array) $notification['also_email_to']; |
|
| 1300 | + $atts['email_to'] = array_merge( $email_fields, $atts['email_to'] ); |
|
| 1301 | + unset( $email_fields ); |
|
| 1302 | + } |
|
| 1303 | 1303 | |
| 1304 | - foreach ( $atts['email_to'] as $key => $email_field ) { |
|
| 1304 | + foreach ( $atts['email_to'] as $key => $email_field ) { |
|
| 1305 | 1305 | |
| 1306 | - if ( is_numeric( $email_field ) ) { |
|
| 1306 | + if ( is_numeric( $email_field ) ) { |
|
| 1307 | 1307 | $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
| 1308 | - } |
|
| 1308 | + } |
|
| 1309 | 1309 | |
| 1310 | 1310 | if ( strpos( $email_field, '|' ) ) { |
| 1311 | - $email_opt = explode( '|', $email_field ); |
|
| 1312 | - if ( isset( $email_opt[0] ) ) { |
|
| 1311 | + $email_opt = explode( '|', $email_field ); |
|
| 1312 | + if ( isset( $email_opt[0] ) ) { |
|
| 1313 | 1313 | $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
| 1314 | - } |
|
| 1315 | - unset( $email_opt ); |
|
| 1316 | - } |
|
| 1317 | - } |
|
| 1314 | + } |
|
| 1315 | + unset( $email_opt ); |
|
| 1316 | + } |
|
| 1317 | + } |
|
| 1318 | 1318 | $atts['email_to'] = implode( ', ', $atts['email_to'] ); |
| 1319 | - } |
|
| 1320 | - |
|
| 1321 | - private static function setup_new_notification( &$new_notification, $notification, $atts ) { |
|
| 1322 | - // Set up new notification |
|
| 1323 | - $new_notification = array( |
|
| 1324 | - 'post_content' => array( |
|
| 1325 | - 'email_to' => $atts['email_to'], |
|
| 1326 | - 'event' => $atts['event'], |
|
| 1327 | - ), |
|
| 1319 | + } |
|
| 1320 | + |
|
| 1321 | + private static function setup_new_notification( &$new_notification, $notification, $atts ) { |
|
| 1322 | + // Set up new notification |
|
| 1323 | + $new_notification = array( |
|
| 1324 | + 'post_content' => array( |
|
| 1325 | + 'email_to' => $atts['email_to'], |
|
| 1326 | + 'event' => $atts['event'], |
|
| 1327 | + ), |
|
| 1328 | 1328 | 'post_name' => $atts['form_id'] . '_email_' . $atts['email_key'], |
| 1329 | - ); |
|
| 1329 | + ); |
|
| 1330 | 1330 | |
| 1331 | - // Add more fields to the new notification |
|
| 1332 | - $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
|
| 1333 | - foreach ( $add_fields as $add_field ) { |
|
| 1331 | + // Add more fields to the new notification |
|
| 1332 | + $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
|
| 1333 | + foreach ( $add_fields as $add_field ) { |
|
| 1334 | 1334 | if ( isset( $notification[ $add_field ] ) ) { |
| 1335 | 1335 | $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
| 1336 | - } else if ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
|
| 1336 | + } else if ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
|
| 1337 | 1337 | $new_notification['post_content'][ $add_field ] = 0; |
| 1338 | - } else { |
|
| 1338 | + } else { |
|
| 1339 | 1339 | $new_notification['post_content'][ $add_field ] = ''; |
| 1340 | - } |
|
| 1341 | - unset( $add_field ); |
|
| 1342 | - } |
|
| 1340 | + } |
|
| 1341 | + unset( $add_field ); |
|
| 1342 | + } |
|
| 1343 | 1343 | |
| 1344 | 1344 | // Set reply to |
| 1345 | 1345 | $new_notification['post_content']['reply_to'] = $atts['reply_to']; |
| 1346 | 1346 | |
| 1347 | - // Set from |
|
| 1347 | + // Set from |
|
| 1348 | 1348 | if ( ! empty( $atts['reply_to'] ) || ! empty( $atts['reply_to_name'] ) ) { |
| 1349 | 1349 | $new_notification['post_content']['from'] = ( empty( $atts['reply_to_name'] ) ? '[sitename]' : $atts['reply_to_name'] ) . ' <' . ( empty( $atts['reply_to'] ) ? '[admin_email]' : $atts['reply_to'] ) . '>'; |
| 1350 | - } |
|
| 1351 | - } |
|
| 1350 | + } |
|
| 1351 | + } |
|
| 1352 | 1352 | |
| 1353 | 1353 | /** |
| 1354 | - * Switch field IDs in pre-2.0 email conditional logic |
|
| 1355 | - * |
|
| 1356 | - * @param $post_content array, pass by reference |
|
| 1357 | - */ |
|
| 1354 | + * Switch field IDs in pre-2.0 email conditional logic |
|
| 1355 | + * |
|
| 1356 | + * @param $post_content array, pass by reference |
|
| 1357 | + */ |
|
| 1358 | 1358 | private static function switch_email_contition_field_ids( &$post_content ) { |
| 1359 | 1359 | // Switch field IDs in conditional logic |
| 1360 | 1360 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
@@ -1367,7 +1367,7 @@ discard block |
||
| 1367 | 1367 | } |
| 1368 | 1368 | } |
| 1369 | 1369 | |
| 1370 | - private static function migrate_autoresponder_to_action( $form_options, $form_id, &$notifications ) { |
|
| 1370 | + private static function migrate_autoresponder_to_action( $form_options, $form_id, &$notifications ) { |
|
| 1371 | 1371 | if ( isset( $form_options['auto_responder'] ) && $form_options['auto_responder'] && isset( $form_options['ar_email_message'] ) && $form_options['ar_email_message'] ) { |
| 1372 | 1372 | // migrate autoresponder |
| 1373 | 1373 | |
@@ -1383,8 +1383,8 @@ discard block |
||
| 1383 | 1383 | $email_field = '[' . $email_field . ']'; |
| 1384 | 1384 | } |
| 1385 | 1385 | |
| 1386 | - $notification = $form_options; |
|
| 1387 | - $new_notification2 = array( |
|
| 1386 | + $notification = $form_options; |
|
| 1387 | + $new_notification2 = array( |
|
| 1388 | 1388 | 'post_content' => array( |
| 1389 | 1389 | 'email_message' => $notification['ar_email_message'], |
| 1390 | 1390 | 'email_subject' => isset( $notification['ar_email_subject'] ) ? $notification['ar_email_subject'] : '', |
@@ -1393,7 +1393,7 @@ discard block |
||
| 1393 | 1393 | 'inc_user_info' => 0, |
| 1394 | 1394 | ), |
| 1395 | 1395 | 'post_name' => $form_id . '_email_' . count( $notifications ), |
| 1396 | - ); |
|
| 1396 | + ); |
|
| 1397 | 1397 | |
| 1398 | 1398 | $reply_to = isset( $notification['ar_reply_to'] ) ? $notification['ar_reply_to'] : ''; |
| 1399 | 1399 | $reply_to_name = isset( $notification['ar_reply_to_name'] ) ? $notification['ar_reply_to_name'] : ''; |
@@ -1406,9 +1406,9 @@ discard block |
||
| 1406 | 1406 | $new_notification2['post_content']['from'] = ( empty( $reply_to_name ) ? '[sitename]' : $reply_to_name ) . ' <' . ( empty( $reply_to ) ? '[admin_email]' : $reply_to ) . '>'; |
| 1407 | 1407 | } |
| 1408 | 1408 | |
| 1409 | - $notifications[] = $new_notification2; |
|
| 1410 | - unset( $new_notification2 ); |
|
| 1411 | - } |
|
| 1412 | - } |
|
| 1409 | + $notifications[] = $new_notification2; |
|
| 1410 | + unset( $new_notification2 ); |
|
| 1411 | + } |
|
| 1412 | + } |
|
| 1413 | 1413 | } |
| 1414 | 1414 | |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | 117 | if ( $term && is_array( $term ) ) { |
| 118 | - $imported['imported']['terms']++; |
|
| 119 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
| 118 | + $imported['imported']['terms'] ++; |
|
| 119 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | unset( $term, $t ); |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | } else { |
| 166 | 166 | $form_id = FrmForm::create( $form ); |
| 167 | 167 | if ( $form_id ) { |
| 168 | - $imported['imported']['forms']++; |
|
| 168 | + $imported['imported']['forms'] ++; |
|
| 169 | 169 | // Keep track of whether this specific form was updated or not |
| 170 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
| 170 | + $imported['form_status'][$form_id] = 'imported'; |
|
| 171 | 171 | self::track_imported_child_forms( (int) $form_id, $form['parent_form_id'], $child_forms ); |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | // Update field ids/keys to new ones |
| 180 | 180 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
| 181 | 181 | |
| 182 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
| 182 | + $imported['forms'][(int) $item->id] = $form_id; |
|
| 183 | 183 | |
| 184 | 184 | // Send pre 2.0 form options through function that creates actions |
| 185 | 185 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
@@ -231,17 +231,17 @@ discard block |
||
| 231 | 231 | private static function update_form( $this_form, $form, &$imported ) { |
| 232 | 232 | $form_id = $this_form->id; |
| 233 | 233 | FrmForm::update( $form_id, $form ); |
| 234 | - $imported['updated']['forms']++; |
|
| 234 | + $imported['updated']['forms'] ++; |
|
| 235 | 235 | // Keep track of whether this specific form was updated or not |
| 236 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
| 236 | + $imported['form_status'][$form_id] = 'updated'; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | private static function get_form_fields( $form_id ) { |
| 240 | 240 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' ); |
| 241 | 241 | $old_fields = array(); |
| 242 | 242 | foreach ( $form_fields as $f ) { |
| 243 | - $old_fields[ $f->id ] = $f; |
|
| 244 | - $old_fields[ $f->field_key ] = $f->id; |
|
| 243 | + $old_fields[$f->id] = $f; |
|
| 244 | + $old_fields[$f->field_key] = $f->id; |
|
| 245 | 245 | unset( $f ); |
| 246 | 246 | } |
| 247 | 247 | $form_fields = $old_fields; |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | */ |
| 296 | 296 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
| 297 | 297 | if ( $parent_form_id ) { |
| 298 | - $child_forms[ $form_id ] = $parent_form_id; |
|
| 298 | + $child_forms[$form_id] = $parent_form_id; |
|
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | |
@@ -310,9 +310,9 @@ discard block |
||
| 310 | 310 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
| 311 | 311 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
| 312 | 312 | |
| 313 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && $imported_forms[ $old_parent_form_id ] != $old_parent_form_id ) { |
|
| 313 | + if ( isset( $imported_forms[$old_parent_form_id] ) && $imported_forms[$old_parent_form_id] != $old_parent_form_id ) { |
|
| 314 | 314 | // Update all children with this old parent_form_id |
| 315 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
| 315 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
| 316 | 316 | |
| 317 | 317 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
| 318 | 318 | } |
@@ -347,25 +347,25 @@ discard block |
||
| 347 | 347 | |
| 348 | 348 | if ( ! empty( $this_form ) ) { |
| 349 | 349 | // check for field to edit by field id |
| 350 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
| 350 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
| 351 | 351 | FrmField::update( $f['id'], $f ); |
| 352 | - $imported['updated']['fields']++; |
|
| 352 | + $imported['updated']['fields'] ++; |
|
| 353 | 353 | |
| 354 | - unset( $form_fields[ $f['id'] ] ); |
|
| 354 | + unset( $form_fields[$f['id']] ); |
|
| 355 | 355 | |
| 356 | 356 | //unset old field key |
| 357 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 358 | - unset( $form_fields[ $f['field_key'] ] ); |
|
| 357 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 358 | + unset( $form_fields[$f['field_key']] ); |
|
| 359 | 359 | } |
| 360 | - } else if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 360 | + } else if ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 361 | 361 | // check for field to edit by field key |
| 362 | 362 | unset( $f['id'] ); |
| 363 | 363 | |
| 364 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
| 365 | - $imported['updated']['fields']++; |
|
| 364 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
| 365 | + $imported['updated']['fields'] ++; |
|
| 366 | 366 | |
| 367 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); //unset old field id |
|
| 368 | - unset( $form_fields[ $f['field_key'] ] ); //unset old field key |
|
| 367 | + unset( $form_fields[$form_fields[$f['field_key']]] ); //unset old field id |
|
| 368 | + unset( $form_fields[$f['field_key']] ); //unset old field key |
|
| 369 | 369 | } else { |
| 370 | 370 | // if no matching field id or key in this form, create the field |
| 371 | 371 | self::create_imported_field( $f, $imported ); |
@@ -432,8 +432,8 @@ discard block |
||
| 432 | 432 | if ( $f['type'] == 'form' || ( $f['type'] == 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) { |
| 433 | 433 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
| 434 | 434 | $form_select = (int) $f['field_options']['form_select']; |
| 435 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
| 436 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
| 435 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
| 436 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | } |
@@ -453,8 +453,8 @@ discard block |
||
| 453 | 453 | |
| 454 | 454 | if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) { |
| 455 | 455 | $old_form = $f['field_options']['get_values_form']; |
| 456 | - if ( isset( $imported['forms'][ $old_form ] ) ) { |
|
| 457 | - $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ]; |
|
| 456 | + if ( isset( $imported['forms'][$old_form] ) ) { |
|
| 457 | + $f['field_options']['get_values_form'] = $imported['forms'][$old_form]; |
|
| 458 | 458 | } |
| 459 | 459 | } |
| 460 | 460 | } |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | private static function create_imported_field( $f, &$imported ) { |
| 470 | 470 | $new_id = FrmField::create( $f ); |
| 471 | 471 | if ( $new_id != false ) { |
| 472 | - $imported['imported']['fields']++; |
|
| 472 | + $imported['imported']['fields'] ++; |
|
| 473 | 473 | do_action( 'frm_after_field_is_imported', $f, $new_id ); |
| 474 | 474 | } |
| 475 | 475 | } |
@@ -599,17 +599,17 @@ discard block |
||
| 599 | 599 | self::update_postmeta( $post, $post_id ); |
| 600 | 600 | |
| 601 | 601 | $this_type = 'posts'; |
| 602 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
| 603 | - $this_type = $post_types[ $post['post_type'] ]; |
|
| 602 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
| 603 | + $this_type = $post_types[$post['post_type']]; |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) { |
| 607 | - $imported['updated'][ $this_type ]++; |
|
| 607 | + $imported['updated'][$this_type] ++; |
|
| 608 | 608 | } else { |
| 609 | - $imported['imported'][ $this_type ]++; |
|
| 609 | + $imported['imported'][$this_type] ++; |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | - $imported['posts'][ (int) $old_id ] = $post_id; |
|
| 612 | + $imported['posts'][(int) $old_id] = $post_id; |
|
| 613 | 613 | |
| 614 | 614 | do_action( 'frm_after_import_view', $post_id, $post ); |
| 615 | 615 | |
@@ -626,9 +626,9 @@ discard block |
||
| 626 | 626 | $post['attachment_url'] = (string) $item->attachment_url; |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | - if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
| 629 | + if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
| 630 | 630 | // update to new form id |
| 631 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
| 631 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | // Don't allow default styles to take over a site's default style |
@@ -655,8 +655,8 @@ discard block |
||
| 655 | 655 | ); |
| 656 | 656 | |
| 657 | 657 | //switch old form and field ids to new ones |
| 658 | - if ( $m['key'] == 'frm_form_id' && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
|
| 659 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
| 658 | + if ( $m['key'] == 'frm_form_id' && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
| 659 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
| 660 | 660 | } else { |
| 661 | 661 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 662 | 662 | |
@@ -667,15 +667,15 @@ discard block |
||
| 667 | 667 | } else if ( $m['key'] == 'frm_options' ) { |
| 668 | 668 | |
| 669 | 669 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
| 670 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
| 671 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
| 670 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
| 671 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
| 672 | 672 | } |
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | $check_dup_array = array(); |
| 676 | 676 | if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) { |
| 677 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
| 678 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
| 677 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
| 678 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
| 679 | 679 | } else if ( is_array( $m['value']['order_by'] ) ) { |
| 680 | 680 | $check_dup_array[] = 'order_by'; |
| 681 | 681 | } |
@@ -686,9 +686,9 @@ discard block |
||
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | foreach ( $check_dup_array as $check_k ) { |
| 689 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
| 690 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
| 691 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
| 689 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
| 690 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
| 691 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
| 692 | 692 | } |
| 693 | 693 | unset( $mk, $mv ); |
| 694 | 694 | } |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
| 704 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | /** |
@@ -729,11 +729,11 @@ discard block |
||
| 729 | 729 | $name = (string) $c; |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
| 733 | - $post['tax_input'][ $taxonomy ] = array(); |
|
| 732 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
| 733 | + $post['tax_input'][$taxonomy] = array(); |
|
| 734 | 734 | } |
| 735 | 735 | |
| 736 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
| 736 | + $post['tax_input'][$taxonomy][] = $name; |
|
| 737 | 737 | unset( $name ); |
| 738 | 738 | } |
| 739 | 739 | } |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | |
| 832 | 832 | $message = '<ul>'; |
| 833 | 833 | foreach ( $result as $type => $results ) { |
| 834 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
| 834 | + if ( ! isset( $t_strings[$type] ) ) { |
|
| 835 | 835 | // only print imported and updated |
| 836 | 836 | continue; |
| 837 | 837 | } |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | } |
| 844 | 844 | |
| 845 | 845 | if ( ! empty( $s_message ) ) { |
| 846 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
| 846 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
| 847 | 847 | $message .= implode( ', ', $s_message ); |
| 848 | 848 | $message .= '</li>'; |
| 849 | 849 | } |
@@ -873,7 +873,7 @@ discard block |
||
| 873 | 873 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
| 874 | 874 | ); |
| 875 | 875 | |
| 876 | - $s_message[] = isset( $strings[ $type ] ) ? $strings[ $type ] : ' ' . $m . ' ' . ucfirst( $type ); |
|
| 876 | + $s_message[] = isset( $strings[$type] ) ? $strings[$type] : ' ' . $m . ' ' . ucfirst( $type ); |
|
| 877 | 877 | } |
| 878 | 878 | |
| 879 | 879 | /** |
@@ -970,10 +970,10 @@ discard block |
||
| 970 | 970 | $array_defaults = array_filter( $defaults, 'is_array' ); |
| 971 | 971 | foreach ( $array_defaults as $d => $default ) { |
| 972 | 972 | // compare array defaults |
| 973 | - if ( $default == $saved[ $d ] ) { |
|
| 974 | - unset( $saved[ $d ] ); |
|
| 973 | + if ( $default == $saved[$d] ) { |
|
| 974 | + unset( $saved[$d] ); |
|
| 975 | 975 | } |
| 976 | - unset( $defaults[ $d ] ); |
|
| 976 | + unset( $defaults[$d] ); |
|
| 977 | 977 | } |
| 978 | 978 | $saved = array_diff_assoc( (array) $saved, $defaults ); |
| 979 | 979 | } |
@@ -984,21 +984,21 @@ discard block |
||
| 984 | 984 | * @since 3.06 |
| 985 | 985 | */ |
| 986 | 986 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
| 987 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
| 987 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
| 988 | 988 | return; |
| 989 | 989 | } |
| 990 | 990 | |
| 991 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
| 992 | - $default_html = $defaults[ $html_name ]; |
|
| 991 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
| 992 | + $default_html = $defaults[$html_name]; |
|
| 993 | 993 | if ( $old_html == $default_html ) { |
| 994 | - unset( $options[ $html_name ] ); |
|
| 994 | + unset( $options[$html_name] ); |
|
| 995 | 995 | return; |
| 996 | 996 | } |
| 997 | 997 | |
| 998 | 998 | // Account for some of the older field default HTML. |
| 999 | 999 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
| 1000 | 1000 | if ( $old_html == $default_html ) { |
| 1001 | - unset( $options[ $html_name ] ); |
|
| 1001 | + unset( $options[$html_name] ); |
|
| 1002 | 1002 | } |
| 1003 | 1003 | } |
| 1004 | 1004 | |
@@ -1072,8 +1072,8 @@ discard block |
||
| 1072 | 1072 | $post_settings = array( 'post_type', 'post_category', 'post_content', 'post_excerpt', 'post_title', 'post_name', 'post_date', 'post_status', 'post_custom_fields', 'post_password' ); |
| 1073 | 1073 | |
| 1074 | 1074 | foreach ( $post_settings as $post_setting ) { |
| 1075 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
| 1076 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
| 1075 | + if ( isset( $form_options[$post_setting] ) ) { |
|
| 1076 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
| 1077 | 1077 | } |
| 1078 | 1078 | unset( $post_setting ); |
| 1079 | 1079 | } |
@@ -1103,7 +1103,7 @@ discard block |
||
| 1103 | 1103 | if ( ! $exists ) { |
| 1104 | 1104 | // this isn't an email, but we need to use a class that will always be included |
| 1105 | 1105 | FrmDb::save_json_post( $new_action ); |
| 1106 | - $imported['imported']['actions']++; |
|
| 1106 | + $imported['imported']['actions'] ++; |
|
| 1107 | 1107 | } |
| 1108 | 1108 | } |
| 1109 | 1109 | |
@@ -1135,11 +1135,11 @@ discard block |
||
| 1135 | 1135 | foreach ( $post_content as $key => $setting ) { |
| 1136 | 1136 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
| 1137 | 1137 | // Replace old IDs with new IDs |
| 1138 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
| 1138 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
| 1139 | 1139 | } else if ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
| 1140 | 1140 | foreach ( $setting as $k => $val ) { |
| 1141 | 1141 | // Replace old IDs with new IDs |
| 1142 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
| 1142 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
| 1143 | 1143 | } |
| 1144 | 1144 | } |
| 1145 | 1145 | unset( $key, $setting ); |
@@ -1169,7 +1169,7 @@ discard block |
||
| 1169 | 1169 | foreach ( $notifications as $new_notification ) { |
| 1170 | 1170 | $new_notification['post_type'] = $post_type; |
| 1171 | 1171 | $new_notification['post_excerpt'] = 'email'; |
| 1172 | - $new_notification['post_title'] = __( 'Email Notification', 'formidable' ); |
|
| 1172 | + $new_notification['post_title'] = __( 'Email Notification', 'formidable' ); |
|
| 1173 | 1173 | $new_notification['menu_order'] = $form_id; |
| 1174 | 1174 | $new_notification['post_status'] = 'publish'; |
| 1175 | 1175 | |
@@ -1182,7 +1182,7 @@ discard block |
||
| 1182 | 1182 | // Switch all other field IDs in email |
| 1183 | 1183 | $new_notification['post_content'] = FrmFieldsHelper::switch_field_ids( $new_notification['post_content'] ); |
| 1184 | 1184 | } |
| 1185 | - $new_notification['post_content'] = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] ); |
|
| 1185 | + $new_notification['post_content'] = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] ); |
|
| 1186 | 1186 | |
| 1187 | 1187 | $exists = get_posts( |
| 1188 | 1188 | array( |
@@ -1195,7 +1195,7 @@ discard block |
||
| 1195 | 1195 | |
| 1196 | 1196 | if ( empty( $exists ) ) { |
| 1197 | 1197 | FrmDb::save_json_post( $new_notification ); |
| 1198 | - $imported['imported']['actions']++; |
|
| 1198 | + $imported['imported']['actions'] ++; |
|
| 1199 | 1199 | } |
| 1200 | 1200 | unset( $new_notification ); |
| 1201 | 1201 | } |
@@ -1214,8 +1214,8 @@ discard block |
||
| 1214 | 1214 | private static function remove_deprecated_notification_settings( $form_id, $form_options ) { |
| 1215 | 1215 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
| 1216 | 1216 | foreach ( $delete_settings as $index ) { |
| 1217 | - if ( isset( $form_options[ $index ] ) ) { |
|
| 1218 | - unset( $form_options[ $index ] ); |
|
| 1217 | + if ( isset( $form_options[$index] ) ) { |
|
| 1218 | + unset( $form_options[$index] ); |
|
| 1219 | 1219 | } |
| 1220 | 1220 | } |
| 1221 | 1221 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -1268,12 +1268,12 @@ discard block |
||
| 1268 | 1268 | 'reply_to_name' => '', |
| 1269 | 1269 | ); |
| 1270 | 1270 | foreach ( $reply_fields as $f => $val ) { |
| 1271 | - if ( isset( $notification[ $f ] ) ) { |
|
| 1272 | - $atts[ $f ] = $notification[ $f ]; |
|
| 1273 | - if ( 'custom' == $notification[ $f ] ) { |
|
| 1274 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
| 1275 | - } else if ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
| 1276 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
| 1271 | + if ( isset( $notification[$f] ) ) { |
|
| 1272 | + $atts[$f] = $notification[$f]; |
|
| 1273 | + if ( 'custom' == $notification[$f] ) { |
|
| 1274 | + $atts[$f] = $notification['cust_' . $f]; |
|
| 1275 | + } else if ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
| 1276 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
| 1277 | 1277 | } |
| 1278 | 1278 | } |
| 1279 | 1279 | unset( $f, $val ); |
@@ -1304,13 +1304,13 @@ discard block |
||
| 1304 | 1304 | foreach ( $atts['email_to'] as $key => $email_field ) { |
| 1305 | 1305 | |
| 1306 | 1306 | if ( is_numeric( $email_field ) ) { |
| 1307 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
| 1307 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | 1310 | if ( strpos( $email_field, '|' ) ) { |
| 1311 | 1311 | $email_opt = explode( '|', $email_field ); |
| 1312 | 1312 | if ( isset( $email_opt[0] ) ) { |
| 1313 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 1313 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 1314 | 1314 | } |
| 1315 | 1315 | unset( $email_opt ); |
| 1316 | 1316 | } |
@@ -1331,12 +1331,12 @@ discard block |
||
| 1331 | 1331 | // Add more fields to the new notification |
| 1332 | 1332 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
| 1333 | 1333 | foreach ( $add_fields as $add_field ) { |
| 1334 | - if ( isset( $notification[ $add_field ] ) ) { |
|
| 1335 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
| 1334 | + if ( isset( $notification[$add_field] ) ) { |
|
| 1335 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
| 1336 | 1336 | } else if ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
| 1337 | - $new_notification['post_content'][ $add_field ] = 0; |
|
| 1337 | + $new_notification['post_content'][$add_field] = 0; |
|
| 1338 | 1338 | } else { |
| 1339 | - $new_notification['post_content'][ $add_field ] = ''; |
|
| 1339 | + $new_notification['post_content'][$add_field] = ''; |
|
| 1340 | 1340 | } |
| 1341 | 1341 | unset( $add_field ); |
| 1342 | 1342 | } |
@@ -1360,7 +1360,7 @@ discard block |
||
| 1360 | 1360 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
| 1361 | 1361 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
| 1362 | 1362 | if ( is_numeric( $email_key ) ) { |
| 1363 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 1363 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 1364 | 1364 | } |
| 1365 | 1365 | unset( $email_key, $val ); |
| 1366 | 1366 | } |