Completed
Push — master ( dc2315...31086c )
by Stephanie
03:16
created
classes/helpers/FrmFieldsHelper.php 1 patch
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
 
8 8
 	public static function setup_new_vars( $type = '', $form_id = '' ) {
9 9
 
10
-        if ( strpos($type, '|') ) {
11
-            list($type, $setting) = explode('|', $type);
10
+        if ( strpos( $type, '|' ) ) {
11
+            list( $type, $setting ) = explode( '|', $type );
12 12
         }
13 13
 
14 14
 		$values = self::get_default_field( $type );
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 			if ( in_array( $type, array( 'data', 'lookup' ) ) ) {
26 26
 				$values['field_options']['data_type'] = $setting;
27 27
 			} else {
28
-				$values['field_options'][ $setting ] = 1;
28
+				$values['field_options'][$setting] = 1;
29 29
 			}
30 30
 		}
31 31
 
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 		}
128 128
 
129 129
 		foreach ( $defaults as $opt => $default ) {
130
-			$values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default;
130
+			$values[$opt] = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default;
131 131
 
132 132
 			if ( $check_post ) {
133
-				self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] );
133
+				self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] );
134 134
 			}
135 135
 
136 136
 			unset( $opt, $default );
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @param mixed $value
174 174
 	 */
175 175
 	private static function get_posted_field_setting( $setting, &$value ) {
176
-		if ( isset( $_POST['field_options'][ $setting ] ) ) {
177
-			$value = maybe_unserialize( $_POST['field_options'][ $setting ] );
176
+		if ( isset( $_POST['field_options'][$setting] ) ) {
177
+			$value = maybe_unserialize( $_POST['field_options'][$setting] );
178 178
 			if ( strpos( $setting, 'html' ) !== false ) {
179 179
 				// strip slashes from HTML but not regex
180 180
 				$value = stripslashes_deep( $value );
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
 
245 245
 		$values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' );
246 246
         $values['form_id'] = $form_id;
247
-        $values['options'] = maybe_serialize($field->options);
248
-        $values['default_value'] = maybe_serialize($field->default_value);
247
+        $values['options'] = maybe_serialize( $field->options );
248
+        $values['default_value'] = maybe_serialize( $field->default_value );
249 249
 
250 250
         foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
251
-            $values[ $col ] = $field->{$col};
251
+            $values[$col] = $field->{$col};
252 252
         }
253 253
     }
254 254
 
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
 		$defaults = array(
270 270
 			'unique_msg' => array(
271 271
 				'full' => $default_settings['unique_msg'],
272
-				'part' => sprintf( __('%s must be unique', 'formidable' ), $field_name ),
272
+				'part' => sprintf( __( '%s must be unique', 'formidable' ), $field_name ),
273 273
 			),
274 274
 			'invalid'  => array(
275 275
 				'full' => __( 'This field is invalid', 'formidable' ),
276
-				'part' => sprintf( __('%s is invalid', 'formidable' ), $field_name ),
276
+				'part' => sprintf( __( '%s is invalid', 'formidable' ), $field_name ),
277 277
 			),
278 278
 			'blank'    => array(
279 279
 				'full' => $frm_settings->blank_msg,
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 		);
287 287
 
288 288
 		$msg = FrmField::get_option( $field, $error );
289
-		$msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg;
289
+		$msg = empty( $msg ) ? $defaults[$error]['part'] : $msg;
290 290
 		$msg = do_shortcode( $msg );
291 291
 		return $msg;
292 292
 	}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 			$default_html = apply_filters( 'frm_other_custom_html', '', $type );
306 306
 		}
307 307
 
308
-		return apply_filters('frm_custom_html', $default_html, $type);
308
+		return apply_filters( 'frm_custom_html', $default_html, $type );
309 309
 	}
310 310
 
311 311
 	/**
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 			// Get string for Other text field, if needed
440 440
 			$other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
441 441
 
442
-			$checked = ( $other_val || isset( $field['value'] ) && ( ( ! is_array( $field['value'] ) && $field['value'] == $field_val ) || ( is_array($field['value'] ) && in_array( $field_val, $field['value'] ) ) ) ) ? ' checked="checked"' : '';
442
+			$checked = ( $other_val || isset( $field['value'] ) && ( ( ! is_array( $field['value'] ) && $field['value'] == $field_val ) || ( is_array( $field['value'] ) && in_array( $field_val, $field['value'] ) ) ) ) ? ' checked="checked"' : '';
443 443
 
444 444
 		    // If this is an "Other" option, get the HTML for it
445 445
 			if ( self::is_other_opt( $opt_key ) ) {
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	 * @return string
471 471
 	 */
472 472
 	public static function get_term_link( $tax_id ) {
473
-        $tax = get_taxonomy($tax_id);
473
+        $tax = get_taxonomy( $tax_id );
474 474
         if ( ! $tax ) {
475 475
             return '';
476 476
         }
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
             __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
480 480
 			'<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>'
481 481
         );
482
-        unset($tax);
482
+        unset( $tax );
483 483
 
484 484
         return $link;
485 485
     }
@@ -488,8 +488,8 @@  discard block
 block discarded – undo
488 488
 		$hide_opt = self::get_value_for_comparision( $hide_opt );
489 489
 		$observed_value = self::get_value_for_comparision( $observed_value );
490 490
 
491
-        if ( is_array($observed_value) ) {
492
-            return self::array_value_condition($observed_value, $cond, $hide_opt);
491
+        if ( is_array( $observed_value ) ) {
492
+            return self::array_value_condition( $observed_value, $cond, $hide_opt );
493 493
         }
494 494
 
495 495
         $m = false;
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
         } else if ( $cond == '<' ) {
503 503
             $m = $observed_value < $hide_opt;
504 504
         } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
505
-            $m = stripos($observed_value, $hide_opt);
505
+            $m = stripos( $observed_value, $hide_opt );
506 506
             if ( $cond == 'not LIKE' ) {
507 507
                 $m = ( $m === false ) ? true : false;
508 508
             } else {
@@ -528,23 +528,23 @@  discard block
 block discarded – undo
528 528
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
529 529
         $m = false;
530 530
         if ( $cond == '==' ) {
531
-            if ( is_array($hide_opt) ) {
532
-                $m = array_intersect($hide_opt, $observed_value);
533
-                $m = empty($m) ? false : true;
531
+            if ( is_array( $hide_opt ) ) {
532
+                $m = array_intersect( $hide_opt, $observed_value );
533
+                $m = empty( $m ) ? false : true;
534 534
             } else {
535
-                $m = in_array($hide_opt, $observed_value);
535
+                $m = in_array( $hide_opt, $observed_value );
536 536
             }
537 537
         } else if ( $cond == '!=' ) {
538
-            $m = ! in_array($hide_opt, $observed_value);
538
+            $m = ! in_array( $hide_opt, $observed_value );
539 539
         } else if ( $cond == '>' ) {
540
-            $min = min($observed_value);
540
+            $min = min( $observed_value );
541 541
             $m = $min > $hide_opt;
542 542
         } else if ( $cond == '<' ) {
543
-            $max = max($observed_value);
543
+            $max = max( $observed_value );
544 544
             $m = $max < $hide_opt;
545 545
         } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
546 546
             foreach ( $observed_value as $ob ) {
547
-                $m = strpos($ob, $hide_opt);
547
+                $m = strpos( $ob, $hide_opt );
548 548
                 if ( $m !== false ) {
549 549
                     $m = true;
550 550
                     break;
@@ -565,20 +565,20 @@  discard block
 block discarded – undo
565 565
      * @return string
566 566
      */
567 567
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
568
-        if ( strpos($value, '[sitename]') !== false ) {
568
+        if ( strpos( $value, '[sitename]' ) !== false ) {
569 569
             $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
570
-            $value = str_replace('[sitename]', $new_value, $value);
570
+            $value = str_replace( '[sitename]', $new_value, $value );
571 571
         }
572 572
 
573
-        $value = apply_filters('frm_content', $value, $form, $entry);
574
-        $value = do_shortcode($value);
573
+        $value = apply_filters( 'frm_content', $value, $form, $entry );
574
+        $value = do_shortcode( $value );
575 575
 
576 576
         return $value;
577 577
     }
578 578
 
579 579
 	public static function get_shortcodes( $content, $form_id ) {
580 580
         if ( FrmAppHelper::pro_is_installed() ) {
581
-            return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
581
+            return FrmProDisplaysHelper::get_shortcodes( $content, $form_id );
582 582
         }
583 583
 
584 584
 		$fields = FrmField::getAll( array(
@@ -586,9 +586,9 @@  discard block
 block discarded – undo
586 586
 			'fi.type not' => FrmField::no_save_fields(),
587 587
 		) );
588 588
 
589
-        $tagregexp = self::allowed_shortcodes($fields);
589
+        $tagregexp = self::allowed_shortcodes( $fields );
590 590
 
591
-        preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
591
+        preg_match_all( "/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER );
592 592
 
593 593
         return $matches;
594 594
     }
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
             $tagregexp[] = $field->field_key;
602 602
         }
603 603
 
604
-        $tagregexp = implode('|', $tagregexp);
604
+        $tagregexp = implode( '|', $tagregexp );
605 605
         return $tagregexp;
606 606
     }
607 607
 
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 				continue;
612 612
 			}
613 613
 
614
-			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
614
+			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] );
615 615
 			$tag  = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key );
616 616
 
617 617
 			$atts['entry'] = $entry;
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 
621 621
 			if ( $replace_with !== null ) {
622 622
 				$replace_with = str_replace( '[', '&#91;', $replace_with ); // prevent shortcodes in fields from being processed
623
-				$content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
623
+				$content = str_replace( $shortcodes[0][$short_key], $replace_with, $content );
624 624
 			}
625 625
 
626 626
 			unset( $atts, $replace_with );
@@ -647,8 +647,8 @@  discard block
 block discarded – undo
647 647
 
648 648
 		$dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' );
649 649
 
650
-		if ( isset( $shortcode_values[ $atts['tag'] ] ) ) {
651
-			$replace_with = $shortcode_values[ $atts['tag'] ];
650
+		if ( isset( $shortcode_values[$atts['tag']] ) ) {
651
+			$replace_with = $shortcode_values[$atts['tag']];
652 652
 		} elseif ( in_array( $atts['tag'], $dynamic_default ) ) {
653 653
 			$replace_with = self::dynamic_default_values( $atts['tag'], $atts );
654 654
 		} elseif ( $clean_tag == 'user_agent' ) {
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 		if ( isset( $atts['format'] ) ) {
678 678
 			$time_format = ' ';
679 679
 		} else {
680
-			$atts['format'] = get_option('date_format');
680
+			$atts['format'] = get_option( 'date_format' );
681 681
 			$time_format = '';
682 682
 		}
683 683
 
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
         $new_value = '';
732 732
         switch ( $tag ) {
733 733
             case 'admin_email':
734
-                $new_value = get_option('admin_email');
734
+                $new_value = get_option( 'admin_email' );
735 735
                 break;
736 736
             case 'siteurl':
737 737
                 $new_value = FrmAppHelper::site_url();
@@ -756,28 +756,28 @@  discard block
 block discarded – undo
756 756
      * @return string|array
757 757
      */
758 758
     public static function process_get_shortcode( $atts, $return_array = false ) {
759
-        if ( ! isset($atts['param']) ) {
759
+        if ( ! isset( $atts['param'] ) ) {
760 760
             return '';
761 761
         }
762 762
 
763
-        if ( strpos($atts['param'], '&#91;') ) {
764
-            $atts['param'] = str_replace('&#91;', '[', $atts['param']);
765
-            $atts['param'] = str_replace('&#93;', ']', $atts['param']);
763
+        if ( strpos( $atts['param'], '&#91;' ) ) {
764
+            $atts['param'] = str_replace( '&#91;', '[', $atts['param'] );
765
+            $atts['param'] = str_replace( '&#93;', ']', $atts['param'] );
766 766
         }
767 767
 
768 768
 		$new_value = FrmAppHelper::get_param( $atts['param'], '', 'get', 'sanitize_text_field' );
769 769
         $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
770 770
 
771 771
         if ( $new_value == '' ) {
772
-            if ( ! isset($atts['prev_val']) ) {
772
+            if ( ! isset( $atts['prev_val'] ) ) {
773 773
                 $atts['prev_val'] = '';
774 774
             }
775 775
 
776
-            $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
776
+            $new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val'];
777 777
         }
778 778
 
779
-        if ( is_array($new_value) && ! $return_array ) {
780
-            $new_value = implode(', ', $new_value);
779
+        if ( is_array( $new_value ) && ! $return_array ) {
780
+            $new_value = implode( ', ', $new_value );
781 781
         }
782 782
 
783 783
         return $new_value;
@@ -818,9 +818,9 @@  discard block
 block discarded – undo
818 818
 			'size'  => 96,
819 819
 		);
820 820
 
821
-		$args = wp_parse_args($args, $defaults);
821
+		$args = wp_parse_args( $args, $defaults );
822 822
 
823
-		$user = get_userdata($user_id);
823
+		$user = get_userdata( $user_id );
824 824
 		$info = '';
825 825
 
826 826
 		if ( $user ) {
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 			} elseif ( $user_info == 'author_link' ) {
830 830
 				$info = get_author_posts_url( $user_id );
831 831
 			} else {
832
-				$info = isset($user->$user_info) ? $user->$user_info : '';
832
+				$info = isset( $user->$user_info ) ? $user->$user_info : '';
833 833
 			}
834 834
 
835 835
 			if ( 'display_name' === $user_info && empty( $info ) && ! $args['blank'] ) {
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 		}
839 839
 
840 840
 		if ( $args['link'] ) {
841
-			$info = '<a href="' . esc_url( admin_url('user-edit.php?user_id=' . $user_id ) ) . '">' . $info . '</a>';
841
+			$info = '<a href="' . esc_url( admin_url( 'user-edit.php?user_id=' . $user_id ) ) . '">' . $info . '</a>';
842 842
 		}
843 843
 
844 844
 		return $info;
@@ -852,14 +852,14 @@  discard block
 block discarded – undo
852 852
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
853 853
 
854 854
         $field_types = array();
855
-        if ( in_array($type, $single_input) ) {
855
+        if ( in_array( $type, $single_input ) ) {
856 856
             self::field_types_for_input( $single_input, $field_selection, $field_types );
857
-        } else if ( in_array($type, $multiple_input) ) {
857
+        } else if ( in_array( $type, $multiple_input ) ) {
858 858
             self::field_types_for_input( $multiple_input, $field_selection, $field_types );
859
-        } else if ( in_array($type, $other_type) ) {
859
+        } else if ( in_array( $type, $other_type ) ) {
860 860
             self::field_types_for_input( $other_type, $field_selection, $field_types );
861
-		} else if ( isset( $field_selection[ $type ] ) ) {
862
-            $field_types[ $type ] = $field_selection[ $type ];
861
+		} else if ( isset( $field_selection[$type] ) ) {
862
+            $field_types[$type] = $field_selection[$type];
863 863
         }
864 864
 
865 865
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) );
@@ -868,8 +868,8 @@  discard block
 block discarded – undo
868 868
 
869 869
     private static function field_types_for_input( $inputs, $fields, &$field_types ) {
870 870
         foreach ( $inputs as $input ) {
871
-            $field_types[ $input ] = $fields[ $input ];
872
-            unset($input);
871
+            $field_types[$input] = $fields[$input];
872
+            unset( $input );
873 873
         }
874 874
     }
875 875
 
@@ -916,21 +916,21 @@  discard block
 block discarded – undo
916 916
 		// Check posted vals before checking saved values
917 917
 
918 918
 		// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
919
-		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) {
919
+		if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) {
920 920
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
921
-				$other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) : '';
921
+				$other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) : '';
922 922
 			} else {
923
-				$other_val = sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] );
923
+				$other_val = sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] );
924 924
 			}
925 925
 			return $other_val;
926 926
 
927
-		} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) {
927
+		} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) {
928 928
 			// For normal fields
929 929
 
930 930
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
931
-				$other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) : '';
931
+				$other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta']['other'][$field['id']][$opt_key] ) : '';
932 932
 			} else {
933
-				$other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] );
933
+				$other_val = sanitize_text_field( $_POST['item_meta']['other'][$field['id']] );
934 934
 			}
935 935
 			return $other_val;
936 936
 		}
@@ -939,8 +939,8 @@  discard block
 block discarded – undo
939 939
 		if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) {
940 940
 			// Check if there is an "other" val in saved value and make sure the
941 941
 			// "other" val is not equal to the Other checkbox option
942
-			if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) {
943
-				$other_val = $field['value'][ $opt_key ];
942
+			if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) {
943
+				$other_val = $field['value'][$opt_key];
944 944
 			}
945 945
 		} else {
946 946
 			/**
@@ -952,8 +952,8 @@  discard block
 block discarded – undo
952 952
 				// Multi-select dropdowns - key is not preserved
953 953
 				if ( is_array( $field['value'] ) ) {
954 954
 					$o_key = array_search( $temp_val, $field['value'] );
955
-					if ( isset( $field['value'][ $o_key ] ) ) {
956
-						unset( $field['value'][ $o_key ], $o_key );
955
+					if ( isset( $field['value'][$o_key] ) ) {
956
+						unset( $field['value'][$o_key], $o_key );
957 957
 					}
958 958
 				} else if ( $temp_val == $field['value'] ) {
959 959
 					// For radio and regular dropdowns
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 	private static function set_other_name( $args, &$other_args ) {
1011 1011
 		//Set up name for other field
1012 1012
 		$other_args['name'] = str_replace( '[]', '', $args['field_name'] );
1013
-		$other_args['name'] = preg_replace('/\[' . $args['field']['id'] . '\]$/', '', $other_args['name']);
1013
+		$other_args['name'] = preg_replace( '/\[' . $args['field']['id'] . '\]$/', '', $other_args['name'] );
1014 1014
 		$other_args['name'] = $other_args['name'] . '[other]' . '[' . $args['field']['id'] . ']';
1015 1015
 
1016 1016
 		//Converts item_meta[field_id] => item_meta[other][field_id] and
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
 		// Count should only be greater than 3 if inside of a repeating section
1038 1038
 		if ( count( $temp_array ) > 3 ) {
1039 1039
 			$parent = str_replace( ']', '', $temp_array[1] );
1040
-			$pointer = str_replace( ']', '', $temp_array[2]);
1040
+			$pointer = str_replace( ']', '', $temp_array[2] );
1041 1041
 		}
1042 1042
 
1043 1043
 		// Get text for "other" text field
@@ -1171,15 +1171,15 @@  discard block
 block discarded – undo
1171 1171
 			$replace_with[] = '[' . $new . ']';
1172 1172
 			$replace[] = '[' . $old . ' ';
1173 1173
 			$replace_with[] = '[' . $new . ' ';
1174
-            unset($old, $new);
1174
+            unset( $old, $new );
1175 1175
         }
1176 1176
 		if ( is_array( $val ) ) {
1177 1177
 			foreach ( $val as $k => $v ) {
1178
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
1179
-                unset($k, $v);
1178
+                $val[$k] = str_replace( $replace, $replace_with, $v );
1179
+                unset( $k, $v );
1180 1180
             }
1181 1181
         } else {
1182
-            $val = str_replace($replace, $replace_with, $val);
1182
+            $val = str_replace( $replace, $replace_with, $val );
1183 1183
         }
1184 1184
 
1185 1185
         return $val;
@@ -1246,19 +1246,19 @@  discard block
 block discarded – undo
1246 1246
 	}
1247 1247
 
1248 1248
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1249
-		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1249
+		$prepop[__( 'Countries', 'formidable' )] = FrmFieldsHelper::get_countries();
1250 1250
 
1251 1251
         $states = FrmFieldsHelper::get_us_states();
1252
-        $state_abv = array_keys($states);
1253
-        sort($state_abv);
1254
-		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1252
+        $state_abv = array_keys( $states );
1253
+        sort( $state_abv );
1254
+		$prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv;
1255 1255
 
1256
-        $states = array_values($states);
1257
-        sort($states);
1258
-		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1259
-        unset($state_abv, $states);
1256
+        $states = array_values( $states );
1257
+        sort( $states );
1258
+		$prepop[__( 'U.S. States', 'formidable' )] = $states;
1259
+        unset( $state_abv, $states );
1260 1260
 
1261
-		$prepop[ __( 'Age', 'formidable' ) ] = array(
1261
+		$prepop[__( 'Age', 'formidable' )] = array(
1262 1262
 			__( 'Under 18', 'formidable' ),
1263 1263
 			__( '18-24', 'formidable' ),
1264 1264
 			__( '25-34', 'formidable' ),
@@ -1269,7 +1269,7 @@  discard block
 block discarded – undo
1269 1269
 			__( 'Prefer Not to Answer', 'formidable' ),
1270 1270
 		);
1271 1271
 
1272
-		$prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1272
+		$prepop[__( 'Satisfaction', 'formidable' )] = array(
1273 1273
 			__( 'Very Satisfied', 'formidable' ),
1274 1274
 			__( 'Satisfied', 'formidable' ),
1275 1275
 			__( 'Neutral', 'formidable' ),
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
 			__( 'N/A', 'formidable' ),
1279 1279
 		);
1280 1280
 
1281
-		$prepop[ __( 'Importance', 'formidable' ) ] = array(
1281
+		$prepop[__( 'Importance', 'formidable' )] = array(
1282 1282
 			__( 'Very Important', 'formidable' ),
1283 1283
 			__( 'Important', 'formidable' ),
1284 1284
 			__( 'Neutral', 'formidable' ),
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
 			__( 'N/A', 'formidable' ),
1288 1288
 		);
1289 1289
 
1290
-		$prepop[ __( 'Agreement', 'formidable' ) ] = array(
1290
+		$prepop[__( 'Agreement', 'formidable' )] = array(
1291 1291
 			__( 'Strongly Agree', 'formidable' ),
1292 1292
 			__( 'Agree', 'formidable' ),
1293 1293
 			__( 'Neutral', 'formidable' ),
Please login to merge, or discard this patch.