@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined('ABSPATH') ) { |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | 3 | die( 'You are not allowed to call this page directly.' ); |
4 | 4 | } |
5 | 5 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | echo "\n" . $padding; |
12 | 12 | $tag = ( is_numeric( $ok ) ? 'key:' : '' ) . $ok; |
13 | 13 | echo '<' . $tag . '>'; |
14 | - self::get_xml_values( $ov, $padding .' ' ); |
|
14 | + self::get_xml_values( $ov, $padding . ' ' ); |
|
15 | 15 | if ( is_array( $ov ) ) { |
16 | 16 | echo "\n" . $padding; |
17 | 17 | } |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | 'terms' => array(), |
37 | 37 | ); |
38 | 38 | |
39 | - unset($defaults); |
|
39 | + unset( $defaults ); |
|
40 | 40 | |
41 | 41 | if ( ! defined( 'WP_IMPORTING' ) ) { |
42 | - define('WP_IMPORTING', true); |
|
42 | + define( 'WP_IMPORTING', true ); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | if ( ! class_exists( 'DOMDocument' ) ) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this XML file', 'formidable' ), libxml_get_errors() ); |
53 | 53 | } |
54 | 54 | |
55 | - if ( ! function_exists('simplexml_import_dom') ) { |
|
55 | + if ( ! function_exists( 'simplexml_import_dom' ) ) { |
|
56 | 56 | return new WP_Error( 'SimpleXML_parse_error', __( 'Your server is missing the simplexml_import_dom function', 'formidable' ), libxml_get_errors() ); |
57 | 57 | } |
58 | 58 | |
@@ -67,21 +67,21 @@ discard block |
||
67 | 67 | // add terms, forms (form and field ids), posts (post ids), and entries to db, in that order |
68 | 68 | foreach ( array( 'term', 'form', 'view' ) as $item_type ) { |
69 | 69 | // grab cats, tags, and terms, or forms or posts |
70 | - if ( isset($xml->{$item_type} ) ) { |
|
70 | + if ( isset( $xml->{$item_type} ) ) { |
|
71 | 71 | $function_name = 'import_xml_' . $item_type . 's'; |
72 | 72 | $imported = self::$function_name( $xml->{$item_type}, $imported ); |
73 | 73 | unset( $function_name, $xml->{$item_type} ); |
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | - $return = apply_filters('frm_importing_xml', $imported, $xml ); |
|
77 | + $return = apply_filters( 'frm_importing_xml', $imported, $xml ); |
|
78 | 78 | |
79 | 79 | return $return; |
80 | 80 | } |
81 | 81 | |
82 | 82 | public static function import_xml_terms( $terms, $imported ) { |
83 | 83 | foreach ( $terms as $t ) { |
84 | - if ( term_exists((string) $t->term_slug, (string) $t->term_taxonomy) ) { |
|
84 | + if ( term_exists( (string) $t->term_slug, (string) $t->term_taxonomy ) ) { |
|
85 | 85 | continue; |
86 | 86 | } |
87 | 87 | |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | 'description' => (string) $t->term_description, |
93 | 93 | 'parent' => empty( $parent ) ? 0 : $parent, |
94 | 94 | 'slug' => (string) $t->term_slug, |
95 | - )); |
|
95 | + ) ); |
|
96 | 96 | |
97 | 97 | if ( $term && is_array( $term ) ) { |
98 | - $imported['imported']['terms']++; |
|
99 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
98 | + $imported['imported']['terms'] ++; |
|
99 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | unset( $term, $t ); |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | 'default_template' => (int) $item->default_template, |
140 | 140 | 'editable' => (int) $item->editable, |
141 | 141 | 'status' => (string) $item->status, |
142 | - 'parent_form_id' => isset($item->parent_form_id) ? (int) $item->parent_form_id : 0, |
|
143 | - 'created_at' => date('Y-m-d H:i:s', strtotime((string) $item->created_at)), |
|
142 | + 'parent_form_id' => isset( $item->parent_form_id ) ? (int) $item->parent_form_id : 0, |
|
143 | + 'created_at' => date( 'Y-m-d H:i:s', strtotime( (string) $item->created_at ) ), |
|
144 | 144 | ); |
145 | 145 | |
146 | - $form['options'] = FrmAppHelper::maybe_json_decode($form['options']); |
|
146 | + $form['options'] = FrmAppHelper::maybe_json_decode( $form['options'] ); |
|
147 | 147 | |
148 | 148 | self::update_custom_style_setting_on_import( $form ); |
149 | 149 | |
@@ -153,35 +153,35 @@ discard block |
||
153 | 153 | $edit_query['created_at'] = $form['created_at']; |
154 | 154 | } |
155 | 155 | |
156 | - $edit_query = apply_filters('frm_match_xml_form', $edit_query, $form); |
|
156 | + $edit_query = apply_filters( 'frm_match_xml_form', $edit_query, $form ); |
|
157 | 157 | |
158 | - $this_form = FrmForm::getAll($edit_query, '', 1); |
|
159 | - unset($edit_query); |
|
158 | + $this_form = FrmForm::getAll( $edit_query, '', 1 ); |
|
159 | + unset( $edit_query ); |
|
160 | 160 | |
161 | 161 | if ( ! empty( $this_form ) ) { |
162 | 162 | $old_id = $form_id = $this_form->id; |
163 | - FrmForm::update($form_id, $form ); |
|
164 | - $imported['updated']['forms']++; |
|
163 | + FrmForm::update( $form_id, $form ); |
|
164 | + $imported['updated']['forms'] ++; |
|
165 | 165 | // Keep track of whether this specific form was updated or not |
166 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
166 | + $imported['form_status'][$form_id] = 'updated'; |
|
167 | 167 | |
168 | 168 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' ); |
169 | 169 | $old_fields = array(); |
170 | 170 | foreach ( $form_fields as $f ) { |
171 | - $old_fields[ $f->id ] = $f; |
|
172 | - $old_fields[ $f->field_key ] = $f->id; |
|
173 | - unset($f); |
|
171 | + $old_fields[$f->id] = $f; |
|
172 | + $old_fields[$f->field_key] = $f->id; |
|
173 | + unset( $f ); |
|
174 | 174 | } |
175 | 175 | $form_fields = $old_fields; |
176 | - unset($old_fields); |
|
176 | + unset( $old_fields ); |
|
177 | 177 | } else { |
178 | 178 | $old_id = false; |
179 | 179 | //form does not exist, so create it |
180 | 180 | $form_id = FrmForm::create( $form ); |
181 | 181 | if ( $form_id ) { |
182 | - $imported['imported']['forms']++; |
|
182 | + $imported['imported']['forms'] ++; |
|
183 | 183 | // Keep track of whether this specific form was updated or not |
184 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
184 | + $imported['form_status'][$form_id] = 'imported'; |
|
185 | 185 | self::track_imported_child_forms( (int) $form_id, $form['parent_form_id'], $child_forms ); |
186 | 186 | } |
187 | 187 | } |
@@ -191,23 +191,23 @@ discard block |
||
191 | 191 | // Delete any fields attached to this form that were not included in the template |
192 | 192 | if ( isset( $form_fields ) && ! empty( $form_fields ) ) { |
193 | 193 | foreach ( $form_fields as $field ) { |
194 | - if ( is_object($field) ) { |
|
195 | - FrmField::destroy($field->id); |
|
194 | + if ( is_object( $field ) ) { |
|
195 | + FrmField::destroy( $field->id ); |
|
196 | 196 | } |
197 | - unset($field); |
|
197 | + unset( $field ); |
|
198 | 198 | } |
199 | - unset($form_fields); |
|
199 | + unset( $form_fields ); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | // Update field ids/keys to new ones |
203 | 203 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
204 | 204 | |
205 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
205 | + $imported['forms'][(int) $item->id] = $form_id; |
|
206 | 206 | |
207 | 207 | // Send pre 2.0 form options through function that creates actions |
208 | 208 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, $switch = true ); |
209 | 209 | |
210 | - unset($form, $item); |
|
210 | + unset( $form, $item ); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | self::maybe_update_child_form_parent_id( $imported['forms'], $child_forms ); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $regular_forms = array(); |
227 | 227 | |
228 | 228 | foreach ( $forms as $form ) { |
229 | - $parent_form_id = isset( $form->parent_form_id) ? (int) $form->parent_form_id : 0; |
|
229 | + $parent_form_id = isset( $form->parent_form_id ) ? (int) $form->parent_form_id : 0; |
|
230 | 230 | |
231 | 231 | if ( $parent_form_id ) { |
232 | 232 | $child_forms[] = $form; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
250 | 250 | if ( $parent_form_id ) { |
251 | - $child_forms[ $form_id ] = $parent_form_id; |
|
251 | + $child_forms[$form_id] = $parent_form_id; |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
264 | 264 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
265 | 265 | |
266 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && $imported_forms[ $old_parent_form_id ] != $old_parent_form_id ) { |
|
266 | + if ( isset( $imported_forms[$old_parent_form_id] ) && $imported_forms[$old_parent_form_id] != $old_parent_form_id ) { |
|
267 | 267 | // Update all children with this old parent_form_id |
268 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
268 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
269 | 269 | |
270 | 270 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
271 | 271 | } |
@@ -286,51 +286,51 @@ discard block |
||
286 | 286 | 'name' => (string) $field->name, |
287 | 287 | 'description' => (string) $field->description, |
288 | 288 | 'type' => (string) $field->type, |
289 | - 'default_value' => FrmAppHelper::maybe_json_decode( (string) $field->default_value), |
|
289 | + 'default_value' => FrmAppHelper::maybe_json_decode( (string) $field->default_value ), |
|
290 | 290 | 'field_order' => (int) $field->field_order, |
291 | 291 | 'form_id' => (int) $form_id, |
292 | 292 | 'required' => (int) $field->required, |
293 | - 'options' => FrmAppHelper::maybe_json_decode( (string) $field->options), |
|
293 | + 'options' => FrmAppHelper::maybe_json_decode( (string) $field->options ), |
|
294 | 294 | 'field_options' => FrmAppHelper::maybe_json_decode( (string) $field->field_options ), |
295 | 295 | ); |
296 | 296 | |
297 | - if ( is_array($f['default_value']) && in_array($f['type'], array( |
|
297 | + if ( is_array( $f['default_value'] ) && in_array( $f['type'], array( |
|
298 | 298 | 'text', 'email', 'url', 'textarea', |
299 | - 'number','phone', 'date', 'time', |
|
299 | + 'number', 'phone', 'date', 'time', |
|
300 | 300 | 'hidden', 'password', 'tag', 'image', |
301 | - )) ) { |
|
302 | - if ( count($f['default_value']) === 1 ) { |
|
303 | - $f['default_value'] = '['. reset($f['default_value']) .']'; |
|
301 | + ) ) ) { |
|
302 | + if ( count( $f['default_value'] ) === 1 ) { |
|
303 | + $f['default_value'] = '[' . reset( $f['default_value'] ) . ']'; |
|
304 | 304 | } else { |
305 | - $f['default_value'] = reset($f['default_value']); |
|
305 | + $f['default_value'] = reset( $f['default_value'] ); |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | |
309 | - $f = apply_filters('frm_duplicated_field', $f); |
|
309 | + $f = apply_filters( 'frm_duplicated_field', $f ); |
|
310 | 310 | |
311 | 311 | self::maybe_update_form_select( $f, $imported ); |
312 | 312 | |
313 | - if ( ! empty($this_form) ) { |
|
313 | + if ( ! empty( $this_form ) ) { |
|
314 | 314 | // check for field to edit by field id |
315 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
315 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
316 | 316 | FrmField::update( $f['id'], $f ); |
317 | - $imported['updated']['fields']++; |
|
317 | + $imported['updated']['fields'] ++; |
|
318 | 318 | |
319 | - unset( $form_fields[ $f['id'] ] ); |
|
319 | + unset( $form_fields[$f['id']] ); |
|
320 | 320 | |
321 | 321 | //unset old field key |
322 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
323 | - unset( $form_fields[ $f['field_key'] ] ); |
|
322 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
323 | + unset( $form_fields[$f['field_key']] ); |
|
324 | 324 | } |
325 | - } else if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
325 | + } else if ( isset( $form_fields[$f['field_key']] ) ) { |
|
326 | 326 | // check for field to edit by field key |
327 | - unset($f['id']); |
|
327 | + unset( $f['id'] ); |
|
328 | 328 | |
329 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
330 | - $imported['updated']['fields']++; |
|
329 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
330 | + $imported['updated']['fields'] ++; |
|
331 | 331 | |
332 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); //unset old field id |
|
333 | - unset( $form_fields[ $f['field_key'] ] ); //unset old field key |
|
332 | + unset( $form_fields[$form_fields[$f['field_key']]] ); //unset old field id |
|
333 | + unset( $form_fields[$f['field_key']] ); //unset old field key |
|
334 | 334 | } else { |
335 | 335 | $new_id = FrmField::create( $f ); |
336 | 336 | if ( $new_id == false ) { |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | // if no matching field id or key in this form, create the field |
341 | - $imported['imported']['fields']++; |
|
341 | + $imported['imported']['fields'] ++; |
|
342 | 342 | } |
343 | 343 | } else { |
344 | 344 | $new_id = FrmField::create( $f ); |
@@ -346,10 +346,10 @@ discard block |
||
346 | 346 | continue; |
347 | 347 | } |
348 | 348 | |
349 | - $imported['imported']['fields']++; |
|
349 | + $imported['imported']['fields'] ++; |
|
350 | 350 | } |
351 | 351 | |
352 | - unset($field, $new_id); |
|
352 | + unset( $field, $new_id ); |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | if ( $f['type'] == 'form' || ( $f['type'] == 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) { |
369 | 369 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
370 | 370 | $form_select = $f['field_options']['form_select']; |
371 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
372 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
371 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
372 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * |
384 | 384 | */ |
385 | 385 | private static function update_custom_style_setting_on_import( &$form ) { |
386 | - if ( is_numeric ( $form['options']['custom_style'] ) ) { |
|
386 | + if ( is_numeric( $form['options']['custom_style'] ) ) { |
|
387 | 387 | // Set to default |
388 | 388 | $form['options']['custom_style'] = 1; |
389 | 389 | } else { |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | $wpdb->prefix . 'posts |
397 | 397 | WHERE |
398 | 398 | post_name=%s'; |
399 | - $query = $wpdb->prepare($raw_query, $form['options']['custom_style']); |
|
399 | + $query = $wpdb->prepare( $raw_query, $form['options']['custom_style'] ); |
|
400 | 400 | $style_id = $wpdb->get_var( $query ); |
401 | 401 | if ( $style_id ) { |
402 | 402 | $form['options']['custom_style'] = $style_id; |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | 'post_id' => (int) $item->post_id, |
431 | 431 | 'post_parent' => (int) $item->post_parent, |
432 | 432 | 'menu_order' => (int) $item->menu_order, |
433 | - 'post_content' => FrmFieldsHelper::switch_field_ids((string) $item->content), |
|
434 | - 'post_excerpt' => FrmFieldsHelper::switch_field_ids((string) $item->excerpt), |
|
433 | + 'post_content' => FrmFieldsHelper::switch_field_ids( (string) $item->content ), |
|
434 | + 'post_excerpt' => FrmFieldsHelper::switch_field_ids( (string) $item->excerpt ), |
|
435 | 435 | 'is_sticky' => (string) $item->is_sticky, |
436 | 436 | 'comment_status' => (string) $item->comment_status, |
437 | 437 | 'post_date' => (string) $item->post_date, |
@@ -442,9 +442,9 @@ discard block |
||
442 | 442 | ); |
443 | 443 | |
444 | 444 | $old_id = $post['post_id']; |
445 | - self::populate_post($post, $item, $imported); |
|
445 | + self::populate_post( $post, $item, $imported ); |
|
446 | 446 | |
447 | - unset($item); |
|
447 | + unset( $item ); |
|
448 | 448 | |
449 | 449 | $post_id = false; |
450 | 450 | if ( $post['post_type'] == $form_action_type ) { |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | if ( $action_control ) { |
453 | 453 | $post_id = $action_control->maybe_create_action( $post, $imported['form_status'] ); |
454 | 454 | } |
455 | - unset($action_control); |
|
455 | + unset( $action_control ); |
|
456 | 456 | } else if ( $post['post_type'] == 'frm_styles' ) { |
457 | 457 | // Properly encode post content before inserting the post |
458 | 458 | $post['post_content'] = FrmAppHelper::maybe_json_decode( $post['post_content'] ); |
@@ -465,26 +465,26 @@ discard block |
||
465 | 465 | $post_id = wp_insert_post( $post ); |
466 | 466 | } |
467 | 467 | |
468 | - if ( ! is_numeric($post_id) ) { |
|
468 | + if ( ! is_numeric( $post_id ) ) { |
|
469 | 469 | continue; |
470 | 470 | } |
471 | 471 | |
472 | - self::update_postmeta($post, $post_id); |
|
472 | + self::update_postmeta( $post, $post_id ); |
|
473 | 473 | |
474 | 474 | $this_type = 'posts'; |
475 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
476 | - $this_type = $post_types[ $post['post_type'] ]; |
|
475 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
476 | + $this_type = $post_types[$post['post_type']]; |
|
477 | 477 | } |
478 | 478 | |
479 | - if ( isset($post['ID']) && $post_id == $post['ID'] ) { |
|
480 | - $imported['updated'][ $this_type ]++; |
|
479 | + if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) { |
|
480 | + $imported['updated'][$this_type] ++; |
|
481 | 481 | } else { |
482 | - $imported['imported'][ $this_type ]++; |
|
482 | + $imported['imported'][$this_type] ++; |
|
483 | 483 | } |
484 | 484 | |
485 | - unset($post); |
|
485 | + unset( $post ); |
|
486 | 486 | |
487 | - $imported['posts'][ (int) $old_id ] = $post_id; |
|
487 | + $imported['posts'][(int) $old_id] = $post_id; |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | self::maybe_update_stylesheet( $imported ); |
@@ -493,23 +493,23 @@ discard block |
||
493 | 493 | } |
494 | 494 | |
495 | 495 | private static function populate_post( &$post, $item, $imported ) { |
496 | - if ( isset($item->attachment_url) ) { |
|
496 | + if ( isset( $item->attachment_url ) ) { |
|
497 | 497 | $post['attachment_url'] = (string) $item->attachment_url; |
498 | 498 | } |
499 | 499 | |
500 | - if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
500 | + if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
501 | 501 | // update to new form id |
502 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
502 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | foreach ( $item->postmeta as $meta ) { |
506 | - self::populate_postmeta($post, $meta, $imported); |
|
507 | - unset($meta); |
|
506 | + self::populate_postmeta( $post, $meta, $imported ); |
|
507 | + unset( $meta ); |
|
508 | 508 | } |
509 | 509 | |
510 | - self::populate_taxonomies($post, $item); |
|
510 | + self::populate_taxonomies( $post, $item ); |
|
511 | 511 | |
512 | - self::maybe_editing_post($post); |
|
512 | + self::maybe_editing_post( $post ); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | private static function populate_postmeta( &$post, $meta, $imported ) { |
@@ -521,27 +521,27 @@ discard block |
||
521 | 521 | ); |
522 | 522 | |
523 | 523 | //switch old form and field ids to new ones |
524 | - if ( $m['key'] == 'frm_form_id' && isset($imported['forms'][ (int) $m['value'] ]) ) { |
|
525 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
524 | + if ( $m['key'] == 'frm_form_id' && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
525 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
526 | 526 | } else { |
527 | - $m['value'] = FrmAppHelper::maybe_json_decode($m['value']); |
|
527 | + $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
|
528 | 528 | |
529 | - if ( ! empty($frm_duplicate_ids) ) { |
|
529 | + if ( ! empty( $frm_duplicate_ids ) ) { |
|
530 | 530 | |
531 | 531 | if ( $m['key'] == 'frm_dyncontent' ) { |
532 | - $m['value'] = FrmFieldsHelper::switch_field_ids($m['value']); |
|
532 | + $m['value'] = FrmFieldsHelper::switch_field_ids( $m['value'] ); |
|
533 | 533 | } else if ( $m['key'] == 'frm_options' ) { |
534 | 534 | |
535 | 535 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
536 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
537 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
536 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
537 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
538 | 538 | } |
539 | 539 | } |
540 | 540 | |
541 | 541 | $check_dup_array = array(); |
542 | 542 | if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) { |
543 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
544 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
543 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
544 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
545 | 545 | } else if ( is_array( $m['value']['order_by'] ) ) { |
546 | 546 | $check_dup_array[] = 'order_by'; |
547 | 547 | } |
@@ -552,22 +552,22 @@ discard block |
||
552 | 552 | } |
553 | 553 | |
554 | 554 | foreach ( $check_dup_array as $check_k ) { |
555 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
556 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
557 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
555 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
556 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
557 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
558 | 558 | } |
559 | - unset($mk, $mv); |
|
559 | + unset( $mk, $mv ); |
|
560 | 560 | } |
561 | 561 | } |
562 | 562 | } |
563 | 563 | } |
564 | 564 | } |
565 | 565 | |
566 | - if ( ! is_array($m['value']) ) { |
|
567 | - $m['value'] = FrmAppHelper::maybe_json_decode($m['value']); |
|
566 | + if ( ! is_array( $m['value'] ) ) { |
|
567 | + $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
|
568 | 568 | } |
569 | 569 | |
570 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
570 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | /** |
@@ -583,23 +583,23 @@ discard block |
||
583 | 583 | } |
584 | 584 | |
585 | 585 | $taxonomy = (string) $att['domain']; |
586 | - if ( is_taxonomy_hierarchical($taxonomy) ) { |
|
586 | + if ( is_taxonomy_hierarchical( $taxonomy ) ) { |
|
587 | 587 | $name = (string) $att['nicename']; |
588 | - $h_term = get_term_by('slug', $name, $taxonomy); |
|
588 | + $h_term = get_term_by( 'slug', $name, $taxonomy ); |
|
589 | 589 | if ( $h_term ) { |
590 | 590 | $name = $h_term->term_id; |
591 | 591 | } |
592 | - unset($h_term); |
|
592 | + unset( $h_term ); |
|
593 | 593 | } else { |
594 | 594 | $name = (string) $c; |
595 | 595 | } |
596 | 596 | |
597 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
598 | - $post['tax_input'][ $taxonomy ] = array(); |
|
597 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
598 | + $post['tax_input'][$taxonomy] = array(); |
|
599 | 599 | } |
600 | 600 | |
601 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
602 | - unset($name); |
|
601 | + $post['tax_input'][$taxonomy][] = $name; |
|
602 | + unset( $name ); |
|
603 | 603 | } |
604 | 604 | } |
605 | 605 | |
@@ -616,29 +616,29 @@ discard block |
||
616 | 616 | |
617 | 617 | if ( in_array( $post['post_status'], array( 'trash', 'draft' ) ) ) { |
618 | 618 | $match_by['include'] = $post['post_id']; |
619 | - unset($match_by['name']); |
|
619 | + unset( $match_by['name'] ); |
|
620 | 620 | } |
621 | 621 | |
622 | - $editing = get_posts($match_by); |
|
622 | + $editing = get_posts( $match_by ); |
|
623 | 623 | |
624 | - if ( ! empty($editing) && current($editing)->post_date == $post['post_date'] ) { |
|
624 | + if ( ! empty( $editing ) && current( $editing )->post_date == $post['post_date'] ) { |
|
625 | 625 | // set the id of the post to edit |
626 | - $post['ID'] = current($editing)->ID; |
|
626 | + $post['ID'] = current( $editing )->ID; |
|
627 | 627 | } |
628 | 628 | } |
629 | 629 | |
630 | 630 | private static function update_postmeta( &$post, $post_id ) { |
631 | 631 | foreach ( $post['postmeta'] as $k => $v ) { |
632 | 632 | if ( '_edit_last' == $k ) { |
633 | - $v = FrmAppHelper::get_user_id_param($v); |
|
633 | + $v = FrmAppHelper::get_user_id_param( $v ); |
|
634 | 634 | } else if ( '_thumbnail_id' == $k && FrmAppHelper::pro_is_installed() ) { |
635 | 635 | //change the attachment ID |
636 | - $v = FrmProXMLHelper::get_file_id($v); |
|
636 | + $v = FrmProXMLHelper::get_file_id( $v ); |
|
637 | 637 | } |
638 | 638 | |
639 | - update_post_meta($post_id, $k, $v); |
|
639 | + update_post_meta( $post_id, $k, $v ); |
|
640 | 640 | |
641 | - unset($k, $v); |
|
641 | + unset( $k, $v ); |
|
642 | 642 | } |
643 | 643 | } |
644 | 644 | |
@@ -655,13 +655,13 @@ discard block |
||
655 | 655 | * @param string $message |
656 | 656 | */ |
657 | 657 | public static function parse_message( $result, &$message, &$errors ) { |
658 | - if ( is_wp_error($result) ) { |
|
658 | + if ( is_wp_error( $result ) ) { |
|
659 | 659 | $errors[] = $result->get_error_message(); |
660 | 660 | } else if ( ! $result ) { |
661 | 661 | return; |
662 | 662 | } |
663 | 663 | |
664 | - if ( ! is_array($result) ) { |
|
664 | + if ( ! is_array( $result ) ) { |
|
665 | 665 | $message = is_string( $result ) ? $result : print_r( $result, 1 ); |
666 | 666 | return; |
667 | 667 | } |
@@ -673,20 +673,20 @@ discard block |
||
673 | 673 | |
674 | 674 | $message = '<ul>'; |
675 | 675 | foreach ( $result as $type => $results ) { |
676 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
676 | + if ( ! isset( $t_strings[$type] ) ) { |
|
677 | 677 | // only print imported and updated |
678 | 678 | continue; |
679 | 679 | } |
680 | 680 | |
681 | 681 | $s_message = array(); |
682 | 682 | foreach ( $results as $k => $m ) { |
683 | - self::item_count_message($m, $k, $s_message); |
|
684 | - unset($k, $m); |
|
683 | + self::item_count_message( $m, $k, $s_message ); |
|
684 | + unset( $k, $m ); |
|
685 | 685 | } |
686 | 686 | |
687 | - if ( ! empty($s_message) ) { |
|
688 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
689 | - $message .= implode(', ', $s_message); |
|
687 | + if ( ! empty( $s_message ) ) { |
|
688 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
689 | + $message .= implode( ', ', $s_message ); |
|
690 | 690 | $message .= '</li>'; |
691 | 691 | } |
692 | 692 | } |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
716 | 716 | ); |
717 | 717 | |
718 | - $s_message[] = isset( $strings[ $type ] ) ? $strings[ $type ] : ' ' . $m . ' ' . ucfirst( $type ); |
|
718 | + $s_message[] = isset( $strings[$type] ) ? $strings[$type] : ' ' . $m . ' ' . ucfirst( $type ); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | /** |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | * @return string |
727 | 727 | */ |
728 | 728 | public static function prepare_form_options_for_export( $options ) { |
729 | - $options = maybe_unserialize ( $options ); |
|
729 | + $options = maybe_unserialize( $options ); |
|
730 | 730 | // Change custom_style to the post_name instead of ID |
731 | 731 | if ( isset( $options['custom_style'] ) && $options['custom_style'] !== 1 ) { |
732 | 732 | global $wpdb; |
@@ -750,14 +750,14 @@ discard block |
||
750 | 750 | } |
751 | 751 | |
752 | 752 | public static function cdata( $str ) { |
753 | - $str = maybe_unserialize($str); |
|
754 | - if ( is_array($str) ) { |
|
755 | - $str = json_encode($str); |
|
753 | + $str = maybe_unserialize( $str ); |
|
754 | + if ( is_array( $str ) ) { |
|
755 | + $str = json_encode( $str ); |
|
756 | 756 | } else if ( seems_utf8( $str ) == false ) { |
757 | 757 | $str = utf8_encode( $str ); |
758 | 758 | } |
759 | 759 | |
760 | - if ( is_numeric($str) ) { |
|
760 | + if ( is_numeric( $str ) ) { |
|
761 | 761 | return $str; |
762 | 762 | } |
763 | 763 | |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | * @param string $post_type |
790 | 790 | */ |
791 | 791 | private static function migrate_post_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) { |
792 | - if ( ! isset($form_options['create_post']) || ! $form_options['create_post'] ) { |
|
792 | + if ( ! isset( $form_options['create_post'] ) || ! $form_options['create_post'] ) { |
|
793 | 793 | return; |
794 | 794 | } |
795 | 795 | |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | 'menu_order' => $form_id, |
801 | 801 | 'post_status' => 'publish', |
802 | 802 | 'post_content' => array(), |
803 | - 'post_name' => $form_id .'_wppost_1', |
|
803 | + 'post_name' => $form_id . '_wppost_1', |
|
804 | 804 | ); |
805 | 805 | |
806 | 806 | $post_settings = array( |
@@ -810,10 +810,10 @@ discard block |
||
810 | 810 | ); |
811 | 811 | |
812 | 812 | foreach ( $post_settings as $post_setting ) { |
813 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
814 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
813 | + if ( isset( $form_options[$post_setting] ) ) { |
|
814 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
815 | 815 | } |
816 | - unset($post_setting); |
|
816 | + unset( $post_setting ); |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | $new_action['event'] = array( 'create', 'update' ); |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | |
828 | 828 | $new_action['post_content'] = self::switch_action_field_ids( $new_action['post_content'], $basic_fields, $array_fields ); |
829 | 829 | } |
830 | - $new_action['post_content'] = json_encode($new_action['post_content']); |
|
830 | + $new_action['post_content'] = json_encode( $new_action['post_content'] ); |
|
831 | 831 | |
832 | 832 | $exists = get_posts( array( |
833 | 833 | 'name' => $new_action['post_name'], |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | if ( ! $exists ) { |
840 | 840 | // this isn't an email, but we need to use a class that will always be included |
841 | 841 | FrmAppHelper::save_json_post( $new_action ); |
842 | - $imported['imported']['actions']++; |
|
842 | + $imported['imported']['actions'] ++; |
|
843 | 843 | } |
844 | 844 | } |
845 | 845 | |
@@ -871,11 +871,11 @@ discard block |
||
871 | 871 | foreach ( $post_content as $key => $setting ) { |
872 | 872 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
873 | 873 | // Replace old IDs with new IDs |
874 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
874 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
875 | 875 | } else if ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
876 | 876 | foreach ( $setting as $k => $val ) { |
877 | 877 | // Replace old IDs with new IDs |
878 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
878 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
879 | 879 | } |
880 | 880 | } |
881 | 881 | unset( $key, $setting ); |
@@ -898,14 +898,14 @@ discard block |
||
898 | 898 | // Migrate autoresponders |
899 | 899 | self::migrate_autoresponder_to_action( $form_options, $form_id, $notifications ); |
900 | 900 | |
901 | - if ( empty( $notifications ) ) { |
|
901 | + if ( empty( $notifications ) ) { |
|
902 | 902 | return; |
903 | 903 | } |
904 | 904 | |
905 | 905 | foreach ( $notifications as $new_notification ) { |
906 | 906 | $new_notification['post_type'] = $post_type; |
907 | 907 | $new_notification['post_excerpt'] = 'email'; |
908 | - $new_notification['post_title'] = __( 'Email Notification', 'formidable' ); |
|
908 | + $new_notification['post_title'] = __( 'Email Notification', 'formidable' ); |
|
909 | 909 | $new_notification['menu_order'] = $form_id; |
910 | 910 | $new_notification['post_status'] = 'publish'; |
911 | 911 | |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | // Switch all other field IDs in email |
919 | 919 | $new_notification['post_content'] = FrmFieldsHelper::switch_field_ids( $new_notification['post_content'] ); |
920 | 920 | } |
921 | - $new_notification['post_content'] = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] ); |
|
921 | + $new_notification['post_content'] = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] ); |
|
922 | 922 | |
923 | 923 | $exists = get_posts( array( |
924 | 924 | 'name' => $new_notification['post_name'], |
@@ -927,11 +927,11 @@ discard block |
||
927 | 927 | 'numberposts' => 1, |
928 | 928 | ) ); |
929 | 929 | |
930 | - if ( empty($exists) ) { |
|
930 | + if ( empty( $exists ) ) { |
|
931 | 931 | FrmAppHelper::save_json_post( $new_notification ); |
932 | - $imported['imported']['actions']++; |
|
932 | + $imported['imported']['actions'] ++; |
|
933 | 933 | } |
934 | - unset($new_notification); |
|
934 | + unset( $new_notification ); |
|
935 | 935 | } |
936 | 936 | } |
937 | 937 | |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | $form_options['notification'] = array( 0 => $form_options['notification'] ); |
945 | 945 | } |
946 | 946 | |
947 | - if ( isset( $form_options['notification'] ) && is_array($form_options['notification']) ) { |
|
947 | + if ( isset( $form_options['notification'] ) && is_array( $form_options['notification'] ) ) { |
|
948 | 948 | foreach ( $form_options['notification'] as $email_key => $notification ) { |
949 | 949 | |
950 | 950 | $atts = array( 'email_to' => '', 'reply_to' => '', 'reply_to_name' => '', 'event' => '', 'form_id' => $form_id, 'email_key' => $email_key ); |
@@ -972,12 +972,12 @@ discard block |
||
972 | 972 | // Format the reply to email and name |
973 | 973 | $reply_fields = array( 'reply_to' => '', 'reply_to_name' => '' ); |
974 | 974 | foreach ( $reply_fields as $f => $val ) { |
975 | - if ( isset( $notification[ $f ] ) ) { |
|
976 | - $atts[ $f ] = $notification[ $f ]; |
|
977 | - if ( 'custom' == $notification[ $f ] ) { |
|
978 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
979 | - } else if ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
980 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
975 | + if ( isset( $notification[$f] ) ) { |
|
976 | + $atts[$f] = $notification[$f]; |
|
977 | + if ( 'custom' == $notification[$f] ) { |
|
978 | + $atts[$f] = $notification['cust_' . $f]; |
|
979 | + } else if ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
980 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
981 | 981 | } |
982 | 982 | } |
983 | 983 | unset( $f, $val ); |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | $atts['event'] = array( 'create' ); |
988 | 988 | if ( isset( $notification['update_email'] ) && 1 == $notification['update_email'] ) { |
989 | 989 | $atts['event'][] = 'update'; |
990 | - } else if ( isset($notification['update_email']) && 2 == $notification['update_email'] ) { |
|
990 | + } else if ( isset( $notification['update_email'] ) && 2 == $notification['update_email'] ) { |
|
991 | 991 | $atts['event'] = array( 'update' ); |
992 | 992 | } |
993 | 993 | } |
@@ -1008,18 +1008,18 @@ discard block |
||
1008 | 1008 | foreach ( $atts['email_to'] as $key => $email_field ) { |
1009 | 1009 | |
1010 | 1010 | if ( is_numeric( $email_field ) ) { |
1011 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
1011 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
1012 | 1012 | } |
1013 | 1013 | |
1014 | - if ( strpos( $email_field, '|') ) { |
|
1014 | + if ( strpos( $email_field, '|' ) ) { |
|
1015 | 1015 | $email_opt = explode( '|', $email_field ); |
1016 | 1016 | if ( isset( $email_opt[0] ) ) { |
1017 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
1017 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
1018 | 1018 | } |
1019 | 1019 | unset( $email_opt ); |
1020 | 1020 | } |
1021 | 1021 | } |
1022 | - $atts['email_to'] = implode(', ', $atts['email_to']); |
|
1022 | + $atts['email_to'] = implode( ', ', $atts['email_to'] ); |
|
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | private static function setup_new_notification( &$new_notification, $notification, $atts ) { |
@@ -1029,18 +1029,18 @@ discard block |
||
1029 | 1029 | 'email_to' => $atts['email_to'], |
1030 | 1030 | 'event' => $atts['event'], |
1031 | 1031 | ), |
1032 | - 'post_name' => $atts['form_id'] .'_email_'. $atts['email_key'], |
|
1032 | + 'post_name' => $atts['form_id'] . '_email_' . $atts['email_key'], |
|
1033 | 1033 | ); |
1034 | 1034 | |
1035 | 1035 | // Add more fields to the new notification |
1036 | 1036 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
1037 | 1037 | foreach ( $add_fields as $add_field ) { |
1038 | - if ( isset( $notification[ $add_field ] ) ) { |
|
1039 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
1038 | + if ( isset( $notification[$add_field] ) ) { |
|
1039 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
1040 | 1040 | } else if ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
1041 | - $new_notification['post_content'][ $add_field ] = 0; |
|
1041 | + $new_notification['post_content'][$add_field] = 0; |
|
1042 | 1042 | } else { |
1043 | - $new_notification['post_content'][ $add_field ] = ''; |
|
1043 | + $new_notification['post_content'][$add_field] = ''; |
|
1044 | 1044 | } |
1045 | 1045 | unset( $add_field ); |
1046 | 1046 | } |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | |
1051 | 1051 | // Set from |
1052 | 1052 | if ( ! empty( $atts['reply_to'] ) || ! empty( $atts['reply_to_name'] ) ) { |
1053 | - $new_notification['post_content']['from'] = ( empty($atts['reply_to_name']) ? '[sitename]' : $atts['reply_to_name'] ) .' <'. ( empty($atts['reply_to']) ? '[admin_email]' : $atts['reply_to'] ) .'>'; |
|
1053 | + $new_notification['post_content']['from'] = ( empty( $atts['reply_to_name'] ) ? '[sitename]' : $atts['reply_to_name'] ) . ' <' . ( empty( $atts['reply_to'] ) ? '[admin_email]' : $atts['reply_to'] ) . '>'; |
|
1054 | 1054 | } |
1055 | 1055 | } |
1056 | 1056 | |
@@ -1064,50 +1064,50 @@ discard block |
||
1064 | 1064 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
1065 | 1065 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
1066 | 1066 | if ( is_numeric( $email_key ) ) { |
1067 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
1067 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
1068 | 1068 | } |
1069 | - unset( $email_key, $val); |
|
1069 | + unset( $email_key, $val ); |
|
1070 | 1070 | } |
1071 | 1071 | } |
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | private static function migrate_autoresponder_to_action( $form_options, $form_id, &$notifications ) { |
1075 | - if ( isset($form_options['auto_responder']) && $form_options['auto_responder'] && isset($form_options['ar_email_message']) && $form_options['ar_email_message'] ) { |
|
1075 | + if ( isset( $form_options['auto_responder'] ) && $form_options['auto_responder'] && isset( $form_options['ar_email_message'] ) && $form_options['ar_email_message'] ) { |
|
1076 | 1076 | // migrate autoresponder |
1077 | 1077 | |
1078 | - $email_field = isset($form_options['ar_email_to']) ? $form_options['ar_email_to'] : 0; |
|
1079 | - if ( strpos($email_field, '|') ) { |
|
1078 | + $email_field = isset( $form_options['ar_email_to'] ) ? $form_options['ar_email_to'] : 0; |
|
1079 | + if ( strpos( $email_field, '|' ) ) { |
|
1080 | 1080 | // data from entries field |
1081 | - $email_field = explode('|', $email_field); |
|
1082 | - if ( isset($email_field[1]) ) { |
|
1081 | + $email_field = explode( '|', $email_field ); |
|
1082 | + if ( isset( $email_field[1] ) ) { |
|
1083 | 1083 | $email_field = $email_field[1]; |
1084 | 1084 | } |
1085 | 1085 | } |
1086 | - if ( is_numeric($email_field) && ! empty($email_field) ) { |
|
1087 | - $email_field = '['. $email_field .']'; |
|
1086 | + if ( is_numeric( $email_field ) && ! empty( $email_field ) ) { |
|
1087 | + $email_field = '[' . $email_field . ']'; |
|
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | $notification = $form_options; |
1091 | 1091 | $new_notification2 = array( |
1092 | 1092 | 'post_content' => array( |
1093 | 1093 | 'email_message' => $notification['ar_email_message'], |
1094 | - 'email_subject' => isset($notification['ar_email_subject']) ? $notification['ar_email_subject'] : '', |
|
1094 | + 'email_subject' => isset( $notification['ar_email_subject'] ) ? $notification['ar_email_subject'] : '', |
|
1095 | 1095 | 'email_to' => $email_field, |
1096 | - 'plain_text' => isset($notification['ar_plain_text']) ? $notification['ar_plain_text'] : 0, |
|
1096 | + 'plain_text' => isset( $notification['ar_plain_text'] ) ? $notification['ar_plain_text'] : 0, |
|
1097 | 1097 | 'inc_user_info' => 0, |
1098 | 1098 | ), |
1099 | - 'post_name' => $form_id .'_email_'. count( $notifications ), |
|
1099 | + 'post_name' => $form_id . '_email_' . count( $notifications ), |
|
1100 | 1100 | ); |
1101 | 1101 | |
1102 | - $reply_to = isset($notification['ar_reply_to']) ? $notification['ar_reply_to'] : ''; |
|
1103 | - $reply_to_name = isset($notification['ar_reply_to_name']) ? $notification['ar_reply_to_name'] : ''; |
|
1102 | + $reply_to = isset( $notification['ar_reply_to'] ) ? $notification['ar_reply_to'] : ''; |
|
1103 | + $reply_to_name = isset( $notification['ar_reply_to_name'] ) ? $notification['ar_reply_to_name'] : ''; |
|
1104 | 1104 | |
1105 | 1105 | if ( ! empty( $reply_to ) ) { |
1106 | 1106 | $new_notification2['post_content']['reply_to'] = $reply_to; |
1107 | 1107 | } |
1108 | 1108 | |
1109 | 1109 | if ( ! empty( $reply_to ) || ! empty( $reply_to_name ) ) { |
1110 | - $new_notification2['post_content']['from'] = ( empty($reply_to_name) ? '[sitename]' : $reply_to_name ) .' <'. ( empty($reply_to) ? '[admin_email]' : $reply_to ) .'>'; |
|
1110 | + $new_notification2['post_content']['from'] = ( empty( $reply_to_name ) ? '[sitename]' : $reply_to_name ) . ' <' . ( empty( $reply_to ) ? '[admin_email]' : $reply_to ) . '>'; |
|
1111 | 1111 | } |
1112 | 1112 | |
1113 | 1113 | $notifications[] = $new_notification2; |
@@ -13,16 +13,16 @@ discard block |
||
13 | 13 | ?> |
14 | 14 | <form> |
15 | 15 | <id><?php echo $form->id ?></id> |
16 | - <form_key><?php echo FrmXMLHelper::cdata($form->form_key) ?></form_key> |
|
17 | - <name><?php echo FrmXMLHelper::cdata($form->name) ?></name> |
|
18 | - <description><?php echo FrmXMLHelper::cdata($form->description) ?></description> |
|
16 | + <form_key><?php echo FrmXMLHelper::cdata( $form->form_key ) ?></form_key> |
|
17 | + <name><?php echo FrmXMLHelper::cdata( $form->name ) ?></name> |
|
18 | + <description><?php echo FrmXMLHelper::cdata( $form->description ) ?></description> |
|
19 | 19 | <created_at><?php echo $form->created_at ?></created_at> |
20 | 20 | <logged_in><?php echo $form->logged_in ?></logged_in> |
21 | 21 | <is_template><?php echo $form->is_template ?></is_template> |
22 | 22 | <default_template><?php echo $form->default_template ?></default_template> |
23 | 23 | <editable><?php echo $form->editable ?></editable> |
24 | - <options><?php echo FrmXMLHelper::prepare_form_options_for_export($form->options) ?></options> |
|
25 | - <status><?php echo FrmXMLHelper::cdata($form->status) ?></status> |
|
24 | + <options><?php echo FrmXMLHelper::prepare_form_options_for_export( $form->options ) ?></options> |
|
25 | + <status><?php echo FrmXMLHelper::cdata( $form->status ) ?></status> |
|
26 | 26 | <parent_form_id><?php echo $form->parent_form_id ?></parent_form_id> |
27 | 27 | <?php |
28 | 28 | |
@@ -31,16 +31,16 @@ discard block |
||
31 | 31 | foreach ( $fields as $field ) { ?> |
32 | 32 | <field> |
33 | 33 | <id><?php echo $field->id ?></id> |
34 | - <field_key><?php echo FrmXMLHelper::cdata($field->field_key) ?></field_key> |
|
35 | - <name><?php echo FrmXMLHelper::cdata($field->name) ?></name> |
|
36 | - <description><?php echo FrmXMLHelper::cdata($field->description) ?></description> |
|
37 | - <type><?php echo FrmXMLHelper::cdata($field->type) ?></type> |
|
38 | - <default_value><?php echo FrmXMLHelper::cdata($field->default_value) ?></default_value> |
|
34 | + <field_key><?php echo FrmXMLHelper::cdata( $field->field_key ) ?></field_key> |
|
35 | + <name><?php echo FrmXMLHelper::cdata( $field->name ) ?></name> |
|
36 | + <description><?php echo FrmXMLHelper::cdata( $field->description ) ?></description> |
|
37 | + <type><?php echo FrmXMLHelper::cdata( $field->type ) ?></type> |
|
38 | + <default_value><?php echo FrmXMLHelper::cdata( $field->default_value ) ?></default_value> |
|
39 | 39 | <field_order><?php echo $field->field_order ?></field_order> |
40 | 40 | <form_id><?php echo $field->form_id ?></form_id> |
41 | 41 | <required><?php echo (bool) $field->required ?></required> |
42 | - <options><?php echo FrmXMLHelper::cdata($field->options) ?></options> |
|
43 | - <field_options><?php echo FrmXMLHelper::cdata($field->field_options) ?></field_options> |
|
42 | + <options><?php echo FrmXMLHelper::cdata( $field->options ) ?></options> |
|
43 | + <field_options><?php echo FrmXMLHelper::cdata( $field->field_options ) ?></field_options> |
|
44 | 44 | </field> |
45 | 45 | <?php } ?> |
46 | 46 | </form> |