Completed
Push — master ( 718d7d...23bf2c )
by Jamie
03:28
created
classes/views/frm-form-actions/_email_settings.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@
 block discarded – undo
6 6
     </td>
7 7
     <td class="frm_bcc_cc_container">
8 8
         <a href="javascript:void(0)" class="button frm_email_buttons frm_cc_button <?php
9
-        echo ( ! empty($form_action->post_content['cc'])  ? 'frm_hidden' : '' );
10
-        ?>" data-emailrow="cc"><?php _e( 'CC', 'formidable' ) ?></a>
9
+		echo ( ! empty($form_action->post_content['cc'])  ? 'frm_hidden' : '' );
10
+		?>" data-emailrow="cc"><?php _e( 'CC', 'formidable' ) ?></a>
11 11
 	    <a href="javascript:void(0)" class="button frm_email_buttons frm_bcc_button <?php
12
-	    echo ( ! empty($form_action->post_content['bcc'])  ? 'frm_hidden' : '' );
13
-	    ?>" data-emailrow="bcc"><?php _e( 'BCC', 'formidable' ) ?></a>
12
+		echo ( ! empty($form_action->post_content['bcc'])  ? 'frm_hidden' : '' );
13
+		?>" data-emailrow="bcc"><?php _e( 'BCC', 'formidable' ) ?></a>
14 14
     </td>
15 15
 </tr>
16 16
 <tr class="frm_cc_row<?php echo empty( $form_action->post_content['cc'] )  ? ' frm_hidden' : ''; ?>" >
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,63 +1,63 @@
 block discarded – undo
1 1
 <table class="form-table frm-no-margin">
2 2
 <tr>
3
-    <th><label <?php FrmAppHelper::maybe_add_tooltip('email_to') ?>><?php _e( 'To', 'formidable' ) ?></label>
3
+    <th><label <?php FrmAppHelper::maybe_add_tooltip( 'email_to' ) ?>><?php _e( 'To', 'formidable' ) ?></label>
4 4
     </th>
5
-    <td><input type="text" name="<?php echo esc_attr( $this->get_field_name('email_to') ) ?>" value="<?php echo esc_attr( $form_action->post_content['email_to'] ); ?>" class="frm_not_email_to frm_email_blur large-text <?php FrmAppHelper::maybe_add_tooltip('email_to', 'open') ?>" id="<?php echo esc_attr( $this->get_field_id('email_to') ) ?>" />
5
+    <td><input type="text" name="<?php echo esc_attr( $this->get_field_name( 'email_to' ) ) ?>" value="<?php echo esc_attr( $form_action->post_content['email_to'] ); ?>" class="frm_not_email_to frm_email_blur large-text <?php FrmAppHelper::maybe_add_tooltip( 'email_to', 'open' ) ?>" id="<?php echo esc_attr( $this->get_field_id( 'email_to' ) ) ?>" />
6 6
     </td>
7 7
     <td class="frm_bcc_cc_container">
8 8
         <a href="javascript:void(0)" class="button frm_email_buttons frm_cc_button <?php
9
-        echo ( ! empty($form_action->post_content['cc'])  ? 'frm_hidden' : '' );
9
+        echo ( ! empty( $form_action->post_content['cc'] ) ? 'frm_hidden' : '' );
10 10
         ?>" data-emailrow="cc"><?php _e( 'CC', 'formidable' ) ?></a>
11 11
 	    <a href="javascript:void(0)" class="button frm_email_buttons frm_bcc_button <?php
12
-	    echo ( ! empty($form_action->post_content['bcc'])  ? 'frm_hidden' : '' );
12
+	    echo ( ! empty( $form_action->post_content['bcc'] ) ? 'frm_hidden' : '' );
13 13
 	    ?>" data-emailrow="bcc"><?php _e( 'BCC', 'formidable' ) ?></a>
14 14
     </td>
15 15
 </tr>
16
-<tr class="frm_cc_row<?php echo empty( $form_action->post_content['cc'] )  ? ' frm_hidden' : ''; ?>" >
17
-    <th><label <?php FrmAppHelper::maybe_add_tooltip('cc') ?>><?php _e( 'CC', 'formidable' ) ?></label>
16
+<tr class="frm_cc_row<?php echo empty( $form_action->post_content['cc'] ) ? ' frm_hidden' : ''; ?>" >
17
+    <th><label <?php FrmAppHelper::maybe_add_tooltip( 'cc' ) ?>><?php _e( 'CC', 'formidable' ) ?></label>
18 18
     </th>
19 19
     <td class="frm_right_addon">
20
-        <input type="text" name="<?php echo esc_attr( $this->get_field_name('cc') ) ?>" value="<?php echo esc_attr( $form_action->post_content['cc'] ); ?>" class="frm_not_email_to large-text <?php FrmAppHelper::maybe_add_tooltip('cc', 'open') ?>" id="<?php echo esc_attr( $this->get_field_id('cc') ) ?>" />
20
+        <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'cc' ) ) ?>" value="<?php echo esc_attr( $form_action->post_content['cc'] ); ?>" class="frm_not_email_to large-text <?php FrmAppHelper::maybe_add_tooltip( 'cc', 'open' ) ?>" id="<?php echo esc_attr( $this->get_field_id( 'cc' ) ) ?>" />
21 21
         <a href="javascript:void(0)" class="frm_icon_font frm_remove_field frm_cancel1_icon" data-emailrow="cc"></a>
22 22
     </td>
23 23
     <td></td>
24 24
 </tr>
25
-<tr class="frm_bcc_row<?php echo empty( $form_action->post_content['bcc'] )  ? ' frm_hidden' : ''; ?>" >
26
-    <th><label <?php FrmAppHelper::maybe_add_tooltip('bcc') ?>><?php _e( 'BCC', 'formidable' ) ?></label>
25
+<tr class="frm_bcc_row<?php echo empty( $form_action->post_content['bcc'] ) ? ' frm_hidden' : ''; ?>" >
26
+    <th><label <?php FrmAppHelper::maybe_add_tooltip( 'bcc' ) ?>><?php _e( 'BCC', 'formidable' ) ?></label>
27 27
     </th>
28 28
     <td class="frm_right_addon">
29
-        <input type="text" name="<?php echo esc_attr( $this->get_field_name('bcc') ) ?>" value="<?php echo esc_attr( $form_action->post_content['bcc'] ); ?>" class="frm_not_email_to large-text <?php FrmAppHelper::maybe_add_tooltip('bcc', 'open') ?>" id="<?php echo esc_attr( $this->get_field_id('bcc') ) ?>" />
29
+        <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'bcc' ) ) ?>" value="<?php echo esc_attr( $form_action->post_content['bcc'] ); ?>" class="frm_not_email_to large-text <?php FrmAppHelper::maybe_add_tooltip( 'bcc', 'open' ) ?>" id="<?php echo esc_attr( $this->get_field_id( 'bcc' ) ) ?>" />
30 30
         <a href="javascript:void(0)" class="frm_icon_font frm_remove_field frm_cancel1_icon" data-emailrow="bcc"></a>
31 31
     </td>
32 32
     <td></td>
33 33
 </tr>
34
-<tr class="frm_reply_to_row<?php echo empty( $form_action->post_content['reply_to'] )  ? ' frm_hidden' : ''; ?>">
35
-    <th><label <?php FrmAppHelper::maybe_add_tooltip('reply_to') ?>><?php _e( 'Reply to', 'formidable' ) ?></label>
34
+<tr class="frm_reply_to_row<?php echo empty( $form_action->post_content['reply_to'] ) ? ' frm_hidden' : ''; ?>">
35
+    <th><label <?php FrmAppHelper::maybe_add_tooltip( 'reply_to' ) ?>><?php _e( 'Reply to', 'formidable' ) ?></label>
36 36
     </th>
37 37
     <td class="frm_right_addon">
38
-        <input type="text" name="<?php echo esc_attr( $this->get_field_name('reply_to') ) ?>" value="<?php echo esc_attr( $form_action->post_content['reply_to'] ); ?>" class="frm_not_email_to large-text <?php FrmAppHelper::maybe_add_tooltip('reply_to', 'open') ?>" id="<?php echo esc_attr( $this->get_field_id('reply_to') ) ?>" />
38
+        <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'reply_to' ) ) ?>" value="<?php echo esc_attr( $form_action->post_content['reply_to'] ); ?>" class="frm_not_email_to large-text <?php FrmAppHelper::maybe_add_tooltip( 'reply_to', 'open' ) ?>" id="<?php echo esc_attr( $this->get_field_id( 'reply_to' ) ) ?>" />
39 39
         <a href="javascript:void(0)" class="frm_icon_font frm_remove_field frm_cancel1_icon" data-emailrow="reply_to"></a>
40 40
     </td>
41 41
     <td></td>
42 42
 </tr>
43 43
 <tr>
44
-    <th><label <?php FrmAppHelper::maybe_add_tooltip('from') ?>><?php _e( 'From', 'formidable' ) ?></label></th>
45
-    <td><input type="text" name="<?php echo esc_attr( $this->get_field_name('from') ) ?>" value="<?php echo esc_attr( $form_action->post_content['from'] ); ?>" class="frm_not_email_to frm_email_blur large-text <?php FrmAppHelper::maybe_add_tooltip('from', 'open') ?>" id="<?php echo esc_attr( $this->get_field_id('from') ) ?>" />
44
+    <th><label <?php FrmAppHelper::maybe_add_tooltip( 'from' ) ?>><?php _e( 'From', 'formidable' ) ?></label></th>
45
+    <td><input type="text" name="<?php echo esc_attr( $this->get_field_name( 'from' ) ) ?>" value="<?php echo esc_attr( $form_action->post_content['from'] ); ?>" class="frm_not_email_to frm_email_blur large-text <?php FrmAppHelper::maybe_add_tooltip( 'from', 'open' ) ?>" id="<?php echo esc_attr( $this->get_field_id( 'from' ) ) ?>" />
46 46
     </td>
47
-    <td><a href="javascript:void(0)" class="button frm_email_buttons frm_reply_to_button <?php echo ( ! empty( $form_action->post_content['reply_to'] )  ? 'frm_hidden' : '' ) ?>" data-emailrow="reply_to"><?php _e( 'Reply To', 'formidable' ) ?></a></td>
47
+    <td><a href="javascript:void(0)" class="button frm_email_buttons frm_reply_to_button <?php echo ( ! empty( $form_action->post_content['reply_to'] ) ? 'frm_hidden' : '' ) ?>" data-emailrow="reply_to"><?php _e( 'Reply To', 'formidable' ) ?></a></td>
48 48
 </tr>
49 49
  <tr>
50 50
      <td colspan="3" class="frm_no_top_padding">
51
-         <p><label <?php FrmAppHelper::maybe_add_tooltip('email_subject', '', $form->name) ?>><?php _e( 'Subject', 'formidable' ) ?></label><br/>
52
-         <input type="text" name="<?php echo esc_attr( $this->get_field_name('email_subject') ) ?>" class="frm_not_email_subject large-text <?php FrmAppHelper::maybe_add_tooltip('email_subject', 'open', $form->name) ?>" id="<?php echo esc_attr( $this->get_field_id('email_subject') ) ?>" size="55" value="<?php echo esc_attr( $form_action->post_content['email_subject'] ); ?>" /></p>
51
+         <p><label <?php FrmAppHelper::maybe_add_tooltip( 'email_subject', '', $form->name ) ?>><?php _e( 'Subject', 'formidable' ) ?></label><br/>
52
+         <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'email_subject' ) ) ?>" class="frm_not_email_subject large-text <?php FrmAppHelper::maybe_add_tooltip( 'email_subject', 'open', $form->name ) ?>" id="<?php echo esc_attr( $this->get_field_id( 'email_subject' ) ) ?>" size="55" value="<?php echo esc_attr( $form_action->post_content['email_subject'] ); ?>" /></p>
53 53
 
54 54
         <p><label><?php _e( 'Message', 'formidable' ) ?> </label><br/>
55
-        <textarea name="<?php echo esc_attr( $this->get_field_name('email_message') ) ?>" class="frm_not_email_message large-text" id="<?php echo esc_attr( $this->get_field_id('email_message') ) ?>" cols="50" rows="5"><?php echo FrmAppHelper::esc_textarea($form_action->post_content['email_message']) ?></textarea></p>
55
+        <textarea name="<?php echo esc_attr( $this->get_field_name( 'email_message' ) ) ?>" class="frm_not_email_message large-text" id="<?php echo esc_attr( $this->get_field_id( 'email_message' ) ) ?>" cols="50" rows="5"><?php echo FrmAppHelper::esc_textarea( $form_action->post_content['email_message'] ) ?></textarea></p>
56 56
 
57 57
         <h4><?php _e( 'Options', 'formidable' ) ?> </h4>
58
-            <label for="<?php echo esc_attr( $this->get_field_id('inc_user_info') ) ?>"><input type="checkbox" name="<?php echo esc_attr( $this->get_field_name('inc_user_info') ) ?>" class="frm_not_inc_user_info" id="<?php echo esc_attr( $this->get_field_id('inc_user_info') ) ?>" value="1" <?php checked( $form_action->post_content['inc_user_info'], 1 ); ?> /> <?php _e( 'Append IP Address, Browser, and Referring URL to message', 'formidable' ) ?></label>
58
+            <label for="<?php echo esc_attr( $this->get_field_id( 'inc_user_info' ) ) ?>"><input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'inc_user_info' ) ) ?>" class="frm_not_inc_user_info" id="<?php echo esc_attr( $this->get_field_id( 'inc_user_info' ) ) ?>" value="1" <?php checked( $form_action->post_content['inc_user_info'], 1 ); ?> /> <?php _e( 'Append IP Address, Browser, and Referring URL to message', 'formidable' ) ?></label>
59 59
 
60
-        <p><label for="<?php echo esc_attr( $this->get_field_id('plain_text') ) ?>"><input type="checkbox" name="<?php echo esc_attr( $this->get_field_name('plain_text') ) ?>" id="<?php echo esc_attr( $this->get_field_id('plain_text') ) ?>" value="1" <?php checked( $form_action->post_content['plain_text'], 1 ); ?> /> <?php _e( 'Send Emails in Plain Text', 'formidable' ) ?></label></p>
60
+        <p><label for="<?php echo esc_attr( $this->get_field_id( 'plain_text' ) ) ?>"><input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'plain_text' ) ) ?>" id="<?php echo esc_attr( $this->get_field_id( 'plain_text' ) ) ?>" value="1" <?php checked( $form_action->post_content['plain_text'], 1 ); ?> /> <?php _e( 'Send Emails in Plain Text', 'formidable' ) ?></label></p>
61 61
     </td>
62 62
 </tr>
63 63
 </table>
Please login to merge, or discard this patch.
classes/views/frm-entries/errors.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,30 +4,30 @@
 block discarded – undo
4 4
 <?php
5 5
 }
6 6
 if ( isset( $message ) && $message != '' ) {
7
-    if ( FrmAppHelper::is_admin() ) {
7
+	if ( FrmAppHelper::is_admin() ) {
8 8
 		?><div id="message" class="frm_message updated frm_msg_padding"><?php echo wp_kses_post( $message ) ?></div><?php
9 9
 	} else {
10 10
 		FrmFormsHelper::maybe_get_scroll_js( $form->id );
11 11
 
12 12
 		// we need to allow scripts here for javascript in the success message
13 13
 		echo $message;
14
-    }
14
+	}
15 15
 }
16 16
 
17 17
 if ( isset($errors) && is_array( $errors ) && ! empty( $errors ) ) {
18 18
 
19 19
 	if ( isset( $form ) && is_object( $form ) ) {
20
-    	FrmFormsHelper::get_scroll_js( $form->id );
20
+		FrmFormsHelper::get_scroll_js( $form->id );
21 21
 	} ?>
22 22
 <div class="<?php echo esc_attr( FrmFormsHelper::form_error_class() ) ?>">
23 23
 <?php
24 24
 $img = '';
25 25
 if ( ! FrmAppHelper::is_admin() ) {
26
-    $img = apply_filters('frm_error_icon', $img);
27
-    if ( $img && ! empty($img) ) {
28
-    ?><img src="<?php echo esc_attr( $img ) ?>" alt="" />
26
+	$img = apply_filters('frm_error_icon', $img);
27
+	if ( $img && ! empty($img) ) {
28
+	?><img src="<?php echo esc_attr( $img ) ?>" alt="" />
29 29
 <?php
30
-    }
30
+	}
31 31
 }
32 32
 
33 33
 FrmFormsHelper::show_errors( compact( 'img', 'errors', 'form' ) );
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( isset($include_extra_container) ) { ?>
2
+if ( isset( $include_extra_container ) ) { ?>
3 3
 <div class="<?php echo esc_attr( $include_extra_container ) ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container">
4 4
 <?php
5 5
 }
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     }
15 15
 }
16 16
 
17
-if ( isset($errors) && is_array( $errors ) && ! empty( $errors ) ) {
17
+if ( isset( $errors ) && is_array( $errors ) && ! empty( $errors ) ) {
18 18
 
19 19
 	if ( isset( $form ) && is_object( $form ) ) {
20 20
     	FrmFormsHelper::get_scroll_js( $form->id );
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 <?php
24 24
 $img = '';
25 25
 if ( ! FrmAppHelper::is_admin() ) {
26
-    $img = apply_filters('frm_error_icon', $img);
27
-    if ( $img && ! empty($img) ) {
26
+    $img = apply_filters( 'frm_error_icon', $img );
27
+    if ( $img && ! empty( $img ) ) {
28 28
     ?><img src="<?php echo esc_attr( $img ) ?>" alt="" />
29 29
 <?php
30 30
     }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 <?php
38 38
 }
39 39
 
40
-if ( isset($include_extra_container) ) { ?>
40
+if ( isset( $include_extra_container ) ) { ?>
41 41
 </div>
42 42
 <?php
43 43
 }
Please login to merge, or discard this patch.
classes/helpers/FrmEntriesHelper.php 2 patches
Spacing   +72 added lines, -72 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
 
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
     public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) {
9 9
         $values = array();
10 10
 		foreach ( array( 'name' => '', 'description' => '', 'item_key' => '' ) as $var => $default ) {
11
-			$values[ $var ] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' );
11
+			$values[$var] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' );
12 12
         }
13 13
 
14 14
         $values['fields'] = array();
15
-        if ( empty($fields) ) {
16
-            return apply_filters('frm_setup_new_entry', $values);
15
+        if ( empty( $fields ) ) {
16
+            return apply_filters( 'frm_setup_new_entry', $values );
17 17
         }
18 18
 
19 19
         foreach ( (array) $fields as $field ) {
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
                 'default_value' => $field->default_value,
26 26
                 'name' => $field->name,
27 27
                 'description' => $field->description,
28
-                'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
28
+                'type' => apply_filters( 'frm_field_type', $field->type, $field, $new_value ),
29 29
                 'options' => $field->options,
30 30
                 'required' => $field->required,
31 31
                 'field_key' => $field->field_key,
@@ -36,43 +36,43 @@  discard block
 block discarded – undo
36 36
 				'in_embed_form' => isset( $args['in_embed_form'] ) ? $args['in_embed_form'] : '0',
37 37
             );
38 38
 
39
-            $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
39
+            $opt_defaults = FrmFieldsHelper::get_default_field_opts( $field_array['type'], $field, true );
40 40
             $opt_defaults['required_indicator'] = '';
41 41
 			$opt_defaults['original_type'] = $field->type;
42 42
 
43 43
 			foreach ( $opt_defaults as $opt => $default_opt ) {
44
-                $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt;
45
-                unset($opt, $default_opt);
44
+                $field_array[$opt] = ( isset( $field->field_options[$opt] ) && $field->field_options[$opt] != '' ) ? $field->field_options[$opt] : $default_opt;
45
+                unset( $opt, $default_opt );
46 46
             }
47 47
 
48
-            unset($opt_defaults);
48
+            unset( $opt_defaults );
49 49
 
50 50
             if ( $field_array['custom_html'] == '' ) {
51
-                $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
51
+                $field_array['custom_html'] = FrmFieldsHelper::get_default_html( $field->type );
52 52
             }
53 53
 
54
-            $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field, $args );
54
+            $field_array = apply_filters( 'frm_setup_new_fields_vars', $field_array, $field, $args );
55 55
             $field_array = array_merge( $field->field_options, $field_array );
56 56
 
57 57
             $values['fields'][] = $field_array;
58 58
 
59
-            if ( ! $form || ! isset($form->id) ) {
60
-                $form = FrmForm::getOne($field->form_id);
59
+            if ( ! $form || ! isset( $form->id ) ) {
60
+                $form = FrmForm::getOne( $field->form_id );
61 61
             }
62 62
         }
63 63
 
64
-        $form->options = maybe_unserialize($form->options);
65
-        if ( is_array($form->options) ) {
64
+        $form->options = maybe_unserialize( $form->options );
65
+        if ( is_array( $form->options ) ) {
66 66
             foreach ( $form->options as $opt => $value ) {
67
-                $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value );
68
-                unset($opt, $value);
67
+                $values[$opt] = FrmAppHelper::get_post_param( $opt, $value );
68
+                unset( $opt, $value );
69 69
             }
70 70
         }
71 71
 
72 72
 		$form_defaults = FrmFormsHelper::get_default_opts();
73 73
 
74 74
 		$frm_settings = FrmAppHelper::get_settings();
75
-		$form_defaults['custom_style']  = ( $frm_settings->load_style != 'none' );
75
+		$form_defaults['custom_style'] = ( $frm_settings->load_style != 'none' );
76 76
 
77 77
 		$values = array_merge( $form_defaults, $values );
78 78
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		$return_array = FrmField::is_field_with_multiple_values( $field );
96 96
 
97 97
 		// Do any shortcodes in default value and allow customization of default value
98
-		$field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true, $return_array);
98
+		$field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true, $return_array );
99 99
 		// Calls FrmProFieldsHelper::get_default_value
100 100
 
101 101
 		$new_value = $field->default_value;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		}
115 115
 
116 116
 		if ( ! is_array( $new_value ) ) {
117
-			$new_value = str_replace('"', '&quot;', $new_value);
117
+			$new_value = str_replace( '"', '&quot;', $new_value );
118 118
 		}
119 119
 
120 120
 		return $new_value;
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 		if ( $_POST ) {
134 134
 			$repeating = isset( $args['repeating'] ) && $args['repeating'];
135 135
 			if ( $repeating ) {
136
-				if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) {
136
+				if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) {
137 137
 					$value_is_posted = true;
138 138
 				}
139
-			} else if ( isset( $_POST['item_meta'][ $field->id ] ) ) {
139
+			} else if ( isset( $_POST['item_meta'][$field->id] ) ) {
140 140
 				$value_is_posted = true;
141 141
 			}
142 142
 		}
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		$values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' );
148 148
         $values['form_id'] = $record->form_id;
149 149
         $values['is_draft'] = $record->is_draft;
150
-        return apply_filters('frm_setup_edit_entry_vars', $values, $record);
150
+        return apply_filters( 'frm_setup_edit_entry_vars', $values, $record );
151 151
     }
152 152
 
153 153
     public static function get_admin_params( $form = null ) {
@@ -176,22 +176,22 @@  discard block
 block discarded – undo
176 176
     }
177 177
 
178 178
 	public static function replace_default_message( $message, $atts ) {
179
-        if ( strpos($message, '[default-message') === false &&
180
-            strpos($message, '[default_message') === false &&
179
+        if ( strpos( $message, '[default-message' ) === false &&
180
+            strpos( $message, '[default_message' ) === false &&
181 181
             ! empty( $message ) ) {
182 182
             return $message;
183 183
         }
184 184
 
185
-        if ( empty($message) ) {
185
+        if ( empty( $message ) ) {
186 186
             $message = '[default-message]';
187 187
         }
188 188
 
189
-        preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
189
+        preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER );
190 190
 
191 191
         foreach ( $shortcodes[0] as $short_key => $tag ) {
192
-			$add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
192
+			$add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] );
193 193
 			if ( ! empty( $add_atts ) ) {
194
-                $this_atts = array_merge($atts, $add_atts);
194
+                $this_atts = array_merge( $atts, $add_atts );
195 195
             } else {
196 196
                 $this_atts = $atts;
197 197
             }
@@ -199,32 +199,32 @@  discard block
 block discarded – undo
199 199
 			$default = FrmEntryFormat::show_entry( $this_atts );
200 200
 
201 201
             // Add the default message
202
-            $message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
202
+            $message = str_replace( $shortcodes[0][$short_key], $default, $message );
203 203
         }
204 204
 
205 205
         return $message;
206 206
     }
207 207
 
208 208
 	public static function prepare_display_value( $entry, $field, $atts ) {
209
-		$field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false;
209
+		$field_value = isset( $entry->metas[$field->id] ) ? $entry->metas[$field->id] : false;
210 210
 
211 211
         if ( FrmAppHelper::pro_is_installed() ) {
212 212
 			FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value );
213 213
         }
214 214
 
215
-        if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
216
-            return self::display_value($field_value, $field, $atts);
215
+        if ( $field->form_id == $entry->form_id || empty( $atts['embedded_field_id'] ) ) {
216
+            return self::display_value( $field_value, $field, $atts );
217 217
         }
218 218
 
219 219
         // this is an embeded form
220 220
         $val = '';
221 221
 
222
-	    if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
222
+	    if ( strpos( $atts['embedded_field_id'], 'form' ) === 0 ) {
223 223
             //this is a repeating section
224 224
 			$child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) );
225 225
         } else {
226 226
             // get all values for this field
227
-	        $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
227
+	        $child_values = isset( $entry->metas[$atts['embedded_field_id']] ) ? $entry->metas[$atts['embedded_field_id']] : false;
228 228
 
229 229
             if ( $child_values ) {
230 230
 	            $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 	    $field_value = array();
235 235
 
236
-        if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
236
+        if ( ! isset( $child_entries ) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
237 237
             return $val;
238 238
         }
239 239
 
@@ -242,17 +242,17 @@  discard block
 block discarded – undo
242 242
             $atts['post_id'] = $child_entry->post_id;
243 243
 
244 244
             // get the value for this field -- check for post values as well
245
-            $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
245
+            $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value( $child_entry, $field );
246 246
 
247 247
             if ( $entry_val ) {
248 248
                 // foreach entry get display_value
249
-                $field_value[] = self::display_value($entry_val, $field, $atts);
249
+                $field_value[] = self::display_value( $entry_val, $field, $atts );
250 250
             }
251 251
 
252
-            unset($child_entry);
252
+            unset( $child_entry );
253 253
         }
254 254
 
255
-        $val = implode(', ', (array) $field_value );
255
+        $val = implode( ', ', (array) $field_value );
256 256
 		$val = wp_kses_post( $val );
257 257
 
258 258
         return $val;
@@ -272,22 +272,22 @@  discard block
 block discarded – undo
272 272
         );
273 273
 
274 274
         $atts = wp_parse_args( $atts, $defaults );
275
-        $atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
275
+        $atts = apply_filters( 'frm_display_value_atts', $atts, $field, $value );
276 276
 
277
-        if ( ! isset($field->field_options['post_field']) ) {
277
+        if ( ! isset( $field->field_options['post_field'] ) ) {
278 278
             $field->field_options['post_field'] = '';
279 279
         }
280 280
 
281
-        if ( ! isset($field->field_options['custom_field']) ) {
281
+        if ( ! isset( $field->field_options['custom_field'] ) ) {
282 282
             $field->field_options['custom_field'] = '';
283 283
         }
284 284
 
285 285
         if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
286 286
             $atts['pre_truncate'] = $atts['truncate'];
287 287
             $atts['truncate'] = true;
288
-            $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
288
+            $atts['exclude_cat'] = isset( $field->field_options['exclude_cat'] ) ? $field->field_options['exclude_cat'] : 0;
289 289
 
290
-            $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
290
+            $value = FrmProEntryMetaHelper::get_post_value( $atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts );
291 291
             $atts['truncate'] = $atts['pre_truncate'];
292 292
         }
293 293
 
@@ -295,39 +295,39 @@  discard block
 block discarded – undo
295 295
             return $value;
296 296
         }
297 297
 
298
-        $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts);
298
+        $value = apply_filters( 'frm_display_value_custom', maybe_unserialize( $value ), $field, $atts );
299 299
 		$value = apply_filters( 'frm_display_' . $field->type . '_value_custom', $value, compact( 'field', 'atts' ) );
300 300
 
301 301
         $new_value = '';
302 302
 
303
-        if ( is_array($value) && $atts['type'] != 'file' ) {
303
+        if ( is_array( $value ) && $atts['type'] != 'file' ) {
304 304
             foreach ( $value as $val ) {
305
-                if ( is_array($val) ) {
305
+                if ( is_array( $val ) ) {
306 306
 					//TODO: add options for display (li or ,)
307
-                    $new_value .= implode($atts['sep'], $val);
307
+                    $new_value .= implode( $atts['sep'], $val );
308 308
                     if ( $atts['type'] != 'data' ) {
309 309
                         $new_value .= '<br/>';
310 310
                     }
311 311
                 }
312
-                unset($val);
312
+                unset( $val );
313 313
             }
314 314
         }
315 315
 
316
-        if ( ! empty($new_value) ) {
316
+        if ( ! empty( $new_value ) ) {
317 317
             $value = $new_value;
318
-        } else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
319
-            $value = implode($atts['sep'], $value);
318
+        } else if ( is_array( $value ) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
319
+            $value = implode( $atts['sep'], $value );
320 320
         }
321 321
 
322 322
         if ( $atts['truncate'] && $atts['type'] != 'image' ) {
323
-            $value = FrmAppHelper::truncate($value, 50);
323
+            $value = FrmAppHelper::truncate( $value, 50 );
324 324
         }
325 325
 
326 326
 		if ( ! $atts['keepjs'] && ! is_array( $value ) ) {
327 327
 			$value = wp_kses_post( $value );
328 328
 		}
329 329
 
330
-        return apply_filters('frm_display_value', $value, $field, $atts);
330
+        return apply_filters( 'frm_display_value', $value, $field, $atts );
331 331
     }
332 332
 
333 333
 	public static function set_posted_value( $field, $value, $args ) {
@@ -335,20 +335,20 @@  discard block
 block discarded – undo
335 335
         if ( isset( $args['other'] ) && $args['other'] ) {
336 336
             $value = $args['temp_value'];
337 337
         }
338
-        if ( empty($args['parent_field_id']) ) {
339
-            $_POST['item_meta'][ $field->id ] = $value;
338
+        if ( empty( $args['parent_field_id'] ) ) {
339
+            $_POST['item_meta'][$field->id] = $value;
340 340
         } else {
341
-            $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
341
+            $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value;
342 342
         }
343 343
     }
344 344
 
345 345
 	public static function get_posted_value( $field, &$value, $args ) {
346 346
 		$field_id = is_object( $field ) ? $field->id : $field;
347 347
 
348
-        if ( empty($args['parent_field_id']) ) {
349
-            $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
348
+        if ( empty( $args['parent_field_id'] ) ) {
349
+            $value = isset( $_POST['item_meta'][$field_id] ) ? $_POST['item_meta'][$field_id] : '';
350 350
         } else {
351
-            $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
351
+            $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] : '';
352 352
         }
353 353
 		FrmAppHelper::sanitize_value( 'wp_kses_post', $value );
354 354
 		$value = stripslashes_deep( $value );
@@ -373,12 +373,12 @@  discard block
 block discarded – undo
373 373
         self::set_other_repeating_vals( $field, $value, $args );
374 374
 
375 375
         // Check if there are any posted "Other" values
376
-		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) {
376
+		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) {
377 377
 
378 378
             // Save original value
379 379
             $args['temp_value'] = $value;
380 380
             $args['other'] = true;
381
-            $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] );
381
+            $other_vals = stripslashes_deep( $_POST['item_meta']['other'][$field->id] );
382 382
 
383 383
             // Set the validation value now
384 384
             self::set_other_validation_val( $value, $other_vals, $field, $args );
@@ -400,12 +400,12 @@  discard block
 block discarded – undo
400 400
         }
401 401
 
402 402
         // Check if there are any other posted "other" values for this field
403
-		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) {
403
+		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) {
404 404
             // Save original value
405 405
             $args['temp_value'] = $value;
406 406
             $args['other'] = true;
407 407
 
408
-            $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ];
408
+            $other_vals = $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id];
409 409
 
410 410
             // Set the validation value now
411 411
             self::set_other_validation_val( $value, $other_vals, $field, $args );
@@ -437,27 +437,27 @@  discard block
 block discarded – undo
437 437
             }
438 438
         } else {
439 439
 			// Radio and dropdowns
440
-            $other_key = array_filter( array_keys($field->options), 'is_string');
440
+            $other_key = array_filter( array_keys( $field->options ), 'is_string' );
441 441
             $other_key = reset( $other_key );
442 442
 
443 443
             // Multi-select dropdown
444 444
             if ( is_array( $value ) ) {
445
-                $o_key = array_search( $field->options[ $other_key ], $value );
445
+                $o_key = array_search( $field->options[$other_key], $value );
446 446
 
447 447
 				if ( $o_key !== false ) {
448 448
 					// Modify the original value so other key will be preserved
449
-					$value[ $other_key ] = $value[ $o_key ];
449
+					$value[$other_key] = $value[$o_key];
450 450
 
451 451
 					// By default, the array keys will be numeric for multi-select dropdowns
452 452
 					// If going backwards and forwards between pages, the array key will match the other key
453 453
 					if ( $o_key != $other_key ) {
454
-						unset( $value[ $o_key ] );
454
+						unset( $value[$o_key] );
455 455
 					}
456 456
 
457 457
 					$args['temp_value'] = $value;
458
-					$value[ $other_key ] = reset( $other_vals );
458
+					$value[$other_key] = reset( $other_vals );
459 459
 				}
460
-            } else if ( $field->options[ $other_key ] == $value ) {
460
+            } else if ( $field->options[$other_key] == $value ) {
461 461
                 $value = $other_vals;
462 462
             }
463 463
         }
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 				$content .= "\n\n";
477 477
 			}
478 478
 
479
-			if ( is_array($val) ) {
479
+			if ( is_array( $val ) ) {
480 480
 				$val = FrmAppHelper::array_flatten( $val );
481 481
 				$val = implode( ', ', $val );
482 482
 			}
Please login to merge, or discard this patch.
Indentation   +291 added lines, -291 removed lines patch added patch discarded remove patch
@@ -5,69 +5,69 @@  discard block
 block discarded – undo
5 5
 
6 6
 class FrmEntriesHelper {
7 7
 
8
-    public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) {
9
-        $values = array();
8
+	public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) {
9
+		$values = array();
10 10
 		foreach ( array( 'name' => '', 'description' => '', 'item_key' => '' ) as $var => $default ) {
11 11
 			$values[ $var ] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' );
12
-        }
13
-
14
-        $values['fields'] = array();
15
-        if ( empty($fields) ) {
16
-            return apply_filters('frm_setup_new_entry', $values);
17
-        }
18
-
19
-        foreach ( (array) $fields as $field ) {
20
-            $new_value = self::get_field_value_for_new_entry( $field, $reset, $args );
21
-
22
-            $field_array = array(
23
-                'id' => $field->id,
24
-                'value' => $new_value,
25
-                'default_value' => $field->default_value,
26
-                'name' => $field->name,
27
-                'description' => $field->description,
28
-                'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
29
-                'options' => $field->options,
30
-                'required' => $field->required,
31
-                'field_key' => $field->field_key,
32
-                'field_order' => $field->field_order,
33
-                'form_id' => $field->form_id,
12
+		}
13
+
14
+		$values['fields'] = array();
15
+		if ( empty($fields) ) {
16
+			return apply_filters('frm_setup_new_entry', $values);
17
+		}
18
+
19
+		foreach ( (array) $fields as $field ) {
20
+			$new_value = self::get_field_value_for_new_entry( $field, $reset, $args );
21
+
22
+			$field_array = array(
23
+				'id' => $field->id,
24
+				'value' => $new_value,
25
+				'default_value' => $field->default_value,
26
+				'name' => $field->name,
27
+				'description' => $field->description,
28
+				'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
29
+				'options' => $field->options,
30
+				'required' => $field->required,
31
+				'field_key' => $field->field_key,
32
+				'field_order' => $field->field_order,
33
+				'form_id' => $field->form_id,
34 34
 				'parent_form_id' => isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id,
35
-	            'reset_value' => $reset,
35
+				'reset_value' => $reset,
36 36
 				'in_embed_form' => isset( $args['in_embed_form'] ) ? $args['in_embed_form'] : '0',
37
-            );
37
+			);
38 38
 
39
-            $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
40
-            $opt_defaults['required_indicator'] = '';
39
+			$opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
40
+			$opt_defaults['required_indicator'] = '';
41 41
 			$opt_defaults['original_type'] = $field->type;
42 42
 
43 43
 			foreach ( $opt_defaults as $opt => $default_opt ) {
44
-                $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt;
45
-                unset($opt, $default_opt);
46
-            }
44
+				$field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt;
45
+				unset($opt, $default_opt);
46
+			}
47 47
 
48
-            unset($opt_defaults);
48
+			unset($opt_defaults);
49 49
 
50
-            if ( $field_array['custom_html'] == '' ) {
51
-                $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
52
-            }
50
+			if ( $field_array['custom_html'] == '' ) {
51
+				$field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
52
+			}
53 53
 
54
-            $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field, $args );
55
-            $field_array = array_merge( $field->field_options, $field_array );
54
+			$field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field, $args );
55
+			$field_array = array_merge( $field->field_options, $field_array );
56 56
 
57
-            $values['fields'][] = $field_array;
57
+			$values['fields'][] = $field_array;
58 58
 
59
-            if ( ! $form || ! isset($form->id) ) {
60
-                $form = FrmForm::getOne($field->form_id);
61
-            }
62
-        }
59
+			if ( ! $form || ! isset($form->id) ) {
60
+				$form = FrmForm::getOne($field->form_id);
61
+			}
62
+		}
63 63
 
64
-        $form->options = maybe_unserialize($form->options);
65
-        if ( is_array($form->options) ) {
66
-            foreach ( $form->options as $opt => $value ) {
67
-                $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value );
68
-                unset($opt, $value);
69
-            }
70
-        }
64
+		$form->options = maybe_unserialize($form->options);
65
+		if ( is_array($form->options) ) {
66
+			foreach ( $form->options as $opt => $value ) {
67
+				$values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value );
68
+				unset($opt, $value);
69
+			}
70
+		}
71 71
 
72 72
 		$form_defaults = FrmFormsHelper::get_default_opts();
73 73
 
@@ -77,19 +77,19 @@  discard block
 block discarded – undo
77 77
 		$values = array_merge( $form_defaults, $values );
78 78
 
79 79
 		return apply_filters( 'frm_setup_new_entry', $values );
80
-    }
80
+	}
81 81
 
82 82
 	/**
83
-	* Set the value for each field
84
-	* This function is used when the form is first loaded and on all page turns *for a new entry*
85
-	*
86
-	* @since 2.0.13
87
-	*
88
-	* @param object $field - this is passed by reference since it is an object
89
-	* @param boolean $reset
90
-	* @param array $args
91
-	* @return string|array $new_value
92
-	*/
83
+	 * Set the value for each field
84
+	 * This function is used when the form is first loaded and on all page turns *for a new entry*
85
+	 *
86
+	 * @since 2.0.13
87
+	 *
88
+	 * @param object $field - this is passed by reference since it is an object
89
+	 * @param boolean $reset
90
+	 * @param array $args
91
+	 * @return string|array $new_value
92
+	 */
93 93
 	private static function get_field_value_for_new_entry( $field, $reset, $args ) {
94 94
 		//If checkbox, multi-select dropdown, or checkbox data from entries field, the value should be an array
95 95
 		$return_array = FrmField::is_field_with_multiple_values( $field );
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 	}
122 122
 
123 123
 	/**
124
-	* Check if a field has a posted value
125
-	*
126
-	* @since 2.01.0
127
-	* @param object $field
128
-	* @param array $args
129
-	* @return boolean $value_is_posted
130
-	*/
124
+	 * Check if a field has a posted value
125
+	 *
126
+	 * @since 2.01.0
127
+	 * @param object $field
128
+	 * @param array $args
129
+	 * @return boolean $value_is_posted
130
+	 */
131 131
 	public static function value_is_posted( $field, $args ) {
132 132
 		$value_is_posted = false;
133 133
 		if ( $_POST ) {
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 
146 146
 	public static function setup_edit_vars( $values, $record ) {
147 147
 		$values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' );
148
-        $values['form_id'] = $record->form_id;
149
-        $values['is_draft'] = $record->is_draft;
150
-        return apply_filters('frm_setup_edit_entry_vars', $values, $record);
151
-    }
148
+		$values['form_id'] = $record->form_id;
149
+		$values['is_draft'] = $record->is_draft;
150
+		return apply_filters('frm_setup_edit_entry_vars', $values, $record);
151
+	}
152 152
 
153
-    public static function get_admin_params( $form = null ) {
153
+	public static function get_admin_params( $form = null ) {
154 154
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_admin_params' );
155 155
 		return FrmForm::set_current_form( $form );
156
-    }
156
+	}
157 157
 
158 158
 	public static function set_current_form( $form_id ) {
159 159
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::set_current_form' );
@@ -165,284 +165,284 @@  discard block
 block discarded – undo
165 165
 		return FrmForm::get_current_form( $form_id );
166 166
 	}
167 167
 
168
-    public static function get_current_form_id() {
168
+	public static function get_current_form_id() {
169 169
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_current_form_id' );
170 170
 		return FrmForm::get_current_form_id();
171
-    }
171
+	}
172 172
 
173
-    public static function maybe_get_entry( &$entry ) {
173
+	public static function maybe_get_entry( &$entry ) {
174 174
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmEntry::maybe_get_entry' );
175 175
 		FrmEntry::maybe_get_entry( $entry );
176
-    }
176
+	}
177 177
 
178 178
 	public static function replace_default_message( $message, $atts ) {
179
-        if ( strpos($message, '[default-message') === false &&
180
-            strpos($message, '[default_message') === false &&
181
-            ! empty( $message ) ) {
182
-            return $message;
183
-        }
179
+		if ( strpos($message, '[default-message') === false &&
180
+			strpos($message, '[default_message') === false &&
181
+			! empty( $message ) ) {
182
+			return $message;
183
+		}
184 184
 
185
-        if ( empty($message) ) {
186
-            $message = '[default-message]';
187
-        }
185
+		if ( empty($message) ) {
186
+			$message = '[default-message]';
187
+		}
188 188
 
189
-        preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
189
+		preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
190 190
 
191
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
191
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
192 192
 			$add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
193 193
 			if ( ! empty( $add_atts ) ) {
194
-                $this_atts = array_merge($atts, $add_atts);
195
-            } else {
196
-                $this_atts = $atts;
197
-            }
194
+				$this_atts = array_merge($atts, $add_atts);
195
+			} else {
196
+				$this_atts = $atts;
197
+			}
198 198
 
199 199
 			$default = FrmEntryFormat::show_entry( $this_atts );
200 200
 
201
-            // Add the default message
202
-            $message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
203
-        }
201
+			// Add the default message
202
+			$message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
203
+		}
204 204
 
205
-        return $message;
206
-    }
205
+		return $message;
206
+	}
207 207
 
208 208
 	public static function prepare_display_value( $entry, $field, $atts ) {
209 209
 		$field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false;
210 210
 
211
-        if ( FrmAppHelper::pro_is_installed() ) {
211
+		if ( FrmAppHelper::pro_is_installed() ) {
212 212
 			FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value );
213
-        }
213
+		}
214 214
 
215
-        if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
216
-            return self::display_value($field_value, $field, $atts);
217
-        }
215
+		if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
216
+			return self::display_value($field_value, $field, $atts);
217
+		}
218 218
 
219
-        // this is an embeded form
220
-        $val = '';
219
+		// this is an embeded form
220
+		$val = '';
221 221
 
222
-	    if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
223
-            //this is a repeating section
222
+		if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
223
+			//this is a repeating section
224 224
 			$child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) );
225
-        } else {
226
-            // get all values for this field
227
-	        $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
225
+		} else {
226
+			// get all values for this field
227
+			$child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
228 228
 
229
-            if ( $child_values ) {
230
-	            $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
231
-	        }
232
-	    }
229
+			if ( $child_values ) {
230
+				$child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
231
+			}
232
+		}
233 233
 
234
-	    $field_value = array();
234
+		$field_value = array();
235 235
 
236
-        if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
237
-            return $val;
238
-        }
236
+		if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
237
+			return $val;
238
+		}
239 239
 
240
-        foreach ( $child_entries as $child_entry ) {
241
-            $atts['item_id'] = $child_entry->id;
242
-            $atts['post_id'] = $child_entry->post_id;
240
+		foreach ( $child_entries as $child_entry ) {
241
+			$atts['item_id'] = $child_entry->id;
242
+			$atts['post_id'] = $child_entry->post_id;
243 243
 
244
-            // get the value for this field -- check for post values as well
245
-            $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
244
+			// get the value for this field -- check for post values as well
245
+			$entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
246 246
 
247
-            if ( $entry_val ) {
248
-                // foreach entry get display_value
249
-                $field_value[] = self::display_value($entry_val, $field, $atts);
250
-            }
247
+			if ( $entry_val ) {
248
+				// foreach entry get display_value
249
+				$field_value[] = self::display_value($entry_val, $field, $atts);
250
+			}
251 251
 
252
-            unset($child_entry);
253
-        }
252
+			unset($child_entry);
253
+		}
254 254
 
255
-        $val = implode(', ', (array) $field_value );
255
+		$val = implode(', ', (array) $field_value );
256 256
 		$val = wp_kses_post( $val );
257 257
 
258
-        return $val;
259
-    }
258
+		return $val;
259
+	}
260 260
 
261
-    /**
262
-     * Prepare the saved value for display
263
-     * @return string
264
-     */
261
+	/**
262
+	 * Prepare the saved value for display
263
+	 * @return string
264
+	 */
265 265
 	public static function display_value( $value, $field, $atts = array() ) {
266 266
 
267
-        $defaults = array(
268
-            'type' => '', 'html' => false, 'show_filename' => true,
269
-            'truncate' => false, 'sep' => ', ', 'post_id' => 0,
270
-            'form_id' => $field->form_id, 'field' => $field, 'keepjs' => 0,
267
+		$defaults = array(
268
+			'type' => '', 'html' => false, 'show_filename' => true,
269
+			'truncate' => false, 'sep' => ', ', 'post_id' => 0,
270
+			'form_id' => $field->form_id, 'field' => $field, 'keepjs' => 0,
271 271
 			'return_array' => false,
272
-        );
272
+		);
273 273
 
274
-        $atts = wp_parse_args( $atts, $defaults );
275
-        $atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
274
+		$atts = wp_parse_args( $atts, $defaults );
275
+		$atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
276 276
 
277
-        if ( ! isset($field->field_options['post_field']) ) {
278
-            $field->field_options['post_field'] = '';
279
-        }
277
+		if ( ! isset($field->field_options['post_field']) ) {
278
+			$field->field_options['post_field'] = '';
279
+		}
280 280
 
281
-        if ( ! isset($field->field_options['custom_field']) ) {
282
-            $field->field_options['custom_field'] = '';
283
-        }
281
+		if ( ! isset($field->field_options['custom_field']) ) {
282
+			$field->field_options['custom_field'] = '';
283
+		}
284 284
 
285
-        if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
286
-            $atts['pre_truncate'] = $atts['truncate'];
287
-            $atts['truncate'] = true;
288
-            $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
285
+		if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
286
+			$atts['pre_truncate'] = $atts['truncate'];
287
+			$atts['truncate'] = true;
288
+			$atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
289 289
 
290
-            $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
291
-            $atts['truncate'] = $atts['pre_truncate'];
292
-        }
290
+			$value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
291
+			$atts['truncate'] = $atts['pre_truncate'];
292
+		}
293 293
 
294
-        if ( $value == '' ) {
295
-            return $value;
296
-        }
294
+		if ( $value == '' ) {
295
+			return $value;
296
+		}
297 297
 
298
-        $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts);
298
+		$value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts);
299 299
 		$value = apply_filters( 'frm_display_' . $field->type . '_value_custom', $value, compact( 'field', 'atts' ) );
300 300
 
301
-        $new_value = '';
301
+		$new_value = '';
302 302
 
303
-        if ( is_array($value) && $atts['type'] != 'file' ) {
304
-            foreach ( $value as $val ) {
305
-                if ( is_array($val) ) {
303
+		if ( is_array($value) && $atts['type'] != 'file' ) {
304
+			foreach ( $value as $val ) {
305
+				if ( is_array($val) ) {
306 306
 					//TODO: add options for display (li or ,)
307
-                    $new_value .= implode($atts['sep'], $val);
308
-                    if ( $atts['type'] != 'data' ) {
309
-                        $new_value .= '<br/>';
310
-                    }
311
-                }
312
-                unset($val);
313
-            }
314
-        }
315
-
316
-        if ( ! empty($new_value) ) {
317
-            $value = $new_value;
318
-        } else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
319
-            $value = implode($atts['sep'], $value);
320
-        }
321
-
322
-        if ( $atts['truncate'] && $atts['type'] != 'image' ) {
323
-            $value = FrmAppHelper::truncate($value, 50);
324
-        }
307
+					$new_value .= implode($atts['sep'], $val);
308
+					if ( $atts['type'] != 'data' ) {
309
+						$new_value .= '<br/>';
310
+					}
311
+				}
312
+				unset($val);
313
+			}
314
+		}
315
+
316
+		if ( ! empty($new_value) ) {
317
+			$value = $new_value;
318
+		} else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
319
+			$value = implode($atts['sep'], $value);
320
+		}
321
+
322
+		if ( $atts['truncate'] && $atts['type'] != 'image' ) {
323
+			$value = FrmAppHelper::truncate($value, 50);
324
+		}
325 325
 
326 326
 		if ( ! $atts['keepjs'] && ! is_array( $value ) ) {
327 327
 			$value = wp_kses_post( $value );
328 328
 		}
329 329
 
330
-        return apply_filters('frm_display_value', $value, $field, $atts);
331
-    }
330
+		return apply_filters('frm_display_value', $value, $field, $atts);
331
+	}
332 332
 
333 333
 	public static function set_posted_value( $field, $value, $args ) {
334
-        // If validating a field with "other" opt, set back to prev value now
335
-        if ( isset( $args['other'] ) && $args['other'] ) {
336
-            $value = $args['temp_value'];
337
-        }
338
-        if ( empty($args['parent_field_id']) ) {
339
-            $_POST['item_meta'][ $field->id ] = $value;
340
-        } else {
341
-            $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
342
-        }
343
-    }
334
+		// If validating a field with "other" opt, set back to prev value now
335
+		if ( isset( $args['other'] ) && $args['other'] ) {
336
+			$value = $args['temp_value'];
337
+		}
338
+		if ( empty($args['parent_field_id']) ) {
339
+			$_POST['item_meta'][ $field->id ] = $value;
340
+		} else {
341
+			$_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
342
+		}
343
+	}
344 344
 
345 345
 	public static function get_posted_value( $field, &$value, $args ) {
346 346
 		$field_id = is_object( $field ) ? $field->id : $field;
347 347
 
348
-        if ( empty($args['parent_field_id']) ) {
349
-            $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
350
-        } else {
351
-            $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
352
-        }
348
+		if ( empty($args['parent_field_id']) ) {
349
+			$value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
350
+		} else {
351
+			$value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
352
+		}
353 353
 		FrmAppHelper::sanitize_value( 'wp_kses_post', $value );
354 354
 		$value = stripslashes_deep( $value );
355
-    }
356
-
357
-    /**
358
-    * Check if field has an "Other" option and if any other values are posted
359
-    *
360
-    * @since 2.0
361
-    *
362
-    * @param object $field
363
-    * @param string|array $value
364
-    * @param array $args
365
-    */
366
-    public static function maybe_set_other_validation( $field, &$value, &$args ) {
367
-        $args['other'] = false;
368
-        if ( ! $value || empty( $value ) || ! FrmAppHelper::pro_is_installed() ) {
369
-            return;
370
-        }
371
-
372
-        // Get other value for fields in repeating section
373
-        self::set_other_repeating_vals( $field, $value, $args );
374
-
375
-        // Check if there are any posted "Other" values
355
+	}
356
+
357
+	/**
358
+	 * Check if field has an "Other" option and if any other values are posted
359
+	 *
360
+	 * @since 2.0
361
+	 *
362
+	 * @param object $field
363
+	 * @param string|array $value
364
+	 * @param array $args
365
+	 */
366
+	public static function maybe_set_other_validation( $field, &$value, &$args ) {
367
+		$args['other'] = false;
368
+		if ( ! $value || empty( $value ) || ! FrmAppHelper::pro_is_installed() ) {
369
+			return;
370
+		}
371
+
372
+		// Get other value for fields in repeating section
373
+		self::set_other_repeating_vals( $field, $value, $args );
374
+
375
+		// Check if there are any posted "Other" values
376 376
 		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) {
377 377
 
378
-            // Save original value
379
-            $args['temp_value'] = $value;
380
-            $args['other'] = true;
381
-            $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] );
382
-
383
-            // Set the validation value now
384
-            self::set_other_validation_val( $value, $other_vals, $field, $args );
385
-        }
386
-    }
387
-
388
-    /**
389
-    * Sets radio or checkbox value equal to "other" value if it is set - FOR REPEATING SECTIONS
390
-    *
391
-    * @since 2.0
392
-    *
393
-    * @param object $field
394
-    * @param string|array $value
395
-    * @param array $args
396
-    */
397
-    public static function set_other_repeating_vals( $field, &$value, &$args ) {
398
-        if ( ! $args['parent_field_id'] ) {
399
-            return;
400
-        }
401
-
402
-        // Check if there are any other posted "other" values for this field
378
+			// Save original value
379
+			$args['temp_value'] = $value;
380
+			$args['other'] = true;
381
+			$other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] );
382
+
383
+			// Set the validation value now
384
+			self::set_other_validation_val( $value, $other_vals, $field, $args );
385
+		}
386
+	}
387
+
388
+	/**
389
+	 * Sets radio or checkbox value equal to "other" value if it is set - FOR REPEATING SECTIONS
390
+	 *
391
+	 * @since 2.0
392
+	 *
393
+	 * @param object $field
394
+	 * @param string|array $value
395
+	 * @param array $args
396
+	 */
397
+	public static function set_other_repeating_vals( $field, &$value, &$args ) {
398
+		if ( ! $args['parent_field_id'] ) {
399
+			return;
400
+		}
401
+
402
+		// Check if there are any other posted "other" values for this field
403 403
 		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) {
404
-            // Save original value
405
-            $args['temp_value'] = $value;
406
-            $args['other'] = true;
407
-
408
-            $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ];
409
-
410
-            // Set the validation value now
411
-            self::set_other_validation_val( $value, $other_vals, $field, $args );
412
-        }
413
-    }
414
-
415
-    /**
416
-    * Modify value used for validation
417
-    * This function essentially removes the "Other" radio or checkbox value from the $value being validated.
418
-    * It also adds any text from the free text fields to the value
419
-    *
420
-    * Needs to accommodate for times when other opt is selected, but no other free text is entered
421
-    *
422
-    * @since 2.0
423
-    *
424
-    * @param string|array $value
425
-    * @param string|array $other_vals (usually of posted values)
426
-    * @param object $field
427
-    * @param array $args
428
-    */
429
-    public static function set_other_validation_val( &$value, $other_vals, $field, &$args ) {
430
-        // Checkboxes and multi-select dropdowns
431
-        if ( is_array( $value ) && $field->type == 'checkbox' ) {
432
-            // Combine "Other" values with checked values. "Other" values will override checked box values.
433
-            $value = array_merge( $value, $other_vals );
434
-            $value = array_filter( $value );
435
-            if ( count( $value ) == 0 ) {
436
-                $value = '';
437
-            }
438
-        } else {
404
+			// Save original value
405
+			$args['temp_value'] = $value;
406
+			$args['other'] = true;
407
+
408
+			$other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ];
409
+
410
+			// Set the validation value now
411
+			self::set_other_validation_val( $value, $other_vals, $field, $args );
412
+		}
413
+	}
414
+
415
+	/**
416
+	 * Modify value used for validation
417
+	 * This function essentially removes the "Other" radio or checkbox value from the $value being validated.
418
+	 * It also adds any text from the free text fields to the value
419
+	 *
420
+	 * Needs to accommodate for times when other opt is selected, but no other free text is entered
421
+	 *
422
+	 * @since 2.0
423
+	 *
424
+	 * @param string|array $value
425
+	 * @param string|array $other_vals (usually of posted values)
426
+	 * @param object $field
427
+	 * @param array $args
428
+	 */
429
+	public static function set_other_validation_val( &$value, $other_vals, $field, &$args ) {
430
+		// Checkboxes and multi-select dropdowns
431
+		if ( is_array( $value ) && $field->type == 'checkbox' ) {
432
+			// Combine "Other" values with checked values. "Other" values will override checked box values.
433
+			$value = array_merge( $value, $other_vals );
434
+			$value = array_filter( $value );
435
+			if ( count( $value ) == 0 ) {
436
+				$value = '';
437
+			}
438
+		} else {
439 439
 			// Radio and dropdowns
440
-            $other_key = array_filter( array_keys($field->options), 'is_string');
441
-            $other_key = reset( $other_key );
440
+			$other_key = array_filter( array_keys($field->options), 'is_string');
441
+			$other_key = reset( $other_key );
442 442
 
443
-            // Multi-select dropdown
444
-            if ( is_array( $value ) ) {
445
-                $o_key = array_search( $field->options[ $other_key ], $value );
443
+			// Multi-select dropdown
444
+			if ( is_array( $value ) ) {
445
+				$o_key = array_search( $field->options[ $other_key ], $value );
446 446
 
447 447
 				if ( $o_key !== false ) {
448 448
 					// Modify the original value so other key will be preserved
@@ -457,20 +457,20 @@  discard block
 block discarded – undo
457 457
 					$args['temp_value'] = $value;
458 458
 					$value[ $other_key ] = reset( $other_vals );
459 459
 				}
460
-            } else if ( $field->options[ $other_key ] == $value ) {
461
-                $value = $other_vals;
462
-            }
463
-        }
464
-    }
460
+			} else if ( $field->options[ $other_key ] == $value ) {
461
+				$value = $other_vals;
462
+			}
463
+		}
464
+	}
465 465
 
466 466
 	public static function enqueue_scripts( $params ) {
467 467
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmFormsController::enqueue_scripts' );
468 468
 		FrmFormsController::enqueue_scripts( $params );
469 469
 	}
470 470
 
471
-    // Add submitted values to a string for spam checking
471
+	// Add submitted values to a string for spam checking
472 472
 	public static function entry_array_to_string( $values ) {
473
-        $content = '';
473
+		$content = '';
474 474
 		foreach ( $values['item_meta'] as $val ) {
475 475
 			if ( $content != '' ) {
476 476
 				$content .= "\n\n";
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 		}
486 486
 
487 487
 		return $content;
488
-    }
488
+	}
489 489
 
490 490
 	public static function fill_entry_values( $atts, $f, array &$values ) {
491 491
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmEntryFormat::fill_entry_values' );
Please login to merge, or discard this patch.
classes/helpers/FrmAppHelper.php 3 patches
Doc Comments   +14 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,6 +57,9 @@  discard block
 block discarded – undo
57 57
         return get_option('blogname');
58 58
     }
59 59
 
60
+	/**
61
+	 * @param string $url
62
+	 */
60 63
 	public static function make_affiliate_url( $url ) {
61 64
 		$affiliate_id = self::get_affiliate();
62 65
 		if ( ! empty( $affiliate_id ) ) {
@@ -356,7 +359,7 @@  discard block
 block discarded – undo
356 359
 	 * Sanitize the value, and allow some HTML
357 360
 	 * @since 2.0
358 361
 	 * @param string $value
359
-	 * @param array $allowed
362
+	 * @param string[] $allowed
360 363
 	 * @return string
361 364
 	 */
362 365
 	public static function kses( $value, $allowed = array() ) {
@@ -464,6 +467,7 @@  discard block
 block discarded – undo
464 467
 	/**
465 468
 	 * Keep track of the keys cached in each group so they can be deleted
466 469
 	 * in Redis and Memcache
470
+	 * @param string $group
467 471
 	 */
468 472
 	public static function add_key_to_group_cache( $key, $group ) {
469 473
 		$cached = self::get_group_cached_keys( $group );
@@ -784,6 +788,9 @@  discard block
 block discarded – undo
784 788
 		return FrmFieldsHelper::prepare_other_input( $args, $other_opt, $checked );
785 789
     }
786 790
 
791
+	/**
792
+	 * @param string $function
793
+	 */
787 794
 	public static function recursive_function_map( $value, $function ) {
788 795
 		if ( is_array( $value ) ) {
789 796
 			$original_function = $function;
@@ -1217,6 +1224,9 @@  discard block
 block discarded – undo
1217 1224
         return $sub . (($len < $original_len) ? $continue : '');
1218 1225
     }
1219 1226
 
1227
+	/**
1228
+	 * @param string[] $function_names
1229
+	 */
1220 1230
 	public static function mb_function( $function_names, $args ) {
1221 1231
 		$mb_function_name = $function_names[0];
1222 1232
 		$function_name = $function_names[1];
@@ -1250,6 +1260,9 @@  discard block
 block discarded – undo
1250 1260
         return $formatted;
1251 1261
     }
1252 1262
 
1263
+	/**
1264
+	 * @param string $time_format
1265
+	 */
1253 1266
 	private static function add_time_to_date( $time_format, $date ) {
1254 1267
 		if ( empty( $time_format ) ) {
1255 1268
 			$time_format = get_option('time_format');
Please login to merge, or discard this patch.
Spacing   +203 added lines, -203 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
 
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
     }
24 24
 
25 25
     public static function plugin_folder() {
26
-        return basename(self::plugin_path());
26
+        return basename( self::plugin_path() );
27 27
     }
28 28
 
29 29
     public static function plugin_path() {
30
-        return dirname(dirname(dirname(__FILE__)));
30
+        return dirname( dirname( dirname( __FILE__ ) ) );
31 31
     }
32 32
 
33 33
     public static function plugin_url() {
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      * @return string
55 55
      */
56 56
     public static function site_name() {
57
-        return get_option('blogname');
57
+        return get_option( 'blogname' );
58 58
     }
59 59
 
60 60
 	public static function make_affiliate_url( $url ) {
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public static function get_settings() {
81 81
         global $frm_settings;
82
-        if ( empty($frm_settings) ) {
82
+        if ( empty( $frm_settings ) ) {
83 83
             $frm_settings = new FrmSettings();
84 84
         }
85 85
         return $frm_settings;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     }
101 101
 
102 102
     public static function pro_is_installed() {
103
-        return apply_filters('frm_pro_installed', false);
103
+        return apply_filters( 'frm_pro_installed', false );
104 104
     }
105 105
 
106 106
     /**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      * @return boolean
145 145
      */
146 146
     public static function doing_ajax() {
147
-        return defined('DOING_AJAX') && DOING_AJAX && ! self::is_preview_page();
147
+        return defined( 'DOING_AJAX' ) && DOING_AJAX && ! self::is_preview_page();
148 148
     }
149 149
 
150 150
 	/**
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      * @return boolean
165 165
      */
166 166
     public static function is_admin() {
167
-        return is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX );
167
+        return is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX );
168 168
     }
169 169
 
170 170
     /**
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      * @return string
192 192
      */
193 193
 	public static function get_server_value( $value ) {
194
-        return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
194
+        return isset( $_SERVER[$value] ) ? wp_strip_all_tags( $_SERVER[$value] ) : '';
195 195
     }
196 196
 
197 197
     /**
@@ -206,14 +206,14 @@  discard block
 block discarded – undo
206 206
             'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
207 207
             'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
208 208
         ) as $key ) {
209
-            if ( ! isset( $_SERVER[ $key ] ) ) {
209
+            if ( ! isset( $_SERVER[$key] ) ) {
210 210
                 continue;
211 211
             }
212 212
 
213
-            foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
214
-                $ip = trim($ip); // just to be safe
213
+            foreach ( explode( ',', $_SERVER[$key] ) as $ip ) {
214
+                $ip = trim( $ip ); // just to be safe
215 215
 
216
-                if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
216
+                if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
217 217
                     return $ip;
218 218
                 }
219 219
             }
@@ -223,15 +223,15 @@  discard block
 block discarded – undo
223 223
     }
224 224
 
225 225
     public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
226
-        if ( strpos($param, '[') ) {
227
-            $params = explode('[', $param);
226
+        if ( strpos( $param, '[' ) ) {
227
+            $params = explode( '[', $param );
228 228
             $param = $params[0];
229 229
         }
230 230
 
231 231
 		if ( $src == 'get' ) {
232
-            $value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
233
-            if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
234
-                $value = stripslashes_deep( htmlspecialchars_decode( $_GET[ $param ] ) );
232
+            $value = isset( $_POST[$param] ) ? stripslashes_deep( $_POST[$param] ) : ( isset( $_GET[$param] ) ? stripslashes_deep( $_GET[$param] ) : $default );
233
+            if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) {
234
+                $value = stripslashes_deep( htmlspecialchars_decode( $_GET[$param] ) );
235 235
             }
236 236
 			self::sanitize_value( $sanitize, $value );
237 237
 		} else {
@@ -240,12 +240,12 @@  discard block
 block discarded – undo
240 240
 
241 241
 		if ( isset( $params ) && is_array( $value ) && ! empty( $value ) ) {
242 242
             foreach ( $params as $k => $p ) {
243
-                if ( ! $k || ! is_array($value) ) {
243
+                if ( ! $k || ! is_array( $value ) ) {
244 244
                     continue;
245 245
                 }
246 246
 
247
-                $p = trim($p, ']');
248
-                $value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
247
+                $p = trim( $p, ']' );
248
+                $value = isset( $value[$p] ) ? $value[$p] : $default;
249 249
             }
250 250
         }
251 251
 
@@ -284,16 +284,16 @@  discard block
 block discarded – undo
284 284
 
285 285
 		$value = $args['default'];
286 286
 		if ( $args['type'] == 'get' ) {
287
-			if ( $_GET && isset( $_GET[ $args['param'] ] ) ) {
288
-				$value = $_GET[ $args['param'] ];
287
+			if ( $_GET && isset( $_GET[$args['param']] ) ) {
288
+				$value = $_GET[$args['param']];
289 289
 			}
290 290
 		} else if ( $args['type'] == 'post' ) {
291
-			if ( isset( $_POST[ $args['param'] ] ) ) {
292
-				$value = stripslashes_deep( maybe_unserialize( $_POST[ $args['param'] ] ) );
291
+			if ( isset( $_POST[$args['param']] ) ) {
292
+				$value = stripslashes_deep( maybe_unserialize( $_POST[$args['param']] ) );
293 293
 			}
294 294
 		} else {
295
-			if ( isset( $_REQUEST[ $args['param'] ] ) ) {
296
-				$value = $_REQUEST[ $args['param'] ];
295
+			if ( isset( $_REQUEST[$args['param']] ) ) {
296
+				$value = $_REQUEST[$args['param']];
297 297
 			}
298 298
 		}
299 299
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 			if ( is_array( $value ) ) {
322 322
 				$temp_values = $value;
323 323
 				foreach ( $temp_values as $k => $v ) {
324
-					FrmAppHelper::sanitize_value( $sanitize, $value[ $k ] );
324
+					FrmAppHelper::sanitize_value( $sanitize, $value[$k] );
325 325
 				}
326 326
 			} else {
327 327
 				$value = call_user_func( $sanitize, $value );
@@ -332,8 +332,8 @@  discard block
 block discarded – undo
332 332
     public static function sanitize_request( $sanitize_method, &$values ) {
333 333
         $temp_values = $values;
334 334
         foreach ( $temp_values as $k => $val ) {
335
-            if ( isset( $sanitize_method[ $k ] ) ) {
336
-				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
335
+            if ( isset( $sanitize_method[$k] ) ) {
336
+				$values[$k] = call_user_func( $sanitize_method[$k], $val );
337 337
             }
338 338
         }
339 339
     }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	public static function sanitize_array( &$values ) {
342 342
 		$temp_values = $values;
343 343
 		foreach ( $temp_values as $k => $val ) {
344
-			$values[ $k ] = wp_kses_post( $val );
344
+			$values[$k] = wp_kses_post( $val );
345 345
 		}
346 346
 	}
347 347
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 
365 365
 		$allowed_html = array();
366 366
 		foreach ( $allowed as $a ) {
367
-			$allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array();
367
+			$allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array();
368 368
 		}
369 369
 
370 370
 		return wp_kses( $value, $allowed_html );
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
      * @since 2.0
376 376
      */
377 377
     public static function remove_get_action() {
378
-        if ( ! isset($_GET) ) {
378
+        if ( ! isset( $_GET ) ) {
379 379
             return;
380 380
         }
381 381
 
@@ -397,8 +397,8 @@  discard block
 block discarded – undo
397 397
         }
398 398
 
399 399
         global $wp_query;
400
-        if ( isset( $wp_query->query_vars[ $param ] ) ) {
401
-            $value = $wp_query->query_vars[ $param ];
400
+        if ( isset( $wp_query->query_vars[$param] ) ) {
401
+            $value = $wp_query->query_vars[$param];
402 402
         }
403 403
 
404 404
         return $value;
@@ -427,19 +427,19 @@  discard block
 block discarded – undo
427 427
      * @return mixed $results The cache or query results
428 428
      */
429 429
     public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
430
-        $results = wp_cache_get($cache_key, $group);
431
-        if ( ! self::is_empty_value( $results, false ) || empty($query) ) {
430
+        $results = wp_cache_get( $cache_key, $group );
431
+        if ( ! self::is_empty_value( $results, false ) || empty( $query ) ) {
432 432
             return $results;
433 433
         }
434 434
 
435 435
         if ( 'get_posts' == $type ) {
436
-            $results = get_posts($query);
436
+            $results = get_posts( $query );
437 437
 		} else if ( 'get_associative_results' == $type ) {
438 438
 			global $wpdb;
439 439
 			$results = $wpdb->get_results( $query, OBJECT_K );
440 440
         } else {
441 441
             global $wpdb;
442
-            $results = $wpdb->{$type}($query);
442
+            $results = $wpdb->{$type}( $query );
443 443
         }
444 444
 
445 445
 		self::set_cache( $cache_key, $results, $group, $time );
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 	 */
461 461
 	public static function add_key_to_group_cache( $key, $group ) {
462 462
 		$cached = self::get_group_cached_keys( $group );
463
-		$cached[ $key ] = $key;
463
+		$cached[$key] = $key;
464 464
 		wp_cache_set( 'cached_keys', $cached, $group, 300 );
465 465
 	}
466 466
 
@@ -487,9 +487,9 @@  discard block
 block discarded – undo
487 487
         }
488 488
 
489 489
         // then check the transient
490
-        $results = get_transient($cache_key);
490
+        $results = get_transient( $cache_key );
491 491
         if ( $results ) {
492
-            wp_cache_set($cache_key, $results);
492
+            wp_cache_set( $cache_key, $results );
493 493
         }
494 494
 
495 495
         return $results;
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
      * @param string $cache_key
501 501
      */
502 502
 	public static function delete_cache_and_transient( $cache_key, $group = 'default' ) {
503
-		delete_transient($cache_key);
503
+		delete_transient( $cache_key );
504 504
 		wp_cache_delete( $cache_key, $group );
505 505
 	}
506 506
 
@@ -544,17 +544,17 @@  discard block
 block discarded – undo
544 544
     }
545 545
 
546 546
     public static function get_pages() {
547
-		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
547
+		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => - 1, 'orderby' => 'title', 'order' => 'ASC' ) );
548 548
     }
549 549
 
550 550
     public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
551 551
         $pages = self::get_pages();
552 552
 		$selected = self::get_post_param( $field_name, $page_id, 'absint' );
553 553
     ?>
554
-        <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" class="frm-pages-dropdown">
554
+        <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" class="frm-pages-dropdown">
555 555
             <option value=""> </option>
556 556
             <?php foreach ( $pages as $page ) { ?>
557
-				<option value="<?php echo esc_attr($page->ID); ?>" <?php selected( $selected, $page->ID ) ?>>
557
+				<option value="<?php echo esc_attr( $page->ID ); ?>" <?php selected( $selected, $page->ID ) ?>>
558 558
 					<?php echo esc_html( $truncate ? self::truncate( $page->post_title, $truncate ) : $page->post_title ); ?>
559 559
 				</option>
560 560
             <?php } ?>
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
     }
564 564
 
565 565
 	public static function post_edit_link( $post_id ) {
566
-        $post = get_post($post_id);
566
+        $post = get_post( $post_id );
567 567
         if ( $post ) {
568 568
 			$post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
569 569
 			return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
@@ -573,17 +573,17 @@  discard block
 block discarded – undo
573 573
 
574 574
 	public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
575 575
     ?>
576
-        <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" <?php
576
+        <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" <?php
577 577
             echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
578 578
             ?> class="frm_multiselect">
579
-            <?php self::roles_options($capability); ?>
579
+            <?php self::roles_options( $capability ); ?>
580 580
         </select>
581 581
     <?php
582 582
     }
583 583
 
584 584
 	public static function roles_options( $capability ) {
585 585
         global $frm_vars;
586
-        if ( isset($frm_vars['editable_roles']) ) {
586
+        if ( isset( $frm_vars['editable_roles'] ) ) {
587 587
             $editable_roles = $frm_vars['editable_roles'];
588 588
         } else {
589 589
             $editable_roles = get_editable_roles();
@@ -591,10 +591,10 @@  discard block
 block discarded – undo
591 591
         }
592 592
 
593 593
         foreach ( $editable_roles as $role => $details ) {
594
-            $name = translate_user_role($details['name'] ); ?>
595
-        <option value="<?php echo esc_attr($role) ?>" <?php echo in_array($role, (array) $capability) ? ' selected="selected"' : ''; ?>><?php echo esc_attr($name) ?> </option>
594
+            $name = translate_user_role( $details['name'] ); ?>
595
+        <option value="<?php echo esc_attr( $role ) ?>" <?php echo in_array( $role, (array) $capability ) ? ' selected="selected"' : ''; ?>><?php echo esc_attr( $name ) ?> </option>
596 596
 <?php
597
-            unset($role, $details);
597
+            unset( $role, $details );
598 598
         }
599 599
     }
600 600
 
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
     public static function maybe_add_permissions() {
651 651
 		self::force_capability( 'frm_view_entries' );
652 652
 
653
-        if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
653
+        if ( ! current_user_can( 'administrator' ) || current_user_can( 'frm_view_forms' ) ) {
654 654
             return;
655 655
         }
656 656
 
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
         $frm_roles = self::frm_capabilities();
660 660
         foreach ( $frm_roles as $frm_role => $frm_role_description ) {
661 661
 			$user->add_cap( $frm_role );
662
-            unset($frm_role, $frm_role_description);
662
+            unset( $frm_role, $frm_role_description );
663 663
         }
664 664
     }
665 665
 
@@ -684,12 +684,12 @@  discard block
 block discarded – undo
684 684
      * @param string $permission
685 685
      */
686 686
 	public static function permission_check( $permission, $show_message = 'show' ) {
687
-        $permission_error = self::permission_nonce_error($permission);
687
+        $permission_error = self::permission_nonce_error( $permission );
688 688
         if ( $permission_error !== false ) {
689 689
             if ( 'hide' == $show_message ) {
690 690
                 $permission_error = '';
691 691
             }
692
-            wp_die($permission_error);
692
+            wp_die( $permission_error );
693 693
         }
694 694
     }
695 695
 
@@ -706,11 +706,11 @@  discard block
 block discarded – undo
706 706
 		}
707 707
 
708 708
 		$error = false;
709
-        if ( empty($nonce_name) ) {
709
+        if ( empty( $nonce_name ) ) {
710 710
             return $error;
711 711
         }
712 712
 
713
-        if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
713
+        if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $_REQUEST[$nonce_name], $nonce ) ) ) {
714 714
             $frm_settings = self::get_settings();
715 715
             $error = $frm_settings->admin_permission;
716 716
         }
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
 			} else {
791 791
 				foreach ( $value as $k => $v ) {
792 792
 					if ( ! is_array( $v ) ) {
793
-						$value[ $k ] = call_user_func( $original_function, $v );
793
+						$value[$k] = call_user_func( $original_function, $v );
794 794
 					}
795 795
 				}
796 796
 			}
@@ -811,11 +811,11 @@  discard block
 block discarded – undo
811 811
 	public static function array_flatten( $array, $keys = 'keep' ) {
812 812
         $return = array();
813 813
         foreach ( $array as $key => $value ) {
814
-            if ( is_array($value) ) {
814
+            if ( is_array( $value ) ) {
815 815
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
816 816
             } else {
817 817
 				if ( $keys == 'keep' ) {
818
-					$return[ $key ] = $value;
818
+					$return[$key] = $value;
819 819
 				} else {
820 820
 					$return[] = $value;
821 821
 				}
@@ -838,8 +838,8 @@  discard block
 block discarded – undo
838 838
      * @since 2.0
839 839
      */
840 840
 	public static function use_wpautop( $content ) {
841
-        if ( apply_filters('frm_use_wpautop', true) ) {
842
-            $content = wpautop(str_replace( '<br>', '<br />', $content));
841
+        if ( apply_filters( 'frm_use_wpautop', true ) ) {
842
+            $content = wpautop( str_replace( '<br>', '<br />', $content ) );
843 843
         }
844 844
         return $content;
845 845
     }
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
      */
859 859
     public static function jquery_ui_base_url() {
860 860
 		$url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core', '1.11.4' );
861
-        $url = apply_filters('frm_jquery_ui_base_url', $url);
861
+        $url = apply_filters( 'frm_jquery_ui_base_url', $url );
862 862
         return $url;
863 863
     }
864 864
 
@@ -872,11 +872,11 @@  discard block
 block discarded – undo
872 872
 		}
873 873
 
874 874
 		$ver = $default;
875
-		if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
875
+		if ( ! isset( $wp_scripts->registered[$handle] ) ) {
876 876
 			return $ver;
877 877
 		}
878 878
 
879
-		$query = $wp_scripts->registered[ $handle ];
879
+		$query = $wp_scripts->registered[$handle];
880 880
 		if ( is_object( $query ) && ! empty( $query->ver ) ) {
881 881
 			$ver = $query->ver;
882 882
 		}
@@ -889,36 +889,36 @@  discard block
 block discarded – undo
889 889
     }
890 890
 
891 891
 	public static function get_user_id_param( $user_id ) {
892
-        if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
892
+        if ( ! $user_id || empty( $user_id ) || is_numeric( $user_id ) ) {
893 893
             return $user_id;
894 894
         }
895 895
 
896 896
 		if ( $user_id == 'current' ) {
897 897
 			$user_id = get_current_user_id();
898 898
 		} else {
899
-            if ( is_email($user_id) ) {
900
-                $user = get_user_by('email', $user_id);
899
+            if ( is_email( $user_id ) ) {
900
+                $user = get_user_by( 'email', $user_id );
901 901
             } else {
902
-                $user = get_user_by('login', $user_id);
902
+                $user = get_user_by( 'login', $user_id );
903 903
             }
904 904
 
905 905
             if ( $user ) {
906 906
                 $user_id = $user->ID;
907 907
             }
908
-            unset($user);
908
+            unset( $user );
909 909
         }
910 910
 
911 911
         return $user_id;
912 912
     }
913 913
 
914 914
 	public static function get_file_contents( $filename, $atts = array() ) {
915
-        if ( ! is_file($filename) ) {
915
+        if ( ! is_file( $filename ) ) {
916 916
             return false;
917 917
         }
918 918
 
919
-        extract($atts);
919
+        extract( $atts );
920 920
         ob_start();
921
-        include($filename);
921
+        include( $filename );
922 922
         $contents = ob_get_contents();
923 923
         ob_end_clean();
924 924
         return $contents;
@@ -934,27 +934,27 @@  discard block
 block discarded – undo
934 934
         $key = '';
935 935
 
936 936
         if ( ! empty( $name ) ) {
937
-            $key = sanitize_key($name);
937
+            $key = sanitize_key( $name );
938 938
         }
939 939
 
940 940
 		if ( empty( $key ) ) {
941
-            $max_slug_value = pow(36, $num_chars);
941
+            $max_slug_value = pow( 36, $num_chars );
942 942
             $min_slug_value = 37; // we want to have at least 2 characters in the slug
943
-            $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
943
+            $key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 );
944 944
         }
945 945
 
946
-		if ( is_numeric($key) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
946
+		if ( is_numeric( $key ) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
947 947
 			$key = $key . 'a';
948 948
         }
949 949
 
950 950
 		$key_check = FrmDb::get_var( $table_name, array( $column => $key, 'ID !' => $id ), $column );
951 951
 
952
-        if ( $key_check || is_numeric($key_check) ) {
952
+        if ( $key_check || is_numeric( $key_check ) ) {
953 953
             $suffix = 2;
954 954
 			do {
955 955
 				$alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
956 956
 				$key_check = FrmDb::get_var( $table_name, array( $column => $alt_post_name, 'ID !' => $id ), $column );
957
-				$suffix++;
957
+				$suffix ++;
958 958
 			} while ( $key_check || is_numeric( $key_check ) );
959 959
 			$key = $alt_post_name;
960 960
         }
@@ -971,32 +971,32 @@  discard block
 block discarded – undo
971 971
             return false;
972 972
         }
973 973
 
974
-        if ( empty($post_values) ) {
975
-            $post_values = stripslashes_deep($_POST);
974
+        if ( empty( $post_values ) ) {
975
+            $post_values = stripslashes_deep( $_POST );
976 976
         }
977 977
 
978 978
 		$values = array( 'id' => $record->id, 'fields' => array() );
979 979
 
980 980
 		foreach ( array( 'name', 'description' ) as $var ) {
981
-            $default_val = isset($record->{$var}) ? $record->{$var} : '';
982
-			$values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' );
983
-            unset($var, $default_val);
981
+            $default_val = isset( $record->{$var}) ? $record->{$var} : '';
982
+			$values[$var] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' );
983
+            unset( $var, $default_val );
984 984
         }
985 985
 
986
-        $values['description'] = self::use_wpautop($values['description']);
986
+        $values['description'] = self::use_wpautop( $values['description'] );
987 987
         $frm_settings = self::get_settings();
988
-        $is_form_builder = self::is_admin_page('formidable' );
988
+        $is_form_builder = self::is_admin_page( 'formidable' );
989 989
 
990 990
         foreach ( (array) $fields as $field ) {
991 991
             // Make sure to filter default values (for placeholder text), but not on the form builder page
992 992
             if ( ! $is_form_builder ) {
993
-                $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
993
+                $field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true );
994 994
             }
995 995
 			$parent_form_id = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
996
-			self::fill_field_defaults($field, $record, $values, compact('default', 'post_values', 'frm_settings', 'parent_form_id' ) );
996
+			self::fill_field_defaults( $field, $record, $values, compact( 'default', 'post_values', 'frm_settings', 'parent_form_id' ) );
997 997
         }
998 998
 
999
-        self::fill_form_opts($record, $table, $post_values, $values);
999
+        self::fill_form_opts( $record, $table, $post_values, $values );
1000 1000
 
1001 1001
         if ( $table == 'entries' ) {
1002 1002
             $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
@@ -1013,8 +1013,8 @@  discard block
 block discarded – undo
1013 1013
         if ( $args['default'] ) {
1014 1014
             $meta_value = $field->default_value;
1015 1015
         } else {
1016
-            if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
1017
-                if ( ! isset($field->field_options['custom_field']) ) {
1016
+            if ( $record->post_id && self::pro_is_installed() && isset( $field->field_options['post_field'] ) && $field->field_options['post_field'] ) {
1017
+                if ( ! isset( $field->field_options['custom_field'] ) ) {
1018 1018
                     $field->field_options['custom_field'] = '';
1019 1019
                 }
1020 1020
 				$meta_value = FrmProEntryMetaHelper::get_post_value( $record->post_id, $field->field_options['post_field'], $field->field_options['custom_field'], array( 'truncate' => false, 'type' => $field->type, 'form_id' => $field->form_id, 'field' => $field ) );
@@ -1023,8 +1023,8 @@  discard block
 block discarded – undo
1023 1023
             }
1024 1024
         }
1025 1025
 
1026
-		$field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type;
1027
-        $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1026
+		$field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type;
1027
+        $new_value = isset( $post_values['item_meta'][$field->id] ) ? maybe_unserialize( $post_values['item_meta'][$field->id] ) : $meta_value;
1028 1028
 
1029 1029
         $field_array = array(
1030 1030
             'id'            => $field->id,
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
             'default_value' => $field->default_value,
1033 1033
             'name'          => $field->name,
1034 1034
             'description'   => $field->description,
1035
-            'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1035
+            'type'          => apply_filters( 'frm_field_type', $field_type, $field, $new_value ),
1036 1036
             'options'       => $field->options,
1037 1037
             'required'      => $field->required,
1038 1038
             'field_key'     => $field->field_key,
@@ -1042,40 +1042,40 @@  discard block
 block discarded – undo
1042 1042
         );
1043 1043
 
1044 1044
         $args['field_type'] = $field_type;
1045
-        self::fill_field_opts($field, $field_array, $args);
1045
+        self::fill_field_opts( $field, $field_array, $args );
1046 1046
 		// Track the original field's type
1047 1047
 		$field_array['original_type'] = isset( $field->field_options['original_type'] ) ? $field->field_options['original_type'] : $field->type;
1048 1048
 
1049 1049
         $field_array = apply_filters( 'frm_setup_edit_fields_vars', $field_array, $field, $values['id'], array() );
1050 1050
 
1051
-        if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1051
+        if ( ! isset( $field_array['unique'] ) || ! $field_array['unique'] ) {
1052 1052
             $field_array['unique_msg'] = '';
1053 1053
         }
1054 1054
 
1055 1055
         $field_array = array_merge( $field->field_options, $field_array );
1056 1056
 
1057
-        $values['fields'][ $field->id ] = $field_array;
1057
+        $values['fields'][$field->id] = $field_array;
1058 1058
     }
1059 1059
 
1060 1060
 	private static function fill_field_opts( $field, array &$field_array, $args ) {
1061 1061
         $post_values = $args['post_values'];
1062
-        $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1062
+        $opt_defaults = FrmFieldsHelper::get_default_field_opts( $field_array['type'], $field, true );
1063 1063
 
1064 1064
         foreach ( $opt_defaults as $opt => $default_opt ) {
1065
-			$field_array[ $opt ] = ( $post_values && isset( $post_values['field_options'][ $opt . '_' . $field->id ] ) ) ? maybe_unserialize( $post_values['field_options'][ $opt . '_' . $field->id ] ) : ( isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default_opt );
1066
-            if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1067
-                $field_array[ $opt ] = $args['frm_settings']->blank_msg;
1068
-            } else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1065
+			$field_array[$opt] = ( $post_values && isset( $post_values['field_options'][$opt . '_' . $field->id] ) ) ? maybe_unserialize( $post_values['field_options'][$opt . '_' . $field->id] ) : ( isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default_opt );
1066
+            if ( $opt == 'blank' && $field_array[$opt] == '' ) {
1067
+                $field_array[$opt] = $args['frm_settings']->blank_msg;
1068
+            } else if ( $opt == 'invalid' && $field_array[$opt] == '' ) {
1069 1069
                 if ( $args['field_type'] == 'captcha' ) {
1070
-                    $field_array[ $opt ] = $args['frm_settings']->re_msg;
1070
+                    $field_array[$opt] = $args['frm_settings']->re_msg;
1071 1071
                 } else {
1072
-                    $field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1072
+                    $field_array[$opt] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1073 1073
                 }
1074 1074
             }
1075 1075
         }
1076 1076
 
1077 1077
         if ( $field_array['custom_html'] == '' ) {
1078
-            $field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1078
+            $field_array['custom_html'] = FrmFieldsHelper::get_default_html( $args['field_type'] );
1079 1079
         }
1080 1080
     }
1081 1081
 
@@ -1094,18 +1094,18 @@  discard block
 block discarded – undo
1094 1094
             return;
1095 1095
         }
1096 1096
 
1097
-        $values['form_name'] = isset($record->form_id) ? $form->name : '';
1097
+        $values['form_name'] = isset( $record->form_id ) ? $form->name : '';
1098 1098
 		$values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
1099 1099
 
1100
-        if ( ! is_array($form->options) ) {
1100
+        if ( ! is_array( $form->options ) ) {
1101 1101
             return;
1102 1102
         }
1103 1103
 
1104 1104
         foreach ( $form->options as $opt => $value ) {
1105
-            $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1105
+            $values[$opt] = isset( $post_values[$opt] ) ? maybe_unserialize( $post_values[$opt] ) : $value;
1106 1106
         }
1107 1107
 
1108
-        self::fill_form_defaults($post_values, $values);
1108
+        self::fill_form_defaults( $post_values, $values );
1109 1109
     }
1110 1110
 
1111 1111
     /**
@@ -1115,11 +1115,11 @@  discard block
 block discarded – undo
1115 1115
         $form_defaults = FrmFormsHelper::get_default_opts();
1116 1116
 
1117 1117
         foreach ( $form_defaults as $opt => $default ) {
1118
-            if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1119
-				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1118
+            if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) {
1119
+				$values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default;
1120 1120
             }
1121 1121
 
1122
-            unset($opt, $defaut);
1122
+            unset( $opt, $defaut );
1123 1123
         }
1124 1124
 
1125 1125
 		if ( ! isset( $values['custom_style'] ) ) {
@@ -1127,10 +1127,10 @@  discard block
 block discarded – undo
1127 1127
 		}
1128 1128
 
1129 1129
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1130
-			if ( ! isset( $values[ $h . '_html' ] ) ) {
1131
-				$values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) );
1130
+			if ( ! isset( $values[$h . '_html'] ) ) {
1131
+				$values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) );
1132 1132
             }
1133
-            unset($h);
1133
+            unset( $h );
1134 1134
         }
1135 1135
     }
1136 1136
 
@@ -1161,9 +1161,9 @@  discard block
 block discarded – undo
1161 1161
         }
1162 1162
     ?>
1163 1163
 <li>
1164
-    <a href="javascript:void(0)" class="frmids frm_insert_code alignright <?php echo esc_attr($class) ?>" data-code="<?php echo esc_attr($args['id']) ?>" >[<?php echo esc_attr( $args['id'] ) ?>]</a>
1165
-    <a href="javascript:void(0)" class="frmkeys frm_insert_code alignright <?php echo esc_attr($class) ?>" data-code="<?php echo esc_attr($args['key']) ?>" >[<?php echo esc_attr( self::truncate($args['key'], 10) ) ?>]</a>
1166
-    <a href="javascript:void(0)" class="frm_insert_code <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr($args['id']) ?>" ><?php echo esc_attr( self::truncate($args['name'], 60) ) ?></a>
1164
+    <a href="javascript:void(0)" class="frmids frm_insert_code alignright <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr( $args['id'] ) ?>" >[<?php echo esc_attr( $args['id'] ) ?>]</a>
1165
+    <a href="javascript:void(0)" class="frmkeys frm_insert_code alignright <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr( $args['key'] ) ?>" >[<?php echo esc_attr( self::truncate( $args['key'], 10 ) ) ?>]</a>
1166
+    <a href="javascript:void(0)" class="frm_insert_code <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr( $args['id'] ) ?>" ><?php echo esc_attr( self::truncate( $args['name'], 60 ) ) ?></a>
1167 1167
 </li>
1168 1168
     <?php
1169 1169
     }
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
             return '';
1182 1182
         } else if ( $length <= 10 ) {
1183 1183
 			$sub = self::mb_function( array( 'mb_substr', 'substr' ), array( $str, 0, $length ) );
1184
-            return $sub . (($length < $original_len) ? $continue : '');
1184
+            return $sub . ( ( $length < $original_len ) ? $continue : '' );
1185 1185
         }
1186 1186
 
1187 1187
         $sub = '';
@@ -1190,23 +1190,23 @@  discard block
 block discarded – undo
1190 1190
 		$words = self::mb_function( array( 'mb_split', 'explode' ), array( ' ', $str ) );
1191 1191
 
1192 1192
 		foreach ( $words as $word ) {
1193
-            $part = (($sub != '') ? ' ' : '') . $word;
1193
+            $part = ( ( $sub != '' ) ? ' ' : '' ) . $word;
1194 1194
 			$total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1195
-            if ( $total_len > $length && str_word_count($sub) ) {
1195
+            if ( $total_len > $length && str_word_count( $sub ) ) {
1196 1196
                 break;
1197 1197
             }
1198 1198
 
1199 1199
             $sub .= $part;
1200 1200
 			$len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1201 1201
 
1202
-            if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1202
+            if ( str_word_count( $sub ) > $minword && $total_len >= $length ) {
1203 1203
                 break;
1204 1204
             }
1205 1205
 
1206
-            unset($total_len, $word);
1206
+            unset( $total_len, $word );
1207 1207
         }
1208 1208
 
1209
-        return $sub . (($len < $original_len) ? $continue : '');
1209
+        return $sub . ( ( $len < $original_len ) ? $continue : '' );
1210 1210
     }
1211 1211
 
1212 1212
 	public static function mb_function( $function_names, $args ) {
@@ -1219,17 +1219,17 @@  discard block
 block discarded – undo
1219 1219
 	}
1220 1220
 
1221 1221
 	public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1222
-        if ( empty($date) ) {
1222
+        if ( empty( $date ) ) {
1223 1223
             return $date;
1224 1224
         }
1225 1225
 
1226
-        if ( empty($date_format) ) {
1227
-            $date_format = get_option('date_format');
1226
+        if ( empty( $date_format ) ) {
1227
+            $date_format = get_option( 'date_format' );
1228 1228
         }
1229 1229
 
1230
-        if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1230
+        if ( preg_match( '/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date ) && self::pro_is_installed() ) {
1231 1231
             $frmpro_settings = new FrmProSettings();
1232
-            $date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1232
+            $date = FrmProAppHelper::convert_date( $date, $frmpro_settings->date_format, 'Y-m-d' );
1233 1233
         }
1234 1234
 
1235 1235
 		$formatted = self::get_localized_date( $date_format, $date );
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
 
1245 1245
 	private static function add_time_to_date( $time_format, $date ) {
1246 1246
 		if ( empty( $time_format ) ) {
1247
-			$time_format = get_option('time_format');
1247
+			$time_format = get_option( 'time_format' );
1248 1248
 		}
1249 1249
 
1250 1250
 		$trimmed_format = trim( $time_format );
@@ -1290,10 +1290,10 @@  discard block
 block discarded – undo
1290 1290
 		$time_strings = self::get_time_strings();
1291 1291
 
1292 1292
 		foreach ( $time_strings as $k => $v ) {
1293
-			if ( $diff[ $k ] ) {
1294
-				$time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] );
1293
+			if ( $diff[$k] ) {
1294
+				$time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] );
1295 1295
 			} else {
1296
-				unset( $time_strings[ $k ] );
1296
+				unset( $time_strings[$k] );
1297 1297
 			}
1298 1298
 		}
1299 1299
 
@@ -1332,7 +1332,7 @@  discard block
 block discarded – undo
1332 1332
      */
1333 1333
 	public static function esc_like( $term ) {
1334 1334
         global $wpdb;
1335
-        if ( method_exists($wpdb, 'esc_like') ) {
1335
+        if ( method_exists( $wpdb, 'esc_like' ) ) {
1336 1336
 			// WP 4.0
1337 1337
             $term = $wpdb->esc_like( $term );
1338 1338
         } else {
@@ -1346,17 +1346,17 @@  discard block
 block discarded – undo
1346 1346
      * @param string $order_query
1347 1347
      */
1348 1348
 	public static function esc_order( $order_query ) {
1349
-        if ( empty($order_query) ) {
1349
+        if ( empty( $order_query ) ) {
1350 1350
             return '';
1351 1351
         }
1352 1352
 
1353 1353
         // remove ORDER BY before santizing
1354
-        $order_query = strtolower($order_query);
1355
-        if ( strpos($order_query, 'order by') !== false ) {
1356
-            $order_query = str_replace('order by', '', $order_query);
1354
+        $order_query = strtolower( $order_query );
1355
+        if ( strpos( $order_query, 'order by' ) !== false ) {
1356
+            $order_query = str_replace( 'order by', '', $order_query );
1357 1357
         }
1358 1358
 
1359
-        $order_query = explode(' ', trim($order_query));
1359
+        $order_query = explode( ' ', trim( $order_query ) );
1360 1360
 
1361 1361
         $order_fields = array(
1362 1362
             'id', 'form_key', 'name', 'description',
@@ -1364,13 +1364,13 @@  discard block
 block discarded – undo
1364 1364
             'default_template', 'status', 'created_at',
1365 1365
         );
1366 1366
 
1367
-        $order = trim(trim(reset($order_query), ','));
1368
-        if ( ! in_array($order, $order_fields) ) {
1367
+        $order = trim( trim( reset( $order_query ), ',' ) );
1368
+        if ( ! in_array( $order, $order_fields ) ) {
1369 1369
             return '';
1370 1370
         }
1371 1371
 
1372 1372
         $order_by = '';
1373
-        if ( count($order_query) > 1 ) {
1373
+        if ( count( $order_query ) > 1 ) {
1374 1374
 			$order_by = end( $order_query );
1375 1375
 			self::esc_order_by( $order_by );
1376 1376
         }
@@ -1392,23 +1392,23 @@  discard block
 block discarded – undo
1392 1392
      * @param string $limit
1393 1393
      */
1394 1394
 	public static function esc_limit( $limit ) {
1395
-        if ( empty($limit) ) {
1395
+        if ( empty( $limit ) ) {
1396 1396
             return '';
1397 1397
         }
1398 1398
 
1399
-        $limit = trim(str_replace(' limit', '', strtolower($limit)));
1400
-        if ( is_numeric($limit) ) {
1399
+        $limit = trim( str_replace( ' limit', '', strtolower( $limit ) ) );
1400
+        if ( is_numeric( $limit ) ) {
1401 1401
 			return ' LIMIT ' . $limit;
1402 1402
         }
1403 1403
 
1404
-        $limit = explode(',', trim($limit));
1404
+        $limit = explode( ',', trim( $limit ) );
1405 1405
         foreach ( $limit as $k => $l ) {
1406 1406
             if ( is_numeric( $l ) ) {
1407
-                $limit[ $k ] = $l;
1407
+                $limit[$k] = $l;
1408 1408
             }
1409 1409
         }
1410 1410
 
1411
-        $limit = implode(',', $limit);
1411
+        $limit = implode( ',', $limit );
1412 1412
 		return ' LIMIT ' . $limit;
1413 1413
     }
1414 1414
 
@@ -1417,12 +1417,12 @@  discard block
 block discarded – undo
1417 1417
      * @since 2.0
1418 1418
      */
1419 1419
     public static function prepare_array_values( $array, $type = '%s' ) {
1420
-        $placeholders = array_fill(0, count($array), $type);
1421
-        return implode(', ', $placeholders);
1420
+        $placeholders = array_fill( 0, count( $array ), $type );
1421
+        return implode( ', ', $placeholders );
1422 1422
     }
1423 1423
 
1424 1424
     public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
1425
-        if ( empty($where) ) {
1425
+        if ( empty( $where ) ) {
1426 1426
             return '';
1427 1427
         }
1428 1428
 
@@ -1463,19 +1463,19 @@  discard block
 block discarded – undo
1463 1463
 	public static function json_to_array( $json_vars ) {
1464 1464
         $vars = array();
1465 1465
         foreach ( $json_vars as $jv ) {
1466
-            $jv_name = explode('[', $jv['name']);
1467
-            $last = count($jv_name) - 1;
1466
+            $jv_name = explode( '[', $jv['name'] );
1467
+            $last = count( $jv_name ) - 1;
1468 1468
             foreach ( $jv_name as $p => $n ) {
1469
-                $name = trim($n, ']');
1470
-                if ( ! isset($l1) ) {
1469
+                $name = trim( $n, ']' );
1470
+                if ( ! isset( $l1 ) ) {
1471 1471
                     $l1 = $name;
1472 1472
                 }
1473 1473
 
1474
-                if ( ! isset($l2) ) {
1474
+                if ( ! isset( $l2 ) ) {
1475 1475
                     $l2 = $name;
1476 1476
                 }
1477 1477
 
1478
-                if ( ! isset($l3) ) {
1478
+                if ( ! isset( $l3 ) ) {
1479 1479
                     $l3 = $name;
1480 1480
                 }
1481 1481
 
@@ -1489,24 +1489,24 @@  discard block
 block discarded – undo
1489 1489
 
1490 1490
                     case 1:
1491 1491
                         $l2 = $name;
1492
-                        self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1492
+                        self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] );
1493 1493
                     break;
1494 1494
 
1495 1495
                     case 2:
1496 1496
                         $l3 = $name;
1497
-                        self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1497
+                        self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] );
1498 1498
                     break;
1499 1499
 
1500 1500
                     case 3:
1501 1501
                         $l4 = $name;
1502
-                        self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1502
+                        self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] );
1503 1503
                     break;
1504 1504
                 }
1505 1505
 
1506
-                unset($this_val, $n);
1506
+                unset( $this_val, $n );
1507 1507
             }
1508 1508
 
1509
-            unset($last, $jv);
1509
+            unset( $last, $jv );
1510 1510
         }
1511 1511
 
1512 1512
         return $vars;
@@ -1519,8 +1519,8 @@  discard block
 block discarded – undo
1519 1519
     public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1520 1520
         if ( $name == '' ) {
1521 1521
             $vars[] = $val;
1522
-        } else if ( ! isset( $vars[ $l1 ] ) ) {
1523
-            $vars[ $l1 ] = $val;
1522
+        } else if ( ! isset( $vars[$l1] ) ) {
1523
+            $vars[$l1] = $val;
1524 1524
         }
1525 1525
     }
1526 1526
 
@@ -1535,7 +1535,7 @@  discard block
 block discarded – undo
1535 1535
             'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
1536 1536
         );
1537 1537
 
1538
-        if ( ! isset( $tooltips[ $name ] ) ) {
1538
+        if ( ! isset( $tooltips[$name] ) ) {
1539 1539
             return;
1540 1540
         }
1541 1541
 
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
             echo ' class="frm_help"';
1546 1546
         }
1547 1547
 
1548
-		echo ' title="' . esc_attr( $tooltips[ $name ] );
1548
+		echo ' title="' . esc_attr( $tooltips[$name] );
1549 1549
 
1550 1550
         if ( 'open' != $class ) {
1551 1551
             echo '"';
@@ -1597,13 +1597,13 @@  discard block
 block discarded – undo
1597 1597
     }
1598 1598
 
1599 1599
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1600
-		if ( ! isset( $post_content[ $key ] ) ) {
1600
+		if ( ! isset( $post_content[$key] ) ) {
1601 1601
 			return;
1602 1602
 		}
1603 1603
 
1604 1604
 		if ( is_array( $val ) ) {
1605 1605
 			foreach ( $val as $k1 => $v1 ) {
1606
-				self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] );
1606
+				self::prepare_action_slashes( $v1, $k1, $post_content[$key] );
1607 1607
 				unset( $k1, $v1 );
1608 1608
 			}
1609 1609
 		} else {
@@ -1611,7 +1611,7 @@  discard block
 block discarded – undo
1611 1611
 			$val = stripslashes( $val );
1612 1612
 
1613 1613
 			// Add backslashes before double quotes and forward slashes only
1614
-			$post_content[ $key ] = addcslashes( $val, '"\\/' );
1614
+			$post_content[$key] = addcslashes( $val, '"\\/' );
1615 1615
 		}
1616 1616
 	}
1617 1617
 
@@ -1628,7 +1628,7 @@  discard block
 block discarded – undo
1628 1628
 		$settings['post_content'] = FrmAppHelper::prepare_and_encode( $settings['post_content'] );
1629 1629
 
1630 1630
 		if ( empty( $settings['ID'] ) ) {
1631
-			unset( $settings['ID']);
1631
+			unset( $settings['ID'] );
1632 1632
 		}
1633 1633
 
1634 1634
 		// delete all caches for this group
@@ -1662,17 +1662,17 @@  discard block
 block discarded – undo
1662 1662
 	}
1663 1663
 
1664 1664
 	public static function maybe_json_decode( $string ) {
1665
-        if ( is_array($string) ) {
1665
+        if ( is_array( $string ) ) {
1666 1666
             return $string;
1667 1667
         }
1668 1668
 
1669
-        $new_string = json_decode($string, true);
1670
-        if ( function_exists('json_last_error') ) {
1669
+        $new_string = json_decode( $string, true );
1670
+        if ( function_exists( 'json_last_error' ) ) {
1671 1671
 			// php 5.3+
1672 1672
             if ( json_last_error() == JSON_ERROR_NONE ) {
1673 1673
                 $string = $new_string;
1674 1674
             }
1675
-        } else if ( isset($new_string) ) {
1675
+        } else if ( isset( $new_string ) ) {
1676 1676
 			// php < 5.3 fallback
1677 1677
             $string = $new_string;
1678 1678
         }
@@ -1688,11 +1688,11 @@  discard block
 block discarded – undo
1688 1688
 	public static function maybe_highlight_menu( $post_type ) {
1689 1689
         global $post;
1690 1690
 
1691
-        if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1691
+        if ( isset( $_REQUEST['post_type'] ) && $_REQUEST['post_type'] != $post_type ) {
1692 1692
             return;
1693 1693
         }
1694 1694
 
1695
-        if ( is_object($post) && $post->post_type != $post_type ) {
1695
+        if ( is_object( $post ) && $post->post_type != $post_type ) {
1696 1696
             return;
1697 1697
         }
1698 1698
 
@@ -1793,11 +1793,11 @@  discard block
 block discarded – undo
1793 1793
         $frm_version = self::plugin_version();
1794 1794
 
1795 1795
         // check if Formidable meets minimum requirements
1796
-        if ( version_compare($frm_version, $min_version, '>=') ) {
1796
+        if ( version_compare( $frm_version, $min_version, '>=' ) ) {
1797 1797
             return;
1798 1798
         }
1799 1799
 
1800
-        $wp_list_table = _get_list_table('WP_Plugins_List_Table');
1800
+        $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
1801 1801
 		echo '<tr class="plugin-update-tr active"><th colspan="' . absint( $wp_list_table->get_column_count() ) . '" class="check-column plugin-update colspanchange"><div class="update-message">' .
1802 1802
         __( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1803 1803
         '</div></td></tr>';
@@ -1805,38 +1805,38 @@  discard block
 block discarded – undo
1805 1805
 
1806 1806
     public static function locales( $type = 'date' ) {
1807 1807
         $locales = array(
1808
-            'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1809
-            'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1810
-            'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1808
+            'en' => __( 'English', 'formidable' ), '' => __( 'English/Western', 'formidable' ),
1809
+            'af' => __( 'Afrikaans', 'formidable' ), 'sq' => __( 'Albanian', 'formidable' ),
1810
+            'ar' => __( 'Arabic', 'formidable' ), 'hy' => __( 'Armenian', 'formidable' ),
1811 1811
             'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1812
-            'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1813
-            'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1812
+            'bs' => __( 'Bosnian', 'formidable' ), 'bg' => __( 'Bulgarian', 'formidable' ),
1813
+            'ca' => __( 'Catalan', 'formidable' ), 'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1814 1814
             'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1815
-            'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1816
-            'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1815
+            'hr' => __( 'Croatian', 'formidable' ), 'cs' => __( 'Czech', 'formidable' ),
1816
+            'da' => __( 'Danish', 'formidable' ), 'nl' => __( 'Dutch', 'formidable' ),
1817 1817
             'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1818
-            'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1818
+            'et' => __( 'Estonian', 'formidable' ), 'fo' => __( 'Faroese', 'formidable' ),
1819 1819
             'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1820
-            'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1820
+            'fi' => __( 'Finnish', 'formidable' ), 'fr' => __( 'French', 'formidable' ),
1821 1821
             'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1822
-            'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1822
+            'de' => __( 'German', 'formidable' ), 'de-AT' => __( 'German/Austria', 'formidable' ),
1823 1823
             'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1824
-            'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1825
-            'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1826
-            'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1827
-            'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1828
-            'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1824
+            'he' => __( 'Hebrew', 'formidable' ), 'iw' => __( 'Hebrew', 'formidable' ),
1825
+            'hi' => __( 'Hindi', 'formidable' ), 'hu' => __( 'Hungarian', 'formidable' ),
1826
+            'is' => __( 'Icelandic', 'formidable' ), 'id' => __( 'Indonesian', 'formidable' ),
1827
+            'it' => __( 'Italian', 'formidable' ), 'ja' => __( 'Japanese', 'formidable' ),
1828
+            'ko' => __( 'Korean', 'formidable' ), 'lv' => __( 'Latvian', 'formidable' ),
1829 1829
             'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1830
-            'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1830
+            'no' => __( 'Norwegian', 'formidable' ), 'pl' => __( 'Polish', 'formidable' ),
1831 1831
             'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1832 1832
             'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1833
-            'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1833
+            'ru' => __( 'Russian', 'formidable' ), 'sr' => __( 'Serbian', 'formidable' ),
1834 1834
             'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1835
-            'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1835
+            'sl' => __( 'Slovenian', 'formidable' ), 'es' => __( 'Spanish', 'formidable' ),
1836 1836
             'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1837
-            'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1838
-            'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1839
-            'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1837
+            'ta' => __( 'Tamil', 'formidable' ), 'th' => __( 'Thai', 'formidable' ),
1838
+            'tu' => __( 'Turkish', 'formidable' ), 'tr' => __( 'Turkish', 'formidable' ),
1839
+            'uk' => __( 'Ukranian', 'formidable' ), 'vi' => __( 'Vietnamese', 'formidable' ),
1840 1840
         );
1841 1841
 
1842 1842
         if ( $type == 'captcha' ) {
@@ -1855,8 +1855,8 @@  discard block
 block discarded – undo
1855 1855
             );
1856 1856
         }
1857 1857
 
1858
-        $locales = array_diff_key($locales, array_flip($unset));
1859
-        $locales = apply_filters('frm_locales', $locales);
1858
+        $locales = array_diff_key( $locales, array_flip( $unset ) );
1859
+        $locales = apply_filters( 'frm_locales', $locales );
1860 1860
 
1861 1861
         return $locales;
1862 1862
     }
Please login to merge, or discard this patch.
Indentation   +1017 added lines, -1017 removed lines patch added patch discarded remove patch
@@ -12,50 +12,50 @@  discard block
 block discarded – undo
12 12
 	 */
13 13
 	public static $plug_version = '2.03.08';
14 14
 
15
-    /**
16
-     * @since 1.07.02
17
-     *
18
-     * @param none
19
-     * @return string The version of this plugin
20
-     */
21
-    public static function plugin_version() {
22
-        return self::$plug_version;
23
-    }
24
-
25
-    public static function plugin_folder() {
26
-        return basename(self::plugin_path());
27
-    }
28
-
29
-    public static function plugin_path() {
30
-        return dirname(dirname(dirname(__FILE__)));
31
-    }
32
-
33
-    public static function plugin_url() {
34
-        //prevously FRM_URL constant
15
+	/**
16
+	 * @since 1.07.02
17
+	 *
18
+	 * @param none
19
+	 * @return string The version of this plugin
20
+	 */
21
+	public static function plugin_version() {
22
+		return self::$plug_version;
23
+	}
24
+
25
+	public static function plugin_folder() {
26
+		return basename(self::plugin_path());
27
+	}
28
+
29
+	public static function plugin_path() {
30
+		return dirname(dirname(dirname(__FILE__)));
31
+	}
32
+
33
+	public static function plugin_url() {
34
+		//prevously FRM_URL constant
35 35
 		return plugins_url( '', self::plugin_path() . '/formidable.php' );
36
-    }
36
+	}
37 37
 
38 38
 	public static function relative_plugin_url() {
39 39
 		return str_replace( array( 'https:', 'http:' ), '', self::plugin_url() );
40 40
 	}
41 41
 
42
-    /**
43
-     * @return string Site URL
44
-     */
45
-    public static function site_url() {
46
-        return site_url();
47
-    }
48
-
49
-    /**
50
-     * Get the name of this site
51
-     * Used for [sitename] shortcode
52
-     *
53
-     * @since 2.0
54
-     * @return string
55
-     */
56
-    public static function site_name() {
57
-        return get_option('blogname');
58
-    }
42
+	/**
43
+	 * @return string Site URL
44
+	 */
45
+	public static function site_url() {
46
+		return site_url();
47
+	}
48
+
49
+	/**
50
+	 * Get the name of this site
51
+	 * Used for [sitename] shortcode
52
+	 *
53
+	 * @since 2.0
54
+	 * @return string
55
+	 */
56
+	public static function site_name() {
57
+		return get_option('blogname');
58
+	}
59 59
 
60 60
 	public static function make_affiliate_url( $url ) {
61 61
 		$affiliate_id = self::get_affiliate();
@@ -69,83 +69,83 @@  discard block
 block discarded – undo
69 69
 		return '';
70 70
 	}
71 71
 
72
-    /**
73
-     * Get the Formidable settings
74
-     *
75
-     * @since 2.0
76
-     *
77
-     * @param None
78
-     * @return FrmSettings $frm_setings
79
-     */
80
-    public static function get_settings() {
81
-        global $frm_settings;
82
-        if ( empty($frm_settings) ) {
83
-            $frm_settings = new FrmSettings();
84
-        }
85
-        return $frm_settings;
86
-    }
72
+	/**
73
+	 * Get the Formidable settings
74
+	 *
75
+	 * @since 2.0
76
+	 *
77
+	 * @param None
78
+	 * @return FrmSettings $frm_setings
79
+	 */
80
+	public static function get_settings() {
81
+		global $frm_settings;
82
+		if ( empty($frm_settings) ) {
83
+			$frm_settings = new FrmSettings();
84
+		}
85
+		return $frm_settings;
86
+	}
87 87
 
88 88
 	public static function get_menu_name() {
89 89
 		$frm_settings = FrmAppHelper::get_settings();
90 90
 		return $frm_settings->menu;
91 91
 	}
92 92
 
93
-    /**
94
-     * Show a message in place of pro features
95
-     *
96
-     * @since 2.0
97
-     */
93
+	/**
94
+	 * Show a message in place of pro features
95
+	 *
96
+	 * @since 2.0
97
+	 */
98 98
 	public static function update_message() {
99 99
 		_deprecated_function( __FUNCTION__, '2.0.19' );
100
-    }
101
-
102
-    public static function pro_is_installed() {
103
-        return apply_filters('frm_pro_installed', false);
104
-    }
105
-
106
-    /**
107
-     * Check for certain page in Formidable settings
108
-     *
109
-     * @since 2.0
110
-     *
111
-     * @param string $page The name of the page to check
112
-     * @return boolean
113
-     */
100
+	}
101
+
102
+	public static function pro_is_installed() {
103
+		return apply_filters('frm_pro_installed', false);
104
+	}
105
+
106
+	/**
107
+	 * Check for certain page in Formidable settings
108
+	 *
109
+	 * @since 2.0
110
+	 *
111
+	 * @param string $page The name of the page to check
112
+	 * @return boolean
113
+	 */
114 114
 	public static function is_admin_page( $page = 'formidable' ) {
115
-        global $pagenow;
115
+		global $pagenow;
116 116
 		$get_page = self::simple_get( 'page', 'sanitize_title' );
117
-        if ( $pagenow ) {
117
+		if ( $pagenow ) {
118 118
 			return $pagenow == 'admin.php' && $get_page == $page;
119
-        }
119
+		}
120 120
 
121 121
 		return is_admin() && $get_page == $page;
122
-    }
123
-
124
-    /**
125
-     * Check for the form preview page
126
-     *
127
-     * @since 2.0
128
-     *
129
-     * @param None
130
-     * @return boolean
131
-     */
132
-    public static function is_preview_page() {
133
-        global $pagenow;
122
+	}
123
+
124
+	/**
125
+	 * Check for the form preview page
126
+	 *
127
+	 * @since 2.0
128
+	 *
129
+	 * @param None
130
+	 * @return boolean
131
+	 */
132
+	public static function is_preview_page() {
133
+		global $pagenow;
134 134
 		$action = FrmAppHelper::simple_get( 'action', 'sanitize_title' );
135 135
 		return $pagenow && $pagenow == 'admin-ajax.php' && $action == 'frm_forms_preview';
136
-    }
136
+	}
137 137
 
138
-    /**
139
-     * Check for ajax except the form preview page
140
-     *
141
-     * @since 2.0
142
-     *
143
-     * @param None
144
-     * @return boolean
145
-     */
146
-    public static function doing_ajax() {
147
-        return defined('DOING_AJAX') && DOING_AJAX && ! self::is_preview_page();
148
-    }
138
+	/**
139
+	 * Check for ajax except the form preview page
140
+	 *
141
+	 * @since 2.0
142
+	 *
143
+	 * @param None
144
+	 * @return boolean
145
+	 */
146
+	public static function doing_ajax() {
147
+		return defined('DOING_AJAX') && DOING_AJAX && ! self::is_preview_page();
148
+	}
149 149
 
150 150
 	/**
151 151
 	 * @since 2.0.8
@@ -155,102 +155,102 @@  discard block
 block discarded – undo
155 155
 		return isset( $frm_vars['prevent_caching'] ) && $frm_vars['prevent_caching'];
156 156
 	}
157 157
 
158
-    /**
159
-     * Check if on an admin page
160
-     *
161
-     * @since 2.0
162
-     *
163
-     * @param None
164
-     * @return boolean
165
-     */
166
-    public static function is_admin() {
167
-        return is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX );
168
-    }
169
-
170
-    /**
171
-     * Check if value contains blank value or empty array
172
-     *
173
-     * @since 2.0
174
-     * @param mixed $value - value to check
158
+	/**
159
+	 * Check if on an admin page
160
+	 *
161
+	 * @since 2.0
162
+	 *
163
+	 * @param None
164
+	 * @return boolean
165
+	 */
166
+	public static function is_admin() {
167
+		return is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX );
168
+	}
169
+
170
+	/**
171
+	 * Check if value contains blank value or empty array
172
+	 *
173
+	 * @since 2.0
174
+	 * @param mixed $value - value to check
175 175
 	 * @param string
176
-     * @return boolean
177
-     */
178
-    public static function is_empty_value( $value, $empty = '' ) {
179
-        return ( is_array( $value ) && empty( $value ) ) || $value == $empty;
180
-    }
181
-
182
-    public static function is_not_empty_value( $value, $empty = '' ) {
183
-        return ! self::is_empty_value( $value, $empty );
184
-    }
185
-
186
-    /**
187
-     * Get any value from the $_SERVER
188
-     *
189
-     * @since 2.0
190
-     * @param string $value
191
-     * @return string
192
-     */
176
+	 * @return boolean
177
+	 */
178
+	public static function is_empty_value( $value, $empty = '' ) {
179
+		return ( is_array( $value ) && empty( $value ) ) || $value == $empty;
180
+	}
181
+
182
+	public static function is_not_empty_value( $value, $empty = '' ) {
183
+		return ! self::is_empty_value( $value, $empty );
184
+	}
185
+
186
+	/**
187
+	 * Get any value from the $_SERVER
188
+	 *
189
+	 * @since 2.0
190
+	 * @param string $value
191
+	 * @return string
192
+	 */
193 193
 	public static function get_server_value( $value ) {
194
-        return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
195
-    }
196
-
197
-    /**
198
-     * Check for the IP address in several places
199
-     * Used by [ip] shortcode
200
-     *
201
-     * @return string The IP address of the current user
202
-     */
203
-    public static function get_ip_address() {
194
+		return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
195
+	}
196
+
197
+	/**
198
+	 * Check for the IP address in several places
199
+	 * Used by [ip] shortcode
200
+	 *
201
+	 * @return string The IP address of the current user
202
+	 */
203
+	public static function get_ip_address() {
204 204
 		$ip = '';
205
-        foreach ( array(
206
-            'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
207
-            'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
208
-        ) as $key ) {
209
-            if ( ! isset( $_SERVER[ $key ] ) ) {
210
-                continue;
211
-            }
212
-
213
-            foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
214
-                $ip = trim($ip); // just to be safe
215
-
216
-                if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
217
-                    return $ip;
218
-                }
219
-            }
220
-        }
205
+		foreach ( array(
206
+			'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
207
+			'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
208
+		) as $key ) {
209
+			if ( ! isset( $_SERVER[ $key ] ) ) {
210
+				continue;
211
+			}
212
+
213
+			foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
214
+				$ip = trim($ip); // just to be safe
215
+
216
+				if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
217
+					return $ip;
218
+				}
219
+			}
220
+		}
221 221
 
222 222
 		return sanitize_text_field( $ip );
223
-    }
223
+	}
224 224
 
225
-    public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
226
-        if ( strpos($param, '[') ) {
227
-            $params = explode('[', $param);
228
-            $param = $params[0];
229
-        }
225
+	public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
226
+		if ( strpos($param, '[') ) {
227
+			$params = explode('[', $param);
228
+			$param = $params[0];
229
+		}
230 230
 
231 231
 		if ( $src == 'get' ) {
232
-            $value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
233
-            if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
234
-                $value = stripslashes_deep( htmlspecialchars_decode( $_GET[ $param ] ) );
235
-            }
232
+			$value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
233
+			if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
234
+				$value = stripslashes_deep( htmlspecialchars_decode( $_GET[ $param ] ) );
235
+			}
236 236
 			self::sanitize_value( $sanitize, $value );
237 237
 		} else {
238
-            $value = self::get_simple_request( array( 'type' => $src, 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
239
-        }
238
+			$value = self::get_simple_request( array( 'type' => $src, 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
239
+		}
240 240
 
241 241
 		if ( isset( $params ) && is_array( $value ) && ! empty( $value ) ) {
242
-            foreach ( $params as $k => $p ) {
243
-                if ( ! $k || ! is_array($value) ) {
244
-                    continue;
245
-                }
242
+			foreach ( $params as $k => $p ) {
243
+				if ( ! $k || ! is_array($value) ) {
244
+					continue;
245
+				}
246 246
 
247
-                $p = trim($p, ']');
248
-                $value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
249
-            }
250
-        }
247
+				$p = trim($p, ']');
248
+				$value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
249
+			}
250
+		}
251 251
 
252
-        return $value;
253
-    }
252
+		return $value;
253
+	}
254 254
 
255 255
 	public static function get_post_param( $param, $default = '', $sanitize = '' ) {
256 256
 		return self::get_simple_request( array( 'type' => 'post', 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 */
267 267
 	public static function simple_get( $param, $sanitize = 'sanitize_text_field', $default = '' ) {
268 268
 		return self::get_simple_request( array( 'type' => 'get', 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
269
-    }
269
+	}
270 270
 
271 271
 	/**
272 272
 	 * Get a GET/POST/REQUEST value and sanitize it
@@ -302,12 +302,12 @@  discard block
 block discarded – undo
302 302
 	}
303 303
 
304 304
 	/**
305
-	* Preserve backslashes in a value, but make sure value doesn't get compounding slashes
306
-	*
307
-	* @since 2.0.8
308
-	* @param string $value
309
-	* @return string $value
310
-	*/
305
+	 * Preserve backslashes in a value, but make sure value doesn't get compounding slashes
306
+	 *
307
+	 * @since 2.0.8
308
+	 * @param string $value
309
+	 * @return string $value
310
+	 */
311 311
 	public static function preserve_backslashes( $value ) {
312 312
 		// If backslashes have already been added, don't add them again
313 313
 		if ( strpos( $value, '\\\\' ) === false ) {
@@ -329,14 +329,14 @@  discard block
 block discarded – undo
329 329
 		}
330 330
 	}
331 331
 
332
-    public static function sanitize_request( $sanitize_method, &$values ) {
333
-        $temp_values = $values;
334
-        foreach ( $temp_values as $k => $val ) {
335
-            if ( isset( $sanitize_method[ $k ] ) ) {
332
+	public static function sanitize_request( $sanitize_method, &$values ) {
333
+		$temp_values = $values;
334
+		foreach ( $temp_values as $k => $val ) {
335
+			if ( isset( $sanitize_method[ $k ] ) ) {
336 336
 				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
337
-            }
338
-        }
339
-    }
337
+			}
338
+		}
339
+	}
340 340
 
341 341
 	public static function sanitize_array( &$values ) {
342 342
 		$temp_values = $values;
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 	 */
355 355
 	public static function kses( $value, $allowed = array() ) {
356 356
 		$html = array(
357
-		    'a' => array(
357
+			'a' => array(
358 358
 				'href'  => array(),
359 359
 				'title' => array(),
360 360
 				'id'    => array(),
361 361
 				'class' => array(),
362
-		    ),
362
+			),
363 363
 		);
364 364
 
365 365
 		$allowed_html = array();
@@ -370,77 +370,77 @@  discard block
 block discarded – undo
370 370
 		return wp_kses( $value, $allowed_html );
371 371
 	}
372 372
 
373
-    /**
374
-     * Used when switching the action for a bulk action
375
-     * @since 2.0
376
-     */
377
-    public static function remove_get_action() {
378
-        if ( ! isset($_GET) ) {
379
-            return;
380
-        }
373
+	/**
374
+	 * Used when switching the action for a bulk action
375
+	 * @since 2.0
376
+	 */
377
+	public static function remove_get_action() {
378
+		if ( ! isset($_GET) ) {
379
+			return;
380
+		}
381 381
 
382
-        $new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
383
-        if ( ! empty( $new_action ) ) {
382
+		$new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
383
+		if ( ! empty( $new_action ) ) {
384 384
 			$_SERVER['REQUEST_URI'] = str_replace( '&action=' . $new_action, '', FrmAppHelper::get_server_value( 'REQUEST_URI' ) );
385
-        }
386
-    }
387
-
388
-    /**
389
-     * Check the WP query for a parameter
390
-     *
391
-     * @since 2.0
392
-     * @return string|array
393
-     */
394
-    public static function get_query_var( $value, $param ) {
395
-        if ( $value != '' ) {
396
-            return $value;
397
-        }
398
-
399
-        global $wp_query;
400
-        if ( isset( $wp_query->query_vars[ $param ] ) ) {
401
-            $value = $wp_query->query_vars[ $param ];
402
-        }
403
-
404
-        return $value;
405
-    }
406
-
407
-    /**
408
-     * @param string $type
409
-     */
410
-    public static function trigger_hook_load( $type, $object = null ) {
411
-        // only load the form hooks once
385
+		}
386
+	}
387
+
388
+	/**
389
+	 * Check the WP query for a parameter
390
+	 *
391
+	 * @since 2.0
392
+	 * @return string|array
393
+	 */
394
+	public static function get_query_var( $value, $param ) {
395
+		if ( $value != '' ) {
396
+			return $value;
397
+		}
398
+
399
+		global $wp_query;
400
+		if ( isset( $wp_query->query_vars[ $param ] ) ) {
401
+			$value = $wp_query->query_vars[ $param ];
402
+		}
403
+
404
+		return $value;
405
+	}
406
+
407
+	/**
408
+	 * @param string $type
409
+	 */
410
+	public static function trigger_hook_load( $type, $object = null ) {
411
+		// only load the form hooks once
412 412
 		$hooks_loaded = apply_filters( 'frm_' . $type . '_hooks_loaded', false, $object );
413
-        if ( ! $hooks_loaded ) {
413
+		if ( ! $hooks_loaded ) {
414 414
 			do_action( 'frm_load_' . $type . '_hooks' );
415
-        }
416
-    }
417
-
418
-    /**
419
-     * Check cache before fetching values and saving to cache
420
-     *
421
-     * @since 2.0
422
-     *
423
-     * @param string $cache_key The unique name for this cache
424
-     * @param string $group The name of the cache group
425
-     * @param string $query If blank, don't run a db call
426
-     * @param string $type The wpdb function to use with this query
427
-     * @return mixed $results The cache or query results
428
-     */
429
-    public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
430
-        $results = wp_cache_get($cache_key, $group);
431
-        if ( ! self::is_empty_value( $results, false ) || empty($query) ) {
432
-            return $results;
433
-        }
434
-
435
-        if ( 'get_posts' == $type ) {
436
-            $results = get_posts($query);
415
+		}
416
+	}
417
+
418
+	/**
419
+	 * Check cache before fetching values and saving to cache
420
+	 *
421
+	 * @since 2.0
422
+	 *
423
+	 * @param string $cache_key The unique name for this cache
424
+	 * @param string $group The name of the cache group
425
+	 * @param string $query If blank, don't run a db call
426
+	 * @param string $type The wpdb function to use with this query
427
+	 * @return mixed $results The cache or query results
428
+	 */
429
+	public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
430
+		$results = wp_cache_get($cache_key, $group);
431
+		if ( ! self::is_empty_value( $results, false ) || empty($query) ) {
432
+			return $results;
433
+		}
434
+
435
+		if ( 'get_posts' == $type ) {
436
+			$results = get_posts($query);
437 437
 		} else if ( 'get_associative_results' == $type ) {
438 438
 			global $wpdb;
439 439
 			$results = $wpdb->get_results( $query, OBJECT_K );
440
-        } else {
441
-            global $wpdb;
442
-            $results = $wpdb->{$type}($query);
443
-        }
440
+		} else {
441
+			global $wpdb;
442
+			$results = $wpdb->{$type}($query);
443
+		}
444 444
 
445 445
 		self::set_cache( $cache_key, $results, $group, $time );
446 446
 
@@ -473,44 +473,44 @@  discard block
 block discarded – undo
473 473
 		return $cached;
474 474
 	}
475 475
 
476
-    /**
477
-     * Data that should be stored for a long time can be stored in a transient.
478
-     * First check the cache, then check the transient
479
-     * @since 2.0
480
-     * @return mixed The cached value or false
481
-     */
476
+	/**
477
+	 * Data that should be stored for a long time can be stored in a transient.
478
+	 * First check the cache, then check the transient
479
+	 * @since 2.0
480
+	 * @return mixed The cached value or false
481
+	 */
482 482
 	public static function check_cache_and_transient( $cache_key ) {
483
-        // check caching layer first
484
-        $results = self::check_cache( $cache_key );
485
-        if ( $results ) {
486
-            return $results;
487
-        }
488
-
489
-        // then check the transient
490
-        $results = get_transient($cache_key);
491
-        if ( $results ) {
492
-            wp_cache_set($cache_key, $results);
493
-        }
494
-
495
-        return $results;
496
-    }
497
-
498
-    /**
499
-     * @since 2.0
500
-     * @param string $cache_key
501
-     */
483
+		// check caching layer first
484
+		$results = self::check_cache( $cache_key );
485
+		if ( $results ) {
486
+			return $results;
487
+		}
488
+
489
+		// then check the transient
490
+		$results = get_transient($cache_key);
491
+		if ( $results ) {
492
+			wp_cache_set($cache_key, $results);
493
+		}
494
+
495
+		return $results;
496
+	}
497
+
498
+	/**
499
+	 * @since 2.0
500
+	 * @param string $cache_key
501
+	 */
502 502
 	public static function delete_cache_and_transient( $cache_key, $group = 'default' ) {
503 503
 		delete_transient($cache_key);
504 504
 		wp_cache_delete( $cache_key, $group );
505 505
 	}
506 506
 
507
-    /**
508
-     * Delete all caching in a single group
509
-     *
510
-     * @since 2.0
511
-     *
512
-     * @param string $group The name of the cache group
513
-     */
507
+	/**
508
+	 * Delete all caching in a single group
509
+	 *
510
+	 * @since 2.0
511
+	 *
512
+	 * @param string $group The name of the cache group
513
+	 */
514 514
 	public static function cache_delete_group( $group ) {
515 515
 		$cached_keys = self::get_group_cached_keys( $group );
516 516
 
@@ -523,34 +523,34 @@  discard block
 block discarded – undo
523 523
 		}
524 524
 	}
525 525
 
526
-    /**
527
-     * Check a value from a shortcode to see if true or false.
528
-     * True when value is 1, true, 'true', 'yes'
529
-     *
530
-     * @since 1.07.10
531
-     *
532
-     * @param string $value The value to compare
533
-     * @return boolean True or False
534
-     */
526
+	/**
527
+	 * Check a value from a shortcode to see if true or false.
528
+	 * True when value is 1, true, 'true', 'yes'
529
+	 *
530
+	 * @since 1.07.10
531
+	 *
532
+	 * @param string $value The value to compare
533
+	 * @return boolean True or False
534
+	 */
535 535
 	public static function is_true( $value ) {
536
-        return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
537
-    }
536
+		return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
537
+	}
538 538
 
539
-    /**
540
-     * Used to filter shortcode in text widgets
541
-     */
542
-    public static function widget_text_filter_callback( $matches ) {
543
-        return do_shortcode( $matches[0] );
544
-    }
539
+	/**
540
+	 * Used to filter shortcode in text widgets
541
+	 */
542
+	public static function widget_text_filter_callback( $matches ) {
543
+		return do_shortcode( $matches[0] );
544
+	}
545 545
 
546
-    public static function get_pages() {
546
+	public static function get_pages() {
547 547
 		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
548
-    }
548
+	}
549 549
 
550
-    public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
551
-        $pages = self::get_pages();
550
+	public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
551
+		$pages = self::get_pages();
552 552
 		$selected = self::get_post_param( $field_name, $page_id, 'absint' );
553
-    ?>
553
+	?>
554 554
         <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" class="frm-pages-dropdown">
555 555
             <option value=""> </option>
556 556
             <?php foreach ( $pages as $page ) { ?>
@@ -560,108 +560,108 @@  discard block
 block discarded – undo
560 560
             <?php } ?>
561 561
         </select>
562 562
     <?php
563
-    }
563
+	}
564 564
 
565 565
 	public static function post_edit_link( $post_id ) {
566
-        $post = get_post($post_id);
567
-        if ( $post ) {
566
+		$post = get_post($post_id);
567
+		if ( $post ) {
568 568
 			$post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
569 569
 			return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
570
-        }
571
-        return '';
572
-    }
570
+		}
571
+		return '';
572
+	}
573 573
 
574 574
 	public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
575
-    ?>
575
+	?>
576 576
         <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" <?php
577
-            echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
578
-            ?> class="frm_multiselect">
577
+			echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
578
+			?> class="frm_multiselect">
579 579
             <?php self::roles_options($capability); ?>
580 580
         </select>
581 581
     <?php
582
-    }
582
+	}
583 583
 
584 584
 	public static function roles_options( $capability ) {
585
-        global $frm_vars;
586
-        if ( isset($frm_vars['editable_roles']) ) {
587
-            $editable_roles = $frm_vars['editable_roles'];
588
-        } else {
589
-            $editable_roles = get_editable_roles();
590
-            $frm_vars['editable_roles'] = $editable_roles;
591
-        }
592
-
593
-        foreach ( $editable_roles as $role => $details ) {
594
-            $name = translate_user_role($details['name'] ); ?>
585
+		global $frm_vars;
586
+		if ( isset($frm_vars['editable_roles']) ) {
587
+			$editable_roles = $frm_vars['editable_roles'];
588
+		} else {
589
+			$editable_roles = get_editable_roles();
590
+			$frm_vars['editable_roles'] = $editable_roles;
591
+		}
592
+
593
+		foreach ( $editable_roles as $role => $details ) {
594
+			$name = translate_user_role($details['name'] ); ?>
595 595
         <option value="<?php echo esc_attr($role) ?>" <?php echo in_array($role, (array) $capability) ? ' selected="selected"' : ''; ?>><?php echo esc_attr($name) ?> </option>
596 596
 <?php
597
-            unset($role, $details);
598
-        }
599
-    }
597
+			unset($role, $details);
598
+		}
599
+	}
600 600
 
601 601
 	public static function frm_capabilities( $type = 'auto' ) {
602
-        $cap = array(
603
-            'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
604
-            'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
605
-            'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
606
-            'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
607
-            'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
608
-            'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
609
-        );
602
+		$cap = array(
603
+			'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
604
+			'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
605
+			'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
606
+			'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
607
+			'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
608
+			'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
609
+		);
610 610
 
611 611
 		if ( ! self::pro_is_installed() && 'pro' != $type ) {
612
-            return $cap;
613
-        }
612
+			return $cap;
613
+		}
614 614
 
615
-        $cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
616
-        $cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
617
-        $cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
618
-        $cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
615
+		$cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
616
+		$cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
617
+		$cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
618
+		$cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
619 619
 
620
-        return $cap;
621
-    }
620
+		return $cap;
621
+	}
622 622
 
623 623
 	public static function user_has_permission( $needed_role ) {
624
-        if ( $needed_role == '-1' ) {
625
-            return false;
624
+		if ( $needed_role == '-1' ) {
625
+			return false;
626 626
 		}
627 627
 
628
-        // $needed_role will be equal to blank if "Logged-in users" is selected
629
-        if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
630
-            return true;
631
-        }
628
+		// $needed_role will be equal to blank if "Logged-in users" is selected
629
+		if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
630
+			return true;
631
+		}
632 632
 
633
-        $roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
634
-        foreach ( $roles as $role ) {
633
+		$roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
634
+		foreach ( $roles as $role ) {
635 635
 			if ( current_user_can( $role ) ) {
636
-        		return true;
636
+				return true;
637 637
 			}
638
-        	if ( $role == $needed_role ) {
639
-        		break;
638
+			if ( $role == $needed_role ) {
639
+				break;
640 640
 			}
641
-        }
642
-        return false;
643
-    }
644
-
645
-    /**
646
-     * Make sure administrators can see Formidable menu
647
-     *
648
-     * @since 2.0
649
-     */
650
-    public static function maybe_add_permissions() {
641
+		}
642
+		return false;
643
+	}
644
+
645
+	/**
646
+	 * Make sure administrators can see Formidable menu
647
+	 *
648
+	 * @since 2.0
649
+	 */
650
+	public static function maybe_add_permissions() {
651 651
 		self::force_capability( 'frm_view_entries' );
652 652
 
653
-        if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
654
-            return;
655
-        }
653
+		if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
654
+			return;
655
+		}
656 656
 
657 657
 		$user_id = get_current_user_id();
658 658
 		$user = new WP_User( $user_id );
659
-        $frm_roles = self::frm_capabilities();
660
-        foreach ( $frm_roles as $frm_role => $frm_role_description ) {
659
+		$frm_roles = self::frm_capabilities();
660
+		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
661 661
 			$user->add_cap( $frm_role );
662
-            unset($frm_role, $frm_role_description);
663
-        }
664
-    }
662
+			unset($frm_role, $frm_role_description);
663
+		}
664
+	}
665 665
 
666 666
 	/**
667 667
 	 * Make sure admins have permission to see the menu items
@@ -677,28 +677,28 @@  discard block
 block discarded – undo
677 677
 		}
678 678
 	}
679 679
 
680
-    /**
681
-     * Check if the user has permision for action.
682
-     * Return permission message and stop the action if no permission
683
-     * @since 2.0
684
-     * @param string $permission
685
-     */
680
+	/**
681
+	 * Check if the user has permision for action.
682
+	 * Return permission message and stop the action if no permission
683
+	 * @since 2.0
684
+	 * @param string $permission
685
+	 */
686 686
 	public static function permission_check( $permission, $show_message = 'show' ) {
687
-        $permission_error = self::permission_nonce_error($permission);
688
-        if ( $permission_error !== false ) {
689
-            if ( 'hide' == $show_message ) {
690
-                $permission_error = '';
691
-            }
692
-            wp_die($permission_error);
693
-        }
694
-    }
695
-
696
-    /**
697
-     * Check user permission and nonce
698
-     * @since 2.0
699
-     * @param string $permission
700
-     * @return false|string The permission message or false if allowed
701
-     */
687
+		$permission_error = self::permission_nonce_error($permission);
688
+		if ( $permission_error !== false ) {
689
+			if ( 'hide' == $show_message ) {
690
+				$permission_error = '';
691
+			}
692
+			wp_die($permission_error);
693
+		}
694
+	}
695
+
696
+	/**
697
+	 * Check user permission and nonce
698
+	 * @since 2.0
699
+	 * @param string $permission
700
+	 * @return false|string The permission message or false if allowed
701
+	 */
702 702
 	public static function permission_nonce_error( $permission, $nonce_name = '', $nonce = '' ) {
703 703
 		if ( ! empty( $permission ) && ! current_user_can( $permission ) && ! current_user_can( 'administrator' ) ) {
704 704
 			$frm_settings = self::get_settings();
@@ -706,23 +706,23 @@  discard block
 block discarded – undo
706 706
 		}
707 707
 
708 708
 		$error = false;
709
-        if ( empty($nonce_name) ) {
710
-            return $error;
711
-        }
709
+		if ( empty($nonce_name) ) {
710
+			return $error;
711
+		}
712 712
 
713
-        if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
714
-            $frm_settings = self::get_settings();
715
-            $error = $frm_settings->admin_permission;
716
-        }
713
+		if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
714
+			$frm_settings = self::get_settings();
715
+			$error = $frm_settings->admin_permission;
716
+		}
717 717
 
718
-        return $error;
719
-    }
718
+		return $error;
719
+	}
720 720
 
721
-    public static function checked( $values, $current ) {
721
+	public static function checked( $values, $current ) {
722 722
 		if ( self::check_selected( $values, $current ) ) {
723
-            echo ' checked="checked"';
723
+			echo ' checked="checked"';
724 724
 		}
725
-    }
725
+	}
726 726
 
727 727
 	public static function check_selected( $values, $current ) {
728 728
 		$values = self::recursive_function_map( $values, 'trim' );
@@ -732,50 +732,50 @@  discard block
 block discarded – undo
732 732
 		return ( is_array( $values ) && in_array( $current, $values ) ) || ( ! is_array( $values ) && $values == $current );
733 733
 	}
734 734
 
735
-    /**
736
-    * Check if current field option is an "other" option
737
-    *
738
-    * @since 2.0
739
-    *
740
-    * @param string $opt_key
741
-    * @return boolean Returns true if current field option is an "Other" option
742
-    */
743
-    public static function is_other_opt( $opt_key ) {
744
-        _deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::is_other_opt' );
745
-        return FrmFieldsHelper::is_other_opt( $opt_key );
746
-    }
747
-
748
-    /**
749
-    * Get value that belongs in "Other" text box
750
-    *
751
-    * @since 2.0
752
-    *
753
-    * @param string $opt_key
754
-    * @param array $field
755
-    * @return string $other_val
756
-    */
757
-    public static function get_other_val( $opt_key, $field, $parent = false, $pointer = false ) {
735
+	/**
736
+	 * Check if current field option is an "other" option
737
+	 *
738
+	 * @since 2.0
739
+	 *
740
+	 * @param string $opt_key
741
+	 * @return boolean Returns true if current field option is an "Other" option
742
+	 */
743
+	public static function is_other_opt( $opt_key ) {
744
+		_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::is_other_opt' );
745
+		return FrmFieldsHelper::is_other_opt( $opt_key );
746
+	}
747
+
748
+	/**
749
+	 * Get value that belongs in "Other" text box
750
+	 *
751
+	 * @since 2.0
752
+	 *
753
+	 * @param string $opt_key
754
+	 * @param array $field
755
+	 * @return string $other_val
756
+	 */
757
+	public static function get_other_val( $opt_key, $field, $parent = false, $pointer = false ) {
758 758
 		_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::get_other_val' );
759 759
 		return FrmFieldsHelper::get_other_val( compact( 'opt_key', 'field', 'parent', 'pointer' ) );
760
-    }
761
-
762
-    /**
763
-    * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
764
-    * Intended for front-end use
765
-    *
766
-    * @since 2.0
767
-    *
768
-    * @param array $field
769
-    * @param boolean $other_opt
770
-    * @param string $checked
771
-    * @param array $args should include opt_key and field name
772
-    * @return string $other_val
773
-    */
774
-    public static function prepare_other_input( $field, &$other_opt, &$checked, $args = array() ) {
760
+	}
761
+
762
+	/**
763
+	 * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
764
+	 * Intended for front-end use
765
+	 *
766
+	 * @since 2.0
767
+	 *
768
+	 * @param array $field
769
+	 * @param boolean $other_opt
770
+	 * @param string $checked
771
+	 * @param array $args should include opt_key and field name
772
+	 * @return string $other_val
773
+	 */
774
+	public static function prepare_other_input( $field, &$other_opt, &$checked, $args = array() ) {
775 775
 		_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::prepare_other_input' );
776 776
 		$args['field'] = $field;
777 777
 		return FrmFieldsHelper::prepare_other_input( $args, $other_opt, $checked );
778
-    }
778
+	}
779 779
 
780 780
 	public static function recursive_function_map( $value, $function ) {
781 781
 		if ( is_array( $value ) ) {
@@ -805,24 +805,24 @@  discard block
 block discarded – undo
805 805
 		return (bool) count( array_filter( array_keys( $array ), 'is_string' ) );
806 806
 	}
807 807
 
808
-    /**
809
-     * Flatten a multi-dimensional array
810
-     */
808
+	/**
809
+	 * Flatten a multi-dimensional array
810
+	 */
811 811
 	public static function array_flatten( $array, $keys = 'keep' ) {
812
-        $return = array();
813
-        foreach ( $array as $key => $value ) {
814
-            if ( is_array($value) ) {
812
+		$return = array();
813
+		foreach ( $array as $key => $value ) {
814
+			if ( is_array($value) ) {
815 815
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
816
-            } else {
816
+			} else {
817 817
 				if ( $keys == 'keep' ) {
818 818
 					$return[ $key ] = $value;
819 819
 				} else {
820 820
 					$return[] = $value;
821 821
 				}
822
-            }
823
-        }
824
-        return $return;
825
-    }
822
+			}
823
+		}
824
+		return $return;
825
+	}
826 826
 
827 827
 	public static function esc_textarea( $text, $is_rich_text = false ) {
828 828
 		$safe_text = str_replace( '&quot;', '"', $text );
@@ -833,38 +833,38 @@  discard block
 block discarded – undo
833 833
 		return apply_filters( 'esc_textarea', $safe_text, $text );
834 834
 	}
835 835
 
836
-    /**
837
-     * Add auto paragraphs to text areas
838
-     * @since 2.0
839
-     */
836
+	/**
837
+	 * Add auto paragraphs to text areas
838
+	 * @since 2.0
839
+	 */
840 840
 	public static function use_wpautop( $content ) {
841
-        if ( apply_filters('frm_use_wpautop', true) ) {
842
-            $content = wpautop(str_replace( '<br>', '<br />', $content));
843
-        }
844
-        return $content;
845
-    }
841
+		if ( apply_filters('frm_use_wpautop', true) ) {
842
+			$content = wpautop(str_replace( '<br>', '<br />', $content));
843
+		}
844
+		return $content;
845
+	}
846 846
 
847 847
 	public static function replace_quotes( $val ) {
848
-        //Replace double quotes
848
+		//Replace double quotes
849 849
 		$val = str_replace( array( '&#8220;', '&#8221;', '&#8243;' ), '"', $val );
850
-        //Replace single quotes
851
-        $val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
852
-        return $val;
853
-    }
854
-
855
-    /**
856
-     * @since 2.0
857
-     * @return string The base Google APIS url for the current version of jQuery UI
858
-     */
859
-    public static function jquery_ui_base_url() {
850
+		//Replace single quotes
851
+		$val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
852
+		return $val;
853
+	}
854
+
855
+	/**
856
+	 * @since 2.0
857
+	 * @return string The base Google APIS url for the current version of jQuery UI
858
+	 */
859
+	public static function jquery_ui_base_url() {
860 860
 		$url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core', '1.11.4' );
861
-        $url = apply_filters('frm_jquery_ui_base_url', $url);
862
-        return $url;
863
-    }
861
+		$url = apply_filters('frm_jquery_ui_base_url', $url);
862
+		return $url;
863
+	}
864 864
 
865
-    /**
866
-     * @param string $handle
867
-     */
865
+	/**
866
+	 * @param string $handle
867
+	 */
868 868
 	public static function script_version( $handle, $default = 0 ) {
869 869
 		global $wp_scripts;
870 870
 		if ( ! $wp_scripts ) {
@@ -886,241 +886,241 @@  discard block
 block discarded – undo
886 886
 
887 887
 	public static function js_redirect( $url ) {
888 888
 		return '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>';
889
-    }
889
+	}
890 890
 
891 891
 	public static function get_user_id_param( $user_id ) {
892
-        if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
893
-            return $user_id;
894
-        }
892
+		if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
893
+			return $user_id;
894
+		}
895 895
 
896 896
 		if ( $user_id == 'current' ) {
897 897
 			$user_id = get_current_user_id();
898 898
 		} else {
899
-            if ( is_email($user_id) ) {
900
-                $user = get_user_by('email', $user_id);
901
-            } else {
902
-                $user = get_user_by('login', $user_id);
903
-            }
899
+			if ( is_email($user_id) ) {
900
+				$user = get_user_by('email', $user_id);
901
+			} else {
902
+				$user = get_user_by('login', $user_id);
903
+			}
904 904
 
905
-            if ( $user ) {
906
-                $user_id = $user->ID;
907
-            }
908
-            unset($user);
909
-        }
905
+			if ( $user ) {
906
+				$user_id = $user->ID;
907
+			}
908
+			unset($user);
909
+		}
910 910
 
911
-        return $user_id;
912
-    }
911
+		return $user_id;
912
+	}
913 913
 
914 914
 	public static function get_file_contents( $filename, $atts = array() ) {
915
-        if ( ! is_file($filename) ) {
916
-            return false;
917
-        }
918
-
919
-        extract($atts);
920
-        ob_start();
921
-        include($filename);
922
-        $contents = ob_get_contents();
923
-        ob_end_clean();
924
-        return $contents;
925
-    }
926
-
927
-    /**
928
-     * @param string $table_name
929
-     * @param string $column
915
+		if ( ! is_file($filename) ) {
916
+			return false;
917
+		}
918
+
919
+		extract($atts);
920
+		ob_start();
921
+		include($filename);
922
+		$contents = ob_get_contents();
923
+		ob_end_clean();
924
+		return $contents;
925
+	}
926
+
927
+	/**
928
+	 * @param string $table_name
929
+	 * @param string $column
930 930
 	 * @param int $id
931 931
 	 * @param int $num_chars
932
-     */
933
-    public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 5 ) {
934
-        $key = '';
932
+	 */
933
+	public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 5 ) {
934
+		$key = '';
935 935
 
936
-        if ( ! empty( $name ) ) {
937
-            $key = sanitize_key($name);
938
-        }
936
+		if ( ! empty( $name ) ) {
937
+			$key = sanitize_key($name);
938
+		}
939 939
 
940 940
 		if ( empty( $key ) ) {
941
-            $max_slug_value = pow(36, $num_chars);
942
-            $min_slug_value = 37; // we want to have at least 2 characters in the slug
943
-            $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
944
-        }
941
+			$max_slug_value = pow(36, $num_chars);
942
+			$min_slug_value = 37; // we want to have at least 2 characters in the slug
943
+			$key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
944
+		}
945 945
 
946 946
 		if ( is_numeric($key) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
947 947
 			$key = $key . 'a';
948
-        }
948
+		}
949 949
 
950 950
 		$key_check = FrmDb::get_var( $table_name, array( $column => $key, 'ID !' => $id ), $column );
951 951
 
952
-        if ( $key_check || is_numeric($key_check) ) {
953
-            $suffix = 2;
952
+		if ( $key_check || is_numeric($key_check) ) {
953
+			$suffix = 2;
954 954
 			do {
955 955
 				$alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
956 956
 				$key_check = FrmDb::get_var( $table_name, array( $column => $alt_post_name, 'ID !' => $id ), $column );
957 957
 				$suffix++;
958 958
 			} while ( $key_check || is_numeric( $key_check ) );
959 959
 			$key = $alt_post_name;
960
-        }
961
-        return $key;
962
-    }
963
-
964
-    /**
965
-     * Editing a Form or Entry
966
-     * @param string $table
967
-     * @return bool|array
968
-     */
969
-    public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
970
-        if ( ! $record ) {
971
-            return false;
972
-        }
973
-
974
-        if ( empty($post_values) ) {
975
-            $post_values = stripslashes_deep($_POST);
976
-        }
960
+		}
961
+		return $key;
962
+	}
963
+
964
+	/**
965
+	 * Editing a Form or Entry
966
+	 * @param string $table
967
+	 * @return bool|array
968
+	 */
969
+	public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
970
+		if ( ! $record ) {
971
+			return false;
972
+		}
973
+
974
+		if ( empty($post_values) ) {
975
+			$post_values = stripslashes_deep($_POST);
976
+		}
977 977
 
978 978
 		$values = array( 'id' => $record->id, 'fields' => array() );
979 979
 
980 980
 		foreach ( array( 'name', 'description' ) as $var ) {
981
-            $default_val = isset($record->{$var}) ? $record->{$var} : '';
981
+			$default_val = isset($record->{$var}) ? $record->{$var} : '';
982 982
 			$values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' );
983
-            unset($var, $default_val);
984
-        }
985
-
986
-        $values['description'] = self::use_wpautop($values['description']);
987
-        $frm_settings = self::get_settings();
988
-        $is_form_builder = self::is_admin_page('formidable' );
989
-
990
-        foreach ( (array) $fields as $field ) {
991
-            // Make sure to filter default values (for placeholder text), but not on the form builder page
992
-            if ( ! $is_form_builder ) {
993
-                $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
994
-            }
983
+			unset($var, $default_val);
984
+		}
985
+
986
+		$values['description'] = self::use_wpautop($values['description']);
987
+		$frm_settings = self::get_settings();
988
+		$is_form_builder = self::is_admin_page('formidable' );
989
+
990
+		foreach ( (array) $fields as $field ) {
991
+			// Make sure to filter default values (for placeholder text), but not on the form builder page
992
+			if ( ! $is_form_builder ) {
993
+				$field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
994
+			}
995 995
 			$parent_form_id = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
996 996
 			self::fill_field_defaults($field, $record, $values, compact('default', 'post_values', 'frm_settings', 'parent_form_id' ) );
997
-        }
997
+		}
998 998
 
999
-        self::fill_form_opts($record, $table, $post_values, $values);
999
+		self::fill_form_opts($record, $table, $post_values, $values);
1000 1000
 
1001
-        if ( $table == 'entries' ) {
1002
-            $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
1003
-        } else if ( $table == 'forms' ) {
1004
-            $values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
1005
-        }
1001
+		if ( $table == 'entries' ) {
1002
+			$values = FrmEntriesHelper::setup_edit_vars( $values, $record );
1003
+		} else if ( $table == 'forms' ) {
1004
+			$values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
1005
+		}
1006 1006
 
1007
-        return $values;
1008
-    }
1007
+		return $values;
1008
+	}
1009 1009
 
1010 1010
 	private static function fill_field_defaults( $field, $record, array &$values, $args ) {
1011
-        $post_values = $args['post_values'];
1012
-
1013
-        if ( $args['default'] ) {
1014
-            $meta_value = $field->default_value;
1015
-        } else {
1016
-            if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
1017
-                if ( ! isset($field->field_options['custom_field']) ) {
1018
-                    $field->field_options['custom_field'] = '';
1019
-                }
1011
+		$post_values = $args['post_values'];
1012
+
1013
+		if ( $args['default'] ) {
1014
+			$meta_value = $field->default_value;
1015
+		} else {
1016
+			if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
1017
+				if ( ! isset($field->field_options['custom_field']) ) {
1018
+					$field->field_options['custom_field'] = '';
1019
+				}
1020 1020
 				$meta_value = FrmProEntryMetaHelper::get_post_value( $record->post_id, $field->field_options['post_field'], $field->field_options['custom_field'], array( 'truncate' => false, 'type' => $field->type, 'form_id' => $field->form_id, 'field' => $field ) );
1021
-            } else {
1021
+			} else {
1022 1022
 				$meta_value = FrmEntryMeta::get_meta_value( $record, $field->id );
1023
-            }
1024
-        }
1023
+			}
1024
+		}
1025 1025
 
1026 1026
 		$field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type;
1027
-        $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1028
-
1029
-        $field_array = array(
1030
-            'id'            => $field->id,
1031
-            'value'         => $new_value,
1032
-            'default_value' => $field->default_value,
1033
-            'name'          => $field->name,
1034
-            'description'   => $field->description,
1035
-            'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1036
-            'options'       => $field->options,
1037
-            'required'      => $field->required,
1038
-            'field_key'     => $field->field_key,
1039
-            'field_order'   => $field->field_order,
1040
-            'form_id'       => $field->form_id,
1027
+		$new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1028
+
1029
+		$field_array = array(
1030
+			'id'            => $field->id,
1031
+			'value'         => $new_value,
1032
+			'default_value' => $field->default_value,
1033
+			'name'          => $field->name,
1034
+			'description'   => $field->description,
1035
+			'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1036
+			'options'       => $field->options,
1037
+			'required'      => $field->required,
1038
+			'field_key'     => $field->field_key,
1039
+			'field_order'   => $field->field_order,
1040
+			'form_id'       => $field->form_id,
1041 1041
 			'parent_form_id' => $args['parent_form_id'],
1042
-        );
1042
+		);
1043 1043
 
1044
-        $args['field_type'] = $field_type;
1045
-        self::fill_field_opts($field, $field_array, $args);
1044
+		$args['field_type'] = $field_type;
1045
+		self::fill_field_opts($field, $field_array, $args);
1046 1046
 		// Track the original field's type
1047 1047
 		$field_array['original_type'] = isset( $field->field_options['original_type'] ) ? $field->field_options['original_type'] : $field->type;
1048 1048
 
1049
-        $field_array = apply_filters( 'frm_setup_edit_fields_vars', $field_array, $field, $values['id'], array() );
1049
+		$field_array = apply_filters( 'frm_setup_edit_fields_vars', $field_array, $field, $values['id'], array() );
1050 1050
 
1051
-        if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1052
-            $field_array['unique_msg'] = '';
1053
-        }
1051
+		if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1052
+			$field_array['unique_msg'] = '';
1053
+		}
1054 1054
 
1055
-        $field_array = array_merge( $field->field_options, $field_array );
1055
+		$field_array = array_merge( $field->field_options, $field_array );
1056 1056
 
1057
-        $values['fields'][ $field->id ] = $field_array;
1058
-    }
1057
+		$values['fields'][ $field->id ] = $field_array;
1058
+	}
1059 1059
 
1060 1060
 	private static function fill_field_opts( $field, array &$field_array, $args ) {
1061
-        $post_values = $args['post_values'];
1062
-        $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1061
+		$post_values = $args['post_values'];
1062
+		$opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1063 1063
 
1064
-        foreach ( $opt_defaults as $opt => $default_opt ) {
1064
+		foreach ( $opt_defaults as $opt => $default_opt ) {
1065 1065
 			$field_array[ $opt ] = ( $post_values && isset( $post_values['field_options'][ $opt . '_' . $field->id ] ) ) ? maybe_unserialize( $post_values['field_options'][ $opt . '_' . $field->id ] ) : ( isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default_opt );
1066
-            if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1067
-                $field_array[ $opt ] = $args['frm_settings']->blank_msg;
1068
-            } else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1069
-                if ( $args['field_type'] == 'captcha' ) {
1070
-                    $field_array[ $opt ] = $args['frm_settings']->re_msg;
1071
-                } else {
1072
-                    $field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1073
-                }
1074
-            }
1075
-        }
1076
-
1077
-        if ( $field_array['custom_html'] == '' ) {
1078
-            $field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1079
-        }
1080
-    }
1081
-
1082
-    /**
1083
-     * @param string $table
1084
-     */
1066
+			if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1067
+				$field_array[ $opt ] = $args['frm_settings']->blank_msg;
1068
+			} else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1069
+				if ( $args['field_type'] == 'captcha' ) {
1070
+					$field_array[ $opt ] = $args['frm_settings']->re_msg;
1071
+				} else {
1072
+					$field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1073
+				}
1074
+			}
1075
+		}
1076
+
1077
+		if ( $field_array['custom_html'] == '' ) {
1078
+			$field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1079
+		}
1080
+	}
1081
+
1082
+	/**
1083
+	 * @param string $table
1084
+	 */
1085 1085
 	private static function fill_form_opts( $record, $table, $post_values, array &$values ) {
1086
-        if ( $table == 'entries' ) {
1087
-            $form = $record->form_id;
1086
+		if ( $table == 'entries' ) {
1087
+			$form = $record->form_id;
1088 1088
 			FrmForm::maybe_get_form( $form );
1089
-        } else {
1090
-            $form = $record;
1091
-        }
1089
+		} else {
1090
+			$form = $record;
1091
+		}
1092 1092
 
1093
-        if ( ! $form ) {
1094
-            return;
1095
-        }
1093
+		if ( ! $form ) {
1094
+			return;
1095
+		}
1096 1096
 
1097
-        $values['form_name'] = isset($record->form_id) ? $form->name : '';
1097
+		$values['form_name'] = isset($record->form_id) ? $form->name : '';
1098 1098
 		$values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
1099 1099
 
1100
-        if ( ! is_array($form->options) ) {
1101
-            return;
1102
-        }
1100
+		if ( ! is_array($form->options) ) {
1101
+			return;
1102
+		}
1103 1103
 
1104
-        foreach ( $form->options as $opt => $value ) {
1105
-            $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1106
-        }
1104
+		foreach ( $form->options as $opt => $value ) {
1105
+			$values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1106
+		}
1107 1107
 
1108
-        self::fill_form_defaults($post_values, $values);
1109
-    }
1108
+		self::fill_form_defaults($post_values, $values);
1109
+	}
1110 1110
 
1111
-    /**
1112
-     * Set to POST value or default
1113
-     */
1111
+	/**
1112
+	 * Set to POST value or default
1113
+	 */
1114 1114
 	private static function fill_form_defaults( $post_values, array &$values ) {
1115
-        $form_defaults = FrmFormsHelper::get_default_opts();
1115
+		$form_defaults = FrmFormsHelper::get_default_opts();
1116 1116
 
1117
-        foreach ( $form_defaults as $opt => $default ) {
1118
-            if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1117
+		foreach ( $form_defaults as $opt => $default ) {
1118
+			if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1119 1119
 				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1120
-            }
1120
+			}
1121 1121
 
1122
-            unset($opt, $defaut);
1123
-        }
1122
+			unset($opt, $defaut);
1123
+		}
1124 1124
 
1125 1125
 		if ( ! isset( $values['custom_style'] ) ) {
1126 1126
 			$values['custom_style'] = self::custom_style_value( $post_values );
@@ -1129,10 +1129,10 @@  discard block
 block discarded – undo
1129 1129
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1130 1130
 			if ( ! isset( $values[ $h . '_html' ] ) ) {
1131 1131
 				$values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) );
1132
-            }
1133
-            unset($h);
1134
-        }
1135
-    }
1132
+			}
1133
+			unset($h);
1134
+		}
1135
+	}
1136 1136
 
1137 1137
 	/**
1138 1138
 	 * @since 2.2.10
@@ -1155,59 +1155,59 @@  discard block
 block discarded – undo
1155 1155
 	}
1156 1156
 
1157 1157
 	public static function insert_opt_html( $args ) {
1158
-        $class = '';
1159
-        if ( in_array( $args['type'], array( 'email', 'user_id', 'hidden', 'select', 'radio', 'checkbox', 'phone', 'text' ) ) ) {
1160
-            $class .= 'show_frm_not_email_to';
1161
-        }
1162
-    ?>
1158
+		$class = '';
1159
+		if ( in_array( $args['type'], array( 'email', 'user_id', 'hidden', 'select', 'radio', 'checkbox', 'phone', 'text' ) ) ) {
1160
+			$class .= 'show_frm_not_email_to';
1161
+		}
1162
+	?>
1163 1163
 <li>
1164 1164
     <a href="javascript:void(0)" class="frmids frm_insert_code alignright <?php echo esc_attr($class) ?>" data-code="<?php echo esc_attr($args['id']) ?>" >[<?php echo esc_attr( $args['id'] ) ?>]</a>
1165 1165
     <a href="javascript:void(0)" class="frmkeys frm_insert_code alignright <?php echo esc_attr($class) ?>" data-code="<?php echo esc_attr($args['key']) ?>" >[<?php echo esc_attr( self::truncate($args['key'], 10) ) ?>]</a>
1166 1166
     <a href="javascript:void(0)" class="frm_insert_code <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr($args['id']) ?>" ><?php echo esc_attr( self::truncate($args['name'], 60) ) ?></a>
1167 1167
 </li>
1168 1168
     <?php
1169
-    }
1169
+	}
1170 1170
 
1171 1171
 	public static function truncate( $str, $length, $minword = 3, $continue = '...' ) {
1172
-        if ( is_array( $str ) ) {
1173
-            return '';
1172
+		if ( is_array( $str ) ) {
1173
+			return '';
1174 1174
 		}
1175 1175
 
1176
-        $length = (int) $length;
1176
+		$length = (int) $length;
1177 1177
 		$str = wp_strip_all_tags( $str );
1178 1178
 		$original_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $str ) );
1179 1179
 
1180 1180
 		if ( $length == 0 ) {
1181
-            return '';
1182
-        } else if ( $length <= 10 ) {
1181
+			return '';
1182
+		} else if ( $length <= 10 ) {
1183 1183
 			$sub = self::mb_function( array( 'mb_substr', 'substr' ), array( $str, 0, $length ) );
1184
-            return $sub . (($length < $original_len) ? $continue : '');
1185
-        }
1184
+			return $sub . (($length < $original_len) ? $continue : '');
1185
+		}
1186 1186
 
1187
-        $sub = '';
1188
-        $len = 0;
1187
+		$sub = '';
1188
+		$len = 0;
1189 1189
 
1190 1190
 		$words = self::mb_function( array( 'mb_split', 'explode' ), array( ' ', $str ) );
1191 1191
 
1192 1192
 		foreach ( $words as $word ) {
1193
-            $part = (($sub != '') ? ' ' : '') . $word;
1193
+			$part = (($sub != '') ? ' ' : '') . $word;
1194 1194
 			$total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1195
-            if ( $total_len > $length && str_word_count($sub) ) {
1196
-                break;
1197
-            }
1195
+			if ( $total_len > $length && str_word_count($sub) ) {
1196
+				break;
1197
+			}
1198 1198
 
1199
-            $sub .= $part;
1199
+			$sub .= $part;
1200 1200
 			$len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1201 1201
 
1202
-            if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1203
-                break;
1204
-            }
1202
+			if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1203
+				break;
1204
+			}
1205 1205
 
1206
-            unset($total_len, $word);
1207
-        }
1206
+			unset($total_len, $word);
1207
+		}
1208 1208
 
1209
-        return $sub . (($len < $original_len) ? $continue : '');
1210
-    }
1209
+		return $sub . (($len < $original_len) ? $continue : '');
1210
+	}
1211 1211
 
1212 1212
 	public static function mb_function( $function_names, $args ) {
1213 1213
 		$mb_function_name = $function_names[0];
@@ -1219,18 +1219,18 @@  discard block
 block discarded – undo
1219 1219
 	}
1220 1220
 
1221 1221
 	public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1222
-        if ( empty($date) ) {
1223
-            return $date;
1224
-        }
1222
+		if ( empty($date) ) {
1223
+			return $date;
1224
+		}
1225 1225
 
1226
-        if ( empty($date_format) ) {
1227
-            $date_format = get_option('date_format');
1228
-        }
1226
+		if ( empty($date_format) ) {
1227
+			$date_format = get_option('date_format');
1228
+		}
1229 1229
 
1230
-        if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1231
-            $frmpro_settings = new FrmProSettings();
1232
-            $date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1233
-        }
1230
+		if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1231
+			$frmpro_settings = new FrmProSettings();
1232
+			$date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1233
+		}
1234 1234
 
1235 1235
 		$formatted = self::get_localized_date( $date_format, $date );
1236 1236
 
@@ -1239,8 +1239,8 @@  discard block
 block discarded – undo
1239 1239
 			$formatted .= self::add_time_to_date( $time_format, $date );
1240 1240
 		}
1241 1241
 
1242
-        return $formatted;
1243
-    }
1242
+		return $formatted;
1243
+	}
1244 1244
 
1245 1245
 	private static function add_time_to_date( $time_format, $date ) {
1246 1246
 		if ( empty( $time_format ) ) {
@@ -1322,61 +1322,61 @@  discard block
 block discarded – undo
1322 1322
 		);
1323 1323
 	}
1324 1324
 
1325
-    /**
1326
-     * Added for < WP 4.0 compatability
1327
-     *
1328
-     * @since 1.07.10
1329
-     *
1330
-     * @param string $term The value to escape
1331
-     * @return string The escaped value
1332
-     */
1325
+	/**
1326
+	 * Added for < WP 4.0 compatability
1327
+	 *
1328
+	 * @since 1.07.10
1329
+	 *
1330
+	 * @param string $term The value to escape
1331
+	 * @return string The escaped value
1332
+	 */
1333 1333
 	public static function esc_like( $term ) {
1334
-        global $wpdb;
1335
-        if ( method_exists($wpdb, 'esc_like') ) {
1334
+		global $wpdb;
1335
+		if ( method_exists($wpdb, 'esc_like') ) {
1336 1336
 			// WP 4.0
1337
-            $term = $wpdb->esc_like( $term );
1338
-        } else {
1339
-            $term = like_escape( $term );
1340
-        }
1337
+			$term = $wpdb->esc_like( $term );
1338
+		} else {
1339
+			$term = like_escape( $term );
1340
+		}
1341 1341
 
1342
-        return $term;
1343
-    }
1342
+		return $term;
1343
+	}
1344 1344
 
1345
-    /**
1346
-     * @param string $order_query
1347
-     */
1345
+	/**
1346
+	 * @param string $order_query
1347
+	 */
1348 1348
 	public static function esc_order( $order_query ) {
1349
-        if ( empty($order_query) ) {
1350
-            return '';
1351
-        }
1352
-
1353
-        // remove ORDER BY before santizing
1354
-        $order_query = strtolower($order_query);
1355
-        if ( strpos($order_query, 'order by') !== false ) {
1356
-            $order_query = str_replace('order by', '', $order_query);
1357
-        }
1358
-
1359
-        $order_query = explode(' ', trim($order_query));
1360
-
1361
-        $order_fields = array(
1362
-            'id', 'form_key', 'name', 'description',
1363
-            'parent_form_id', 'logged_in', 'is_template',
1364
-            'default_template', 'status', 'created_at',
1365
-        );
1366
-
1367
-        $order = trim(trim(reset($order_query), ','));
1368
-        if ( ! in_array($order, $order_fields) ) {
1369
-            return '';
1370
-        }
1371
-
1372
-        $order_by = '';
1373
-        if ( count($order_query) > 1 ) {
1349
+		if ( empty($order_query) ) {
1350
+			return '';
1351
+		}
1352
+
1353
+		// remove ORDER BY before santizing
1354
+		$order_query = strtolower($order_query);
1355
+		if ( strpos($order_query, 'order by') !== false ) {
1356
+			$order_query = str_replace('order by', '', $order_query);
1357
+		}
1358
+
1359
+		$order_query = explode(' ', trim($order_query));
1360
+
1361
+		$order_fields = array(
1362
+			'id', 'form_key', 'name', 'description',
1363
+			'parent_form_id', 'logged_in', 'is_template',
1364
+			'default_template', 'status', 'created_at',
1365
+		);
1366
+
1367
+		$order = trim(trim(reset($order_query), ','));
1368
+		if ( ! in_array($order, $order_fields) ) {
1369
+			return '';
1370
+		}
1371
+
1372
+		$order_by = '';
1373
+		if ( count($order_query) > 1 ) {
1374 1374
 			$order_by = end( $order_query );
1375 1375
 			self::esc_order_by( $order_by );
1376
-        }
1376
+		}
1377 1377
 
1378 1378
 		return ' ORDER BY ' . $order . ' ' . $order_by;
1379
-    }
1379
+	}
1380 1380
 
1381 1381
 	/**
1382 1382
 	 * Make sure this is ordering by either ASC or DESC
@@ -1388,169 +1388,169 @@  discard block
 block discarded – undo
1388 1388
 		}
1389 1389
 	}
1390 1390
 
1391
-    /**
1392
-     * @param string $limit
1393
-     */
1391
+	/**
1392
+	 * @param string $limit
1393
+	 */
1394 1394
 	public static function esc_limit( $limit ) {
1395
-        if ( empty($limit) ) {
1396
-            return '';
1397
-        }
1395
+		if ( empty($limit) ) {
1396
+			return '';
1397
+		}
1398 1398
 
1399
-        $limit = trim(str_replace(' limit', '', strtolower($limit)));
1400
-        if ( is_numeric($limit) ) {
1399
+		$limit = trim(str_replace(' limit', '', strtolower($limit)));
1400
+		if ( is_numeric($limit) ) {
1401 1401
 			return ' LIMIT ' . $limit;
1402
-        }
1402
+		}
1403 1403
 
1404
-        $limit = explode(',', trim($limit));
1405
-        foreach ( $limit as $k => $l ) {
1406
-            if ( is_numeric( $l ) ) {
1407
-                $limit[ $k ] = $l;
1408
-            }
1409
-        }
1404
+		$limit = explode(',', trim($limit));
1405
+		foreach ( $limit as $k => $l ) {
1406
+			if ( is_numeric( $l ) ) {
1407
+				$limit[ $k ] = $l;
1408
+			}
1409
+		}
1410 1410
 
1411
-        $limit = implode(',', $limit);
1411
+		$limit = implode(',', $limit);
1412 1412
 		return ' LIMIT ' . $limit;
1413
-    }
1414
-
1415
-    /**
1416
-     * Get an array of values ready to go through $wpdb->prepare
1417
-     * @since 2.0
1418
-     */
1419
-    public static function prepare_array_values( $array, $type = '%s' ) {
1420
-        $placeholders = array_fill(0, count($array), $type);
1421
-        return implode(', ', $placeholders);
1422
-    }
1423
-
1424
-    public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
1425
-        if ( empty($where) ) {
1426
-            return '';
1427
-        }
1413
+	}
1414
+
1415
+	/**
1416
+	 * Get an array of values ready to go through $wpdb->prepare
1417
+	 * @since 2.0
1418
+	 */
1419
+	public static function prepare_array_values( $array, $type = '%s' ) {
1420
+		$placeholders = array_fill(0, count($array), $type);
1421
+		return implode(', ', $placeholders);
1422
+	}
1423
+
1424
+	public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
1425
+		if ( empty($where) ) {
1426
+			return '';
1427
+		}
1428 1428
 
1429 1429
 		if ( is_array( $where ) ) {
1430
-            global $wpdb;
1431
-            FrmDb::get_where_clause_and_values( $where, $starts_with );
1430
+			global $wpdb;
1431
+			FrmDb::get_where_clause_and_values( $where, $starts_with );
1432 1432
 			$where = $wpdb->prepare( $where['where'], $where['values'] );
1433 1433
 		} else {
1434
-            $where = $starts_with . $where;
1435
-        }
1434
+			$where = $starts_with . $where;
1435
+		}
1436 1436
 
1437
-        return $where;
1438
-    }
1437
+		return $where;
1438
+	}
1439 1439
 
1440
-    // Pagination Methods
1440
+	// Pagination Methods
1441 1441
 
1442
-    /**
1443
-     * @param integer $current_p
1444
-     */
1442
+	/**
1443
+	 * @param integer $current_p
1444
+	 */
1445 1445
 	public static function get_last_record_num( $r_count, $current_p, $p_size ) {
1446 1446
 		return ( ( $r_count < ( $current_p * $p_size ) ) ? $r_count : ( $current_p * $p_size ) );
1447 1447
 	}
1448 1448
 
1449
-    /**
1450
-     * @param integer $current_p
1451
-     */
1452
-    public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1453
-        if ( $current_p == 1 ) {
1454
-            return 1;
1455
-        } else {
1456
-            return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1457
-        }
1458
-    }
1449
+	/**
1450
+	 * @param integer $current_p
1451
+	 */
1452
+	public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1453
+		if ( $current_p == 1 ) {
1454
+			return 1;
1455
+		} else {
1456
+			return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1457
+		}
1458
+	}
1459 1459
 
1460 1460
 	/**
1461 1461
 	 * @return array
1462 1462
 	 */
1463 1463
 	public static function json_to_array( $json_vars ) {
1464
-        $vars = array();
1465
-        foreach ( $json_vars as $jv ) {
1466
-            $jv_name = explode('[', $jv['name']);
1467
-            $last = count($jv_name) - 1;
1468
-            foreach ( $jv_name as $p => $n ) {
1469
-                $name = trim($n, ']');
1470
-                if ( ! isset($l1) ) {
1471
-                    $l1 = $name;
1472
-                }
1473
-
1474
-                if ( ! isset($l2) ) {
1475
-                    $l2 = $name;
1476
-                }
1477
-
1478
-                if ( ! isset($l3) ) {
1479
-                    $l3 = $name;
1480
-                }
1481
-
1482
-                $this_val = ( $p == $last ) ? $jv['value'] : array();
1483
-
1484
-                switch ( $p ) {
1485
-                    case 0:
1486
-                        $l1 = $name;
1487
-                        self::add_value_to_array( $name, $l1, $this_val, $vars );
1488
-                    break;
1489
-
1490
-                    case 1:
1491
-                        $l2 = $name;
1492
-                        self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1493
-                    break;
1494
-
1495
-                    case 2:
1496
-                        $l3 = $name;
1497
-                        self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1498
-                    break;
1499
-
1500
-                    case 3:
1501
-                        $l4 = $name;
1502
-                        self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1503
-                    break;
1504
-                }
1505
-
1506
-                unset($this_val, $n);
1507
-            }
1508
-
1509
-            unset($last, $jv);
1510
-        }
1511
-
1512
-        return $vars;
1513
-    }
1514
-
1515
-    /**
1516
-     * @param string $name
1517
-     * @param string $l1
1518
-     */
1519
-    public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1520
-        if ( $name == '' ) {
1521
-            $vars[] = $val;
1522
-        } else if ( ! isset( $vars[ $l1 ] ) ) {
1523
-            $vars[ $l1 ] = $val;
1524
-        }
1525
-    }
1464
+		$vars = array();
1465
+		foreach ( $json_vars as $jv ) {
1466
+			$jv_name = explode('[', $jv['name']);
1467
+			$last = count($jv_name) - 1;
1468
+			foreach ( $jv_name as $p => $n ) {
1469
+				$name = trim($n, ']');
1470
+				if ( ! isset($l1) ) {
1471
+					$l1 = $name;
1472
+				}
1473
+
1474
+				if ( ! isset($l2) ) {
1475
+					$l2 = $name;
1476
+				}
1477
+
1478
+				if ( ! isset($l3) ) {
1479
+					$l3 = $name;
1480
+				}
1481
+
1482
+				$this_val = ( $p == $last ) ? $jv['value'] : array();
1483
+
1484
+				switch ( $p ) {
1485
+					case 0:
1486
+						$l1 = $name;
1487
+						self::add_value_to_array( $name, $l1, $this_val, $vars );
1488
+					break;
1489
+
1490
+					case 1:
1491
+						$l2 = $name;
1492
+						self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1493
+					break;
1494
+
1495
+					case 2:
1496
+						$l3 = $name;
1497
+						self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1498
+					break;
1499
+
1500
+					case 3:
1501
+						$l4 = $name;
1502
+						self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1503
+					break;
1504
+				}
1505
+
1506
+				unset($this_val, $n);
1507
+			}
1508
+
1509
+			unset($last, $jv);
1510
+		}
1511
+
1512
+		return $vars;
1513
+	}
1514
+
1515
+	/**
1516
+	 * @param string $name
1517
+	 * @param string $l1
1518
+	 */
1519
+	public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1520
+		if ( $name == '' ) {
1521
+			$vars[] = $val;
1522
+		} else if ( ! isset( $vars[ $l1 ] ) ) {
1523
+			$vars[ $l1 ] = $val;
1524
+		}
1525
+	}
1526 1526
 
1527 1527
 	public static function maybe_add_tooltip( $name, $class = 'closed', $form_name = '' ) {
1528
-        $tooltips = array(
1529
-            'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1530
-            'email_to'      => __( 'Add one or more recipient addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].  [admin_email] is the address set in WP General Settings.', 'formidable' ),
1531
-            'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1532
-            'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1533
-            'reply_to'      => __( 'If you would like a different reply to address than the "from" address, add a single address here.  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1534
-            'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1535
-            'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
1536
-        );
1537
-
1538
-        if ( ! isset( $tooltips[ $name ] ) ) {
1539
-            return;
1540
-        }
1541
-
1542
-        if ( 'open' == $class ) {
1543
-            echo ' frm_help"';
1544
-        } else {
1545
-            echo ' class="frm_help"';
1546
-        }
1528
+		$tooltips = array(
1529
+			'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1530
+			'email_to'      => __( 'Add one or more recipient addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].  [admin_email] is the address set in WP General Settings.', 'formidable' ),
1531
+			'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1532
+			'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1533
+			'reply_to'      => __( 'If you would like a different reply to address than the "from" address, add a single address here.  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1534
+			'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1535
+			'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
1536
+		);
1537
+
1538
+		if ( ! isset( $tooltips[ $name ] ) ) {
1539
+			return;
1540
+		}
1541
+
1542
+		if ( 'open' == $class ) {
1543
+			echo ' frm_help"';
1544
+		} else {
1545
+			echo ' class="frm_help"';
1546
+		}
1547 1547
 
1548 1548
 		echo ' title="' . esc_attr( $tooltips[ $name ] );
1549 1549
 
1550
-        if ( 'open' != $class ) {
1551
-            echo '"';
1552
-        }
1553
-    }
1550
+		if ( 'open' != $class ) {
1551
+			echo '"';
1552
+		}
1553
+	}
1554 1554
 
1555 1555
 	/**
1556 1556
 	 * Add the current_page class to that page in the form nav
@@ -1566,35 +1566,35 @@  discard block
 block discarded – undo
1566 1566
 		}
1567 1567
 	}
1568 1568
 
1569
-    /**
1570
-     * Prepare and json_encode post content
1571
-     *
1572
-     * @since 2.0
1573
-     *
1574
-     * @param array $post_content
1575
-     * @return string $post_content ( json encoded array )
1576
-     */
1577
-    public static function prepare_and_encode( $post_content ) {
1578
-        //Loop through array to strip slashes and add only the needed ones
1569
+	/**
1570
+	 * Prepare and json_encode post content
1571
+	 *
1572
+	 * @since 2.0
1573
+	 *
1574
+	 * @param array $post_content
1575
+	 * @return string $post_content ( json encoded array )
1576
+	 */
1577
+	public static function prepare_and_encode( $post_content ) {
1578
+		//Loop through array to strip slashes and add only the needed ones
1579 1579
 		foreach ( $post_content as $key => $val ) {
1580 1580
 			// Replace problematic characters (like &quot;)
1581 1581
 			$val = str_replace( '&quot;', '"', $val );
1582 1582
 
1583 1583
 			self::prepare_action_slashes( $val, $key, $post_content );
1584
-            unset( $key, $val );
1585
-        }
1584
+			unset( $key, $val );
1585
+		}
1586 1586
 
1587
-        // json_encode the array
1588
-        $post_content = json_encode( $post_content );
1587
+		// json_encode the array
1588
+		$post_content = json_encode( $post_content );
1589 1589
 
1590
-	    // add extra slashes for \r\n since WP strips them
1590
+		// add extra slashes for \r\n since WP strips them
1591 1591
 		$post_content = str_replace( array( '\\r', '\\n', '\\u', '\\t' ), array( '\\\\r', '\\\\n', '\\\\u', '\\\\t' ), $post_content );
1592 1592
 
1593
-        // allow for &quot
1594
-	    $post_content = str_replace( '&quot;', '\\"', $post_content );
1593
+		// allow for &quot
1594
+		$post_content = str_replace( '&quot;', '\\"', $post_content );
1595 1595
 
1596
-        return $post_content;
1597
-    }
1596
+		return $post_content;
1597
+	}
1598 1598
 
1599 1599
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1600 1600
 		if ( ! isset( $post_content[ $key ] ) ) {
@@ -1662,64 +1662,64 @@  discard block
 block discarded – undo
1662 1662
 	}
1663 1663
 
1664 1664
 	public static function maybe_json_decode( $string ) {
1665
-        if ( is_array($string) ) {
1666
-            return $string;
1667
-        }
1665
+		if ( is_array($string) ) {
1666
+			return $string;
1667
+		}
1668 1668
 
1669
-        $new_string = json_decode($string, true);
1670
-        if ( function_exists('json_last_error') ) {
1669
+		$new_string = json_decode($string, true);
1670
+		if ( function_exists('json_last_error') ) {
1671 1671
 			// php 5.3+
1672
-            if ( json_last_error() == JSON_ERROR_NONE ) {
1673
-                $string = $new_string;
1674
-            }
1675
-        } else if ( isset($new_string) ) {
1672
+			if ( json_last_error() == JSON_ERROR_NONE ) {
1673
+				$string = $new_string;
1674
+			}
1675
+		} else if ( isset($new_string) ) {
1676 1676
 			// php < 5.3 fallback
1677
-            $string = $new_string;
1678
-        }
1679
-        return $string;
1680
-    }
1681
-
1682
-    /**
1683
-     * @since 1.07.10
1684
-     *
1685
-     * @param string $post_type The name of the post type that may need to be highlighted
1686
-     * echo The javascript to open and highlight the Formidable menu
1687
-     */
1677
+			$string = $new_string;
1678
+		}
1679
+		return $string;
1680
+	}
1681
+
1682
+	/**
1683
+	 * @since 1.07.10
1684
+	 *
1685
+	 * @param string $post_type The name of the post type that may need to be highlighted
1686
+	 * echo The javascript to open and highlight the Formidable menu
1687
+	 */
1688 1688
 	public static function maybe_highlight_menu( $post_type ) {
1689
-        global $post;
1689
+		global $post;
1690 1690
 
1691
-        if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1692
-            return;
1693
-        }
1691
+		if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1692
+			return;
1693
+		}
1694 1694
 
1695
-        if ( is_object($post) && $post->post_type != $post_type ) {
1696
-            return;
1697
-        }
1695
+		if ( is_object($post) && $post->post_type != $post_type ) {
1696
+			return;
1697
+		}
1698 1698
 
1699
-        self::load_admin_wide_js();
1700
-        echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1701
-    }
1699
+		self::load_admin_wide_js();
1700
+		echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1701
+	}
1702 1702
 
1703
-    /**
1704
-     * Load the JS file on non-Formidable pages in the admin area
1705
-     * @since 2.0
1706
-     */
1703
+	/**
1704
+	 * Load the JS file on non-Formidable pages in the admin area
1705
+	 * @since 2.0
1706
+	 */
1707 1707
 	public static function load_admin_wide_js( $load = true ) {
1708
-        $version = FrmAppHelper::plugin_version();
1708
+		$version = FrmAppHelper::plugin_version();
1709 1709
 		wp_register_script( 'formidable_admin_global', FrmAppHelper::plugin_url() . '/js/formidable_admin_global.js', array( 'jquery' ), $version );
1710 1710
 
1711
-        wp_localize_script( 'formidable_admin_global', 'frmGlobal', array(
1711
+		wp_localize_script( 'formidable_admin_global', 'frmGlobal', array(
1712 1712
 			'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
1713
-            'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1713
+			'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1714 1714
 			'url'          => FrmAppHelper::plugin_url(),
1715 1715
 			'loading'      => __( 'Loading&hellip;' ),
1716 1716
 			'nonce'        => wp_create_nonce( 'frm_ajax' ),
1717
-        ) );
1717
+		) );
1718 1718
 
1719 1719
 		if ( $load ) {
1720 1720
 			wp_enqueue_script( 'formidable_admin_global' );
1721 1721
 		}
1722
-    }
1722
+	}
1723 1723
 
1724 1724
 	/**
1725 1725
 	 * @since 2.0.9
@@ -1728,9 +1728,9 @@  discard block
 block discarded – undo
1728 1728
 		wp_enqueue_style( 'frm_fonts', self::plugin_url() . '/css/frm_fonts.css', array(), self::plugin_version() );
1729 1729
 	}
1730 1730
 
1731
-    /**
1732
-     * @param string $location
1733
-     */
1731
+	/**
1732
+	 * @param string $location
1733
+	 */
1734 1734
 	public static function localize_script( $location ) {
1735 1735
 		$ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
1736 1736
 		$ajax_url = apply_filters( 'frm_ajax_url', $ajax_url );
@@ -1783,81 +1783,81 @@  discard block
 block discarded – undo
1783 1783
 		}
1784 1784
 	}
1785 1785
 
1786
-    /**
1786
+	/**
1787 1787
 	 * echo the message on the plugins listing page
1788
-     * @since 1.07.10
1789
-     *
1790
-     * @param float $min_version The version the add-on requires
1791
-     */
1788
+	 * @since 1.07.10
1789
+	 *
1790
+	 * @param float $min_version The version the add-on requires
1791
+	 */
1792 1792
 	public static function min_version_notice( $min_version ) {
1793
-        $frm_version = self::plugin_version();
1793
+		$frm_version = self::plugin_version();
1794 1794
 
1795
-        // check if Formidable meets minimum requirements
1796
-        if ( version_compare($frm_version, $min_version, '>=') ) {
1797
-            return;
1798
-        }
1795
+		// check if Formidable meets minimum requirements
1796
+		if ( version_compare($frm_version, $min_version, '>=') ) {
1797
+			return;
1798
+		}
1799 1799
 
1800
-        $wp_list_table = _get_list_table('WP_Plugins_List_Table');
1800
+		$wp_list_table = _get_list_table('WP_Plugins_List_Table');
1801 1801
 		echo '<tr class="plugin-update-tr active"><th colspan="' . absint( $wp_list_table->get_column_count() ) . '" class="check-column plugin-update colspanchange"><div class="update-message">' .
1802
-        __( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1803
-        '</div></td></tr>';
1804
-    }
1805
-
1806
-    public static function locales( $type = 'date' ) {
1807
-        $locales = array(
1808
-            'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1809
-            'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1810
-            'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1811
-            'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1812
-            'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1813
-            'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1814
-            'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1815
-            'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1816
-            'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1817
-            'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1818
-            'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1819
-            'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1820
-            'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1821
-            'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1822
-            'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1823
-            'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1824
-            'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1825
-            'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1826
-            'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1827
-            'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1828
-            'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1829
-            'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1830
-            'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1831
-            'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1832
-            'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1833
-            'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1834
-            'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1835
-            'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1836
-            'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1837
-            'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1838
-            'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1839
-            'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1840
-        );
1841
-
1842
-        if ( $type == 'captcha' ) {
1843
-            // remove the languages unavailable for the captcha
1844
-            $unset = array(
1845
-                '', 'af', 'sq', 'hy', 'az', 'eu', 'bs',
1846
-                'zh-HK', 'eo', 'et', 'fo', 'fr-CH',
1847
-                'he', 'is', 'ms', 'sr-SR', 'ta', 'tu',
1848
-            );
1849
-        } else {
1850
-            // remove the languages unavailable for the datepicker
1851
-            $unset = array(
1852
-                'en', 'fil', 'fr-CA', 'de-AT', 'de-AT',
1853
-                'de-CH', 'iw', 'hi', 'pt', 'pt-PT',
1854
-                'es-419', 'tr',
1855
-            );
1856
-        }
1857
-
1858
-        $locales = array_diff_key($locales, array_flip($unset));
1859
-        $locales = apply_filters('frm_locales', $locales);
1860
-
1861
-        return $locales;
1862
-    }
1802
+		__( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1803
+		'</div></td></tr>';
1804
+	}
1805
+
1806
+	public static function locales( $type = 'date' ) {
1807
+		$locales = array(
1808
+			'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1809
+			'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1810
+			'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1811
+			'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1812
+			'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1813
+			'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1814
+			'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1815
+			'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1816
+			'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1817
+			'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1818
+			'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1819
+			'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1820
+			'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1821
+			'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1822
+			'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1823
+			'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1824
+			'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1825
+			'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1826
+			'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1827
+			'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1828
+			'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1829
+			'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1830
+			'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1831
+			'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1832
+			'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1833
+			'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1834
+			'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1835
+			'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1836
+			'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1837
+			'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1838
+			'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1839
+			'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1840
+		);
1841
+
1842
+		if ( $type == 'captcha' ) {
1843
+			// remove the languages unavailable for the captcha
1844
+			$unset = array(
1845
+				'', 'af', 'sq', 'hy', 'az', 'eu', 'bs',
1846
+				'zh-HK', 'eo', 'et', 'fo', 'fr-CH',
1847
+				'he', 'is', 'ms', 'sr-SR', 'ta', 'tu',
1848
+			);
1849
+		} else {
1850
+			// remove the languages unavailable for the datepicker
1851
+			$unset = array(
1852
+				'en', 'fil', 'fr-CA', 'de-AT', 'de-AT',
1853
+				'de-CH', 'iw', 'hi', 'pt', 'pt-PT',
1854
+				'es-419', 'tr',
1855
+			);
1856
+		}
1857
+
1858
+		$locales = array_diff_key($locales, array_flip($unset));
1859
+		$locales = apply_filters('frm_locales', $locales);
1860
+
1861
+		return $locales;
1862
+	}
1863 1863
 }
Please login to merge, or discard this patch.
classes/controllers/FrmAppController.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 <div class="update-nag frm-update-to-pro">
139 139
 	<?php echo FrmAppHelper::kses( $tip['tip'] ) ?>
140 140
 	<span><?php echo FrmAppHelper::kses( $tip['call'] ) ?></span>
141
-	<a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidableforms.com?banner=1&tip=' . absint( $tip['num'] ) ) ) ?>" class="button">Upgrade to Pro</a>
141
+	<a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com?banner=1&tip=' . absint( $tip['num'] ) ) ) ?>" class="button">Upgrade to Pro</a>
142 142
 </div>
143 143
 <?php
144 144
 		}
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
     }
371 371
 
372 372
     public static function uninstall() {
373
-		FrmAppHelper::permission_check('administrator');
373
+		FrmAppHelper::permission_check( 'administrator' );
374 374
         check_ajax_referer( 'frm_ajax', 'nonce' );
375 375
 
376 376
 		$frmdb = new FrmDb();
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
     }
406 406
 
407 407
     public static function deauthorize() {
408
-		FrmAppHelper::permission_check('frm_change_settings');
408
+		FrmAppHelper::permission_check( 'frm_change_settings' );
409 409
         check_ajax_referer( 'frm_ajax', 'nonce' );
410 410
 
411 411
         delete_option( 'frmpro-credentials' );
Please login to merge, or discard this patch.
Indentation   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
3 3
 class FrmAppController {
4 4
 
5 5
 	public static function menu() {
6
-        FrmAppHelper::maybe_add_permissions();
7
-        if ( ! current_user_can( 'frm_view_forms' ) ) {
8
-            return;
9
-        }
6
+		FrmAppHelper::maybe_add_permissions();
7
+		if ( ! current_user_can( 'frm_view_forms' ) ) {
8
+			return;
9
+		}
10 10
 
11 11
 		$menu_name = FrmAppHelper::get_menu_name();
12 12
 		add_menu_page( 'Formidable', $menu_name, 'frm_view_forms', 'formidable', 'FrmFormsController::route', '', self::get_menu_position() );
13
-    }
13
+	}
14 14
 
15 15
 	private static function get_menu_position() {
16 16
 		$count = count( get_post_types( array( 'show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) );
@@ -19,15 +19,15 @@  discard block
 block discarded – undo
19 19
 		return $pos;
20 20
 	}
21 21
 
22
-    public static function load_wp_admin_style() {
23
-        FrmAppHelper::load_font_style();
24
-    }
22
+	public static function load_wp_admin_style() {
23
+		FrmAppHelper::load_font_style();
24
+	}
25 25
 
26 26
 	public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) {
27 27
 		$show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
28
-        if ( empty( $show_nav ) || ! $form ) {
29
-            return;
30
-        }
28
+		if ( empty( $show_nav ) || ! $form ) {
29
+			return;
30
+		}
31 31
 
32 32
 		FrmForm::maybe_get_form( $form );
33 33
 		if ( ! is_object( $form ) ) {
@@ -85,28 +85,28 @@  discard block
 block discarded – undo
85 85
 		return $nav_items;
86 86
 	}
87 87
 
88
-    // Adds a settings link to the plugins page
89
-    public static function settings_link( $links ) {
88
+	// Adds a settings link to the plugins page
89
+	public static function settings_link( $links ) {
90 90
 		$settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">' . __( 'Settings', 'formidable' ) . '</a>';
91
-        array_unshift( $links, $settings );
91
+		array_unshift( $links, $settings );
92 92
 
93
-        return $links;
94
-    }
93
+		return $links;
94
+	}
95 95
 
96
-    public static function pro_get_started_headline() {
96
+	public static function pro_get_started_headline() {
97 97
 		self::maybe_show_upgrade_bar();
98 98
 
99
-        // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message
100
-        if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) {
101
-            return;
102
-        }
99
+		// Don't display this error as we're upgrading the thing, or if the user shouldn't see the message
100
+		if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) {
101
+			return;
102
+		}
103 103
 
104 104
 		if ( get_site_option( 'frmpro-authorized' ) && ! file_exists( FrmAppHelper::plugin_path() . '/pro/formidable-pro.php' ) ) {
105
-            FrmAppHelper::load_admin_wide_js();
105
+			FrmAppHelper::load_admin_wide_js();
106 106
 
107
-            // user is authorized, but running free version
108
-            $inst_install_url = 'https://formidableforms.com/knowledgebase/install-formidable-forms/';
109
-        ?>
107
+			// user is authorized, but running free version
108
+			$inst_install_url = 'https://formidableforms.com/knowledgebase/install-formidable-forms/';
109
+		?>
110 110
 <div class="error" class="frm_previous_install">
111 111
 		<?php
112 112
 		echo wp_kses_post( apply_filters( 'frm_pro_update_msg',
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 		) ); ?>
119 119
 </div>
120 120
 <?php
121
-        }
122
-    }
121
+		}
122
+	}
123 123
 
124 124
 	private static function maybe_show_upgrade_bar() {
125 125
 		$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		}
225 225
 	}
226 226
 
227
-    public static function admin_js() {
227
+	public static function admin_js() {
228 228
 		$version = FrmAppHelper::plugin_version();
229 229
 		FrmAppHelper::load_admin_wide_js( false );
230 230
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 			'bootstrap_tooltip', 'bootstrap-multiselect',
236 236
 		), $version, true );
237 237
 		wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
238
-        wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
238
+		wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
239 239
 		wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version );
240 240
 
241 241
 		// load multselect js
@@ -247,54 +247,54 @@  discard block
 block discarded – undo
247 247
 		global $pagenow;
248 248
 		if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) {
249 249
 
250
-            wp_enqueue_script( 'admin-widgets' );
251
-            wp_enqueue_style( 'widgets' );
252
-            wp_enqueue_script( 'formidable' );
253
-            wp_enqueue_script( 'formidable_admin' );
250
+			wp_enqueue_script( 'admin-widgets' );
251
+			wp_enqueue_style( 'widgets' );
252
+			wp_enqueue_script( 'formidable' );
253
+			wp_enqueue_script( 'formidable_admin' );
254 254
 			FrmAppHelper::localize_script( 'admin' );
255 255
 
256
-            wp_enqueue_style( 'formidable-admin' );
256
+			wp_enqueue_style( 'formidable-admin' );
257 257
 			wp_enqueue_style( 'formidable-grids' );
258 258
 			wp_enqueue_style( 'formidable-dropzone' );
259
-            add_thickbox();
259
+			add_thickbox();
260 260
 
261
-            wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
261
+			wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
262 262
 
263
-        } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
264
-            if ( isset( $_REQUEST['post_type'] ) ) {
265
-                $post_type = sanitize_title( $_REQUEST['post_type'] );
263
+		} else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
264
+			if ( isset( $_REQUEST['post_type'] ) ) {
265
+				$post_type = sanitize_title( $_REQUEST['post_type'] );
266 266
 			} else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) {
267 267
 				$post = get_post( absint( $_REQUEST['post'] ) );
268
-                if ( ! $post ) {
269
-                    return;
270
-                }
271
-                $post_type = $post->post_type;
272
-            } else {
273
-                return;
274
-            }
275
-
276
-            if ( $post_type == 'frm_display' ) {
277
-                wp_enqueue_script( 'jquery-ui-draggable' );
278
-                wp_enqueue_script( 'formidable_admin' );
279
-                wp_enqueue_style( 'formidable-admin' );
268
+				if ( ! $post ) {
269
+					return;
270
+				}
271
+				$post_type = $post->post_type;
272
+			} else {
273
+				return;
274
+			}
275
+
276
+			if ( $post_type == 'frm_display' ) {
277
+				wp_enqueue_script( 'jquery-ui-draggable' );
278
+				wp_enqueue_script( 'formidable_admin' );
279
+				wp_enqueue_style( 'formidable-admin' );
280 280
 				FrmAppHelper::localize_script( 'admin' );
281
-            }
282
-        } else if ( $pagenow == 'widgets.php' ) {
283
-            FrmAppHelper::load_admin_wide_js();
284
-        }
285
-    }
286
-
287
-    public static function load_lang() {
288
-        load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
289
-    }
290
-
291
-    /**
292
-     * Filter shortcodes in text widgets
293
-     */
294
-    public static function widget_text_filter( $content ) {
295
-    	$regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/';
296
-    	return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content );
297
-    }
281
+			}
282
+		} else if ( $pagenow == 'widgets.php' ) {
283
+			FrmAppHelper::load_admin_wide_js();
284
+		}
285
+	}
286
+
287
+	public static function load_lang() {
288
+		load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
289
+	}
290
+
291
+	/**
292
+	 * Filter shortcodes in text widgets
293
+	 */
294
+	public static function widget_text_filter( $content ) {
295
+		$regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/';
296
+		return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content );
297
+	}
298 298
 
299 299
 	/**
300 300
 	 * Deprecated in favor of wpmu_upgrade_site
@@ -359,20 +359,20 @@  discard block
 block discarded – undo
359 359
 		wp_die();
360 360
 	}
361 361
 
362
-    public static function activation_install() {
363
-        FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' );
364
-        FrmFormActionsController::actions_init();
365
-        self::install();
366
-    }
362
+	public static function activation_install() {
363
+		FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' );
364
+		FrmFormActionsController::actions_init();
365
+		self::install();
366
+	}
367 367
 
368
-    public static function install( $old_db_version = false ) {
369
-        $frmdb = new FrmDb();
370
-        $frmdb->upgrade( $old_db_version );
371
-    }
368
+	public static function install( $old_db_version = false ) {
369
+		$frmdb = new FrmDb();
370
+		$frmdb->upgrade( $old_db_version );
371
+	}
372 372
 
373
-    public static function uninstall() {
373
+	public static function uninstall() {
374 374
 		FrmAppHelper::permission_check('administrator');
375
-        check_ajax_referer( 'frm_ajax', 'nonce' );
375
+		check_ajax_referer( 'frm_ajax', 'nonce' );
376 376
 
377 377
 		$frmdb = new FrmDb();
378 378
 		$frmdb->uninstall();
@@ -381,43 +381,43 @@  discard block
 block discarded – undo
381 381
 		deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false );
382 382
 		echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
383 383
 
384
-        wp_die();
385
-    }
384
+		wp_die();
385
+	}
386 386
 
387
-    public static function drop_tables( $tables ) {
388
-        global $wpdb;
389
-        $tables[] = $wpdb->prefix . 'frm_fields';
390
-        $tables[] = $wpdb->prefix . 'frm_forms';
391
-        $tables[] = $wpdb->prefix . 'frm_items';
392
-        $tables[] = $wpdb->prefix . 'frm_item_metas';
393
-        return $tables;
394
-    }
387
+	public static function drop_tables( $tables ) {
388
+		global $wpdb;
389
+		$tables[] = $wpdb->prefix . 'frm_fields';
390
+		$tables[] = $wpdb->prefix . 'frm_forms';
391
+		$tables[] = $wpdb->prefix . 'frm_items';
392
+		$tables[] = $wpdb->prefix . 'frm_item_metas';
393
+		return $tables;
394
+	}
395 395
 
396
-    // Routes for wordpress pages -- we're just replacing content here folks.
397
-    public static function page_route( $content ) {
398
-        global $post;
396
+	// Routes for wordpress pages -- we're just replacing content here folks.
397
+	public static function page_route( $content ) {
398
+		global $post;
399 399
 
400
-        $frm_settings = FrmAppHelper::get_settings();
401
-        if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) {
402
-            $content = FrmFormsController::page_preview();
403
-        }
400
+		$frm_settings = FrmAppHelper::get_settings();
401
+		if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) {
402
+			$content = FrmFormsController::page_preview();
403
+		}
404 404
 
405
-        return $content;
406
-    }
405
+		return $content;
406
+	}
407 407
 
408
-    public static function deauthorize() {
408
+	public static function deauthorize() {
409 409
 		FrmAppHelper::permission_check('frm_change_settings');
410
-        check_ajax_referer( 'frm_ajax', 'nonce' );
411
-
412
-        delete_option( 'frmpro-credentials' );
413
-        delete_option( 'frmpro-authorized' );
414
-        delete_site_option( 'frmpro-credentials' );
415
-        delete_site_option( 'frmpro-authorized' );
416
-        wp_die();
417
-    }
418
-
419
-    public static function get_form_shortcode( $atts ) {
420
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
421
-        return FrmFormsController::get_form_shortcode( $atts );
422
-    }
410
+		check_ajax_referer( 'frm_ajax', 'nonce' );
411
+
412
+		delete_option( 'frmpro-credentials' );
413
+		delete_option( 'frmpro-authorized' );
414
+		delete_site_option( 'frmpro-credentials' );
415
+		delete_site_option( 'frmpro-authorized' );
416
+		wp_die();
417
+	}
418
+
419
+	public static function get_form_shortcode( $atts ) {
420
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
421
+		return FrmFormsController::get_form_shortcode( $atts );
422
+	}
423 423
 }
Please login to merge, or discard this patch.
classes/views/addons/upgrade_to_pro.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,9 +58,9 @@
 block discarded – undo
58 58
 			<tr>
59 59
 				<th>Included AddOns</th>
60 60
 				<td>None</td>
61
-				<td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidableforms.com/pricing/#addon-lists') ) ?>" target="_blank">Premium Addons</a></td>
62
-				<td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidableforms.com/pricing/#addon-lists') ) ?>" target="_blank">Advanced Addons</a></td>
63
-				<td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidableforms.com/pricing/#addon-lists') ) ?>" target="_blank">Enterprise Addons</a></td>
61
+				<td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/pricing/#addon-lists' ) ) ?>" target="_blank">Premium Addons</a></td>
62
+				<td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/pricing/#addon-lists' ) ) ?>" target="_blank">Advanced Addons</a></td>
63
+				<td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/pricing/#addon-lists' ) ) ?>" target="_blank">Enterprise Addons</a></td>
64 64
 			</tr>
65 65
 		</tbody>
66 66
 	</table>
Please login to merge, or discard this patch.
classes/views/frm-entries/no_entries.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <div class="frmcenter frm_no_entries_form">
2 2
 <?php
3
-if ( $form && isset($form->options['no_save']) && $form->options['no_save'] ) { ?>
3
+if ( $form && isset( $form->options['no_save'] ) && $form->options['no_save'] ) { ?>
4 4
 <h3><?php _e( 'This form is not set to save any entries.', 'formidable' ) ?></h3>
5 5
 <p>If you would like entries in this form to be saved, go to the <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable' ) . '&frm_action=settings&id=' . $form->id ) ?>">form Settings</a> page and uncheck the "Do not store any entries submitted from this form" box.</p>
6 6
 <?php
7 7
 } else if ( $form ) {
8 8
 ?>
9
-<div class="frm_no_entries_header"><?php printf(__( 'No Entries for form: %s', 'formidable' ), $form->name); ?></div>
10
-<p class="frm_no_entries_text"><?php printf( __( 'For instructions on publishing your form see %1$sthe docs%2$s or click "%3$sAdd New%4$s" above to add an entry from here (Requires License)', 'formidable' ), '<a href="https://formidableforms.com/knowledgebase/publish-your-forms/" target="_blank">', '</a> <br/>', '<a href="' . esc_url( admin_url('admin.php?page=formidable-entries&frm_action=new&form=' . $form->id ) ) . '">', '</a>' ); ?></p>
9
+<div class="frm_no_entries_header"><?php printf( __( 'No Entries for form: %s', 'formidable' ), $form->name ); ?></div>
10
+<p class="frm_no_entries_text"><?php printf( __( 'For instructions on publishing your form see %1$sthe docs%2$s or click "%3$sAdd New%4$s" above to add an entry from here (Requires License)', 'formidable' ), '<a href="https://formidableforms.com/knowledgebase/publish-your-forms/" target="_blank">', '</a> <br/>', '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&frm_action=new&form=' . $form->id ) ) . '">', '</a>' ); ?></p>
11 11
 <?php
12 12
 } else {
13 13
 ?>
Please login to merge, or discard this patch.
classes/views/frm-entries/show.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -14,44 +14,44 @@
 block discarded – undo
14 14
                     <div class="inside">
15 15
                         <table class="form-table"><tbody>
16 16
                         <?php
17
-                        $first_h3 = 'frm_first_h3';
18
-                        foreach ( $fields as $field ) {
17
+						$first_h3 = 'frm_first_h3';
18
+						foreach ( $fields as $field ) {
19 19
 							if ( in_array( $field->type, array( 'captcha', 'html', 'end_divider', 'form' ) ) ) {
20
-                                continue;
21
-                            }
20
+								continue;
21
+							}
22 22
 
23
-                            if ( in_array($field->type, array( 'break', 'divider' ) ) ) {
24
-                            ?>
23
+							if ( in_array($field->type, array( 'break', 'divider' ) ) ) {
24
+							?>
25 25
                         </tbody></table>
26 26
                         <br/><h3 class="<?php echo esc_attr( $first_h3 ) ?>"><?php echo esc_html( $field->name ) ?></h3>
27 27
                         <table class="form-table"><tbody>
28 28
                         <?php
29
-                                $first_h3 = '';
30
-                            } else {
31
-                        ?>
29
+								$first_h3 = '';
30
+							} else {
31
+						?>
32 32
                         <tr>
33 33
                             <th scope="row"><?php echo esc_html( $field->name ) ?>:</th>
34 34
                             <td>
35 35
                             <?php
36 36
 							$embedded_field_id = ( $entry->form_id != $field->form_id ) ? 'form' . $field->form_id : 0;
37
-                            $atts = array(
38
-                                'type' => $field->type, 'post_id' => $entry->post_id,
39
-                                'show_filename' => true, 'show_icon' => true, 'entry_id' => $entry->id,
40
-                                'embedded_field_id' => $embedded_field_id,
41
-                            );
37
+							$atts = array(
38
+								'type' => $field->type, 'post_id' => $entry->post_id,
39
+								'show_filename' => true, 'show_icon' => true, 'entry_id' => $entry->id,
40
+								'embedded_field_id' => $embedded_field_id,
41
+							);
42 42
 							$display_value = FrmEntriesHelper::prepare_display_value( $entry, $field, $atts );
43 43
 							echo $display_value;
44 44
 
45
-                            if ( is_email($display_value) && ! in_array($display_value, $to_emails) ) {
46
-                                $to_emails[] = $display_value;
47
-                            }
48
-                            ?>
45
+							if ( is_email($display_value) && ! in_array($display_value, $to_emails) ) {
46
+								$to_emails[] = $display_value;
47
+							}
48
+							?>
49 49
                             </td>
50 50
                         </tr>
51 51
                         <?php }
52
-                        }
52
+						}
53 53
 
54
-                        ?>
54
+						?>
55 55
 
56 56
                         <?php if ( $entry->parent_item_id ) { ?>
57 57
                         <tr><th><?php _e( 'Parent Entry ID', 'formidable' ) ?>:</th>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <div id="form_show_entry_page" class="wrap">
2 2
     <h2 class="frm_no_print"><?php _e( 'View Entry', 'formidable' ) ?>
3
-        <?php do_action('frm_entry_inside_h2', $entry->form_id); ?>
3
+        <?php do_action( 'frm_entry_inside_h2', $entry->form_id ); ?>
4 4
     </h2>
5 5
 
6 6
     <div class="frm_forms">
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
         <div id="poststuff">
9 9
             <div id="post-body" class="metabox-holder columns-2">
10 10
             <div id="post-body-content">
11
-                <?php FrmAppController::get_form_nav($entry->form_id, true); ?>
11
+                <?php FrmAppController::get_form_nav( $entry->form_id, true ); ?>
12 12
                 <div class="postbox">
13 13
                     <h3 class="hndle"><span><?php _e( 'Entry', 'formidable' ) ?></span></h3>
14 14
                     <div class="inside">
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
                                 continue;
21 21
                             }
22 22
 
23
-                            if ( in_array($field->type, array( 'break', 'divider' ) ) ) {
23
+                            if ( in_array( $field->type, array( 'break', 'divider' ) ) ) {
24 24
                             ?>
25 25
                         </tbody></table>
26 26
                         <br/><h3 class="<?php echo esc_attr( $first_h3 ) ?>"><?php echo esc_html( $field->name ) ?></h3>
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 							$display_value = FrmEntriesHelper::prepare_display_value( $entry, $field, $atts );
43 43
 							echo $display_value;
44 44
 
45
-                            if ( is_email($display_value) && ! in_array($display_value, $to_emails) ) {
45
+                            if ( is_email( $display_value ) && ! in_array( $display_value, $to_emails ) ) {
46 46
                                 $to_emails[] = $display_value;
47 47
                             }
48 48
                             ?>
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
                         </td></tr>
60 60
                         <?php } ?>
61 61
                         </tbody></table>
62
-                        <?php do_action('frm_show_entry', $entry); ?>
62
+                        <?php do_action( 'frm_show_entry', $entry ); ?>
63 63
                     </div>
64 64
                 </div>
65 65
 
66
-                <?php do_action('frm_after_show_entry', $entry); ?>
66
+                <?php do_action( 'frm_after_show_entry', $entry ); ?>
67 67
 
68 68
             </div>
69 69
 			<?php require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-show.php' ); ?>
Please login to merge, or discard this patch.
classes/controllers/FrmSettingsController.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -2,26 +2,26 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmSettingsController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		// Make sure admins can see the menu items
7 7
 		FrmAppHelper::force_capability( 'frm_change_settings' );
8 8
 
9
-        add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' );
10
-    }
9
+		add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' );
10
+	}
11 11
 
12
-    public static function license_box() {
12
+	public static function license_box() {
13 13
 		$a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
14
-        include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' );
15
-    }
14
+		include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' );
15
+	}
16 16
 
17
-    public static function display_form( $errors = array(), $message = '' ) {
18
-        global $frm_vars;
17
+	public static function display_form( $errors = array(), $message = '' ) {
18
+		global $frm_vars;
19 19
 
20
-        $frm_settings = FrmAppHelper::get_settings();
21
-        $frm_roles = FrmAppHelper::frm_capabilities();
20
+		$frm_settings = FrmAppHelper::get_settings();
21
+		$frm_roles = FrmAppHelper::frm_capabilities();
22 22
 
23
-        $uploads = wp_upload_dir();
24
-        $target_path = $uploads['basedir'] . '/formidable/css';
23
+		$uploads = wp_upload_dir();
24
+		$target_path = $uploads['basedir'] . '/formidable/css';
25 25
 
26 26
 		$sections = array();
27 27
 		if ( apply_filters( 'frm_include_addon_page', false ) ) {
@@ -30,54 +30,54 @@  discard block
 block discarded – undo
30 30
 				'name' => __( 'Plugin Licenses', 'formidable' ),
31 31
 			);
32 32
 		}
33
-        $sections = apply_filters( 'frm_add_settings_section', $sections );
33
+		$sections = apply_filters( 'frm_add_settings_section', $sections );
34 34
 
35
-        $captcha_lang = FrmAppHelper::locales( 'captcha' );
35
+		$captcha_lang = FrmAppHelper::locales( 'captcha' );
36 36
 
37
-        require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' );
38
-    }
37
+		require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' );
38
+	}
39 39
 
40
-    public static function process_form( $stop_load = false ) {
41
-        global $frm_vars;
40
+	public static function process_form( $stop_load = false ) {
41
+		global $frm_vars;
42 42
 
43
-        $frm_settings = FrmAppHelper::get_settings();
43
+		$frm_settings = FrmAppHelper::get_settings();
44 44
 
45 45
 		$process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
46 46
 		if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
47
-            wp_die( $frm_settings->admin_permission );
48
-        }
47
+			wp_die( $frm_settings->admin_permission );
48
+		}
49 49
 
50
-        $errors = array();
51
-        $message = '';
50
+		$errors = array();
51
+		$message = '';
52 52
 
53
-        if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) {
54
-            $errors = $frm_settings->validate( $_POST, array() );
53
+		if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) {
54
+			$errors = $frm_settings->validate( $_POST, array() );
55 55
 
56
-            $frm_settings->update( stripslashes_deep( $_POST ) );
56
+			$frm_settings->update( stripslashes_deep( $_POST ) );
57 57
 
58
-            if ( empty( $errors ) ) {
59
-                $frm_settings->store();
60
-                $message = __( 'Settings Saved', 'formidable' );
61
-            }
62
-        } else {
63
-            $message = __( 'Settings Saved', 'formidable' );
64
-        }
58
+			if ( empty( $errors ) ) {
59
+				$frm_settings->store();
60
+				$message = __( 'Settings Saved', 'formidable' );
61
+			}
62
+		} else {
63
+			$message = __( 'Settings Saved', 'formidable' );
64
+		}
65 65
 
66 66
 		if ( $stop_load == 'stop_load' ) {
67
-            $frm_vars['settings_routed'] = true;
68
-            return;
69
-        }
67
+			$frm_vars['settings_routed'] = true;
68
+			return;
69
+		}
70 70
 
71
-        self::display_form( $errors, $message );
72
-    }
71
+		self::display_form( $errors, $message );
72
+	}
73 73
 
74
-    public static function route( $stop_load = false ) {
75
-        $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
74
+	public static function route( $stop_load = false ) {
75
+		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
76 76
 		$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
77
-        if ( $action == 'process-form' ) {
77
+		if ( $action == 'process-form' ) {
78 78
 			self::process_form( $stop_load );
79
-        } else if ( $stop_load != 'stop_load' ) {
79
+		} else if ( $stop_load != 'stop_load' ) {
80 80
 			self::display_form();
81
-        }
82
-    }
81
+		}
82
+	}
83 83
 }
Please login to merge, or discard this patch.