Completed
Push — master ( a9c2e2...0d281e )
by Jamie
07:48 queued 03:04
created
classes/models/FrmEDD_SL_Plugin_Updater.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
      * @uses api_request()
70 70
      *
71 71
      * @param array   $_transient_data Update array build by WordPress.
72
-     * @return array Modified update array with custom plugin data.
72
+     * @return stdClass Modified update array with custom plugin data.
73 73
      */
74 74
     public function check_update( $_transient_data ) {
75 75
 
Please login to merge, or discard this patch.
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -15,23 +15,23 @@  discard block
 block discarded – undo
15 15
  * @version 1.6.3
16 16
  */
17 17
 class FrmEDD_SL_Plugin_Updater {
18
-    private $api_url   = '';
19
-    private $api_data  = array();
20
-    private $name      = '';
21
-    private $slug      = '';
22
-    private $version   = '';
23
-
24
-    /**
25
-     * Class constructor.
26
-     *
27
-     * @uses plugin_basename()
28
-     * @uses hook()
29
-     *
30
-     * @param string  $_api_url     The URL pointing to the custom API endpoint.
31
-     * @param string  $_plugin_file Path to the plugin file.
32
-     * @param array   $_api_data    Optional data to send with API calls.
33
-     */
34
-    public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
18
+	private $api_url   = '';
19
+	private $api_data  = array();
20
+	private $name      = '';
21
+	private $slug      = '';
22
+	private $version   = '';
23
+
24
+	/**
25
+	 * Class constructor.
26
+	 *
27
+	 * @uses plugin_basename()
28
+	 * @uses hook()
29
+	 *
30
+	 * @param string  $_api_url     The URL pointing to the custom API endpoint.
31
+	 * @param string  $_plugin_file Path to the plugin file.
32
+	 * @param array   $_api_data    Optional data to send with API calls.
33
+	 */
34
+	public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
35 35
 		global $frm_edd_plugin_data;
36 36
 
37 37
 		$this->api_url  = trailingslashit( $_api_url );
@@ -44,159 +44,159 @@  discard block
 block discarded – undo
44 44
 
45 45
 		// Set up hooks.
46 46
 		$this->init();
47
-    }
48
-
49
-    /**
50
-     * Set up WordPress filters to hook into WP's update process.
51
-     *
52
-     * @uses add_filter()
53
-     *
54
-     * @return void
55
-     */
56
-    public function init() {
57
-        add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
58
-        add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
47
+	}
48
+
49
+	/**
50
+	 * Set up WordPress filters to hook into WP's update process.
51
+	 *
52
+	 * @uses add_filter()
53
+	 *
54
+	 * @return void
55
+	 */
56
+	public function init() {
57
+		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
58
+		add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
59 59
 		add_action( 'admin_init', array( $this, 'show_changelog' ) );
60
-    }
61
-
62
-    /**
63
-     * Check for Updates at the defined API endpoint and modify the update array.
64
-     *
65
-     * This function dives into the update API just when WordPress creates its update array,
66
-     * then adds a custom API call and injects the custom plugin data retrieved from the API.
67
-     * It is reassembled from parts of the native WordPress plugin update code.
68
-     * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
69
-     *
70
-     * @uses api_request()
71
-     *
72
-     * @param array   $_transient_data Update array build by WordPress.
73
-     * @return array Modified update array with custom plugin data.
74
-     */
75
-    public function check_update( $_transient_data ) {
76
-
77
-        global $pagenow;
78
-
79
-        if ( ! is_object( $_transient_data ) ) {
80
-            $_transient_data = new stdClass;
81
-        }
60
+	}
61
+
62
+	/**
63
+	 * Check for Updates at the defined API endpoint and modify the update array.
64
+	 *
65
+	 * This function dives into the update API just when WordPress creates its update array,
66
+	 * then adds a custom API call and injects the custom plugin data retrieved from the API.
67
+	 * It is reassembled from parts of the native WordPress plugin update code.
68
+	 * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
69
+	 *
70
+	 * @uses api_request()
71
+	 *
72
+	 * @param array   $_transient_data Update array build by WordPress.
73
+	 * @return array Modified update array with custom plugin data.
74
+	 */
75
+	public function check_update( $_transient_data ) {
76
+
77
+		global $pagenow;
78
+
79
+		if ( ! is_object( $_transient_data ) ) {
80
+			$_transient_data = new stdClass;
81
+		}
82 82
 
83
-        if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
83
+		if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
84 84
 
85
-            $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
85
+			$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
86 86
 
87
-            if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
87
+			if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
88 88
 
89
-                if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
89
+				if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
90 90
 
91 91
 					if ( empty( $version_info->plugin ) ) {
92 92
 						$version_info->plugin = $this->name;
93 93
 					}
94 94
 
95
-                    $_transient_data->response[ $this->name ] = $version_info;
96
-
97
-                }
98
-
99
-                $_transient_data->last_checked = time();
100
-                $_transient_data->checked[ $this->name ] = $this->version;
101
-
102
-            }
103
-        }
104
-
105
-        return $_transient_data;
106
-    }
107
-
108
-    /**
109
-     * Updates information on the "View version x.x details" page with custom data.
110
-     *
111
-     * @uses api_request()
112
-     *
113
-     * @param mixed   $_data
114
-     * @param string  $_action
115
-     * @param object  $_args
116
-     * @return object $_data
117
-     */
118
-    public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
119
-
120
-        if ( $_action != 'plugin_information' ) {
95
+					$_transient_data->response[ $this->name ] = $version_info;
121 96
 
122
-            return $_data;
97
+				}
123 98
 
124
-        }
99
+				$_transient_data->last_checked = time();
100
+				$_transient_data->checked[ $this->name ] = $this->version;
125 101
 
126
-        if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
102
+			}
103
+		}
127 104
 
128
-            return $_data;
105
+		return $_transient_data;
106
+	}
129 107
 
130
-        }
108
+	/**
109
+	 * Updates information on the "View version x.x details" page with custom data.
110
+	 *
111
+	 * @uses api_request()
112
+	 *
113
+	 * @param mixed   $_data
114
+	 * @param string  $_action
115
+	 * @param object  $_args
116
+	 * @return object $_data
117
+	 */
118
+	public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
131 119
 
132
-        $to_send = array(
133
-            'slug'   => $this->slug,
134
-            'is_ssl' => is_ssl(),
135
-            'fields' => array(
136
-                'banners' => false, // These will be supported soon hopefully
137
-                'reviews' => false,
138
-            ),
139
-        );
120
+		if ( $_action != 'plugin_information' ) {
140 121
 
141
-        $api_response = $this->api_request( 'plugin_information', $to_send );
122
+			return $_data;
142 123
 
143
-        if ( false !== $api_response ) {
144
-            $_data = $api_response;
145
-        }
124
+		}
146 125
 
147
-        return $_data;
148
-    }
126
+		if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
149 127
 
128
+			return $_data;
150 129
 
151
-    /**
152
-     * Disable SSL verification in order to prevent download update failures
153
-     *
154
-     * @param array   $args
155
-     * @param string  $url
156
-     * @return object $array
157
-     */
158
-    public function http_request_args( $args, $url ) {
159
-        // If it is an https request and we are performing a package download, disable ssl verification
160
-        if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
161
-            $args['sslverify'] = false;
162
-        }
163
-        return $args;
164
-    }
130
+		}
165 131
 
166
-    /**
167
-     * Calls the API and, if successfull, returns the object delivered by the API.
168
-     *
169
-     * @uses get_bloginfo()
170
-     * @uses wp_remote_post()
171
-     * @uses is_wp_error()
172
-     *
173
-     * @param string  $_action The requested action.
174
-     * @param array   $_data   Parameters for the API action.
175
-     * @return false|object
176
-     */
177
-    private function api_request( $_action, $_data ) {
132
+		$to_send = array(
133
+			'slug'   => $this->slug,
134
+			'is_ssl' => is_ssl(),
135
+			'fields' => array(
136
+				'banners' => false, // These will be supported soon hopefully
137
+				'reviews' => false,
138
+			),
139
+		);
178 140
 
179
-        global $wp_version;
141
+		$api_response = $this->api_request( 'plugin_information', $to_send );
180 142
 
181
-        $data = array_merge( $this->api_data, $_data );
143
+		if ( false !== $api_response ) {
144
+			$_data = $api_response;
145
+		}
182 146
 
183
-        if ( $data['slug'] != $this->slug ) {
184
-            return;
147
+		return $_data;
148
+	}
149
+
150
+
151
+	/**
152
+	 * Disable SSL verification in order to prevent download update failures
153
+	 *
154
+	 * @param array   $args
155
+	 * @param string  $url
156
+	 * @return object $array
157
+	 */
158
+	public function http_request_args( $args, $url ) {
159
+		// If it is an https request and we are performing a package download, disable ssl verification
160
+		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
161
+			$args['sslverify'] = false;
162
+		}
163
+		return $args;
164
+	}
165
+
166
+	/**
167
+	 * Calls the API and, if successfull, returns the object delivered by the API.
168
+	 *
169
+	 * @uses get_bloginfo()
170
+	 * @uses wp_remote_post()
171
+	 * @uses is_wp_error()
172
+	 *
173
+	 * @param string  $_action The requested action.
174
+	 * @param array   $_data   Parameters for the API action.
175
+	 * @return false|object
176
+	 */
177
+	private function api_request( $_action, $_data ) {
178
+
179
+		global $wp_version;
180
+
181
+		$data = array_merge( $this->api_data, $_data );
182
+
183
+		if ( $data['slug'] != $this->slug ) {
184
+			return;
185 185
 		}
186 186
 
187
-        if ( $this->api_url == home_url() ) {
188
-            return false; // Don't allow a plugin to ping itself
189
-        }
187
+		if ( $this->api_url == home_url() ) {
188
+			return false; // Don't allow a plugin to ping itself
189
+		}
190 190
 
191
-        $api_params = array(
192
-            'edd_action' => 'get_version',
193
-            'license'    => ! empty( $data['license'] ) ? $data['license'] : '',
194
-            'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
195
-            'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
196
-            'slug'       => $data['slug'],
197
-            'author'     => $data['author'],
198
-            'url'        => home_url(),
199
-        );
191
+		$api_params = array(
192
+			'edd_action' => 'get_version',
193
+			'license'    => ! empty( $data['license'] ) ? $data['license'] : '',
194
+			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
195
+			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
196
+			'slug'       => $data['slug'],
197
+			'author'     => $data['author'],
198
+			'url'        => home_url(),
199
+		);
200 200
 
201 201
 		$cache_key = 'edd_plugin_' . md5( sanitize_key( $api_params['license'] . $this->version ) . '_' . $api_params['edd_action'] );
202 202
 		$cached_response = get_transient( $cache_key );
@@ -205,24 +205,24 @@  discard block
 block discarded – undo
205 205
 			return $cached_response;
206 206
 		}
207 207
 
208
-        $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
208
+		$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
209 209
 
210
-        if ( ! is_wp_error( $request ) ) {
211
-            $request = json_decode( wp_remote_retrieve_body( $request ) );
212
-        }
210
+		if ( ! is_wp_error( $request ) ) {
211
+			$request = json_decode( wp_remote_retrieve_body( $request ) );
212
+		}
213 213
 
214
-        if ( $request && isset( $request->sections ) ) {
215
-            $request->sections = maybe_unserialize( $request->sections );
214
+		if ( $request && isset( $request->sections ) ) {
215
+			$request->sections = maybe_unserialize( $request->sections );
216 216
 			set_transient( $cache_key, $request, DAY_IN_SECONDS );
217
-        } else {
218
-            $request = false;
217
+		} else {
218
+			$request = false;
219 219
 			set_transient( $cache_key, 0, DAY_IN_SECONDS );
220
-        }
220
+		}
221 221
 
222
-        return $request;
223
-    }
222
+		return $request;
223
+	}
224 224
 
225
-    public function show_changelog() {
225
+	public function show_changelog() {
226 226
 
227 227
 		global $frm_edd_plugin_data;
228 228
 
@@ -278,5 +278,5 @@  discard block
 block discarded – undo
278 278
 		}
279 279
 
280 280
 		exit;
281
-    }
281
+	}
282 282
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		$this->slug     = basename( $_plugin_file, '.php' );
41 41
 		$this->version  = $_api_data['version'];
42 42
 
43
-		$frm_edd_plugin_data[ $this->slug ] = $this->api_data;
43
+		$frm_edd_plugin_data[$this->slug] = $this->api_data;
44 44
 
45 45
 		// Set up hooks.
46 46
 		$this->init();
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             $_transient_data = new stdClass;
81 81
         }
82 82
 
83
-        if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
83
+        if ( empty( $_transient_data->response ) || empty( $_transient_data->response[$this->name] ) ) {
84 84
 
85 85
             $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
86 86
 
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
 						$version_info->plugin = $this->name;
93 93
 					}
94 94
 
95
-                    $_transient_data->response[ $this->name ] = $version_info;
95
+                    $_transient_data->response[$this->name] = $version_info;
96 96
 
97 97
                 }
98 98
 
99 99
                 $_transient_data->last_checked = time();
100
-                $_transient_data->checked[ $this->name ] = $this->version;
100
+                $_transient_data->checked[$this->name] = $this->version;
101 101
 
102 102
             }
103 103
         }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 			wp_die( __( 'You do not have permission to install plugin updates', 'formidable' ), __( 'Error', 'formidable' ), array( 'response' => 403 ) );
243 243
 		}
244 244
 
245
-		$data         = $frm_edd_plugin_data[ $_REQUEST['slug'] ];
245
+		$data         = $frm_edd_plugin_data[$_REQUEST['slug']];
246 246
 		$cache_key    = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_version_info' );
247 247
 		$version_info = get_transient( $cache_key );
248 248
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
 		}
275 275
 
276
-		if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
276
+		if ( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
277 277
 			echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
278 278
 		}
279 279
 
Please login to merge, or discard this patch.
classes/views/shared/form-nav.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,6 +17,6 @@
 block discarded – undo
17 17
 </ul>
18 18
 
19 19
 <?php if ( $form && $title == 'show' ) { ?>
20
-    <input id="title" type="text" value="<?php echo esc_attr( $form->name == '' ? __( '(no title)') : $form->name ) ?>" readonly="readonly" disabled="disabled" />
20
+    <input id="title" type="text" value="<?php echo esc_attr( $form->name == '' ? __( '(no title)' ) : $form->name ) ?>" readonly="readonly" disabled="disabled" />
21 21
 <?php } ?>
22 22
 </div>
Please login to merge, or discard this patch.
classes/views/addons/list.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@
 block discarded – undo
7 7
 				continue;
8 8
 			}
9 9
 
10
-			if ( isset( $plugin_names[ $addon['info']['slug'] ] ) ) {
11
-				$installed = is_dir( WP_PLUGIN_DIR . '/' . $plugin_names[ $addon['info']['slug'] ] );
10
+			if ( isset( $plugin_names[$addon['info']['slug']] ) ) {
11
+				$installed = is_dir( WP_PLUGIN_DIR . '/' . $plugin_names[$addon['info']['slug']] );
12 12
 			} else {
13
-				$installed = isset( $installed_addons[ $addon['info']['slug'] ] ) || is_dir( WP_PLUGIN_DIR . '/formidable-' . $addon['info']['slug'] );
13
+				$installed = isset( $installed_addons[$addon['info']['slug']] ) || is_dir( WP_PLUGIN_DIR . '/formidable-' . $addon['info']['slug'] );
14 14
 			}
15 15
 			$has_thumbnail = ! empty( $addon['info']['thumbnail'] );
16 16
 			$addon['info']['link'] = $addon['info']['link'] . $append_affiliate;
17 17
 
18 18
 		?>
19
-			<div class="plugin-card <?php echo esc_attr( $has_thumbnail ? '' : 'frm-no-thumb') ?>">
19
+			<div class="plugin-card <?php echo esc_attr( $has_thumbnail ? '' : 'frm-no-thumb' ) ?>">
20 20
 				<div class="plugin-card-top">
21 21
 					<div class="name column-name">
22 22
 						<h3>
Please login to merge, or discard this patch.
classes/controllers/FrmAppController.php 1 patch
Indentation   +168 added lines, -168 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
-        $frm_settings = FrmAppHelper::get_settings();
12
-        add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() );
13
-    }
11
+		$frm_settings = FrmAppHelper::get_settings();
12
+		add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() );
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,39 +19,39 @@  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
-        global $pagenow, $frm_vars;
27
+		global $pagenow, $frm_vars;
28 28
 
29 29
 		$show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
30
-        if ( empty( $show_nav ) ) {
31
-            return;
32
-        }
30
+		if ( empty( $show_nav ) ) {
31
+			return;
32
+		}
33 33
 
34 34
 		$current_page = isset( $_GET['page'] ) ? FrmAppHelper::simple_get( 'page', 'sanitize_title' ) : FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' );
35 35
 		if ( $pagenow == 'post.php' || $pagenow == 'post-new.php' ) {
36 36
 			$current_page = 'frm_display';
37 37
 		}
38 38
 
39
-        if ( $form ) {
39
+		if ( $form ) {
40 40
 			FrmForm::maybe_get_form( $form );
41 41
 
42
-            if ( is_object( $form ) ) {
43
-                $id = $form->id;
44
-            }
45
-        }
42
+			if ( is_object( $form ) ) {
43
+				$id = $form->id;
44
+			}
45
+		}
46 46
 
47
-        if ( ! isset( $id ) ) {
48
-            $form = $id = false;
49
-        }
47
+		if ( ! isset( $id ) ) {
48
+			$form = $id = false;
49
+		}
50 50
 
51 51
 		$nav_items = self::get_form_nav_items( $id );
52 52
 
53
-        include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
54
-    }
53
+		include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
54
+	}
55 55
 
56 56
 	private static function get_form_nav_items( $id ) {
57 57
 		$nav_items = array(
@@ -82,26 +82,26 @@  discard block
 block discarded – undo
82 82
 		return $nav_items;
83 83
 	}
84 84
 
85
-    // Adds a settings link to the plugins page
86
-    public static function settings_link( $links ) {
85
+	// Adds a settings link to the plugins page
86
+	public static function settings_link( $links ) {
87 87
 		$settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">' . __( 'Settings', 'formidable' ) . '</a>';
88
-        array_unshift( $links, $settings );
88
+		array_unshift( $links, $settings );
89 89
 
90
-        return $links;
91
-    }
90
+		return $links;
91
+	}
92 92
 
93
-    public static function pro_get_started_headline() {
94
-        // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message
95
-        if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) {
96
-            return;
97
-        }
93
+	public static function pro_get_started_headline() {
94
+		// Don't display this error as we're upgrading the thing, or if the user shouldn't see the message
95
+		if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) {
96
+			return;
97
+		}
98 98
 
99 99
 		if ( get_site_option( 'frmpro-authorized' ) && ! file_exists( FrmAppHelper::plugin_path() . '/pro/formidable-pro.php' ) ) {
100
-            FrmAppHelper::load_admin_wide_js();
100
+			FrmAppHelper::load_admin_wide_js();
101 101
 
102
-            // user is authorized, but running free version
103
-            $inst_install_url = 'https://formidablepro.com/knowledgebase/install-formidable-forms/';
104
-        ?>
102
+			// user is authorized, but running free version
103
+			$inst_install_url = 'https://formidablepro.com/knowledgebase/install-formidable-forms/';
104
+		?>
105 105
 <div class="error" class="frm_previous_install">
106 106
 		<?php
107 107
 		echo wp_kses_post( apply_filters( 'frm_pro_update_msg',
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 		) ); ?>
114 114
 </div>
115 115
 <?php
116
-        }
117
-    }
116
+		}
117
+	}
118 118
 
119 119
 	/**
120 120
 	 * If there are CURL problems on this server, wp_remote_post won't work for installing
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 		}
157 157
 	}
158 158
 
159
-    public static function admin_js() {
159
+	public static function admin_js() {
160 160
 		$version = FrmAppHelper::plugin_version();
161 161
 		FrmAppHelper::load_admin_wide_js( false );
162 162
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 			'bootstrap_tooltip', 'bootstrap-multiselect',
168 168
 		), $version, true );
169 169
 		wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
170
-        wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
170
+		wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
171 171
 
172 172
 		// load multselect js
173 173
 		wp_register_script( 'bootstrap-multiselect', FrmAppHelper::plugin_url() . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip' ), '0.9.8', true );
@@ -178,78 +178,78 @@  discard block
 block discarded – undo
178 178
 		global $pagenow;
179 179
 		if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) {
180 180
 
181
-            wp_enqueue_script( 'admin-widgets' );
182
-            wp_enqueue_style( 'widgets' );
183
-            wp_enqueue_script( 'formidable' );
184
-            wp_enqueue_script( 'formidable_admin' );
181
+			wp_enqueue_script( 'admin-widgets' );
182
+			wp_enqueue_style( 'widgets' );
183
+			wp_enqueue_script( 'formidable' );
184
+			wp_enqueue_script( 'formidable_admin' );
185 185
 			FrmAppHelper::localize_script( 'admin' );
186 186
 
187
-            wp_enqueue_style( 'formidable-admin' );
188
-            add_thickbox();
187
+			wp_enqueue_style( 'formidable-admin' );
188
+			add_thickbox();
189 189
 
190
-            wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
190
+			wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
191 191
 
192
-        } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
193
-            if ( isset( $_REQUEST['post_type'] ) ) {
194
-                $post_type = sanitize_title( $_REQUEST['post_type'] );
192
+		} else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
193
+			if ( isset( $_REQUEST['post_type'] ) ) {
194
+				$post_type = sanitize_title( $_REQUEST['post_type'] );
195 195
 			} else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) {
196 196
 				$post = get_post( absint( $_REQUEST['post'] ) );
197
-                if ( ! $post ) {
198
-                    return;
199
-                }
200
-                $post_type = $post->post_type;
201
-            } else {
202
-                return;
203
-            }
204
-
205
-            if ( $post_type == 'frm_display' ) {
206
-                wp_enqueue_script( 'jquery-ui-draggable' );
207
-                wp_enqueue_script( 'formidable_admin' );
208
-                wp_enqueue_style( 'formidable-admin' );
197
+				if ( ! $post ) {
198
+					return;
199
+				}
200
+				$post_type = $post->post_type;
201
+			} else {
202
+				return;
203
+			}
204
+
205
+			if ( $post_type == 'frm_display' ) {
206
+				wp_enqueue_script( 'jquery-ui-draggable' );
207
+				wp_enqueue_script( 'formidable_admin' );
208
+				wp_enqueue_style( 'formidable-admin' );
209 209
 				FrmAppHelper::localize_script( 'admin' );
210
-            }
211
-        } else if ( $pagenow == 'widgets.php' ) {
212
-            FrmAppHelper::load_admin_wide_js();
213
-        }
214
-    }
215
-
216
-    public static function wp_admin_body_class( $classes ) {
217
-        global $wp_version;
218
-        //we need this class everywhere in the admin for the menu
219
-        if ( version_compare( $wp_version, '3.7.2', '>' ) ) {
220
-            $classes .= ' frm_38_trigger';
221
-        }
222
-
223
-        return $classes;
224
-    }
225
-
226
-    public static function load_lang() {
227
-        load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
228
-    }
229
-
230
-    /**
231
-     * Filter shortcodes in text widgets
232
-     */
233
-    public static function widget_text_filter( $content ) {
234
-    	$regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/';
235
-    	return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content );
236
-    }
237
-
238
-    public static function widget_text_filter_callback( $matches ) {
239
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' );
240
-        return FrmAppHelper::widget_text_filter_callback( $matches );
241
-    }
242
-
243
-    public static function front_head() {
244
-        if ( is_multisite() ) {
245
-            $old_db_version = get_option( 'frm_db_version' );
246
-            $pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false;
247
-            if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) ||
248
-                ( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) {
249
-                self::install( $old_db_version );
250
-            }
251
-        }
252
-    }
210
+			}
211
+		} else if ( $pagenow == 'widgets.php' ) {
212
+			FrmAppHelper::load_admin_wide_js();
213
+		}
214
+	}
215
+
216
+	public static function wp_admin_body_class( $classes ) {
217
+		global $wp_version;
218
+		//we need this class everywhere in the admin for the menu
219
+		if ( version_compare( $wp_version, '3.7.2', '>' ) ) {
220
+			$classes .= ' frm_38_trigger';
221
+		}
222
+
223
+		return $classes;
224
+	}
225
+
226
+	public static function load_lang() {
227
+		load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
228
+	}
229
+
230
+	/**
231
+	 * Filter shortcodes in text widgets
232
+	 */
233
+	public static function widget_text_filter( $content ) {
234
+		$regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/';
235
+		return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content );
236
+	}
237
+
238
+	public static function widget_text_filter_callback( $matches ) {
239
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' );
240
+		return FrmAppHelper::widget_text_filter_callback( $matches );
241
+	}
242
+
243
+	public static function front_head() {
244
+		if ( is_multisite() ) {
245
+			$old_db_version = get_option( 'frm_db_version' );
246
+			$pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false;
247
+			if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) ||
248
+				( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) {
249
+				self::install( $old_db_version );
250
+			}
251
+		}
252
+	}
253 253
 
254 254
 	public static function localize_script( $location ) {
255 255
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmAppHelper::localize_script' );
@@ -309,72 +309,72 @@  discard block
 block discarded – undo
309 309
 		wp_die();
310 310
 	}
311 311
 
312
-    public static function activation_install() {
313
-        FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' );
314
-        FrmFormActionsController::actions_init();
315
-        self::install();
316
-    }
312
+	public static function activation_install() {
313
+		FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' );
314
+		FrmFormActionsController::actions_init();
315
+		self::install();
316
+	}
317 317
 
318
-    public static function install( $old_db_version = false ) {
319
-        $frmdb = new FrmDb();
320
-        $frmdb->upgrade( $old_db_version );
321
-    }
318
+	public static function install( $old_db_version = false ) {
319
+		$frmdb = new FrmDb();
320
+		$frmdb->upgrade( $old_db_version );
321
+	}
322 322
 
323
-    public static function uninstall() {
324
-        check_ajax_referer( 'frm_ajax', 'nonce' );
323
+	public static function uninstall() {
324
+		check_ajax_referer( 'frm_ajax', 'nonce' );
325 325
 
326
-        if ( current_user_can( 'administrator' ) ) {
327
-            $frmdb = new FrmDb();
328
-            $frmdb->uninstall();
326
+		if ( current_user_can( 'administrator' ) ) {
327
+			$frmdb = new FrmDb();
328
+			$frmdb->uninstall();
329 329
 
330 330
 			//disable the plugin and redirect after uninstall so the tables don't get added right back
331 331
 			deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false );
332 332
 			echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
333
-        } else {
334
-            $frm_settings = FrmAppHelper::get_settings();
335
-            wp_die( $frm_settings->admin_permission );
336
-        }
337
-        wp_die();
338
-    }
339
-
340
-    public static function drop_tables( $tables ) {
341
-        global $wpdb;
342
-        $tables[] = $wpdb->prefix . 'frm_fields';
343
-        $tables[] = $wpdb->prefix . 'frm_forms';
344
-        $tables[] = $wpdb->prefix . 'frm_items';
345
-        $tables[] = $wpdb->prefix . 'frm_item_metas';
346
-        return $tables;
347
-    }
348
-
349
-    // Routes for wordpress pages -- we're just replacing content here folks.
350
-    public static function page_route( $content ) {
351
-        global $post;
352
-
353
-        $frm_settings = FrmAppHelper::get_settings();
354
-        if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) {
355
-            $content = FrmFormsController::page_preview();
356
-        }
357
-
358
-        return $content;
359
-    }
360
-
361
-    public static function deauthorize() {
362
-        check_ajax_referer( 'frm_ajax', 'nonce' );
363
-
364
-        delete_option( 'frmpro-credentials' );
365
-        delete_option( 'frmpro-authorized' );
366
-        delete_site_option( 'frmpro-credentials' );
367
-        delete_site_option( 'frmpro-authorized' );
368
-        wp_die();
369
-    }
370
-
371
-    public static function get_form_shortcode( $atts ) {
372
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
373
-        return FrmFormsController::get_form_shortcode( $atts );
374
-    }
375
-
376
-    public static function get_postbox_class() {
377
-        _deprecated_function( __FUNCTION__, '2.0' );
378
-        return 'postbox-container';
379
-    }
333
+		} else {
334
+			$frm_settings = FrmAppHelper::get_settings();
335
+			wp_die( $frm_settings->admin_permission );
336
+		}
337
+		wp_die();
338
+	}
339
+
340
+	public static function drop_tables( $tables ) {
341
+		global $wpdb;
342
+		$tables[] = $wpdb->prefix . 'frm_fields';
343
+		$tables[] = $wpdb->prefix . 'frm_forms';
344
+		$tables[] = $wpdb->prefix . 'frm_items';
345
+		$tables[] = $wpdb->prefix . 'frm_item_metas';
346
+		return $tables;
347
+	}
348
+
349
+	// Routes for wordpress pages -- we're just replacing content here folks.
350
+	public static function page_route( $content ) {
351
+		global $post;
352
+
353
+		$frm_settings = FrmAppHelper::get_settings();
354
+		if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) {
355
+			$content = FrmFormsController::page_preview();
356
+		}
357
+
358
+		return $content;
359
+	}
360
+
361
+	public static function deauthorize() {
362
+		check_ajax_referer( 'frm_ajax', 'nonce' );
363
+
364
+		delete_option( 'frmpro-credentials' );
365
+		delete_option( 'frmpro-authorized' );
366
+		delete_site_option( 'frmpro-credentials' );
367
+		delete_site_option( 'frmpro-authorized' );
368
+		wp_die();
369
+	}
370
+
371
+	public static function get_form_shortcode( $atts ) {
372
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
373
+		return FrmFormsController::get_form_shortcode( $atts );
374
+	}
375
+
376
+	public static function get_postbox_class() {
377
+		_deprecated_function( __FUNCTION__, '2.0' );
378
+		return 'postbox-container';
379
+	}
380 380
 }
Please login to merge, or discard this patch.
classes/views/shared/mb_adv_info.php 2 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -42,51 +42,51 @@  discard block
 block discarded – undo
42 42
 
43 43
 				if ( $f->type == 'data' ) {
44 44
 					//get all fields from linked form
45
-                    if ( isset($f->field_options['form_select']) && is_numeric($f->field_options['form_select']) ) {
46
-                        $linked_form = FrmDb::get_var( $wpdb->prefix .'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' );
47
-                        if ( ! in_array( $linked_form, $linked_forms ) ) {
48
-                            $linked_forms[] = $linked_form;
45
+					if ( isset($f->field_options['form_select']) && is_numeric($f->field_options['form_select']) ) {
46
+						$linked_form = FrmDb::get_var( $wpdb->prefix .'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' );
47
+						if ( ! in_array( $linked_form, $linked_forms ) ) {
48
+							$linked_forms[] = $linked_form;
49 49
 							$linked_fields = FrmField::getAll( array( 'fi.type not' => FrmField::no_save_fields(), 'fi.form_id' => $linked_form ) );
50
-                            $ldfe = '';
50
+							$ldfe = '';
51 51
 							if ( $linked_fields ) {
52 52
 								foreach ( $linked_fields as $linked_field ) {
53
-                                    FrmAppHelper::insert_opt_html( array( 'id' => $f->id . ' show=' . $linked_field->id, 'key' => $f->field_key . ' show=' . $linked_field->field_key, 'name' => $linked_field->name, 'type' => $linked_field->type ) );
54
-
55
-                                    $ldfe = $linked_field->id;
56
-                                    unset($linked_field);
57
-                                }
58
-                            }
59
-                        }
60
-                    }
61
-                    $dfe = $f->id;
62
-        	    }
63
-                unset($f);
64
-                }
65
-            } ?>
53
+									FrmAppHelper::insert_opt_html( array( 'id' => $f->id . ' show=' . $linked_field->id, 'key' => $f->field_key . ' show=' . $linked_field->field_key, 'name' => $linked_field->name, 'type' => $linked_field->type ) );
54
+
55
+									$ldfe = $linked_field->id;
56
+									unset($linked_field);
57
+								}
58
+							}
59
+						}
60
+					}
61
+					$dfe = $f->id;
62
+				}
63
+				unset($f);
64
+				}
65
+			} ?>
66 66
         </ul>
67 67
 
68 68
         <?php _e( 'Helpers', 'formidable' ) ?>:
69 69
         <ul class="frm_code_list">
70 70
         <?php
71
-        $col = 'one';
71
+		$col = 'one';
72 72
 		foreach ( $entry_shortcodes as $skey => $sname ) {
73 73
 			if ( empty( $skey ) ) {
74
-                 $col = 'one';
75
-                 echo '<li class="clear frm_block"></li>';
76
-                 continue;
77
-            }
78
-        ?>
74
+				 $col = 'one';
75
+				 echo '<li class="clear frm_block"></li>';
76
+				 continue;
77
+			}
78
+		?>
79 79
         <li class="frm_col_<?php echo esc_attr( $col ) ?>">
80 80
             <a href="javascript:void(0)" class="frmbutton button <?php
81 81
 			echo ( in_array( $skey, array( 'siteurl', 'sitename', 'entry_count' ) ) ) ? 'show_before_content show_after_content' : '';
82
-            echo ( strpos( $skey, 'default-' ) === 0 ) ? 'hide_frm_not_email_subject' : '';
83
-            ?> frm_insert_code" data-code="<?php echo esc_attr( $skey ) ?>"><?php echo esc_html( $sname ) ?></a>
82
+			echo ( strpos( $skey, 'default-' ) === 0 ) ? 'hide_frm_not_email_subject' : '';
83
+			?> frm_insert_code" data-code="<?php echo esc_attr( $skey ) ?>"><?php echo esc_html( $sname ) ?></a>
84 84
         </li>
85 85
         <?php
86
-            $col = ( $col == 'one' ) ? 'two' : 'one';
87
-            unset($skey, $sname);
88
-        }
89
-        ?>
86
+			$col = ( $col == 'one' ) ? 'two' : 'one';
87
+			unset($skey, $sname);
88
+		}
89
+		?>
90 90
         </ul>
91 91
 	</div>
92 92
 
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	    <ul class="alignleft"><li><?php _e( 'Fields from your form', 'formidable' ) ?>:</li></ul>
100 100
 	    <ul class="frm_code_list frm_full_width">
101 101
 		    <?php if ( ! empty( $fields ) ) {
102
-		        foreach ( $fields as $f ) {
102
+				foreach ( $fields as $f ) {
103 103
 					if ( FrmField::is_no_save_field( $f->type ) || ( $f->type == 'data' && ( ! isset( $f->field_options['data_type'] ) || $f->field_options['data_type'] == 'data' || $f->field_options['data_type'] == '' ) ) ) {
104
-                        continue;
105
-                }
106
-            ?>
104
+						continue;
105
+				}
106
+			?>
107 107
                 <li>
108 108
                     <a href="javascript:void(0)" class="frmids alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->id ) ?>]<?php esc_attr_e( 'Conditional text here', 'formidable' ) ?>[/if <?php echo esc_attr( $f->id ) ?>">[if <?php echo (int) $f->id ?>]</a>
109 109
                 	<a href="javascript:void(0)" class="frmkeys alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->field_key ) ?>]something[/if <?php echo esc_attr( $f->field_key ) ?>">[if <?php echo FrmAppHelper::truncate($f->field_key, 10) ?>]</a>
@@ -111,30 +111,30 @@  discard block
 block discarded – undo
111 111
                 </li>
112 112
                 <?php
113 113
 
114
-                    if ( $f->type == 'user_id' ) {
115
-                        $uid = $f;
116
-                    } else if ( $f->type == 'file' ) {
117
-                        $file = $f;
118
-                    }
119
-        		    unset($f);
120
-		        }
121
-		    } ?>
114
+					if ( $f->type == 'user_id' ) {
115
+						$uid = $f;
116
+					} else if ( $f->type == 'file' ) {
117
+						$file = $f;
118
+					}
119
+					unset($f);
120
+				}
121
+			} ?>
122 122
         </ul>
123 123
 
124 124
         <p class="howto"><?php _e( 'Click a button below to insert sample logic into your view', 'formidable' ) ?></p>
125 125
         <ul class="frm_code_list">
126 126
         <?php
127
-        $col = 'one';
127
+		$col = 'one';
128 128
 		foreach ( $cond_shortcodes as $skey => $sname ) {
129
-	    ?>
129
+		?>
130 130
 	    <li class="frm_col_<?php echo esc_attr( $col ) ?>">
131 131
 	        <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="if 125 <?php echo esc_attr($skey) ?>][/if 125"><?php echo esc_html( $sname ) ?></a>
132 132
 	    </li>
133 133
 	    <?php
134
-	        $col = ( $col == 'one' ) ? 'two' : 'one';
135
-	        unset($skey, $sname);
136
-	    }
137
-        ?>
134
+			$col = ( $col == 'one' ) ? 'two' : 'one';
135
+			unset($skey, $sname);
136
+		}
137
+		?>
138 138
         </ul>
139 139
 	</div>
140 140
 	<?php } ?>
@@ -142,17 +142,17 @@  discard block
 block discarded – undo
142 142
 	<div id="frm-adv-info-tab" class="tabs-panel">
143 143
 		<ul class="frm_code_list">
144 144
         <?php
145
-        $col = 'one';
145
+		$col = 'one';
146 146
 		foreach ( $adv_shortcodes as $skey => $sname ) {
147
-	    ?>
147
+		?>
148 148
 	    <li class="frm_col_<?php echo esc_attr( $col ) ?>">
149 149
 	        <a href="javascript:void(0)" class="frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="125 <?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="'. esc_attr( $sname['title'] ) .'"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a>
150 150
 	    </li>
151 151
 	    <?php
152
-	        $col = ($col == 'one') ? 'two' : 'one';
153
-	        unset($skey, $sname);
154
-	    }
155
-        ?>
152
+			$col = ($col == 'one') ? 'two' : 'one';
153
+			unset($skey, $sname);
154
+		}
155
+		?>
156 156
         <?php if ( isset($file) ) { ?>
157 157
         <li class="frm_col_<?php echo esc_attr( $col ) ?>">
158 158
 	        <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> size=thumbnail html=1"><?php _e( 'Image Size', 'formidable' ) ?></a>
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
         <div class="clear"></div>
170 170
         <?php
171 171
 
172
-        if ( isset($uid) && ! empty($user_fields) ) {
173
-            $col = 'one'; ?>
172
+		if ( isset($uid) && ! empty($user_fields) ) {
173
+			$col = 'one'; ?>
174 174
         <p class="howto"><?php _e( 'Insert user information', 'formidable' ) ?></p>
175 175
         <ul class="frm_code_list">
176 176
         <?php foreach ( $user_fields as $uk => $uf ) { ?>
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
 				<a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $uid->id . ' show="' . $uk . '"' ) ?>"><?php echo esc_html( $uf ) ?></a>
179 179
     	    </li>
180 180
         <?php
181
-            $col = ($col == 'one') ? 'two' : 'one';
182
-            unset($uf, $uk);
183
-        }
184
-        unset($uid); ?>
181
+			$col = ($col == 'one') ? 'two' : 'one';
182
+			unset($uf, $uk);
183
+		}
184
+		unset($uid); ?>
185 185
         </ul>
186 186
         <?php }
187 187
 
188
-        if ( isset($repeat_field) ) { ?>
188
+		if ( isset($repeat_field) ) { ?>
189 189
         <div class="clear"></div>
190 190
         <p class="howto"><?php _e( 'Repeating field options', 'formidable' ) ?></p>
191 191
             <ul class="frm_code_list">
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
         	    </li>
195 195
             </ul>
196 196
         <?php
197
-        }
197
+		}
198 198
 
199
-        if ( isset($dfe) ) { ?>
199
+		if ( isset($dfe) ) { ?>
200 200
 
201 201
         <div class="clear"></div>
202 202
         <p class="howto"><?php _e( 'Dynamic field options', 'formidable' ) ?></p>
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
 	</div>
216 216
 
217 217
     <?php
218
-    if ( $settings_tab ) {
219
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/mb_html_tab.php');
220
-    }
221
-    ?>
218
+	if ( $settings_tab ) {
219
+		include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/mb_html_tab.php');
220
+	}
221
+	?>
222 222
 </div>
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 
43 43
 				if ( $f->type == 'data' ) {
44 44
 					//get all fields from linked form
45
-                    if ( isset($f->field_options['form_select']) && is_numeric($f->field_options['form_select']) ) {
46
-                        $linked_form = FrmDb::get_var( $wpdb->prefix .'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' );
45
+                    if ( isset( $f->field_options['form_select'] ) && is_numeric( $f->field_options['form_select'] ) ) {
46
+                        $linked_form = FrmDb::get_var( $wpdb->prefix . 'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' );
47 47
                         if ( ! in_array( $linked_form, $linked_forms ) ) {
48 48
                             $linked_forms[] = $linked_form;
49 49
 							$linked_fields = FrmField::getAll( array( 'fi.type not' => FrmField::no_save_fields(), 'fi.form_id' => $linked_form ) );
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
                                     FrmAppHelper::insert_opt_html( array( 'id' => $f->id . ' show=' . $linked_field->id, 'key' => $f->field_key . ' show=' . $linked_field->field_key, 'name' => $linked_field->name, 'type' => $linked_field->type ) );
54 54
 
55 55
                                     $ldfe = $linked_field->id;
56
-                                    unset($linked_field);
56
+                                    unset( $linked_field );
57 57
                                 }
58 58
                             }
59 59
                         }
60 60
                     }
61 61
                     $dfe = $f->id;
62 62
         	    }
63
-                unset($f);
63
+                unset( $f );
64 64
                 }
65 65
             } ?>
66 66
         </ul>
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         </li>
85 85
         <?php
86 86
             $col = ( $col == 'one' ) ? 'two' : 'one';
87
-            unset($skey, $sname);
87
+            unset( $skey, $sname );
88 88
         }
89 89
         ?>
90 90
         </ul>
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
             ?>
107 107
                 <li>
108 108
                     <a href="javascript:void(0)" class="frmids alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->id ) ?>]<?php esc_attr_e( 'Conditional text here', 'formidable' ) ?>[/if <?php echo esc_attr( $f->id ) ?>">[if <?php echo (int) $f->id ?>]</a>
109
-                	<a href="javascript:void(0)" class="frmkeys alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->field_key ) ?>]something[/if <?php echo esc_attr( $f->field_key ) ?>">[if <?php echo FrmAppHelper::truncate($f->field_key, 10) ?>]</a>
110
-                	<a href="javascript:void(0)" class="frm_insert_code" data-code="<?php echo esc_attr($f->id) ?>"><?php echo FrmAppHelper::truncate($f->name, 60) ?></a>
109
+                	<a href="javascript:void(0)" class="frmkeys alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->field_key ) ?>]something[/if <?php echo esc_attr( $f->field_key ) ?>">[if <?php echo FrmAppHelper::truncate( $f->field_key, 10 ) ?>]</a>
110
+                	<a href="javascript:void(0)" class="frm_insert_code" data-code="<?php echo esc_attr( $f->id ) ?>"><?php echo FrmAppHelper::truncate( $f->name, 60 ) ?></a>
111 111
                 </li>
112 112
                 <?php
113 113
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                     } else if ( $f->type == 'file' ) {
117 117
                         $file = $f;
118 118
                     }
119
-        		    unset($f);
119
+        		    unset( $f );
120 120
 		        }
121 121
 		    } ?>
122 122
         </ul>
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 		foreach ( $cond_shortcodes as $skey => $sname ) {
129 129
 	    ?>
130 130
 	    <li class="frm_col_<?php echo esc_attr( $col ) ?>">
131
-	        <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="if 125 <?php echo esc_attr($skey) ?>][/if 125"><?php echo esc_html( $sname ) ?></a>
131
+	        <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="if 125 <?php echo esc_attr( $skey ) ?>][/if 125"><?php echo esc_html( $sname ) ?></a>
132 132
 	    </li>
133 133
 	    <?php
134 134
 	        $col = ( $col == 'one' ) ? 'two' : 'one';
135
-	        unset($skey, $sname);
135
+	        unset( $skey, $sname );
136 136
 	    }
137 137
         ?>
138 138
         </ul>
@@ -146,22 +146,22 @@  discard block
 block discarded – undo
146 146
 		foreach ( $adv_shortcodes as $skey => $sname ) {
147 147
 	    ?>
148 148
 	    <li class="frm_col_<?php echo esc_attr( $col ) ?>">
149
-	        <a href="javascript:void(0)" class="frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="125 <?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="'. esc_attr( $sname['title'] ) .'"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a>
149
+	        <a href="javascript:void(0)" class="frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="125 <?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="' . esc_attr( $sname['title'] ) . '"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a>
150 150
 	    </li>
151 151
 	    <?php
152
-	        $col = ($col == 'one') ? 'two' : 'one';
153
-	        unset($skey, $sname);
152
+	        $col = ( $col == 'one' ) ? 'two' : 'one';
153
+	        unset( $skey, $sname );
154 154
 	    }
155 155
         ?>
156
-        <?php if ( isset($file) ) { ?>
156
+        <?php if ( isset( $file ) ) { ?>
157 157
         <li class="frm_col_<?php echo esc_attr( $col ) ?>">
158
-	        <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> size=thumbnail html=1"><?php _e( 'Image Size', 'formidable' ) ?></a>
158
+	        <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $file->id ) ?> size=thumbnail html=1"><?php _e( 'Image Size', 'formidable' ) ?></a>
159 159
 	    </li>
160
-	    <li class="frm_col_<?php echo $col = (($col == 'one') ? 'two' : 'one') ?>">
161
-	        <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> show=id"><?php _e( 'Image ID', 'formidable' ) ?></a>
160
+	    <li class="frm_col_<?php echo $col = ( ( $col == 'one' ) ? 'two' : 'one' ) ?>">
161
+	        <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $file->id ) ?> show=id"><?php _e( 'Image ID', 'formidable' ) ?></a>
162 162
 	    </li>
163
-	    <li class="frm_col_<?php echo $col = (($col == 'one') ? 'two' : 'one') ?>">
164
-	        <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> show=label"><?php _e( 'Image Name', 'formidable' ) ?></a>
163
+	    <li class="frm_col_<?php echo $col = ( ( $col == 'one' ) ? 'two' : 'one' ) ?>">
164
+	        <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $file->id ) ?> show=label"><?php _e( 'Image Name', 'formidable' ) ?></a>
165 165
 	    </li>
166 166
 	    <?php } ?>
167 167
         </ul>
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         <div class="clear"></div>
170 170
         <?php
171 171
 
172
-        if ( isset($uid) && ! empty($user_fields) ) {
172
+        if ( isset( $uid ) && ! empty( $user_fields ) ) {
173 173
             $col = 'one'; ?>
174 174
         <p class="howto"><?php _e( 'Insert user information', 'formidable' ) ?></p>
175 175
         <ul class="frm_code_list">
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
 				<a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $uid->id . ' show="' . $uk . '"' ) ?>"><?php echo esc_html( $uf ) ?></a>
179 179
     	    </li>
180 180
         <?php
181
-            $col = ($col == 'one') ? 'two' : 'one';
182
-            unset($uf, $uk);
181
+            $col = ( $col == 'one' ) ? 'two' : 'one';
182
+            unset( $uf, $uk );
183 183
         }
184
-        unset($uid); ?>
184
+        unset( $uid ); ?>
185 185
         </ul>
186 186
         <?php }
187 187
 
188
-        if ( isset($repeat_field) ) { ?>
188
+        if ( isset( $repeat_field ) ) { ?>
189 189
         <div class="clear"></div>
190 190
         <p class="howto"><?php _e( 'Repeating field options', 'formidable' ) ?></p>
191 191
             <ul class="frm_code_list">
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         <?php
197 197
         }
198 198
 
199
-        if ( isset($dfe) ) { ?>
199
+        if ( isset( $dfe ) ) { ?>
200 200
 
201 201
         <div class="clear"></div>
202 202
         <p class="howto"><?php _e( 'Dynamic field options', 'formidable' ) ?></p>
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         	    <li class="frm_col_one">
205 205
 					<a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $dfe . ' show="created-at"' ) ?>"><?php _e( 'Creation Date', 'formidable' ) ?></a>
206 206
         	    </li>
207
-        	    <?php if ( isset($ldfe) ) { ?>
207
+        	    <?php if ( isset( $ldfe ) ) { ?>
208 208
         	    <li class="frm_col_two">
209 209
 					<a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $dfe . ' show="' . $ldfe . '"' ) ?>"><?php _e( 'Field From Entry', 'formidable' ) ?></a>
210 210
         	    </li>
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
     <?php
218 218
     if ( $settings_tab ) {
219
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/mb_html_tab.php');
219
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/mb_html_tab.php' );
220 220
     }
221 221
     ?>
222 222
 </div>
Please login to merge, or discard this patch.
classes/helpers/FrmCSVExportHelper.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-class FrmCSVExportHelper{
3
+class FrmCSVExportHelper {
4 4
 	protected static $separator        = ', ';
5 5
 	protected static $column_separator = ',';
6 6
 	protected static $line_break       = 'return';
Please login to merge, or discard this patch.
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -235,50 +235,50 @@  discard block
 block discarded – undo
235 235
 			return $line;
236 236
 		}
237 237
 
238
-        $convmap = false;
238
+		$convmap = false;
239 239
 
240 240
 		switch ( self::$to_encoding ) {
241
-            case 'macintosh':
241
+			case 'macintosh':
242 242
 				// this map was derived from the differences between the MacRoman and UTF-8 Charsets
243 243
 				// Reference:
244 244
 				//   - http://www.alanwood.net/demos/macroman.html
245
-                $convmap = array(
246
-                    256, 304, 0, 0xffff,
247
-                    306, 337, 0, 0xffff,
248
-                    340, 375, 0, 0xffff,
249
-                    377, 401, 0, 0xffff,
250
-                    403, 709, 0, 0xffff,
251
-                    712, 727, 0, 0xffff,
252
-                    734, 936, 0, 0xffff,
253
-                    938, 959, 0, 0xffff,
254
-                    961, 8210, 0, 0xffff,
255
-                    8213, 8215, 0, 0xffff,
256
-                    8219, 8219, 0, 0xffff,
257
-                    8227, 8229, 0, 0xffff,
258
-                    8231, 8239, 0, 0xffff,
259
-                    8241, 8248, 0, 0xffff,
260
-                    8251, 8259, 0, 0xffff,
261
-                    8261, 8363, 0, 0xffff,
262
-                    8365, 8481, 0, 0xffff,
263
-                    8483, 8705, 0, 0xffff,
264
-                    8707, 8709, 0, 0xffff,
265
-                    8711, 8718, 0, 0xffff,
266
-                    8720, 8720, 0, 0xffff,
267
-                    8722, 8729, 0, 0xffff,
268
-                    8731, 8733, 0, 0xffff,
269
-                    8735, 8746, 0, 0xffff,
270
-                    8748, 8775, 0, 0xffff,
271
-                    8777, 8799, 0, 0xffff,
272
-                    8801, 8803, 0, 0xffff,
273
-                    8806, 9673, 0, 0xffff,
274
-                    9675, 63742, 0, 0xffff,
275
-                    63744, 64256, 0, 0xffff,
276
-                );
277
-            break;
278
-            case 'ISO-8859-1':
279
-                $convmap = array( 256, 10000, 0, 0xffff );
280
-            break;
281
-        }
245
+				$convmap = array(
246
+					256, 304, 0, 0xffff,
247
+					306, 337, 0, 0xffff,
248
+					340, 375, 0, 0xffff,
249
+					377, 401, 0, 0xffff,
250
+					403, 709, 0, 0xffff,
251
+					712, 727, 0, 0xffff,
252
+					734, 936, 0, 0xffff,
253
+					938, 959, 0, 0xffff,
254
+					961, 8210, 0, 0xffff,
255
+					8213, 8215, 0, 0xffff,
256
+					8219, 8219, 0, 0xffff,
257
+					8227, 8229, 0, 0xffff,
258
+					8231, 8239, 0, 0xffff,
259
+					8241, 8248, 0, 0xffff,
260
+					8251, 8259, 0, 0xffff,
261
+					8261, 8363, 0, 0xffff,
262
+					8365, 8481, 0, 0xffff,
263
+					8483, 8705, 0, 0xffff,
264
+					8707, 8709, 0, 0xffff,
265
+					8711, 8718, 0, 0xffff,
266
+					8720, 8720, 0, 0xffff,
267
+					8722, 8729, 0, 0xffff,
268
+					8731, 8733, 0, 0xffff,
269
+					8735, 8746, 0, 0xffff,
270
+					8748, 8775, 0, 0xffff,
271
+					8777, 8799, 0, 0xffff,
272
+					8801, 8803, 0, 0xffff,
273
+					8806, 9673, 0, 0xffff,
274
+					9675, 63742, 0, 0xffff,
275
+					63744, 64256, 0, 0xffff,
276
+				);
277
+			break;
278
+			case 'ISO-8859-1':
279
+				$convmap = array( 256, 10000, 0, 0xffff );
280
+			break;
281
+		}
282 282
 
283 283
 		if ( is_array( $convmap ) ) {
284 284
 			$line = mb_encode_numericentity( $line, $convmap, self::$charset );
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		}
290 290
 
291 291
 		return self::escape_csv( $line );
292
-    }
292
+	}
293 293
 
294 294
 	/**
295 295
 	 * Escape a " in a csv with another "
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class FrmCSVExportHelper{
3
+class FrmCSVExportHelper {
4 4
 	protected static $separator        = ', ';
5 5
 	protected static $column_separator = ',';
6 6
 	protected static $line_break       = 'return';
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		header( 'Content-Description: File Transfer' );
64 64
 		header( 'Content-Disposition: attachment; filename="' . esc_attr( $filename ) . '"' );
65 65
 		header( 'Content-Type: text/csv; charset=' . self::$charset, true );
66
-		header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', mktime( date( 'H' ) + 2, date( 'i' ), date( 's' ), date( 'm' ), date( 'd' ), date('Y' ) ) ) . ' GMT' );
66
+		header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', mktime( date( 'H' ) + 2, date( 'i' ), date( 's' ), date( 'm' ), date( 'd' ), date( 'Y' ) ) ) . ' GMT' );
67 67
 		header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
68 68
 		header( 'Cache-Control: no-cache, must-revalidate' );
69 69
 		header( 'Pragma: no-cache' );
@@ -87,19 +87,19 @@  discard block
 block discarded – undo
87 87
 	private static function csv_headings( &$headings ) {
88 88
 		foreach ( self::$fields as $col ) {
89 89
 			if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, array( 'user_id', 'file', 'data', 'date' ) ) ) {
90
-				$headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) );
90
+				$headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) );
91 91
 			}
92 92
 
93
-			$headings[ $col->id ] = strip_tags( $col->name );
93
+			$headings[$col->id] = strip_tags( $col->name );
94 94
 		}
95 95
 
96 96
 		if ( self::$comment_count ) {
97
-			for ( $i = 0; $i < self::$comment_count; $i++ ) {
98
-				$headings[ 'comment' . $i ] = __( 'Comment', 'formidable' );
99
-				$headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' );
100
-				$headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' );
97
+			for ( $i = 0; $i < self::$comment_count; $i ++ ) {
98
+				$headings['comment' . $i] = __( 'Comment', 'formidable' );
99
+				$headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' );
100
+				$headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' );
101 101
 			}
102
-			unset($i);
102
+			unset( $i );
103 103
 		}
104 104
 
105 105
 		$headings['created_at'] = __( 'Timestamp', 'formidable' );
@@ -146,45 +146,45 @@  discard block
 block discarded – undo
146 146
 					continue;
147 147
 				}
148 148
 
149
-				if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) {
150
-					$entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array();
151
-				} else if ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) {
149
+				if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) {
150
+					$entries[self::$entry->parent_item_id]->metas[$meta_id] = array();
151
+				} else if ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) {
152 152
 					// if the data is here, it should be an array but if this field has collected data
153 153
 					// both while inside and outside of the repeating section, it's possible this is a string
154
-					$entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ];
154
+					$entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id];
155 155
 				}
156 156
 
157 157
 				//add the repeated values
158
-				$entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value;
158
+				$entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value;
159 159
 			}
160
-			$entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas;
160
+			$entries[self::$entry->parent_item_id]->metas += self::$entry->metas;
161 161
 		}
162 162
 
163 163
 		// add the embedded form id
164
-		if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) {
165
-			$entries[ self::$entry->parent_item_id ]->embedded_fields = array();
164
+		if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) {
165
+			$entries[self::$entry->parent_item_id]->embedded_fields = array();
166 166
 		}
167
-		$entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id;
167
+		$entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id;
168 168
 	}
169 169
 
170 170
 	private static function add_field_values_to_csv( &$row ) {
171 171
 		foreach ( self::$fields as $col ) {
172
-			$field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false;
172
+			$field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false;
173 173
 
174 174
 			$field_value = maybe_unserialize( $field_value );
175
-			$field_value = apply_filters( 'frm_csv_value', $field_value, array( 'field' => $col, 'entry' => self::$entry, 'separator' => self::$separator, ) );
175
+			$field_value = apply_filters( 'frm_csv_value', $field_value, array( 'field' => $col, 'entry' => self::$entry, 'separator' => self::$separator,) );
176 176
 
177 177
 			if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] ) {
178 178
 				$sep_value = FrmEntriesHelper::display_value( $field_value, $col, array(
179 179
 					'type' => $col->type, 'post_id' => self::$entry->post_id, 'show_icon' => false,
180 180
 					'entry_id' => self::$entry->id, 'sep' => self::$separator,
181
-					'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0,
181
+					'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0,
182 182
 					) );
183
-				$row[ $col->id . '_label' ] = $sep_value;
183
+				$row[$col->id . '_label'] = $sep_value;
184 184
 				unset( $sep_value );
185 185
 			}
186 186
 
187
-			$row[ $col->id ] = $field_value;
187
+			$row[$col->id] = $field_value;
188 188
 
189 189
 			unset( $col, $field_value );
190 190
 		}
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
 		$col_count = count( $rows );
206 206
 		$this_col = 0;
207 207
 		foreach ( $rows as $k => $row ) {
208
-			$this_col++;
208
+			$this_col ++;
209 209
 
210
-			if ( ! isset( self::$headings[ $k ] ) ) {
210
+			if ( ! isset( self::$headings[$k] ) ) {
211 211
 				// this column has been removed from the csv, so skip it
212 212
 				continue;
213 213
 			}
Please login to merge, or discard this patch.
classes/views/xml/import_form.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,9 +87,9 @@
 block discarded – undo
87 87
 								} else if ( $form->is_template ) {
88 88
 									echo ' ' . __( '(template)', 'formidable' );
89 89
 								}
90
-                        ?></option>
90
+						?></option>
91 91
                         <?php
92
-                        } ?>
92
+						} ?>
93 93
                         </select>
94 94
                         <p class="howto"><?php _e( 'Hold down the CTRL/Command button to select multiple forms', 'formidable' ); ?></p>
95 95
                     </td>
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
     <div class="frmicon icon32"><br/></div>
3 3
     <h2><?php _e( 'Import/Export', 'formidable' ); ?></h2>
4 4
 
5
-    <?php include(FrmAppHelper::plugin_path() .'/classes/views/shared/errors.php'); ?>
5
+    <?php include( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); ?>
6 6
     <div id="poststuff" class="metabox-holder">
7 7
     <div id="post-body">
8 8
     <div id="post-body-content">
@@ -10,16 +10,16 @@  discard block
 block discarded – undo
10 10
     <div class="postbox ">
11 11
     <h3 class="hndle"><span><?php _e( 'Import', 'formidable' ) ?></span></h3>
12 12
     <div class="inside">
13
-        <p class="howto"><?php echo apply_filters('frm_upload_instructions1', __( 'Upload your Formidable XML file to import forms into this site. If your imported form key and creation date match a form on your site, that form will be updated.', 'formidable' )) ?></p>
13
+        <p class="howto"><?php echo apply_filters( 'frm_upload_instructions1', __( 'Upload your Formidable XML file to import forms into this site. If your imported form key and creation date match a form on your site, that form will be updated.', 'formidable' ) ) ?></p>
14 14
         <br/>
15 15
         <form enctype="multipart/form-data" method="post">
16 16
             <input type="hidden" name="frm_action" value="import_xml" />
17
-            <?php wp_nonce_field('import-xml-nonce', 'import-xml'); ?>
18
-            <p><label><?php echo apply_filters('frm_upload_instructions2', __( 'Choose a Formidable XML file', 'formidable' )) ?> (<?php printf(__( 'Maximum size: %s', 'formidable' ), ini_get('upload_max_filesize')) ?>)</label>
17
+            <?php wp_nonce_field( 'import-xml-nonce', 'import-xml' ); ?>
18
+            <p><label><?php echo apply_filters( 'frm_upload_instructions2', __( 'Choose a Formidable XML file', 'formidable' ) ) ?> (<?php printf( __( 'Maximum size: %s', 'formidable' ), ini_get( 'upload_max_filesize' ) ) ?>)</label>
19 19
             <input type="file" name="frm_import_file" size="25" />
20 20
             </p>
21 21
 
22
-            <?php do_action('frm_csv_opts', $forms) ?>
22
+            <?php do_action( 'frm_csv_opts', $forms ) ?>
23 23
 
24 24
             <p class="submit">
25 25
 				<input type="submit" value="<?php esc_attr_e( 'Upload file and import', 'formidable' ) ?>" class="button-primary" />
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     <div class="inside with_frm_style">
35 35
 		<form method="post" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" id="frm_export_xml">
36 36
             <input type="hidden" name="action" value="frm_export_xml" />
37
-            <?php wp_nonce_field('export-xml-nonce', 'export-xml'); ?>
37
+            <?php wp_nonce_field( 'export-xml-nonce', 'export-xml' ); ?>
38 38
 
39 39
             <table class="form-table">
40 40
                 <tr class="form-field">
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
                     <td>
43 43
                         <select name="format">
44 44
 						<?php foreach ( $export_format as $t => $type ) { ?>
45
-                            <option value="<?php echo esc_attr( $t ) ?>" data-support="<?php echo esc_attr( $type['support'] ) ?>" <?php echo isset( $type['count'] ) ? 'data-count="'. esc_attr( $type['count'] ) .'"' : ''; ?>><?php echo isset( $type['name'] ) ? $type['name'] : $t ?></option>
45
+                            <option value="<?php echo esc_attr( $t ) ?>" data-support="<?php echo esc_attr( $type['support'] ) ?>" <?php echo isset( $type['count'] ) ? 'data-count="' . esc_attr( $type['count'] ) . '"' : ''; ?>><?php echo isset( $type['name'] ) ? $type['name'] : $t ?></option>
46 46
                         <?php } ?>
47 47
                         </select>
48 48
 
Please login to merge, or discard this patch.
classes/controllers/FrmXMLController.php 3 patches
Indentation   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -2,110 +2,110 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmXMLController {
4 4
 
5
-    public static function menu() {
6
-        add_submenu_page('formidable', 'Formidable | '. __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route');
7
-    }
5
+	public static function menu() {
6
+		add_submenu_page('formidable', 'Formidable | '. __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route');
7
+	}
8 8
 
9
-    public static function add_default_templates() {
9
+	public static function add_default_templates() {
10 10
 		if ( ! function_exists( 'libxml_disable_entity_loader' ) ) {
11
-    		// XML import is not enabled on your server
12
-    		return;
13
-    	}
11
+			// XML import is not enabled on your server
12
+			return;
13
+		}
14 14
 
15
-        $set_err = libxml_use_internal_errors(true);
16
-        $loader = libxml_disable_entity_loader( true );
15
+		$set_err = libxml_use_internal_errors(true);
16
+		$loader = libxml_disable_entity_loader( true );
17 17
 
18 18
 		$files = apply_filters( 'frm_default_templates_files', array( FrmAppHelper::plugin_path() . '/classes/views/xml/default-templates.xml' ) );
19 19
 
20
-        foreach ( (array) $files as $file ) {
21
-            FrmXMLHelper::import_xml($file);
22
-            unset($file);
23
-        }
24
-        /*
20
+		foreach ( (array) $files as $file ) {
21
+			FrmXMLHelper::import_xml($file);
22
+			unset($file);
23
+		}
24
+		/*
25 25
         if(is_wp_error($result))
26 26
             $errors[] = $result->get_error_message();
27 27
         else if($result)
28 28
             $message = $result;
29 29
         */
30 30
 
31
-        unset( $files );
31
+		unset( $files );
32 32
 
33
-        libxml_use_internal_errors( $set_err );
34
-    	libxml_disable_entity_loader( $loader );
35
-    }
33
+		libxml_use_internal_errors( $set_err );
34
+		libxml_disable_entity_loader( $loader );
35
+	}
36 36
 
37
-    public static function route() {
38
-        $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
37
+	public static function route() {
38
+		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
39 39
 		$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
40 40
 		if ( $action == 'import_xml' ) {
41
-            return self::import_xml();
41
+			return self::import_xml();
42 42
 		} else if ( $action == 'export_xml' ) {
43
-            return self::export_xml();
44
-        } else {
45
-            if ( apply_filters( 'frm_xml_route', true, $action ) ) {
46
-                return self::form();
47
-            }
48
-        }
49
-    }
50
-
51
-    public static function form( $errors = array(), $message = '' ) {
43
+			return self::export_xml();
44
+		} else {
45
+			if ( apply_filters( 'frm_xml_route', true, $action ) ) {
46
+				return self::form();
47
+			}
48
+		}
49
+	}
50
+
51
+	public static function form( $errors = array(), $message = '' ) {
52 52
 		$where = array(
53 53
 			'parent_form_id' => array( null, 0 ),
54 54
 			'status' => array( null, '', 'published' )
55 55
 		);
56 56
 		$forms = FrmForm::getAll( $where, 'name' );
57 57
 
58
-        $export_types = apply_filters( 'frm_xml_export_types',
59
-            array( 'forms' => __( 'Forms', 'formidable' ), 'items' => __( 'Entries', 'formidable' ) )
60
-        );
58
+		$export_types = apply_filters( 'frm_xml_export_types',
59
+			array( 'forms' => __( 'Forms', 'formidable' ), 'items' => __( 'Entries', 'formidable' ) )
60
+		);
61 61
 
62
-        $export_format = apply_filters( 'frm_export_formats', array(
63
-            'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ),
62
+		$export_format = apply_filters( 'frm_export_formats', array(
63
+			'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ),
64 64
 			'csv' => array( 'name' => 'CSV', 'support' => 'items', 'count' => 'single' ),
65
-        ) );
65
+		) );
66 66
 
67
-        include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php');
68
-    }
67
+		include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php');
68
+	}
69 69
 
70
-    public static function import_xml() {
71
-        $errors = array();
72
-        $message = '';
70
+	public static function import_xml() {
71
+		$errors = array();
72
+		$message = '';
73 73
 
74
-        $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce');
75
-        if ( $permission_error !== false ) {
76
-            $errors[] = $permission_error;
77
-            self::form($errors);
78
-            return;
79
-        }
74
+		$permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce');
75
+		if ( $permission_error !== false ) {
76
+			$errors[] = $permission_error;
77
+			self::form($errors);
78
+			return;
79
+		}
80 80
 
81
-        if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) {
82
-            $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' );
83
-            self::form($errors);
84
-            return;
85
-        }
81
+		if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) {
82
+			$errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' );
83
+			self::form($errors);
84
+			return;
85
+		}
86 86
 
87
-        $file = $_FILES['frm_import_file']['tmp_name'];
87
+		$file = $_FILES['frm_import_file']['tmp_name'];
88 88
 
89
-        if ( ! is_uploaded_file( $file ) ) {
90
-            unset($file);
91
-            $errors[] = __( 'The file does not exist, please try again.', 'formidable' );
92
-            self::form($errors);
93
-            return;
94
-        }
89
+		if ( ! is_uploaded_file( $file ) ) {
90
+			unset($file);
91
+			$errors[] = __( 'The file does not exist, please try again.', 'formidable' );
92
+			self::form($errors);
93
+			return;
94
+		}
95 95
 
96
-        //add_filter('upload_mimes', 'FrmXMLController::allow_mime');
96
+		//add_filter('upload_mimes', 'FrmXMLController::allow_mime');
97 97
 
98
-        $export_format = apply_filters('frm_export_formats', array(
98
+		$export_format = apply_filters('frm_export_formats', array(
99 99
 			'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ),
100 100
 		) );
101 101
 
102
-        $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION));
103
-        if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) {
104
-            // allow other file types to be imported
105
-            do_action('frm_before_import_'. $file_type );
106
-            return;
107
-        }
108
-        unset($file_type);
102
+		$file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION));
103
+		if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) {
104
+			// allow other file types to be imported
105
+			do_action('frm_before_import_'. $file_type );
106
+			return;
107
+		}
108
+		unset($file_type);
109 109
 
110 110
 		if ( ! function_exists( 'libxml_disable_entity_loader' ) ) {
111 111
 			$errors[] = __( 'XML import is not enabled on your server.', 'formidable' );
@@ -124,148 +124,148 @@  discard block
 block discarded – undo
124 124
 		libxml_use_internal_errors( $set_err );
125 125
 		libxml_disable_entity_loader( $loader );
126 126
 
127
-        self::form($errors, $message);
128
-    }
127
+		self::form($errors, $message);
128
+	}
129 129
 
130
-    public static function export_xml() {
131
-        $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' );
132
-        if ( ! empty($error) ) {
133
-            wp_die( $error );
134
-        }
130
+	public static function export_xml() {
131
+		$error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' );
132
+		if ( ! empty($error) ) {
133
+			wp_die( $error );
134
+		}
135 135
 
136 136
 		$ids = FrmAppHelper::get_post_param( 'frm_export_forms', array() );
137 137
 		$type = FrmAppHelper::get_post_param( 'type', array() );
138 138
 		$format = FrmAppHelper::get_post_param( 'format', 'xml', 'sanitize_title' );
139 139
 
140
-        if ( ! headers_sent() && ! $type ) {
141
-            wp_redirect( esc_url_raw( admin_url( 'admin.php?page=formidable-import' ) ) );
142
-            die();
143
-        }
140
+		if ( ! headers_sent() && ! $type ) {
141
+			wp_redirect( esc_url_raw( admin_url( 'admin.php?page=formidable-import' ) ) );
142
+			die();
143
+		}
144 144
 
145
-        if ( $format == 'xml' ) {
146
-            self::generate_xml($type, compact('ids'));
145
+		if ( $format == 'xml' ) {
146
+			self::generate_xml($type, compact('ids'));
147 147
 		} if ( $format == 'csv' ) {
148 148
 			self::generate_csv( compact('ids') );
149
-        } else {
150
-            do_action('frm_export_format_'. $format, compact('ids'));
151
-        }
149
+		} else {
150
+			do_action('frm_export_format_'. $format, compact('ids'));
151
+		}
152 152
 
153
-        wp_die();
154
-    }
153
+		wp_die();
154
+	}
155 155
 
156 156
 	public static function generate_xml( $type, $args = array() ) {
157
-    	global $wpdb;
158
-
159
-	    $type = (array) $type;
160
-        if ( in_array( 'items', $type) && ! in_array( 'forms', $type) ) {
161
-            // make sure the form is included if there are entries
162
-            $type[] = 'forms';
163
-        }
164
-
165
-	    if ( in_array( 'forms', $type) ) {
166
-            // include actions with forms
167
-	        $type[] = 'actions';
168
-	    }
169
-
170
-	    $tables = array(
171
-	        'items'     => $wpdb->prefix .'frm_items',
172
-	        'forms'     => $wpdb->prefix .'frm_forms',
173
-	        'posts'     => $wpdb->posts,
174
-	        'styles'    => $wpdb->posts,
175
-	        'actions'   => $wpdb->posts,
176
-	    );
157
+		global $wpdb;
158
+
159
+		$type = (array) $type;
160
+		if ( in_array( 'items', $type) && ! in_array( 'forms', $type) ) {
161
+			// make sure the form is included if there are entries
162
+			$type[] = 'forms';
163
+		}
164
+
165
+		if ( in_array( 'forms', $type) ) {
166
+			// include actions with forms
167
+			$type[] = 'actions';
168
+		}
169
+
170
+		$tables = array(
171
+			'items'     => $wpdb->prefix .'frm_items',
172
+			'forms'     => $wpdb->prefix .'frm_forms',
173
+			'posts'     => $wpdb->posts,
174
+			'styles'    => $wpdb->posts,
175
+			'actions'   => $wpdb->posts,
176
+		);
177 177
 
178 178
 		$defaults = array( 'ids' => false );
179
-	    $args = wp_parse_args( $args, $defaults );
179
+		$args = wp_parse_args( $args, $defaults );
180 180
 
181
-        $sitename = sanitize_key( get_bloginfo( 'name' ) );
181
+		$sitename = sanitize_key( get_bloginfo( 'name' ) );
182 182
 
183
-    	if ( ! empty( $sitename ) ) {
183
+		if ( ! empty( $sitename ) ) {
184 184
 			$sitename .= '.';
185 185
 		}
186
-    	$filename = $sitename . 'formidable.' . date( 'Y-m-d' ) . '.xml';
186
+		$filename = $sitename . 'formidable.' . date( 'Y-m-d' ) . '.xml';
187 187
 
188
-    	header( 'Content-Description: File Transfer' );
189
-    	header( 'Content-Disposition: attachment; filename=' . $filename );
190
-    	header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
188
+		header( 'Content-Description: File Transfer' );
189
+		header( 'Content-Disposition: attachment; filename=' . $filename );
190
+		header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
191 191
 
192
-        //make sure ids are numeric
193
-    	if ( is_array( $args['ids'] ) && ! empty( $args['ids'] ) ) {
194
-	        $args['ids'] = array_filter( $args['ids'], 'is_numeric' );
195
-	    }
192
+		//make sure ids are numeric
193
+		if ( is_array( $args['ids'] ) && ! empty( $args['ids'] ) ) {
194
+			$args['ids'] = array_filter( $args['ids'], 'is_numeric' );
195
+		}
196 196
 
197
-	    $records = array();
197
+		$records = array();
198 198
 
199 199
 		foreach ( $type as $tb_type ) {
200
-            $where = array();
200
+			$where = array();
201 201
 			$join = '';
202
-            $table = $tables[ $tb_type ];
202
+			$table = $tables[ $tb_type ];
203 203
 
204
-            $select = $table .'.id';
205
-            $query_vars = array();
204
+			$select = $table .'.id';
205
+			$query_vars = array();
206 206
 
207
-            switch ( $tb_type ) {
208
-                case 'forms':
209
-                    //add forms
210
-                    if ( $args['ids'] ) {
207
+			switch ( $tb_type ) {
208
+				case 'forms':
209
+					//add forms
210
+					if ( $args['ids'] ) {
211 211
 						$where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table .'.parent_form_id' => $args['ids'] );
212
-                	} else {
212
+					} else {
213 213
 						$where[ $table . '.status !' ] = 'draft';
214
-                	}
215
-                break;
216
-                case 'actions':
217
-                    $select = $table .'.ID';
214
+					}
215
+				break;
216
+				case 'actions':
217
+					$select = $table .'.ID';
218 218
 					$where['post_type'] = FrmFormActionsController::$action_post_type;
219
-                    if ( ! empty($args['ids']) ) {
219
+					if ( ! empty($args['ids']) ) {
220 220
 						$where['menu_order'] = $args['ids'];
221
-                    }
222
-                break;
223
-                case 'items':
224
-                    //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)";
225
-                    if ( $args['ids'] ) {
221
+					}
222
+				break;
223
+				case 'items':
224
+					//$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)";
225
+					if ( $args['ids'] ) {
226 226
 						$where[ $table . '.form_id' ] = $args['ids'];
227
-                    }
228
-                break;
229
-                case 'styles':
230
-                    // Loop through all exported forms and get their selected style IDs
231
-                    $form_ids = $args['ids'];
232
-                    $style_ids = array();
233
-                    foreach ( $form_ids as $form_id ) {
234
-                        $form_data = FrmForm::getOne( $form_id );
235
-                        // For forms that have not been updated while running 2.0, check if custom_style is set
236
-                        if ( isset( $form_data->options['custom_style'] ) ) {
237
-                            $style_ids[] = $form_data->options['custom_style'];
238
-                        }
239
-                        unset( $form_id, $form_data );
240
-                    }
241
-                    $select = $table .'.ID';
242
-                    $where['post_type'] = 'frm_styles';
243
-
244
-                    // Only export selected styles
245
-                    if ( ! empty( $style_ids ) ) {
246
-                        $where['ID'] = $style_ids;
247
-                    }
248
-                break;
249
-                default:
250
-                    $select = $table .'.ID';
251
-                    $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)';
252
-                    $where['pm.meta_key'] = 'frm_form_id';
253
-
254
-                    if ( empty($args['ids']) ) {
255
-                        $where['pm.meta_value >'] = 1;
256
-                    } else {
257
-                        $where['pm.meta_value'] = $args['ids'];
258
-                    }
259
-                break;
260
-            }
227
+					}
228
+				break;
229
+				case 'styles':
230
+					// Loop through all exported forms and get their selected style IDs
231
+					$form_ids = $args['ids'];
232
+					$style_ids = array();
233
+					foreach ( $form_ids as $form_id ) {
234
+						$form_data = FrmForm::getOne( $form_id );
235
+						// For forms that have not been updated while running 2.0, check if custom_style is set
236
+						if ( isset( $form_data->options['custom_style'] ) ) {
237
+							$style_ids[] = $form_data->options['custom_style'];
238
+						}
239
+						unset( $form_id, $form_data );
240
+					}
241
+					$select = $table .'.ID';
242
+					$where['post_type'] = 'frm_styles';
243
+
244
+					// Only export selected styles
245
+					if ( ! empty( $style_ids ) ) {
246
+						$where['ID'] = $style_ids;
247
+					}
248
+				break;
249
+				default:
250
+					$select = $table .'.ID';
251
+					$join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)';
252
+					$where['pm.meta_key'] = 'frm_form_id';
253
+
254
+					if ( empty($args['ids']) ) {
255
+						$where['pm.meta_value >'] = 1;
256
+					} else {
257
+						$where['pm.meta_value'] = $args['ids'];
258
+					}
259
+				break;
260
+			}
261 261
 
262 262
 			$records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select );
263
-            unset($tb_type);
264
-        }
263
+			unset($tb_type);
264
+		}
265 265
 
266 266
 		echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n";
267
-        include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php');
268
-    }
267
+		include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php');
268
+	}
269 269
 
270 270
 
271 271
 	public static function generate_csv( $atts ) {
@@ -336,14 +336,14 @@  discard block
 block discarded – undo
336 336
 	}
337 337
 
338 338
 	/**
339
-	* Get the fields that should be included in the CSV export
340
-	*
341
-	* @since 2.0.19
342
-	*
343
-	* @param int $form_id
344
-	* @param object $form
345
-	* @return array $csv_fields
346
-	*/
339
+	 * Get the fields that should be included in the CSV export
340
+	 *
341
+	 * @since 2.0.19
342
+	 *
343
+	 * @param int $form_id
344
+	 * @param object $form
345
+	 * @return array $csv_fields
346
+	 */
347 347
 	private static function get_fields_for_csv_export( $form_id, $form ) {
348 348
 		$csv_field_ids = apply_filters( 'frm_csv_field_ids', '', $form_id, array( 'form' => $form ) );
349 349
 
@@ -371,16 +371,16 @@  discard block
 block discarded – undo
371 371
 	}
372 372
 
373 373
 	public static function allow_mime( $mimes ) {
374
-        if ( ! isset( $mimes['csv'] ) ) {
375
-            // allow csv files
376
-            $mimes['csv'] = 'text/csv';
377
-        }
378
-
379
-        if ( ! isset( $mimes['xml'] ) ) {
380
-            // allow xml
381
-            $mimes['xml'] = 'text/xml';
382
-        }
383
-
384
-        return $mimes;
385
-    }
374
+		if ( ! isset( $mimes['csv'] ) ) {
375
+			// allow csv files
376
+			$mimes['csv'] = 'text/csv';
377
+		}
378
+
379
+		if ( ! isset( $mimes['xml'] ) ) {
380
+			// allow xml
381
+			$mimes['xml'] = 'text/xml';
382
+		}
383
+
384
+		return $mimes;
385
+	}
386 386
 }
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 class FrmXMLController {
4 4
 
5 5
     public static function menu() {
6
-        add_submenu_page('formidable', 'Formidable | '. __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route');
6
+        add_submenu_page( 'formidable', 'Formidable | ' . __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route' );
7 7
     }
8 8
 
9 9
     public static function add_default_templates() {
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
     		return;
13 13
     	}
14 14
 
15
-        $set_err = libxml_use_internal_errors(true);
15
+        $set_err = libxml_use_internal_errors( true );
16 16
         $loader = libxml_disable_entity_loader( true );
17 17
 
18 18
 		$files = apply_filters( 'frm_default_templates_files', array( FrmAppHelper::plugin_path() . '/classes/views/xml/default-templates.xml' ) );
19 19
 
20 20
         foreach ( (array) $files as $file ) {
21
-            FrmXMLHelper::import_xml($file);
22
-            unset($file);
21
+            FrmXMLHelper::import_xml( $file );
22
+            unset( $file );
23 23
         }
24 24
         /*
25 25
         if(is_wp_error($result))
@@ -64,48 +64,48 @@  discard block
 block discarded – undo
64 64
 			'csv' => array( 'name' => 'CSV', 'support' => 'items', 'count' => 'single' ),
65 65
         ) );
66 66
 
67
-        include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php');
67
+        include( FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php' );
68 68
     }
69 69
 
70 70
     public static function import_xml() {
71 71
         $errors = array();
72 72
         $message = '';
73 73
 
74
-        $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce');
74
+        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'import-xml', 'import-xml-nonce' );
75 75
         if ( $permission_error !== false ) {
76 76
             $errors[] = $permission_error;
77
-            self::form($errors);
77
+            self::form( $errors );
78 78
             return;
79 79
         }
80 80
 
81
-        if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) {
81
+        if ( ! isset( $_FILES ) || ! isset( $_FILES['frm_import_file'] ) || empty( $_FILES['frm_import_file']['name'] ) || (int) $_FILES['frm_import_file']['size'] < 1 ) {
82 82
             $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' );
83
-            self::form($errors);
83
+            self::form( $errors );
84 84
             return;
85 85
         }
86 86
 
87 87
         $file = $_FILES['frm_import_file']['tmp_name'];
88 88
 
89 89
         if ( ! is_uploaded_file( $file ) ) {
90
-            unset($file);
90
+            unset( $file );
91 91
             $errors[] = __( 'The file does not exist, please try again.', 'formidable' );
92
-            self::form($errors);
92
+            self::form( $errors );
93 93
             return;
94 94
         }
95 95
 
96 96
         //add_filter('upload_mimes', 'FrmXMLController::allow_mime');
97 97
 
98
-        $export_format = apply_filters('frm_export_formats', array(
98
+        $export_format = apply_filters( 'frm_export_formats', array(
99 99
 			'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ),
100 100
 		) );
101 101
 
102
-        $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION));
103
-        if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) {
102
+        $file_type = strtolower( pathinfo( $_FILES['frm_import_file']['name'], PATHINFO_EXTENSION ) );
103
+        if ( $file_type != 'xml' && isset( $export_format[$file_type] ) ) {
104 104
             // allow other file types to be imported
105
-            do_action('frm_before_import_'. $file_type );
105
+            do_action( 'frm_before_import_' . $file_type );
106 106
             return;
107 107
         }
108
-        unset($file_type);
108
+        unset( $file_type );
109 109
 
110 110
 		if ( ! function_exists( 'libxml_disable_entity_loader' ) ) {
111 111
 			$errors[] = __( 'XML import is not enabled on your server.', 'formidable' );
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 		libxml_use_internal_errors( $set_err );
125 125
 		libxml_disable_entity_loader( $loader );
126 126
 
127
-        self::form($errors, $message);
127
+        self::form( $errors, $message );
128 128
     }
129 129
 
130 130
     public static function export_xml() {
131 131
         $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' );
132
-        if ( ! empty($error) ) {
132
+        if ( ! empty( $error ) ) {
133 133
             wp_die( $error );
134 134
         }
135 135
 
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
         }
144 144
 
145 145
         if ( $format == 'xml' ) {
146
-            self::generate_xml($type, compact('ids'));
146
+            self::generate_xml( $type, compact( 'ids' ) );
147 147
 		} if ( $format == 'csv' ) {
148
-			self::generate_csv( compact('ids') );
148
+			self::generate_csv( compact( 'ids' ) );
149 149
         } else {
150
-            do_action('frm_export_format_'. $format, compact('ids'));
150
+            do_action( 'frm_export_format_' . $format, compact( 'ids' ) );
151 151
         }
152 152
 
153 153
         wp_die();
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
     	global $wpdb;
158 158
 
159 159
 	    $type = (array) $type;
160
-        if ( in_array( 'items', $type) && ! in_array( 'forms', $type) ) {
160
+        if ( in_array( 'items', $type ) && ! in_array( 'forms', $type ) ) {
161 161
             // make sure the form is included if there are entries
162 162
             $type[] = 'forms';
163 163
         }
164 164
 
165
-	    if ( in_array( 'forms', $type) ) {
165
+	    if ( in_array( 'forms', $type ) ) {
166 166
             // include actions with forms
167 167
 	        $type[] = 'actions';
168 168
 	    }
169 169
 
170 170
 	    $tables = array(
171
-	        'items'     => $wpdb->prefix .'frm_items',
172
-	        'forms'     => $wpdb->prefix .'frm_forms',
171
+	        'items'     => $wpdb->prefix . 'frm_items',
172
+	        'forms'     => $wpdb->prefix . 'frm_forms',
173 173
 	        'posts'     => $wpdb->posts,
174 174
 	        'styles'    => $wpdb->posts,
175 175
 	        'actions'   => $wpdb->posts,
@@ -199,31 +199,31 @@  discard block
 block discarded – undo
199 199
 		foreach ( $type as $tb_type ) {
200 200
             $where = array();
201 201
 			$join = '';
202
-            $table = $tables[ $tb_type ];
202
+            $table = $tables[$tb_type];
203 203
 
204
-            $select = $table .'.id';
204
+            $select = $table . '.id';
205 205
             $query_vars = array();
206 206
 
207 207
             switch ( $tb_type ) {
208 208
                 case 'forms':
209 209
                     //add forms
210 210
                     if ( $args['ids'] ) {
211
-						$where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table .'.parent_form_id' => $args['ids'] );
211
+						$where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table . '.parent_form_id' => $args['ids'] );
212 212
                 	} else {
213
-						$where[ $table . '.status !' ] = 'draft';
213
+						$where[$table . '.status !'] = 'draft';
214 214
                 	}
215 215
                 break;
216 216
                 case 'actions':
217
-                    $select = $table .'.ID';
217
+                    $select = $table . '.ID';
218 218
 					$where['post_type'] = FrmFormActionsController::$action_post_type;
219
-                    if ( ! empty($args['ids']) ) {
219
+                    if ( ! empty( $args['ids'] ) ) {
220 220
 						$where['menu_order'] = $args['ids'];
221 221
                     }
222 222
                 break;
223 223
                 case 'items':
224 224
                     //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)";
225 225
                     if ( $args['ids'] ) {
226
-						$where[ $table . '.form_id' ] = $args['ids'];
226
+						$where[$table . '.form_id'] = $args['ids'];
227 227
                     }
228 228
                 break;
229 229
                 case 'styles':
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
                         }
239 239
                         unset( $form_id, $form_data );
240 240
                     }
241
-                    $select = $table .'.ID';
241
+                    $select = $table . '.ID';
242 242
                     $where['post_type'] = 'frm_styles';
243 243
 
244 244
                     // Only export selected styles
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
                     }
248 248
                 break;
249 249
                 default:
250
-                    $select = $table .'.ID';
250
+                    $select = $table . '.ID';
251 251
                     $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)';
252 252
                     $where['pm.meta_key'] = 'frm_form_id';
253 253
 
254
-                    if ( empty($args['ids']) ) {
254
+                    if ( empty( $args['ids'] ) ) {
255 255
                         $where['pm.meta_value >'] = 1;
256 256
                     } else {
257 257
                         $where['pm.meta_value'] = $args['ids'];
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
                 break;
260 260
             }
261 261
 
262
-			$records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select );
263
-            unset($tb_type);
262
+			$records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select );
263
+            unset( $tb_type );
264 264
         }
265 265
 
266
-		echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n";
267
-        include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php');
266
+		echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo( 'charset' ) ) . "\" ?>\n";
267
+        include( FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php' );
268 268
     }
269 269
 
270 270
 
@@ -289,11 +289,11 @@  discard block
 block discarded – undo
289 289
 			$fid = FrmAppHelper::get_param( 'fid', '', 'get', 'sanitize_text_field' );
290 290
 		}
291 291
 
292
-		if ( ! ini_get('safe_mode') ) {
293
-			set_time_limit(0); //Remove time limit to execute this function
294
-			$mem_limit = str_replace('M', '', ini_get('memory_limit'));
292
+		if ( ! ini_get( 'safe_mode' ) ) {
293
+			set_time_limit( 0 ); //Remove time limit to execute this function
294
+			$mem_limit = str_replace( 'M', '', ini_get( 'memory_limit' ) );
295 295
 			if ( (int) $mem_limit < 256 ) {
296
-				ini_set('memory_limit', '256M');
296
+				ini_set( 'memory_limit', '256M' );
297 297
 			}
298 298
 		}
299 299
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		 */
324 324
 		$query = apply_filters( 'frm_csv_where', $query, compact( 'form_id', 'search', 'fid', 'item_id' ) );
325 325
 
326
-		$entry_ids = FrmDb::get_col( $wpdb->prefix .'frm_items it', $query );
326
+		$entry_ids = FrmDb::get_col( $wpdb->prefix . 'frm_items it', $query );
327 327
 		unset( $query );
328 328
 
329 329
 		if ( empty( $entry_ids ) ) {
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 			if ( ! is_array( $csv_field_ids ) ) {
354 354
 				$csv_field_ids = explode( ',', $csv_field_ids );
355 355
 			}
356
-			if ( ! empty( $csv_field_ids ) )	{
356
+			if ( ! empty( $csv_field_ids ) ) {
357 357
 				$where['fi.id'] = $csv_field_ids;
358 358
 			}
359 359
 			$csv_fields = FrmField::getAll( $where, 'field_order' );
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 			$no_export_fields = FrmField::no_save_fields();
363 363
 			foreach ( $csv_fields as $k => $f ) {
364 364
 				if ( in_array( $f->type, $no_export_fields ) ) {
365
-					unset( $csv_fields[ $k ] );
365
+					unset( $csv_fields[$k] );
366 366
 				}
367 367
 			}
368 368
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -353,7 +353,7 @@
 block discarded – undo
353 353
 			if ( ! is_array( $csv_field_ids ) ) {
354 354
 				$csv_field_ids = explode( ',', $csv_field_ids );
355 355
 			}
356
-			if ( ! empty( $csv_field_ids ) )	{
356
+			if ( ! empty( $csv_field_ids ) ) {
357 357
 				$where['fi.id'] = $csv_field_ids;
358 358
 			}
359 359
 			$csv_fields = FrmField::getAll( $where, 'field_order' );
Please login to merge, or discard this patch.
classes/helpers/FrmAppHelper.php 3 patches
Doc Comments   +12 added 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 = apply_filters( 'frm_affiliate_link', '' );
62 65
 		$allowed_affiliates = array('Mojo');
@@ -752,6 +755,9 @@  discard block
 block discarded – undo
752 755
 		return FrmFieldsHelper::prepare_other_input( $args, $other_opt, $checked );
753 756
     }
754 757
 
758
+	/**
759
+	 * @param string $function
760
+	 */
755 761
 	public static function recursive_function_map( $value, $function ) {
756 762
 		if ( is_array( $value ) ) {
757 763
 			$original_function = $function;
@@ -1179,6 +1185,9 @@  discard block
 block discarded – undo
1179 1185
         return $sub . (($len < $original_len) ? $continue : '');
1180 1186
     }
1181 1187
 
1188
+	/**
1189
+	 * @param string[] $function_names
1190
+	 */
1182 1191
 	public static function mb_function( $function_names, $args ) {
1183 1192
 		$mb_function_name = $function_names[0];
1184 1193
 		$function_name = $function_names[1];
@@ -1212,6 +1221,9 @@  discard block
 block discarded – undo
1212 1221
         return $formatted;
1213 1222
     }
1214 1223
 
1224
+	/**
1225
+	 * @param string $time_format
1226
+	 */
1215 1227
 	private static function add_time_to_date( $time_format, $date ) {
1216 1228
 		if ( empty( $time_format ) ) {
1217 1229
 			$time_format = get_option('time_format');
Please login to merge, or discard this patch.
Indentation   +1130 added lines, -1130 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.0.19';
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
35
-        return plugins_url( '', self::plugin_path() .'/formidable.php' );
36
-    }
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
+		return plugins_url( '', self::plugin_path() .'/formidable.php' );
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 = apply_filters( 'frm_affiliate_link', '' );
@@ -66,78 +66,78 @@  discard block
 block discarded – undo
66 66
 		return $url;
67 67
 	}
68 68
 
69
-    /**
70
-     * Get the Formidable settings
71
-     *
72
-     * @since 2.0
73
-     *
74
-     * @param None
75
-     * @return FrmSettings $frm_setings
76
-     */
77
-    public static function get_settings() {
78
-        global $frm_settings;
79
-        if ( empty($frm_settings) ) {
80
-            $frm_settings = new FrmSettings();
81
-        }
82
-        return $frm_settings;
83
-    }
84
-
85
-    /**
86
-     * Show a message in place of pro features
87
-     *
88
-     * @since 2.0
89
-     */
69
+	/**
70
+	 * Get the Formidable settings
71
+	 *
72
+	 * @since 2.0
73
+	 *
74
+	 * @param None
75
+	 * @return FrmSettings $frm_setings
76
+	 */
77
+	public static function get_settings() {
78
+		global $frm_settings;
79
+		if ( empty($frm_settings) ) {
80
+			$frm_settings = new FrmSettings();
81
+		}
82
+		return $frm_settings;
83
+	}
84
+
85
+	/**
86
+	 * Show a message in place of pro features
87
+	 *
88
+	 * @since 2.0
89
+	 */
90 90
 	public static function update_message( $features, $class = '' ) {
91 91
 		_deprecated_function( __FUNCTION__, '2.0.19' );
92
-    }
93
-
94
-    public static function pro_is_installed() {
95
-        return apply_filters('frm_pro_installed', false);
96
-    }
97
-
98
-    /**
99
-     * Check for certain page in Formidable settings
100
-     *
101
-     * @since 2.0
102
-     *
103
-     * @param string $page The name of the page to check
104
-     * @return boolean
105
-     */
92
+	}
93
+
94
+	public static function pro_is_installed() {
95
+		return apply_filters('frm_pro_installed', false);
96
+	}
97
+
98
+	/**
99
+	 * Check for certain page in Formidable settings
100
+	 *
101
+	 * @since 2.0
102
+	 *
103
+	 * @param string $page The name of the page to check
104
+	 * @return boolean
105
+	 */
106 106
 	public static function is_admin_page( $page = 'formidable' ) {
107
-        global $pagenow;
107
+		global $pagenow;
108 108
 		$get_page = self::simple_get( 'page', 'sanitize_title' );
109
-        if ( $pagenow ) {
109
+		if ( $pagenow ) {
110 110
 			return $pagenow == 'admin.php' && $get_page == $page;
111
-        }
111
+		}
112 112
 
113 113
 		return is_admin() && $get_page == $page;
114
-    }
115
-
116
-    /**
117
-     * Check for the form preview page
118
-     *
119
-     * @since 2.0
120
-     *
121
-     * @param None
122
-     * @return boolean
123
-     */
124
-    public static function is_preview_page() {
125
-        global $pagenow;
114
+	}
115
+
116
+	/**
117
+	 * Check for the form preview page
118
+	 *
119
+	 * @since 2.0
120
+	 *
121
+	 * @param None
122
+	 * @return boolean
123
+	 */
124
+	public static function is_preview_page() {
125
+		global $pagenow;
126 126
 		$action = FrmAppHelper::simple_get( 'action', 'sanitize_title' );
127 127
 		return $pagenow && $pagenow == 'admin-ajax.php' && $action == 'frm_forms_preview';
128
-    }
128
+	}
129 129
 
130
-    /**
131
-     * Check for ajax except the form preview page
132
-     *
133
-     * @since 2.0
134
-     *
135
-     * @param None
136
-     * @return boolean
137
-     */
138
-    public static function doing_ajax() {
139
-        return defined('DOING_AJAX') && DOING_AJAX && ! self::is_preview_page();
140
-    }
130
+	/**
131
+	 * Check for ajax except the form preview page
132
+	 *
133
+	 * @since 2.0
134
+	 *
135
+	 * @param None
136
+	 * @return boolean
137
+	 */
138
+	public static function doing_ajax() {
139
+		return defined('DOING_AJAX') && DOING_AJAX && ! self::is_preview_page();
140
+	}
141 141
 
142 142
 	/**
143 143
 	 * @since 2.0.8
@@ -147,101 +147,101 @@  discard block
 block discarded – undo
147 147
 		return isset( $frm_vars['prevent_caching'] ) && $frm_vars['prevent_caching'];
148 148
 	}
149 149
 
150
-    /**
151
-     * Check if on an admin page
152
-     *
153
-     * @since 2.0
154
-     *
155
-     * @param None
156
-     * @return boolean
157
-     */
158
-    public static function is_admin() {
159
-        return is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX );
160
-    }
161
-
162
-    /**
163
-     * Check if value contains blank value or empty array
164
-     *
165
-     * @since 2.0
166
-     * @param $value - value to check
167
-     * @return boolean
168
-     */
169
-    public static function is_empty_value( $value, $empty = '' ) {
170
-        return ( is_array( $value ) && empty( $value ) ) || $value == $empty;
171
-    }
172
-
173
-    public static function is_not_empty_value( $value, $empty = '' ) {
174
-        return ! self::is_empty_value( $value, $empty );
175
-    }
176
-
177
-    /**
178
-     * Get any value from the $_SERVER
179
-     *
180
-     * @since 2.0
181
-     * @param string $value
182
-     * @return string
183
-     */
150
+	/**
151
+	 * Check if on an admin page
152
+	 *
153
+	 * @since 2.0
154
+	 *
155
+	 * @param None
156
+	 * @return boolean
157
+	 */
158
+	public static function is_admin() {
159
+		return is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX );
160
+	}
161
+
162
+	/**
163
+	 * Check if value contains blank value or empty array
164
+	 *
165
+	 * @since 2.0
166
+	 * @param $value - value to check
167
+	 * @return boolean
168
+	 */
169
+	public static function is_empty_value( $value, $empty = '' ) {
170
+		return ( is_array( $value ) && empty( $value ) ) || $value == $empty;
171
+	}
172
+
173
+	public static function is_not_empty_value( $value, $empty = '' ) {
174
+		return ! self::is_empty_value( $value, $empty );
175
+	}
176
+
177
+	/**
178
+	 * Get any value from the $_SERVER
179
+	 *
180
+	 * @since 2.0
181
+	 * @param string $value
182
+	 * @return string
183
+	 */
184 184
 	public static function get_server_value( $value ) {
185
-        return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
186
-    }
187
-
188
-    /**
189
-     * Check for the IP address in several places
190
-     * Used by [ip] shortcode
191
-     *
192
-     * @return string The IP address of the current user
193
-     */
194
-    public static function get_ip_address() {
185
+		return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
186
+	}
187
+
188
+	/**
189
+	 * Check for the IP address in several places
190
+	 * Used by [ip] shortcode
191
+	 *
192
+	 * @return string The IP address of the current user
193
+	 */
194
+	public static function get_ip_address() {
195 195
 		$ip = '';
196
-        foreach ( array(
197
-            'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
198
-            'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
199
-        ) as $key ) {
200
-            if ( ! isset( $_SERVER[ $key ] ) ) {
201
-                continue;
202
-            }
203
-
204
-            foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
205
-                $ip = trim($ip); // just to be safe
206
-
207
-                if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
208
-                    return $ip;
209
-                }
210
-            }
211
-        }
196
+		foreach ( array(
197
+			'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
198
+			'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
199
+		) as $key ) {
200
+			if ( ! isset( $_SERVER[ $key ] ) ) {
201
+				continue;
202
+			}
203
+
204
+			foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
205
+				$ip = trim($ip); // just to be safe
206
+
207
+				if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
208
+					return $ip;
209
+				}
210
+			}
211
+		}
212 212
 
213 213
 		return sanitize_text_field( $ip );
214
-    }
214
+	}
215 215
 
216
-    public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
217
-        if ( strpos($param, '[') ) {
218
-            $params = explode('[', $param);
219
-            $param = $params[0];
220
-        }
216
+	public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
217
+		if ( strpos($param, '[') ) {
218
+			$params = explode('[', $param);
219
+			$param = $params[0];
220
+		}
221 221
 
222 222
 		if ( $src == 'get' ) {
223
-            $value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
224
-            if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
225
-                $value = stripslashes_deep( htmlspecialchars_decode( urldecode( $_GET[ $param ] ) ) );
226
-            }
223
+			$value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
224
+			if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
225
+				$value = stripslashes_deep( htmlspecialchars_decode( urldecode( $_GET[ $param ] ) ) );
226
+			}
227 227
 			self::sanitize_value( $sanitize, $value );
228 228
 		} else {
229
-            $value = self::get_simple_request( array( 'type' => $src, 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
230
-        }
229
+			$value = self::get_simple_request( array( 'type' => $src, 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
230
+		}
231 231
 
232 232
 		if ( isset( $params ) && is_array( $value ) && ! empty( $value ) ) {
233
-            foreach ( $params as $k => $p ) {
234
-                if ( ! $k || ! is_array($value) ) {
235
-                    continue;
236
-                }
233
+			foreach ( $params as $k => $p ) {
234
+				if ( ! $k || ! is_array($value) ) {
235
+					continue;
236
+				}
237 237
 
238
-                $p = trim($p, ']');
239
-                $value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
240
-            }
241
-        }
238
+				$p = trim($p, ']');
239
+				$value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
240
+			}
241
+		}
242 242
 
243
-        return $value;
244
-    }
243
+		return $value;
244
+	}
245 245
 
246 246
 	/**
247 247
 	 *
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	public static function simple_get( $param, $sanitize = 'sanitize_text_field', $default = '' ) {
264 264
 		return self::get_simple_request( array( 'type' => 'get', 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
265
-    }
265
+	}
266 266
 
267 267
 	/**
268 268
 	 * Get a GET/POST/REQUEST value and sanitize it
@@ -296,12 +296,12 @@  discard block
 block discarded – undo
296 296
 	}
297 297
 
298 298
 	/**
299
-	* Preserve backslashes in a value, but make sure value doesn't get compounding slashes
300
-	*
301
-	* @since 2.0.8
302
-	* @param string $value
303
-	* @return string $value
304
-	*/
299
+	 * Preserve backslashes in a value, but make sure value doesn't get compounding slashes
300
+	 *
301
+	 * @since 2.0.8
302
+	 * @param string $value
303
+	 * @return string $value
304
+	 */
305 305
 	public static function preserve_backslashes( $value ) {
306 306
 		// If backslashes have already been added, don't add them again
307 307
 		if ( strpos( $value, '\\\\' ) === false ) {
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
 		}
321 321
 	}
322 322
 
323
-    public static function sanitize_request( $sanitize_method, &$values ) {
324
-        $temp_values = $values;
325
-        foreach ( $temp_values as $k => $val ) {
326
-            if ( isset( $sanitize_method[ $k ] ) ) {
323
+	public static function sanitize_request( $sanitize_method, &$values ) {
324
+		$temp_values = $values;
325
+		foreach ( $temp_values as $k => $val ) {
326
+			if ( isset( $sanitize_method[ $k ] ) ) {
327 327
 				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
328
-            }
329
-        }
330
-    }
328
+			}
329
+		}
330
+	}
331 331
 
332 332
 	public static function sanitize_array( &$values ) {
333 333
 		$temp_values = $values;
@@ -342,12 +342,12 @@  discard block
 block discarded – undo
342 342
 	 */
343 343
 	public static function kses( $value, $allowed = array() ) {
344 344
 		$html = array(
345
-		    'a' => array(
345
+			'a' => array(
346 346
 				'href'  => array(),
347 347
 				'title' => array(),
348 348
 				'id'    => array(),
349 349
 				'class' => array(),
350
-		    ),
350
+			),
351 351
 		);
352 352
 
353 353
 		$allowed_html = array();
@@ -358,176 +358,176 @@  discard block
 block discarded – undo
358 358
 		return wp_kses( $value, $allowed_html );
359 359
 	}
360 360
 
361
-    /**
362
-     * Used when switching the action for a bulk action
363
-     * @since 2.0
364
-     */
365
-    public static function remove_get_action() {
366
-        if ( ! isset($_GET) ) {
367
-            return;
368
-        }
361
+	/**
362
+	 * Used when switching the action for a bulk action
363
+	 * @since 2.0
364
+	 */
365
+	public static function remove_get_action() {
366
+		if ( ! isset($_GET) ) {
367
+			return;
368
+		}
369 369
 
370
-        $new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
371
-        if ( ! empty( $new_action ) ) {
370
+		$new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
371
+		if ( ! empty( $new_action ) ) {
372 372
 			$_SERVER['REQUEST_URI'] = str_replace( '&action=' . $new_action, '', FrmAppHelper::get_server_value( 'REQUEST_URI' ) );
373
-        }
374
-    }
375
-
376
-    /**
377
-     * Check the WP query for a parameter
378
-     *
379
-     * @since 2.0
380
-     * @return string|array
381
-     */
382
-    public static function get_query_var( $value, $param ) {
383
-        if ( $value != '' ) {
384
-            return $value;
385
-        }
386
-
387
-        global $wp_query;
388
-        if ( isset( $wp_query->query_vars[ $param ] ) ) {
389
-            $value = $wp_query->query_vars[ $param ];
390
-        }
391
-
392
-        return $value;
393
-    }
394
-
395
-    /**
396
-     * @param string $type
397
-     */
398
-    public static function trigger_hook_load( $type, $object = null ) {
399
-        // only load the form hooks once
400
-        $hooks_loaded = apply_filters('frm_'. $type .'_hooks_loaded', false, $object);
401
-        if ( ! $hooks_loaded ) {
402
-            do_action('frm_load_'. $type .'_hooks');
403
-        }
404
-    }
405
-
406
-    /**
407
-     * Check cache before fetching values and saving to cache
408
-     *
409
-     * @since 2.0
410
-     *
411
-     * @param string $cache_key The unique name for this cache
412
-     * @param string $group The name of the cache group
413
-     * @param string $query If blank, don't run a db call
414
-     * @param string $type The wpdb function to use with this query
415
-     * @return mixed $results The cache or query results
416
-     */
417
-    public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
418
-        $results = wp_cache_get($cache_key, $group);
419
-        if ( ! self::is_empty_value( $results, false ) || empty($query) ) {
420
-            return $results;
421
-        }
422
-
423
-        if ( 'get_posts' == $type ) {
424
-            $results = get_posts($query);
425
-        } else {
426
-            global $wpdb;
427
-            $results = $wpdb->{$type}($query);
428
-        }
373
+		}
374
+	}
375
+
376
+	/**
377
+	 * Check the WP query for a parameter
378
+	 *
379
+	 * @since 2.0
380
+	 * @return string|array
381
+	 */
382
+	public static function get_query_var( $value, $param ) {
383
+		if ( $value != '' ) {
384
+			return $value;
385
+		}
386
+
387
+		global $wp_query;
388
+		if ( isset( $wp_query->query_vars[ $param ] ) ) {
389
+			$value = $wp_query->query_vars[ $param ];
390
+		}
391
+
392
+		return $value;
393
+	}
394
+
395
+	/**
396
+	 * @param string $type
397
+	 */
398
+	public static function trigger_hook_load( $type, $object = null ) {
399
+		// only load the form hooks once
400
+		$hooks_loaded = apply_filters('frm_'. $type .'_hooks_loaded', false, $object);
401
+		if ( ! $hooks_loaded ) {
402
+			do_action('frm_load_'. $type .'_hooks');
403
+		}
404
+	}
405
+
406
+	/**
407
+	 * Check cache before fetching values and saving to cache
408
+	 *
409
+	 * @since 2.0
410
+	 *
411
+	 * @param string $cache_key The unique name for this cache
412
+	 * @param string $group The name of the cache group
413
+	 * @param string $query If blank, don't run a db call
414
+	 * @param string $type The wpdb function to use with this query
415
+	 * @return mixed $results The cache or query results
416
+	 */
417
+	public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
418
+		$results = wp_cache_get($cache_key, $group);
419
+		if ( ! self::is_empty_value( $results, false ) || empty($query) ) {
420
+			return $results;
421
+		}
422
+
423
+		if ( 'get_posts' == $type ) {
424
+			$results = get_posts($query);
425
+		} else {
426
+			global $wpdb;
427
+			$results = $wpdb->{$type}($query);
428
+		}
429 429
 
430 430
 		if ( ! self::prevent_caching() ) {
431 431
 			wp_cache_set( $cache_key, $results, $group, $time );
432 432
 		}
433 433
 
434
-        return $results;
435
-    }
434
+		return $results;
435
+	}
436 436
 
437
-    /**
438
-     * Data that should be stored for a long time can be stored in a transient.
439
-     * First check the cache, then check the transient
440
-     * @since 2.0
441
-     * @return mixed The cached value or false
442
-     */
437
+	/**
438
+	 * Data that should be stored for a long time can be stored in a transient.
439
+	 * First check the cache, then check the transient
440
+	 * @since 2.0
441
+	 * @return mixed The cached value or false
442
+	 */
443 443
 	public static function check_cache_and_transient( $cache_key ) {
444
-        // check caching layer first
445
-        $results = self::check_cache( $cache_key );
446
-        if ( $results ) {
447
-            return $results;
448
-        }
449
-
450
-        // then check the transient
451
-        $results = get_transient($cache_key);
452
-        if ( $results ) {
453
-            wp_cache_set($cache_key, $results);
454
-        }
455
-
456
-        return $results;
457
-    }
458
-
459
-    /**
460
-     * @since 2.0
461
-     * @param string $cache_key
462
-     */
444
+		// check caching layer first
445
+		$results = self::check_cache( $cache_key );
446
+		if ( $results ) {
447
+			return $results;
448
+		}
449
+
450
+		// then check the transient
451
+		$results = get_transient($cache_key);
452
+		if ( $results ) {
453
+			wp_cache_set($cache_key, $results);
454
+		}
455
+
456
+		return $results;
457
+	}
458
+
459
+	/**
460
+	 * @since 2.0
461
+	 * @param string $cache_key
462
+	 */
463 463
 	public static function delete_cache_and_transient( $cache_key ) {
464
-        delete_transient($cache_key);
465
-        wp_cache_delete($cache_key);
466
-    }
467
-
468
-    /**
469
-     * Delete all caching in a single group
470
-     *
471
-     * @since 2.0
472
-     *
473
-     * @param string $group The name of the cache group
474
-     * @return boolean True or False
475
-     */
464
+		delete_transient($cache_key);
465
+		wp_cache_delete($cache_key);
466
+	}
467
+
468
+	/**
469
+	 * Delete all caching in a single group
470
+	 *
471
+	 * @since 2.0
472
+	 *
473
+	 * @param string $group The name of the cache group
474
+	 * @return boolean True or False
475
+	 */
476 476
 	public static function cache_delete_group( $group ) {
477
-    	global $wp_object_cache;
478
-
479
-        if ( isset( $wp_object_cache->cache[ $group ] ) ) {
480
-            foreach ( $wp_object_cache->cache[ $group ] as $k => $v ) {
481
-                wp_cache_delete($k, $group);
482
-            }
483
-            return true;
484
-        }
485
-
486
-    	return false;
487
-    }
488
-
489
-    /**
490
-     * Check a value from a shortcode to see if true or false.
491
-     * True when value is 1, true, 'true', 'yes'
492
-     *
493
-     * @since 1.07.10
494
-     *
495
-     * @param string $value The value to compare
496
-     * @return boolean True or False
497
-     */
477
+		global $wp_object_cache;
478
+
479
+		if ( isset( $wp_object_cache->cache[ $group ] ) ) {
480
+			foreach ( $wp_object_cache->cache[ $group ] as $k => $v ) {
481
+				wp_cache_delete($k, $group);
482
+			}
483
+			return true;
484
+		}
485
+
486
+		return false;
487
+	}
488
+
489
+	/**
490
+	 * Check a value from a shortcode to see if true or false.
491
+	 * True when value is 1, true, 'true', 'yes'
492
+	 *
493
+	 * @since 1.07.10
494
+	 *
495
+	 * @param string $value The value to compare
496
+	 * @return boolean True or False
497
+	 */
498 498
 	public static function is_true( $value ) {
499
-        return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
500
-    }
499
+		return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
500
+	}
501 501
 
502
-    /**
503
-     * Used to filter shortcode in text widgets
504
-     */
505
-    public static function widget_text_filter_callback( $matches ) {
506
-        return do_shortcode( $matches[0] );
507
-    }
502
+	/**
503
+	 * Used to filter shortcode in text widgets
504
+	 */
505
+	public static function widget_text_filter_callback( $matches ) {
506
+		return do_shortcode( $matches[0] );
507
+	}
508 508
 
509 509
 	public static function load_scripts( $scripts ) {
510
-        _deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_script' );
511
-        foreach ( (array) $scripts as $s ) {
512
-            wp_enqueue_script($s);
513
-        }
514
-    }
510
+		_deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_script' );
511
+		foreach ( (array) $scripts as $s ) {
512
+			wp_enqueue_script($s);
513
+		}
514
+	}
515 515
 
516 516
 	public static function load_styles( $styles ) {
517
-        _deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_style' );
518
-        foreach ( (array) $styles as $s ) {
519
-            wp_enqueue_style($s);
520
-        }
521
-    }
517
+		_deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_style' );
518
+		foreach ( (array) $styles as $s ) {
519
+			wp_enqueue_style($s);
520
+		}
521
+	}
522 522
 
523
-    public static function get_pages() {
523
+	public static function get_pages() {
524 524
 		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
525
-    }
525
+	}
526 526
 
527
-    public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
528
-        $pages = self::get_pages();
527
+	public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
528
+		$pages = self::get_pages();
529 529
 		$selected = self::get_post_param( $field_name, $page_id, 'absint' );
530
-    ?>
530
+	?>
531 531
         <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" class="frm-pages-dropdown">
532 532
             <option value=""> </option>
533 533
             <?php foreach ( $pages as $page ) { ?>
@@ -537,107 +537,107 @@  discard block
 block discarded – undo
537 537
             <?php } ?>
538 538
         </select>
539 539
     <?php
540
-    }
540
+	}
541 541
 
542 542
 	public static function post_edit_link( $post_id ) {
543
-        $post = get_post($post_id);
544
-        if ( $post ) {
545
-            return '<a href="'. esc_url(admin_url('post.php') .'?post='. $post_id .'&action=edit') .'">'. self::truncate($post->post_title, 50) .'</a>';
546
-        }
547
-        return '';
548
-    }
543
+		$post = get_post($post_id);
544
+		if ( $post ) {
545
+			return '<a href="'. esc_url(admin_url('post.php') .'?post='. $post_id .'&action=edit') .'">'. self::truncate($post->post_title, 50) .'</a>';
546
+		}
547
+		return '';
548
+	}
549 549
 
550 550
 	public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
551
-    ?>
551
+	?>
552 552
         <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" <?php
553
-            echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
554
-            ?> class="frm_multiselect">
553
+			echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
554
+			?> class="frm_multiselect">
555 555
             <?php self::roles_options($capability); ?>
556 556
         </select>
557 557
     <?php
558
-    }
558
+	}
559 559
 
560 560
 	public static function roles_options( $capability ) {
561
-        global $frm_vars;
562
-        if ( isset($frm_vars['editable_roles']) ) {
563
-            $editable_roles = $frm_vars['editable_roles'];
564
-        } else {
565
-            $editable_roles = get_editable_roles();
566
-            $frm_vars['editable_roles'] = $editable_roles;
567
-        }
568
-
569
-        foreach ( $editable_roles as $role => $details ) {
570
-            $name = translate_user_role($details['name'] ); ?>
561
+		global $frm_vars;
562
+		if ( isset($frm_vars['editable_roles']) ) {
563
+			$editable_roles = $frm_vars['editable_roles'];
564
+		} else {
565
+			$editable_roles = get_editable_roles();
566
+			$frm_vars['editable_roles'] = $editable_roles;
567
+		}
568
+
569
+		foreach ( $editable_roles as $role => $details ) {
570
+			$name = translate_user_role($details['name'] ); ?>
571 571
         <option value="<?php echo esc_attr($role) ?>" <?php echo in_array($role, (array) $capability) ? ' selected="selected"' : ''; ?>><?php echo esc_attr($name) ?> </option>
572 572
 <?php
573
-            unset($role, $details);
574
-        }
575
-    }
573
+			unset($role, $details);
574
+		}
575
+	}
576 576
 
577 577
 	public static function frm_capabilities( $type = 'auto' ) {
578
-        $cap = array(
579
-            'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
580
-            'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
581
-            'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
582
-            'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
583
-            'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
584
-            'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
585
-        );
578
+		$cap = array(
579
+			'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
580
+			'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
581
+			'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
582
+			'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
583
+			'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
584
+			'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
585
+		);
586 586
 
587 587
 		if ( ! self::pro_is_installed() && 'pro' != $type ) {
588
-            return $cap;
589
-        }
588
+			return $cap;
589
+		}
590 590
 
591
-        $cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
592
-        $cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
593
-        $cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
594
-        $cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
591
+		$cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
592
+		$cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
593
+		$cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
594
+		$cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
595 595
 
596
-        return $cap;
597
-    }
596
+		return $cap;
597
+	}
598 598
 
599 599
 	public static function user_has_permission( $needed_role ) {
600
-        if ( $needed_role == '-1' ) {
601
-            return false;
600
+		if ( $needed_role == '-1' ) {
601
+			return false;
602 602
 		}
603 603
 
604
-        // $needed_role will be equal to blank if "Logged-in users" is selected
605
-        if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
606
-            return true;
607
-        }
604
+		// $needed_role will be equal to blank if "Logged-in users" is selected
605
+		if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
606
+			return true;
607
+		}
608 608
 
609
-        $roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
610
-        foreach ( $roles as $role ) {
609
+		$roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
610
+		foreach ( $roles as $role ) {
611 611
 			if ( current_user_can( $role ) ) {
612
-        		return true;
612
+				return true;
613 613
 			}
614
-        	if ( $role == $needed_role ) {
615
-        		break;
614
+			if ( $role == $needed_role ) {
615
+				break;
616 616
 			}
617
-        }
618
-        return false;
619
-    }
620
-
621
-    /**
622
-     * Make sure administrators can see Formidable menu
623
-     *
624
-     * @since 2.0
625
-     */
626
-    public static function maybe_add_permissions() {
617
+		}
618
+		return false;
619
+	}
620
+
621
+	/**
622
+	 * Make sure administrators can see Formidable menu
623
+	 *
624
+	 * @since 2.0
625
+	 */
626
+	public static function maybe_add_permissions() {
627 627
 		self::force_capability( 'frm_view_entries' );
628 628
 
629
-        if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
630
-            return;
631
-        }
629
+		if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
630
+			return;
631
+		}
632 632
 
633 633
 		$user_id = get_current_user_id();
634 634
 		$user = new WP_User( $user_id );
635
-        $frm_roles = self::frm_capabilities();
636
-        foreach ( $frm_roles as $frm_role => $frm_role_description ) {
635
+		$frm_roles = self::frm_capabilities();
636
+		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
637 637
 			$user->add_cap( $frm_role );
638
-            unset($frm_role, $frm_role_description);
639
-        }
640
-    }
638
+			unset($frm_role, $frm_role_description);
639
+		}
640
+	}
641 641
 
642 642
 	/**
643 643
 	 * Make sure admins have permission to see the menu items
@@ -653,28 +653,28 @@  discard block
 block discarded – undo
653 653
 		}
654 654
 	}
655 655
 
656
-    /**
657
-     * Check if the user has permision for action.
658
-     * Return permission message and stop the action if no permission
659
-     * @since 2.0
660
-     * @param string $permission
661
-     */
656
+	/**
657
+	 * Check if the user has permision for action.
658
+	 * Return permission message and stop the action if no permission
659
+	 * @since 2.0
660
+	 * @param string $permission
661
+	 */
662 662
 	public static function permission_check( $permission, $show_message = 'show' ) {
663
-        $permission_error = self::permission_nonce_error($permission);
664
-        if ( $permission_error !== false ) {
665
-            if ( 'hide' == $show_message ) {
666
-                $permission_error = '';
667
-            }
668
-            wp_die($permission_error);
669
-        }
670
-    }
671
-
672
-    /**
673
-     * Check user permission and nonce
674
-     * @since 2.0
675
-     * @param string $permission
676
-     * @return false|string The permission message or false if allowed
677
-     */
663
+		$permission_error = self::permission_nonce_error($permission);
664
+		if ( $permission_error !== false ) {
665
+			if ( 'hide' == $show_message ) {
666
+				$permission_error = '';
667
+			}
668
+			wp_die($permission_error);
669
+		}
670
+	}
671
+
672
+	/**
673
+	 * Check user permission and nonce
674
+	 * @since 2.0
675
+	 * @param string $permission
676
+	 * @return false|string The permission message or false if allowed
677
+	 */
678 678
 	public static function permission_nonce_error( $permission, $nonce_name = '', $nonce = '' ) {
679 679
 		if ( ! empty( $permission ) && ! current_user_can( $permission ) && ! current_user_can( 'administrator' ) ) {
680 680
 			$frm_settings = self::get_settings();
@@ -682,75 +682,75 @@  discard block
 block discarded – undo
682 682
 		}
683 683
 
684 684
 		$error = false;
685
-        if ( empty($nonce_name) ) {
686
-            return $error;
687
-        }
685
+		if ( empty($nonce_name) ) {
686
+			return $error;
687
+		}
688 688
 
689
-        if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
690
-            $frm_settings = self::get_settings();
691
-            $error = $frm_settings->admin_permission;
692
-        }
689
+		if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
690
+			$frm_settings = self::get_settings();
691
+			$error = $frm_settings->admin_permission;
692
+		}
693 693
 
694
-        return $error;
695
-    }
694
+		return $error;
695
+	}
696 696
 
697
-    public static function checked( $values, $current ) {
697
+	public static function checked( $values, $current ) {
698 698
 		if ( self::check_selected( $values, $current ) ) {
699
-            echo ' checked="checked"';
699
+			echo ' checked="checked"';
700 700
 		}
701
-    }
701
+	}
702 702
 
703 703
 	public static function check_selected( $values, $current ) {
704
-        $values = self::recursive_function_map( $values, 'trim' );
705
-        $current = trim($current);
706
-
707
-        return ( is_array($values) && in_array($current, $values) ) || ( ! is_array($values) && $values == $current );
708
-    }
709
-
710
-    /**
711
-    * Check if current field option is an "other" option
712
-    *
713
-    * @since 2.0
714
-    *
715
-    * @param string $opt_key
716
-    * @return boolean Returns true if current field option is an "Other" option
717
-    */
718
-    public static function is_other_opt( $opt_key ) {
719
-        _deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::is_other_opt' );
720
-        return FrmFieldsHelper::is_other_opt( $opt_key );
721
-    }
722
-
723
-    /**
724
-    * Get value that belongs in "Other" text box
725
-    *
726
-    * @since 2.0
727
-    *
728
-    * @param string $opt_key
729
-    * @param array $field
730
-    * @return string $other_val
731
-    */
732
-    public static function get_other_val( $opt_key, $field, $parent = false, $pointer = false ) {
704
+		$values = self::recursive_function_map( $values, 'trim' );
705
+		$current = trim($current);
706
+
707
+		return ( is_array($values) && in_array($current, $values) ) || ( ! is_array($values) && $values == $current );
708
+	}
709
+
710
+	/**
711
+	 * Check if current field option is an "other" option
712
+	 *
713
+	 * @since 2.0
714
+	 *
715
+	 * @param string $opt_key
716
+	 * @return boolean Returns true if current field option is an "Other" option
717
+	 */
718
+	public static function is_other_opt( $opt_key ) {
719
+		_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::is_other_opt' );
720
+		return FrmFieldsHelper::is_other_opt( $opt_key );
721
+	}
722
+
723
+	/**
724
+	 * Get value that belongs in "Other" text box
725
+	 *
726
+	 * @since 2.0
727
+	 *
728
+	 * @param string $opt_key
729
+	 * @param array $field
730
+	 * @return string $other_val
731
+	 */
732
+	public static function get_other_val( $opt_key, $field, $parent = false, $pointer = false ) {
733 733
 		_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::get_other_val' );
734 734
 		return FrmFieldsHelper::get_other_val( compact( 'opt_key', 'field', 'parent', 'pointer' ) );
735
-    }
736
-
737
-    /**
738
-    * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
739
-    * Intended for front-end use
740
-    *
741
-    * @since 2.0
742
-    *
743
-    * @param array $field
744
-    * @param boolean $other_opt
745
-    * @param string $checked
746
-    * @param array $args should include opt_key and field name
747
-    * @return string $other_val
748
-    */
749
-    public static function prepare_other_input( $field, &$other_opt, &$checked, $args = array() ) {
735
+	}
736
+
737
+	/**
738
+	 * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
739
+	 * Intended for front-end use
740
+	 *
741
+	 * @since 2.0
742
+	 *
743
+	 * @param array $field
744
+	 * @param boolean $other_opt
745
+	 * @param string $checked
746
+	 * @param array $args should include opt_key and field name
747
+	 * @return string $other_val
748
+	 */
749
+	public static function prepare_other_input( $field, &$other_opt, &$checked, $args = array() ) {
750 750
 		_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::prepare_other_input' );
751 751
 		$args['field'] = $field;
752 752
 		return FrmFieldsHelper::prepare_other_input( $args, $other_opt, $checked );
753
-    }
753
+	}
754 754
 
755 755
 	public static function recursive_function_map( $value, $function ) {
756 756
 		if ( is_array( $value ) ) {
@@ -780,334 +780,334 @@  discard block
 block discarded – undo
780 780
 		return (bool) count( array_filter( array_keys( $array ), 'is_string' ) );
781 781
 	}
782 782
 
783
-    /**
784
-     * Flatten a multi-dimensional array
785
-     */
783
+	/**
784
+	 * Flatten a multi-dimensional array
785
+	 */
786 786
 	public static function array_flatten( $array, $keys = 'keep' ) {
787
-        $return = array();
788
-        foreach ( $array as $key => $value ) {
789
-            if ( is_array($value) ) {
787
+		$return = array();
788
+		foreach ( $array as $key => $value ) {
789
+			if ( is_array($value) ) {
790 790
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
791
-            } else {
791
+			} else {
792 792
 				if ( $keys == 'keep' ) {
793 793
 					$return[ $key ] = $value;
794 794
 				} else {
795 795
 					$return[] = $value;
796 796
 				}
797
-            }
798
-        }
799
-        return $return;
800
-    }
801
-
802
-    public static function esc_textarea( $text ) {
803
-        $safe_text = str_replace('&quot;', '"', $text);
804
-        $safe_text = htmlspecialchars( $safe_text, ENT_NOQUOTES );
805
-    	return apply_filters( 'esc_textarea', $safe_text, $text );
806
-    }
807
-
808
-    /**
809
-     * Add auto paragraphs to text areas
810
-     * @since 2.0
811
-     */
797
+			}
798
+		}
799
+		return $return;
800
+	}
801
+
802
+	public static function esc_textarea( $text ) {
803
+		$safe_text = str_replace('&quot;', '"', $text);
804
+		$safe_text = htmlspecialchars( $safe_text, ENT_NOQUOTES );
805
+		return apply_filters( 'esc_textarea', $safe_text, $text );
806
+	}
807
+
808
+	/**
809
+	 * Add auto paragraphs to text areas
810
+	 * @since 2.0
811
+	 */
812 812
 	public static function use_wpautop( $content ) {
813
-        if ( apply_filters('frm_use_wpautop', true) ) {
814
-            $content = wpautop(str_replace( '<br>', '<br />', $content));
815
-        }
816
-        return $content;
817
-    }
813
+		if ( apply_filters('frm_use_wpautop', true) ) {
814
+			$content = wpautop(str_replace( '<br>', '<br />', $content));
815
+		}
816
+		return $content;
817
+	}
818 818
 
819 819
 	public static function replace_quotes( $val ) {
820
-        //Replace double quotes
820
+		//Replace double quotes
821 821
 		$val = str_replace( array( '&#8220;', '&#8221;', '&#8243;' ), '"', $val );
822
-        //Replace single quotes
823
-        $val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
824
-        return $val;
825
-    }
826
-
827
-    /**
828
-     * @since 2.0
829
-     * @return string The base Google APIS url for the current version of jQuery UI
830
-     */
831
-    public static function jquery_ui_base_url() {
832
-        $url = 'http'. ( is_ssl() ? 's' : '' ) .'://ajax.googleapis.com/ajax/libs/jqueryui/'. self::script_version('jquery-ui-core');
833
-        $url = apply_filters('frm_jquery_ui_base_url', $url);
834
-        return $url;
835
-    }
836
-
837
-    /**
838
-     * @param string $handle
839
-     */
822
+		//Replace single quotes
823
+		$val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
824
+		return $val;
825
+	}
826
+
827
+	/**
828
+	 * @since 2.0
829
+	 * @return string The base Google APIS url for the current version of jQuery UI
830
+	 */
831
+	public static function jquery_ui_base_url() {
832
+		$url = 'http'. ( is_ssl() ? 's' : '' ) .'://ajax.googleapis.com/ajax/libs/jqueryui/'. self::script_version('jquery-ui-core');
833
+		$url = apply_filters('frm_jquery_ui_base_url', $url);
834
+		return $url;
835
+	}
836
+
837
+	/**
838
+	 * @param string $handle
839
+	 */
840 840
 	public static function script_version( $handle ) {
841
-        global $wp_scripts;
842
-    	if ( ! $wp_scripts ) {
843
-    	    return false;
844
-    	}
841
+		global $wp_scripts;
842
+		if ( ! $wp_scripts ) {
843
+			return false;
844
+		}
845 845
 
846
-        $ver = 0;
846
+		$ver = 0;
847 847
 
848
-        if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
849
-            return $ver;
850
-        }
848
+		if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
849
+			return $ver;
850
+		}
851 851
 
852
-        $query = $wp_scripts->registered[ $handle ];
853
-    	if ( is_object( $query ) ) {
854
-    	    $ver = $query->ver;
855
-    	}
852
+		$query = $wp_scripts->registered[ $handle ];
853
+		if ( is_object( $query ) ) {
854
+			$ver = $query->ver;
855
+		}
856 856
 
857
-    	return $ver;
858
-    }
857
+		return $ver;
858
+	}
859 859
 
860 860
 	public static function js_redirect( $url ) {
861 861
 		return '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>';
862
-    }
862
+	}
863 863
 
864 864
 	public static function get_user_id_param( $user_id ) {
865
-        if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
866
-            return $user_id;
867
-        }
865
+		if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
866
+			return $user_id;
867
+		}
868 868
 
869 869
 		if ( $user_id == 'current' ) {
870
-            $user_ID = get_current_user_id();
871
-            $user_id = $user_ID;
870
+			$user_ID = get_current_user_id();
871
+			$user_id = $user_ID;
872 872
 		} else {
873
-            if ( is_email($user_id) ) {
874
-                $user = get_user_by('email', $user_id);
875
-            } else {
876
-                $user = get_user_by('login', $user_id);
877
-            }
873
+			if ( is_email($user_id) ) {
874
+				$user = get_user_by('email', $user_id);
875
+			} else {
876
+				$user = get_user_by('login', $user_id);
877
+			}
878 878
 
879
-            if ( $user ) {
880
-                $user_id = $user->ID;
881
-            }
882
-            unset($user);
883
-        }
879
+			if ( $user ) {
880
+				$user_id = $user->ID;
881
+			}
882
+			unset($user);
883
+		}
884 884
 
885
-        return $user_id;
886
-    }
885
+		return $user_id;
886
+	}
887 887
 
888 888
 	public static function get_file_contents( $filename, $atts = array() ) {
889
-        if ( ! is_file($filename) ) {
890
-            return false;
891
-        }
892
-
893
-        extract($atts);
894
-        ob_start();
895
-        include($filename);
896
-        $contents = ob_get_contents();
897
-        ob_end_clean();
898
-        return $contents;
899
-    }
900
-
901
-    /**
902
-     * @param string $table_name
903
-     * @param string $column
904
-     */
905
-    public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 6 ) {
906
-        global $wpdb;
907
-
908
-        $key = '';
909
-
910
-        if ( ! empty( $name ) ) {
911
-            $key = sanitize_key($name);
912
-        }
889
+		if ( ! is_file($filename) ) {
890
+			return false;
891
+		}
892
+
893
+		extract($atts);
894
+		ob_start();
895
+		include($filename);
896
+		$contents = ob_get_contents();
897
+		ob_end_clean();
898
+		return $contents;
899
+	}
900
+
901
+	/**
902
+	 * @param string $table_name
903
+	 * @param string $column
904
+	 */
905
+	public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 6 ) {
906
+		global $wpdb;
907
+
908
+		$key = '';
909
+
910
+		if ( ! empty( $name ) ) {
911
+			$key = sanitize_key($name);
912
+		}
913 913
 
914 914
 		if ( empty( $key ) ) {
915
-            $max_slug_value = pow(36, $num_chars);
916
-            $min_slug_value = 37; // we want to have at least 2 characters in the slug
917
-            $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
918
-        }
915
+			$max_slug_value = pow(36, $num_chars);
916
+			$min_slug_value = 37; // we want to have at least 2 characters in the slug
917
+			$key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
918
+		}
919 919
 
920 920
 		if ( is_numeric($key) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
921
-            $key = $key .'a';
922
-        }
921
+			$key = $key .'a';
922
+		}
923 923
 
924 924
 		$key_check = FrmDb::get_var( $table_name, array( $column => $key, 'ID !' => $id ), $column );
925 925
 
926
-        if ( $key_check || is_numeric($key_check) ) {
927
-            $suffix = 2;
926
+		if ( $key_check || is_numeric($key_check) ) {
927
+			$suffix = 2;
928 928
 			do {
929 929
 				$alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
930 930
 				$key_check = FrmDb::get_var( $table_name, array( $column => $alt_post_name, 'ID !' => $id ), $column );
931 931
 				$suffix++;
932 932
 			} while ($key_check || is_numeric($key_check));
933 933
 			$key = $alt_post_name;
934
-        }
935
-        return $key;
936
-    }
937
-
938
-    /**
939
-     * Editing a Form or Entry
940
-     * @param string $table
941
-     * @return bool|array
942
-     */
943
-    public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
944
-        if ( ! $record ) {
945
-            return false;
946
-        }
947
-
948
-        global $frm_vars;
949
-
950
-        if ( empty($post_values) ) {
951
-            $post_values = stripslashes_deep($_POST);
952
-        }
934
+		}
935
+		return $key;
936
+	}
937
+
938
+	/**
939
+	 * Editing a Form or Entry
940
+	 * @param string $table
941
+	 * @return bool|array
942
+	 */
943
+	public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
944
+		if ( ! $record ) {
945
+			return false;
946
+		}
947
+
948
+		global $frm_vars;
949
+
950
+		if ( empty($post_values) ) {
951
+			$post_values = stripslashes_deep($_POST);
952
+		}
953 953
 
954 954
 		$values = array( 'id' => $record->id, 'fields' => array() );
955 955
 
956 956
 		foreach ( array( 'name', 'description' ) as $var ) {
957
-            $default_val = isset($record->{$var}) ? $record->{$var} : '';
958
-            $values[ $var ] = self::get_param( $var, $default_val );
959
-            unset($var, $default_val);
960
-        }
961
-
962
-        $values['description'] = self::use_wpautop($values['description']);
963
-        $frm_settings = self::get_settings();
964
-        $is_form_builder = self::is_admin_page('formidable' );
965
-
966
-        foreach ( (array) $fields as $field ) {
967
-            // Make sure to filter default values (for placeholder text), but not on the form builder page
968
-            if ( ! $is_form_builder ) {
969
-                $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
970
-            }
957
+			$default_val = isset($record->{$var}) ? $record->{$var} : '';
958
+			$values[ $var ] = self::get_param( $var, $default_val );
959
+			unset($var, $default_val);
960
+		}
961
+
962
+		$values['description'] = self::use_wpautop($values['description']);
963
+		$frm_settings = self::get_settings();
964
+		$is_form_builder = self::is_admin_page('formidable' );
965
+
966
+		foreach ( (array) $fields as $field ) {
967
+			// Make sure to filter default values (for placeholder text), but not on the form builder page
968
+			if ( ! $is_form_builder ) {
969
+				$field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
970
+			}
971 971
 			$parent_form_id = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
972 972
 			self::fill_field_defaults($field, $record, $values, compact('default', 'post_values', 'frm_settings', 'parent_form_id' ) );
973
-        }
973
+		}
974 974
 
975
-        self::fill_form_opts($record, $table, $post_values, $values);
975
+		self::fill_form_opts($record, $table, $post_values, $values);
976 976
 
977
-        if ( $table == 'entries' ) {
978
-            $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
979
-        } else if ( $table == 'forms' ) {
980
-            $values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
981
-        }
977
+		if ( $table == 'entries' ) {
978
+			$values = FrmEntriesHelper::setup_edit_vars( $values, $record );
979
+		} else if ( $table == 'forms' ) {
980
+			$values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
981
+		}
982 982
 
983
-        return $values;
984
-    }
983
+		return $values;
984
+	}
985 985
 
986 986
 	private static function fill_field_defaults( $field, $record, array &$values, $args ) {
987
-        $post_values = $args['post_values'];
988
-
989
-        if ( $args['default'] ) {
990
-            $meta_value = $field->default_value;
991
-        } else {
992
-            if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
993
-                if ( ! isset($field->field_options['custom_field']) ) {
994
-                    $field->field_options['custom_field'] = '';
995
-                }
987
+		$post_values = $args['post_values'];
988
+
989
+		if ( $args['default'] ) {
990
+			$meta_value = $field->default_value;
991
+		} else {
992
+			if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
993
+				if ( ! isset($field->field_options['custom_field']) ) {
994
+					$field->field_options['custom_field'] = '';
995
+				}
996 996
 				$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 ) );
997
-            } else {
997
+			} else {
998 998
 				$meta_value = FrmEntryMeta::get_meta_value( $record, $field->id );
999
-            }
1000
-        }
1001
-
1002
-        $field_type = isset( $post_values['field_options'][ 'type_'. $field->id ] ) ? $post_values['field_options'][ 'type_'. $field->id ] : $field->type;
1003
-        $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1004
-
1005
-        $field_array = array(
1006
-            'id'            => $field->id,
1007
-            'value'         => $new_value,
1008
-            'default_value' => $field->default_value,
1009
-            'name'          => $field->name,
1010
-            'description'   => $field->description,
1011
-            'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1012
-            'options'       => $field->options,
1013
-            'required'      => $field->required,
1014
-            'field_key'     => $field->field_key,
1015
-            'field_order'   => $field->field_order,
1016
-            'form_id'       => $field->form_id,
999
+			}
1000
+		}
1001
+
1002
+		$field_type = isset( $post_values['field_options'][ 'type_'. $field->id ] ) ? $post_values['field_options'][ 'type_'. $field->id ] : $field->type;
1003
+		$new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1004
+
1005
+		$field_array = array(
1006
+			'id'            => $field->id,
1007
+			'value'         => $new_value,
1008
+			'default_value' => $field->default_value,
1009
+			'name'          => $field->name,
1010
+			'description'   => $field->description,
1011
+			'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1012
+			'options'       => $field->options,
1013
+			'required'      => $field->required,
1014
+			'field_key'     => $field->field_key,
1015
+			'field_order'   => $field->field_order,
1016
+			'form_id'       => $field->form_id,
1017 1017
 			'parent_form_id' => $args['parent_form_id'],
1018
-        );
1018
+		);
1019 1019
 
1020
-        $args['field_type'] = $field_type;
1021
-        self::fill_field_opts($field, $field_array, $args);
1020
+		$args['field_type'] = $field_type;
1021
+		self::fill_field_opts($field, $field_array, $args);
1022 1022
 
1023
-        $field_array = apply_filters('frm_setup_edit_fields_vars', $field_array, $field, $values['id']);
1023
+		$field_array = apply_filters('frm_setup_edit_fields_vars', $field_array, $field, $values['id']);
1024 1024
 
1025
-        if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1026
-            $field_array['unique_msg'] = '';
1027
-        }
1025
+		if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1026
+			$field_array['unique_msg'] = '';
1027
+		}
1028 1028
 
1029
-        $field_array = array_merge( $field->field_options, $field_array );
1029
+		$field_array = array_merge( $field->field_options, $field_array );
1030 1030
 
1031
-        $values['fields'][ $field->id ] = $field_array;
1032
-    }
1031
+		$values['fields'][ $field->id ] = $field_array;
1032
+	}
1033 1033
 
1034 1034
 	private static function fill_field_opts( $field, array &$field_array, $args ) {
1035
-        $post_values = $args['post_values'];
1036
-        $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1037
-
1038
-        foreach ( $opt_defaults as $opt => $default_opt ) {
1039
-            $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 );
1040
-            if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1041
-                $field_array[ $opt ] = $args['frm_settings']->blank_msg;
1042
-            } else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1043
-                if ( $args['field_type'] == 'captcha' ) {
1044
-                    $field_array[ $opt ] = $args['frm_settings']->re_msg;
1045
-                } else {
1046
-                    $field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1047
-                }
1048
-            }
1049
-        }
1050
-
1051
-        if ( $field_array['custom_html'] == '' ) {
1052
-            $field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1053
-        }
1054
-    }
1055
-
1056
-    /**
1057
-     * @param string $table
1058
-     */
1035
+		$post_values = $args['post_values'];
1036
+		$opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1037
+
1038
+		foreach ( $opt_defaults as $opt => $default_opt ) {
1039
+			$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 );
1040
+			if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1041
+				$field_array[ $opt ] = $args['frm_settings']->blank_msg;
1042
+			} else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1043
+				if ( $args['field_type'] == 'captcha' ) {
1044
+					$field_array[ $opt ] = $args['frm_settings']->re_msg;
1045
+				} else {
1046
+					$field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1047
+				}
1048
+			}
1049
+		}
1050
+
1051
+		if ( $field_array['custom_html'] == '' ) {
1052
+			$field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1053
+		}
1054
+	}
1055
+
1056
+	/**
1057
+	 * @param string $table
1058
+	 */
1059 1059
 	private static function fill_form_opts( $record, $table, $post_values, array &$values ) {
1060
-        if ( $table == 'entries' ) {
1061
-            $form = $record->form_id;
1060
+		if ( $table == 'entries' ) {
1061
+			$form = $record->form_id;
1062 1062
 			FrmForm::maybe_get_form( $form );
1063
-        } else {
1064
-            $form = $record;
1065
-        }
1063
+		} else {
1064
+			$form = $record;
1065
+		}
1066 1066
 
1067
-        if ( ! $form ) {
1068
-            return;
1069
-        }
1067
+		if ( ! $form ) {
1068
+			return;
1069
+		}
1070 1070
 
1071
-        $values['form_name'] = isset($record->form_id) ? $form->name : '';
1071
+		$values['form_name'] = isset($record->form_id) ? $form->name : '';
1072 1072
 		$values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
1073 1073
 
1074
-        if ( ! is_array($form->options) ) {
1075
-            return;
1076
-        }
1074
+		if ( ! is_array($form->options) ) {
1075
+			return;
1076
+		}
1077 1077
 
1078
-        foreach ( $form->options as $opt => $value ) {
1079
-            $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1080
-        }
1078
+		foreach ( $form->options as $opt => $value ) {
1079
+			$values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1080
+		}
1081 1081
 
1082
-        self::fill_form_defaults($post_values, $values);
1083
-    }
1082
+		self::fill_form_defaults($post_values, $values);
1083
+	}
1084 1084
 
1085
-    /**
1086
-     * Set to POST value or default
1087
-     */
1085
+	/**
1086
+	 * Set to POST value or default
1087
+	 */
1088 1088
 	private static function fill_form_defaults( $post_values, array &$values ) {
1089
-        $form_defaults = FrmFormsHelper::get_default_opts();
1089
+		$form_defaults = FrmFormsHelper::get_default_opts();
1090 1090
 
1091
-        foreach ( $form_defaults as $opt => $default ) {
1092
-            if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1091
+		foreach ( $form_defaults as $opt => $default ) {
1092
+			if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1093 1093
 				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1094
-            }
1094
+			}
1095 1095
 
1096
-            unset($opt, $defaut);
1097
-        }
1096
+			unset($opt, $defaut);
1097
+		}
1098 1098
 
1099
-        if ( ! isset($values['custom_style']) ) {
1100
-            $frm_settings = self::get_settings();
1099
+		if ( ! isset($values['custom_style']) ) {
1100
+			$frm_settings = self::get_settings();
1101 1101
 			$values['custom_style'] = ( $post_values && isset( $post_values['options']['custom_style'] ) ) ? absint( $_POST['options']['custom_style'] ) : ( $frm_settings->load_style != 'none' );
1102
-        }
1102
+		}
1103 1103
 
1104 1104
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1105
-            if ( ! isset( $values[ $h .'_html' ] ) ) {
1106
-                $values[ $h .'_html' ] = ( isset( $post_values['options'][ $h .'_html' ] ) ? $post_values['options'][ $h .'_html' ] : FrmFormsHelper::get_default_html( $h ) );
1107
-            }
1108
-            unset($h);
1109
-        }
1110
-    }
1105
+			if ( ! isset( $values[ $h .'_html' ] ) ) {
1106
+				$values[ $h .'_html' ] = ( isset( $post_values['options'][ $h .'_html' ] ) ? $post_values['options'][ $h .'_html' ] : FrmFormsHelper::get_default_html( $h ) );
1107
+			}
1108
+			unset($h);
1109
+		}
1110
+	}
1111 1111
 
1112 1112
 	public static function get_meta_value( $field_id, $entry ) {
1113 1113
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmEntryMeta::get_meta_value' );
@@ -1115,69 +1115,69 @@  discard block
 block discarded – undo
1115 1115
 	}
1116 1116
 
1117 1117
 	public static function insert_opt_html( $args ) {
1118
-        $class = '';
1119
-        if ( in_array( $args['type'], array( 'email', 'user_id', 'hidden', 'select', 'radio', 'checkbox', 'phone', 'text' ) ) ) {
1120
-            $class .= 'show_frm_not_email_to';
1121
-        }
1122
-    ?>
1118
+		$class = '';
1119
+		if ( in_array( $args['type'], array( 'email', 'user_id', 'hidden', 'select', 'radio', 'checkbox', 'phone', 'text' ) ) ) {
1120
+			$class .= 'show_frm_not_email_to';
1121
+		}
1122
+	?>
1123 1123
 <li>
1124 1124
     <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>
1125 1125
     <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>
1126 1126
     <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>
1127 1127
 </li>
1128 1128
     <?php
1129
-    }
1129
+	}
1130 1130
 
1131
-    public static function get_us_states() {
1132
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmFieldsHelper::get_us_states' );
1133
-        return FrmFieldsHelper::get_us_states();
1134
-    }
1131
+	public static function get_us_states() {
1132
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmFieldsHelper::get_us_states' );
1133
+		return FrmFieldsHelper::get_us_states();
1134
+	}
1135 1135
 
1136
-    public static function get_countries() {
1137
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmFieldsHelper::get_countries' );
1138
-        return FrmFieldsHelper::get_countries();
1139
-    }
1136
+	public static function get_countries() {
1137
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmFieldsHelper::get_countries' );
1138
+		return FrmFieldsHelper::get_countries();
1139
+	}
1140 1140
 
1141 1141
 	public static function truncate( $str, $length, $minword = 3, $continue = '...' ) {
1142
-        if ( is_array( $str ) ) {
1143
-            return;
1142
+		if ( is_array( $str ) ) {
1143
+			return;
1144 1144
 		}
1145 1145
 
1146
-        $length = (int) $length;
1146
+		$length = (int) $length;
1147 1147
 		$str = wp_strip_all_tags( $str );
1148 1148
 		$original_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $str ) );
1149 1149
 
1150 1150
 		if ( $length == 0 ) {
1151
-            return '';
1152
-        } else if ( $length <= 10 ) {
1151
+			return '';
1152
+		} else if ( $length <= 10 ) {
1153 1153
 			$sub = self::mb_function( array( 'mb_substr', 'substr' ), array( $str, 0, $length ) );
1154
-            return $sub . (($length < $original_len) ? $continue : '');
1155
-        }
1154
+			return $sub . (($length < $original_len) ? $continue : '');
1155
+		}
1156 1156
 
1157
-        $sub = '';
1158
-        $len = 0;
1157
+		$sub = '';
1158
+		$len = 0;
1159 1159
 
1160 1160
 		$words = self::mb_function( array( 'mb_split', 'explode' ), array( ' ', $str ) );
1161 1161
 
1162 1162
 		foreach ( $words as $word ) {
1163
-            $part = (($sub != '') ? ' ' : '') . $word;
1163
+			$part = (($sub != '') ? ' ' : '') . $word;
1164 1164
 			$total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1165
-            if ( $total_len > $length && str_word_count($sub) ) {
1166
-                break;
1167
-            }
1165
+			if ( $total_len > $length && str_word_count($sub) ) {
1166
+				break;
1167
+			}
1168 1168
 
1169
-            $sub .= $part;
1169
+			$sub .= $part;
1170 1170
 			$len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1171 1171
 
1172
-            if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1173
-                break;
1174
-            }
1172
+			if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1173
+				break;
1174
+			}
1175 1175
 
1176
-            unset($total_len, $word);
1177
-        }
1176
+			unset($total_len, $word);
1177
+		}
1178 1178
 
1179
-        return $sub . (($len < $original_len) ? $continue : '');
1180
-    }
1179
+		return $sub . (($len < $original_len) ? $continue : '');
1180
+	}
1181 1181
 
1182 1182
 	public static function mb_function( $function_names, $args ) {
1183 1183
 		$mb_function_name = $function_names[0];
@@ -1189,18 +1189,18 @@  discard block
 block discarded – undo
1189 1189
 	}
1190 1190
 
1191 1191
 	public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1192
-        if ( empty($date) ) {
1193
-            return $date;
1194
-        }
1192
+		if ( empty($date) ) {
1193
+			return $date;
1194
+		}
1195 1195
 
1196
-        if ( empty($date_format) ) {
1197
-            $date_format = get_option('date_format');
1198
-        }
1196
+		if ( empty($date_format) ) {
1197
+			$date_format = get_option('date_format');
1198
+		}
1199 1199
 
1200
-        if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1201
-            $frmpro_settings = new FrmProSettings();
1202
-            $date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1203
-        }
1200
+		if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1201
+			$frmpro_settings = new FrmProSettings();
1202
+			$date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1203
+		}
1204 1204
 
1205 1205
 		$formatted = self::get_localized_date( $date_format, $date );
1206 1206
 
@@ -1209,8 +1209,8 @@  discard block
 block discarded – undo
1209 1209
 			$formatted .= self::add_time_to_date( $time_format, $date );
1210 1210
 		}
1211 1211
 
1212
-        return $formatted;
1213
-    }
1212
+		return $formatted;
1213
+	}
1214 1214
 
1215 1215
 	private static function add_time_to_date( $time_format, $date ) {
1216 1216
 		if ( empty( $time_format ) ) {
@@ -1287,61 +1287,61 @@  discard block
 block discarded – undo
1287 1287
 		);
1288 1288
 	}
1289 1289
 
1290
-    /**
1291
-     * Added for < WP 4.0 compatability
1292
-     *
1293
-     * @since 1.07.10
1294
-     *
1295
-     * @param string $term The value to escape
1296
-     * @return string The escaped value
1297
-     */
1290
+	/**
1291
+	 * Added for < WP 4.0 compatability
1292
+	 *
1293
+	 * @since 1.07.10
1294
+	 *
1295
+	 * @param string $term The value to escape
1296
+	 * @return string The escaped value
1297
+	 */
1298 1298
 	public static function esc_like( $term ) {
1299
-        global $wpdb;
1300
-        if ( method_exists($wpdb, 'esc_like') ) {
1299
+		global $wpdb;
1300
+		if ( method_exists($wpdb, 'esc_like') ) {
1301 1301
 			// WP 4.0
1302
-            $term = $wpdb->esc_like( $term );
1303
-        } else {
1304
-            $term = like_escape( $term );
1305
-        }
1302
+			$term = $wpdb->esc_like( $term );
1303
+		} else {
1304
+			$term = like_escape( $term );
1305
+		}
1306 1306
 
1307
-        return $term;
1308
-    }
1307
+		return $term;
1308
+	}
1309 1309
 
1310
-    /**
1311
-     * @param string $order_query
1312
-     */
1310
+	/**
1311
+	 * @param string $order_query
1312
+	 */
1313 1313
 	public static function esc_order( $order_query ) {
1314
-        if ( empty($order_query) ) {
1315
-            return '';
1316
-        }
1317
-
1318
-        // remove ORDER BY before santizing
1319
-        $order_query = strtolower($order_query);
1320
-        if ( strpos($order_query, 'order by') !== false ) {
1321
-            $order_query = str_replace('order by', '', $order_query);
1322
-        }
1323
-
1324
-        $order_query = explode(' ', trim($order_query));
1325
-
1326
-        $order_fields = array(
1327
-            'id', 'form_key', 'name', 'description',
1328
-            'parent_form_id', 'logged_in', 'is_template',
1329
-            'default_template', 'status', 'created_at',
1330
-        );
1331
-
1332
-        $order = trim(trim(reset($order_query), ','));
1333
-        if ( ! in_array($order, $order_fields) ) {
1334
-            return '';
1335
-        }
1336
-
1337
-        $order_by = '';
1338
-        if ( count($order_query) > 1 ) {
1314
+		if ( empty($order_query) ) {
1315
+			return '';
1316
+		}
1317
+
1318
+		// remove ORDER BY before santizing
1319
+		$order_query = strtolower($order_query);
1320
+		if ( strpos($order_query, 'order by') !== false ) {
1321
+			$order_query = str_replace('order by', '', $order_query);
1322
+		}
1323
+
1324
+		$order_query = explode(' ', trim($order_query));
1325
+
1326
+		$order_fields = array(
1327
+			'id', 'form_key', 'name', 'description',
1328
+			'parent_form_id', 'logged_in', 'is_template',
1329
+			'default_template', 'status', 'created_at',
1330
+		);
1331
+
1332
+		$order = trim(trim(reset($order_query), ','));
1333
+		if ( ! in_array($order, $order_fields) ) {
1334
+			return '';
1335
+		}
1336
+
1337
+		$order_by = '';
1338
+		if ( count($order_query) > 1 ) {
1339 1339
 			$order_by = end( $order_query );
1340 1340
 			self::esc_order_by( $order_by );
1341
-        }
1341
+		}
1342 1342
 
1343
-        return ' ORDER BY '. $order . ' '. $order_by;
1344
-    }
1343
+		return ' ORDER BY '. $order . ' '. $order_by;
1344
+	}
1345 1345
 
1346 1346
 	/**
1347 1347
 	 * Make sure this is ordering by either ASC or DESC
@@ -1353,183 +1353,183 @@  discard block
 block discarded – undo
1353 1353
 		}
1354 1354
 	}
1355 1355
 
1356
-    /**
1357
-     * @param string $limit
1358
-     */
1356
+	/**
1357
+	 * @param string $limit
1358
+	 */
1359 1359
 	public static function esc_limit( $limit ) {
1360
-        if ( empty($limit) ) {
1361
-            return '';
1362
-        }
1363
-
1364
-        $limit = trim(str_replace(' limit', '', strtolower($limit)));
1365
-        if ( is_numeric($limit) ) {
1366
-            return ' LIMIT '. $limit;
1367
-        }
1368
-
1369
-        $limit = explode(',', trim($limit));
1370
-        foreach ( $limit as $k => $l ) {
1371
-            if ( is_numeric( $l ) ) {
1372
-                $limit[ $k ] = $l;
1373
-            }
1374
-        }
1375
-
1376
-        $limit = implode(',', $limit);
1377
-        return ' LIMIT '. $limit;
1378
-    }
1379
-
1380
-    /**
1381
-     * Get an array of values ready to go through $wpdb->prepare
1382
-     * @since 2.0
1383
-     */
1384
-    public static function prepare_array_values( $array, $type = '%s' ) {
1385
-        $placeholders = array_fill(0, count($array), $type);
1386
-        return implode(', ', $placeholders);
1387
-    }
1388
-
1389
-    public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
1390
-        if ( empty($where) ) {
1391
-            return '';
1392
-        }
1360
+		if ( empty($limit) ) {
1361
+			return '';
1362
+		}
1363
+
1364
+		$limit = trim(str_replace(' limit', '', strtolower($limit)));
1365
+		if ( is_numeric($limit) ) {
1366
+			return ' LIMIT '. $limit;
1367
+		}
1368
+
1369
+		$limit = explode(',', trim($limit));
1370
+		foreach ( $limit as $k => $l ) {
1371
+			if ( is_numeric( $l ) ) {
1372
+				$limit[ $k ] = $l;
1373
+			}
1374
+		}
1375
+
1376
+		$limit = implode(',', $limit);
1377
+		return ' LIMIT '. $limit;
1378
+	}
1379
+
1380
+	/**
1381
+	 * Get an array of values ready to go through $wpdb->prepare
1382
+	 * @since 2.0
1383
+	 */
1384
+	public static function prepare_array_values( $array, $type = '%s' ) {
1385
+		$placeholders = array_fill(0, count($array), $type);
1386
+		return implode(', ', $placeholders);
1387
+	}
1388
+
1389
+	public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
1390
+		if ( empty($where) ) {
1391
+			return '';
1392
+		}
1393 1393
 
1394 1394
 		if ( is_array( $where ) ) {
1395
-            global $wpdb;
1396
-            FrmDb::get_where_clause_and_values( $where, $starts_with );
1395
+			global $wpdb;
1396
+			FrmDb::get_where_clause_and_values( $where, $starts_with );
1397 1397
 			$where = $wpdb->prepare( $where['where'], $where['values'] );
1398 1398
 		} else {
1399
-            $where = $starts_with . $where;
1400
-        }
1399
+			$where = $starts_with . $where;
1400
+		}
1401 1401
 
1402
-        return $where;
1403
-    }
1402
+		return $where;
1403
+	}
1404 1404
 
1405
-    // Pagination Methods
1405
+	// Pagination Methods
1406 1406
 
1407
-    /**
1408
-     * @param integer $current_p
1409
-     */
1407
+	/**
1408
+	 * @param integer $current_p
1409
+	 */
1410 1410
 	public static function get_last_record_num( $r_count, $current_p, $p_size ) {
1411 1411
 		return ( ( $r_count < ( $current_p * $p_size ) ) ? $r_count : ( $current_p * $p_size ) );
1412 1412
 	}
1413 1413
 
1414
-    /**
1415
-     * @param integer $current_p
1416
-     */
1417
-    public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1418
-        if ( $current_p == 1 ) {
1419
-            return 1;
1420
-        } else {
1421
-            return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1422
-        }
1423
-    }
1424
-
1425
-    /**
1426
-     * @param string $table_name
1427
-     */
1428
-    public static function &getRecordCount( $where = '', $table_name ) {
1429
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmDb::get_count' );
1430
-        $count = FrmDb::get_count( $table_name, $where );
1431
-        return $count;
1432
-    }
1433
-
1434
-    public static function get_referer_info() {
1435
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::get_server_value' );
1436
-        return self::get_server_value('HTTP_REFERER');
1437
-    }
1414
+	/**
1415
+	 * @param integer $current_p
1416
+	 */
1417
+	public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1418
+		if ( $current_p == 1 ) {
1419
+			return 1;
1420
+		} else {
1421
+			return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1422
+		}
1423
+	}
1424
+
1425
+	/**
1426
+	 * @param string $table_name
1427
+	 */
1428
+	public static function &getRecordCount( $where = '', $table_name ) {
1429
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmDb::get_count' );
1430
+		$count = FrmDb::get_count( $table_name, $where );
1431
+		return $count;
1432
+	}
1433
+
1434
+	public static function get_referer_info() {
1435
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::get_server_value' );
1436
+		return self::get_server_value('HTTP_REFERER');
1437
+	}
1438 1438
 
1439 1439
 	/**
1440 1440
 	 * @return array
1441 1441
 	 */
1442 1442
 	public static function json_to_array( $json_vars ) {
1443
-        $vars = array();
1444
-        foreach ( $json_vars as $jv ) {
1445
-            $jv_name = explode('[', $jv['name']);
1446
-            $last = count($jv_name) - 1;
1447
-            foreach ( $jv_name as $p => $n ) {
1448
-                $name = trim($n, ']');
1449
-                if ( ! isset($l1) ) {
1450
-                    $l1 = $name;
1451
-                }
1452
-
1453
-                if ( ! isset($l2) ) {
1454
-                    $l2 = $name;
1455
-                }
1456
-
1457
-                if ( ! isset($l3) ) {
1458
-                    $l3 = $name;
1459
-                }
1460
-
1461
-                $this_val = ( $p == $last ) ? $jv['value'] : array();
1462
-
1463
-                switch ( $p ) {
1464
-                    case 0:
1465
-                        $l1 = $name;
1466
-                        self::add_value_to_array( $name, $l1, $this_val, $vars );
1467
-                    break;
1468
-
1469
-                    case 1:
1470
-                        $l2 = $name;
1471
-                        self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1472
-                    break;
1473
-
1474
-                    case 2:
1475
-                        $l3 = $name;
1476
-                        self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1477
-                    break;
1478
-
1479
-                    case 3:
1480
-                        $l4 = $name;
1481
-                        self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1482
-                    break;
1483
-                }
1484
-
1485
-                unset($this_val, $n);
1486
-            }
1487
-
1488
-            unset($last, $jv);
1489
-        }
1490
-
1491
-        return $vars;
1492
-    }
1493
-
1494
-    /**
1495
-     * @param string $name
1496
-     * @param string $l1
1497
-     */
1498
-    public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1499
-        if ( $name == '' ) {
1500
-            $vars[] = $val;
1501
-        } else if ( ! isset( $vars[ $l1 ] ) ) {
1502
-            $vars[ $l1 ] = $val;
1503
-        }
1504
-    }
1443
+		$vars = array();
1444
+		foreach ( $json_vars as $jv ) {
1445
+			$jv_name = explode('[', $jv['name']);
1446
+			$last = count($jv_name) - 1;
1447
+			foreach ( $jv_name as $p => $n ) {
1448
+				$name = trim($n, ']');
1449
+				if ( ! isset($l1) ) {
1450
+					$l1 = $name;
1451
+				}
1452
+
1453
+				if ( ! isset($l2) ) {
1454
+					$l2 = $name;
1455
+				}
1456
+
1457
+				if ( ! isset($l3) ) {
1458
+					$l3 = $name;
1459
+				}
1460
+
1461
+				$this_val = ( $p == $last ) ? $jv['value'] : array();
1462
+
1463
+				switch ( $p ) {
1464
+					case 0:
1465
+						$l1 = $name;
1466
+						self::add_value_to_array( $name, $l1, $this_val, $vars );
1467
+					break;
1468
+
1469
+					case 1:
1470
+						$l2 = $name;
1471
+						self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1472
+					break;
1473
+
1474
+					case 2:
1475
+						$l3 = $name;
1476
+						self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1477
+					break;
1478
+
1479
+					case 3:
1480
+						$l4 = $name;
1481
+						self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1482
+					break;
1483
+				}
1484
+
1485
+				unset($this_val, $n);
1486
+			}
1487
+
1488
+			unset($last, $jv);
1489
+		}
1490
+
1491
+		return $vars;
1492
+	}
1493
+
1494
+	/**
1495
+	 * @param string $name
1496
+	 * @param string $l1
1497
+	 */
1498
+	public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1499
+		if ( $name == '' ) {
1500
+			$vars[] = $val;
1501
+		} else if ( ! isset( $vars[ $l1 ] ) ) {
1502
+			$vars[ $l1 ] = $val;
1503
+		}
1504
+	}
1505 1505
 
1506 1506
 	public static function maybe_add_tooltip( $name, $class = 'closed', $form_name = '' ) {
1507
-        $tooltips = array(
1508
-            'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1509
-            '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' ),
1510
-            'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1511
-            'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1512
-            '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' ),
1513
-            'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1514
-            '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() ) ),
1515
-        );
1516
-
1517
-        if ( ! isset( $tooltips[ $name ] ) ) {
1518
-            return;
1519
-        }
1520
-
1521
-        if ( 'open' == $class ) {
1522
-            echo ' frm_help"';
1523
-        } else {
1524
-            echo ' class="frm_help"';
1525
-        }
1526
-
1527
-        echo ' title="'. esc_attr( $tooltips[ $name ] );
1528
-
1529
-        if ( 'open' != $class ) {
1530
-            echo '"';
1531
-        }
1532
-    }
1507
+		$tooltips = array(
1508
+			'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1509
+			'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' ),
1510
+			'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1511
+			'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1512
+			'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' ),
1513
+			'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1514
+			'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() ) ),
1515
+		);
1516
+
1517
+		if ( ! isset( $tooltips[ $name ] ) ) {
1518
+			return;
1519
+		}
1520
+
1521
+		if ( 'open' == $class ) {
1522
+			echo ' frm_help"';
1523
+		} else {
1524
+			echo ' class="frm_help"';
1525
+		}
1526
+
1527
+		echo ' title="'. esc_attr( $tooltips[ $name ] );
1528
+
1529
+		if ( 'open' != $class ) {
1530
+			echo '"';
1531
+		}
1532
+	}
1533 1533
 
1534 1534
 	/**
1535 1535
 	 * Add the current_page class to that page in the form nav
@@ -1545,35 +1545,35 @@  discard block
 block discarded – undo
1545 1545
 		}
1546 1546
 	}
1547 1547
 
1548
-    /**
1549
-     * Prepare and json_encode post content
1550
-     *
1551
-     * @since 2.0
1552
-     *
1553
-     * @param array $post_content
1554
-     * @return string $post_content ( json encoded array )
1555
-     */
1556
-    public static function prepare_and_encode( $post_content ) {
1557
-        //Loop through array to strip slashes and add only the needed ones
1548
+	/**
1549
+	 * Prepare and json_encode post content
1550
+	 *
1551
+	 * @since 2.0
1552
+	 *
1553
+	 * @param array $post_content
1554
+	 * @return string $post_content ( json encoded array )
1555
+	 */
1556
+	public static function prepare_and_encode( $post_content ) {
1557
+		//Loop through array to strip slashes and add only the needed ones
1558 1558
 		foreach ( $post_content as $key => $val ) {
1559 1559
 			// Replace problematic characters (like &quot;)
1560 1560
 			$val = str_replace( '&quot;', '"', $val );
1561 1561
 
1562 1562
 			self::prepare_action_slashes( $val, $key, $post_content );
1563
-            unset( $key, $val );
1564
-        }
1563
+			unset( $key, $val );
1564
+		}
1565 1565
 
1566
-        // json_encode the array
1567
-        $post_content = json_encode( $post_content );
1566
+		// json_encode the array
1567
+		$post_content = json_encode( $post_content );
1568 1568
 
1569
-	    // add extra slashes for \r\n since WP strips them
1569
+		// add extra slashes for \r\n since WP strips them
1570 1570
 		$post_content = str_replace( array( '\\r', '\\n', '\\u', '\\t' ), array( '\\\\r', '\\\\n', '\\\\u', '\\\\t' ), $post_content );
1571 1571
 
1572
-        // allow for &quot
1573
-	    $post_content = str_replace( '&quot;', '\\"', $post_content );
1572
+		// allow for &quot
1573
+		$post_content = str_replace( '&quot;', '\\"', $post_content );
1574 1574
 
1575
-        return $post_content;
1576
-    }
1575
+		return $post_content;
1576
+	}
1577 1577
 
1578 1578
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1579 1579
 		if ( ! isset( $post_content[ $key ] ) ) {
@@ -1641,64 +1641,64 @@  discard block
 block discarded – undo
1641 1641
 	}
1642 1642
 
1643 1643
 	public static function maybe_json_decode( $string ) {
1644
-        if ( is_array($string) ) {
1645
-            return $string;
1646
-        }
1644
+		if ( is_array($string) ) {
1645
+			return $string;
1646
+		}
1647 1647
 
1648
-        $new_string = json_decode($string, true);
1649
-        if ( function_exists('json_last_error') ) {
1648
+		$new_string = json_decode($string, true);
1649
+		if ( function_exists('json_last_error') ) {
1650 1650
 			// php 5.3+
1651
-            if ( json_last_error() == JSON_ERROR_NONE ) {
1652
-                $string = $new_string;
1653
-            }
1654
-        } else if ( isset($new_string) ) {
1651
+			if ( json_last_error() == JSON_ERROR_NONE ) {
1652
+				$string = $new_string;
1653
+			}
1654
+		} else if ( isset($new_string) ) {
1655 1655
 			// php < 5.3 fallback
1656
-            $string = $new_string;
1657
-        }
1658
-        return $string;
1659
-    }
1660
-
1661
-    /**
1662
-     * @since 1.07.10
1663
-     *
1664
-     * @param string $post_type The name of the post type that may need to be highlighted
1665
-     * @return echo The javascript to open and highlight the Formidable menu
1666
-     */
1656
+			$string = $new_string;
1657
+		}
1658
+		return $string;
1659
+	}
1660
+
1661
+	/**
1662
+	 * @since 1.07.10
1663
+	 *
1664
+	 * @param string $post_type The name of the post type that may need to be highlighted
1665
+	 * @return echo The javascript to open and highlight the Formidable menu
1666
+	 */
1667 1667
 	public static function maybe_highlight_menu( $post_type ) {
1668
-        global $post, $pagenow;
1668
+		global $post, $pagenow;
1669 1669
 
1670
-        if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1671
-            return;
1672
-        }
1670
+		if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1671
+			return;
1672
+		}
1673 1673
 
1674
-        if ( is_object($post) && $post->post_type != $post_type ) {
1675
-            return;
1676
-        }
1674
+		if ( is_object($post) && $post->post_type != $post_type ) {
1675
+			return;
1676
+		}
1677 1677
 
1678
-        self::load_admin_wide_js();
1679
-        echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1680
-    }
1678
+		self::load_admin_wide_js();
1679
+		echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1680
+	}
1681 1681
 
1682
-    /**
1683
-     * Load the JS file on non-Formidable pages in the admin area
1684
-     * @since 2.0
1685
-     */
1682
+	/**
1683
+	 * Load the JS file on non-Formidable pages in the admin area
1684
+	 * @since 2.0
1685
+	 */
1686 1686
 	public static function load_admin_wide_js( $load = true ) {
1687
-        $version = FrmAppHelper::plugin_version();
1687
+		$version = FrmAppHelper::plugin_version();
1688 1688
 		wp_register_script( 'formidable_admin_global', FrmAppHelper::plugin_url() . '/js/formidable_admin_global.js', array( 'jquery' ), $version );
1689 1689
 
1690
-        wp_localize_script( 'formidable_admin_global', 'frmGlobal', array(
1690
+		wp_localize_script( 'formidable_admin_global', 'frmGlobal', array(
1691 1691
 			'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
1692
-            'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1692
+			'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1693 1693
 			'url'          => FrmAppHelper::plugin_url(),
1694 1694
 			'loading'      => __( 'Loading&hellip;' ),
1695 1695
 			'nonce'        => wp_create_nonce( 'frm_ajax' ),
1696
-        ) );
1696
+		) );
1697 1697
 
1698 1698
 		if ( $load ) {
1699 1699
 			wp_enqueue_script( 'formidable_admin_global' );
1700 1700
 		}
1701
-    }
1701
+	}
1702 1702
 
1703 1703
 	/**
1704 1704
 	 * @since 2.0.9
@@ -1707,9 +1707,9 @@  discard block
 block discarded – undo
1707 1707
 		wp_enqueue_style( 'frm_fonts', self::plugin_url() . '/css/frm_fonts.css', array(), self::plugin_version() );
1708 1708
 	}
1709 1709
 
1710
-    /**
1711
-     * @param string $location
1712
-     */
1710
+	/**
1711
+	 * @param string $location
1712
+	 */
1713 1713
 	public static function localize_script( $location ) {
1714 1714
 		$ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
1715 1715
 		$ajax_url = apply_filters( 'frm_ajax_url', $ajax_url );
@@ -1759,81 +1759,81 @@  discard block
 block discarded – undo
1759 1759
 		}
1760 1760
 	}
1761 1761
 
1762
-    /**
1763
-     * @since 1.07.10
1764
-     *
1765
-     * @param float $min_version The version the add-on requires
1766
-     * @return echo The message on the plugins listing page
1767
-     */
1762
+	/**
1763
+	 * @since 1.07.10
1764
+	 *
1765
+	 * @param float $min_version The version the add-on requires
1766
+	 * @return echo The message on the plugins listing page
1767
+	 */
1768 1768
 	public static function min_version_notice( $min_version ) {
1769
-        $frm_version = self::plugin_version();
1769
+		$frm_version = self::plugin_version();
1770 1770
 
1771
-        // check if Formidable meets minimum requirements
1772
-        if ( version_compare($frm_version, $min_version, '>=') ) {
1773
-            return;
1774
-        }
1771
+		// check if Formidable meets minimum requirements
1772
+		if ( version_compare($frm_version, $min_version, '>=') ) {
1773
+			return;
1774
+		}
1775 1775
 
1776
-        $wp_list_table = _get_list_table('WP_Plugins_List_Table');
1776
+		$wp_list_table = _get_list_table('WP_Plugins_List_Table');
1777 1777
 		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">' .
1778
-        __( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1779
-        '</div></td></tr>';
1780
-    }
1781
-
1782
-    public static function locales( $type = 'date' ) {
1783
-        $locales = array(
1784
-            'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1785
-            'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1786
-            'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1787
-            'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1788
-            'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1789
-            'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1790
-            'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1791
-            'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1792
-            'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1793
-            'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1794
-            'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1795
-            'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1796
-            'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1797
-            'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1798
-            'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1799
-            'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1800
-            'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1801
-            'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1802
-            'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1803
-            'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1804
-            'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1805
-            'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1806
-            'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1807
-            'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1808
-            'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1809
-            'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1810
-            'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1811
-            'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1812
-            'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1813
-            'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1814
-            'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1815
-            'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1816
-        );
1817
-
1818
-        if ( $type == 'captcha' ) {
1819
-            // remove the languages unavailable for the captcha
1820
-            $unset = array(
1821
-                '', 'af', 'sq', 'hy', 'az', 'eu', 'bs',
1822
-                'zh-HK', 'eo', 'et', 'fo', 'fr-CH',
1823
-                'he', 'is', 'ms', 'sr-SR', 'ta', 'tu',
1824
-            );
1825
-        } else {
1826
-            // remove the languages unavailable for the datepicker
1827
-            $unset = array(
1828
-                'en', 'fil', 'fr-CA', 'de-AT', 'de-AT',
1829
-                'de-CH', 'iw', 'hi', 'pt', 'pt-PT',
1830
-                'es-419', 'tr',
1831
-            );
1832
-        }
1833
-
1834
-        $locales = array_diff_key($locales, array_flip($unset));
1835
-        $locales = apply_filters('frm_locales', $locales);
1836
-
1837
-        return $locales;
1838
-    }
1778
+		__( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1779
+		'</div></td></tr>';
1780
+	}
1781
+
1782
+	public static function locales( $type = 'date' ) {
1783
+		$locales = array(
1784
+			'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1785
+			'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1786
+			'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1787
+			'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1788
+			'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1789
+			'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1790
+			'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1791
+			'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1792
+			'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1793
+			'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1794
+			'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1795
+			'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1796
+			'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1797
+			'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1798
+			'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1799
+			'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1800
+			'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1801
+			'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1802
+			'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1803
+			'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1804
+			'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1805
+			'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1806
+			'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1807
+			'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1808
+			'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1809
+			'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1810
+			'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1811
+			'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1812
+			'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1813
+			'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1814
+			'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1815
+			'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1816
+		);
1817
+
1818
+		if ( $type == 'captcha' ) {
1819
+			// remove the languages unavailable for the captcha
1820
+			$unset = array(
1821
+				'', 'af', 'sq', 'hy', 'az', 'eu', 'bs',
1822
+				'zh-HK', 'eo', 'et', 'fo', 'fr-CH',
1823
+				'he', 'is', 'ms', 'sr-SR', 'ta', 'tu',
1824
+			);
1825
+		} else {
1826
+			// remove the languages unavailable for the datepicker
1827
+			$unset = array(
1828
+				'en', 'fil', 'fr-CA', 'de-AT', 'de-AT',
1829
+				'de-CH', 'iw', 'hi', 'pt', 'pt-PT',
1830
+				'es-419', 'tr',
1831
+			);
1832
+		}
1833
+
1834
+		$locales = array_diff_key($locales, array_flip($unset));
1835
+		$locales = apply_filters('frm_locales', $locales);
1836
+
1837
+		return $locales;
1838
+	}
1839 1839
 }
Please login to merge, or discard this patch.
Spacing   +224 added lines, -224 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,16 +23,16 @@  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() {
34 34
         //prevously FRM_URL constant
35
-        return plugins_url( '', self::plugin_path() .'/formidable.php' );
35
+        return plugins_url( '', self::plugin_path() . '/formidable.php' );
36 36
     }
37 37
 
38 38
 	public static function relative_plugin_url() {
@@ -54,12 +54,12 @@  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 ) {
61 61
 		$affiliate_id = apply_filters( 'frm_affiliate_link', '' );
62
-		$allowed_affiliates = array('Mojo');
62
+		$allowed_affiliates = array( 'Mojo' );
63 63
 		if ( in_array( $affiliate_id, $allowed_affiliates ) ) {
64 64
 			$url .= '?aff=' . $affiliate_id;
65 65
 		}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public static function get_settings() {
78 78
         global $frm_settings;
79
-        if ( empty($frm_settings) ) {
79
+        if ( empty( $frm_settings ) ) {
80 80
             $frm_settings = new FrmSettings();
81 81
         }
82 82
         return $frm_settings;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     }
93 93
 
94 94
     public static function pro_is_installed() {
95
-        return apply_filters('frm_pro_installed', false);
95
+        return apply_filters( 'frm_pro_installed', false );
96 96
     }
97 97
 
98 98
     /**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      * @return boolean
137 137
      */
138 138
     public static function doing_ajax() {
139
-        return defined('DOING_AJAX') && DOING_AJAX && ! self::is_preview_page();
139
+        return defined( 'DOING_AJAX' ) && DOING_AJAX && ! self::is_preview_page();
140 140
     }
141 141
 
142 142
 	/**
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      * @return boolean
157 157
      */
158 158
     public static function is_admin() {
159
-        return is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX );
159
+        return is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX );
160 160
     }
161 161
 
162 162
     /**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      * @return string
183 183
      */
184 184
 	public static function get_server_value( $value ) {
185
-        return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
185
+        return isset( $_SERVER[$value] ) ? wp_strip_all_tags( $_SERVER[$value] ) : '';
186 186
     }
187 187
 
188 188
     /**
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
             'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
198 198
             'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
199 199
         ) as $key ) {
200
-            if ( ! isset( $_SERVER[ $key ] ) ) {
200
+            if ( ! isset( $_SERVER[$key] ) ) {
201 201
                 continue;
202 202
             }
203 203
 
204
-            foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
205
-                $ip = trim($ip); // just to be safe
204
+            foreach ( explode( ',', $_SERVER[$key] ) as $ip ) {
205
+                $ip = trim( $ip ); // just to be safe
206 206
 
207
-                if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
207
+                if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
208 208
                     return $ip;
209 209
                 }
210 210
             }
@@ -214,15 +214,15 @@  discard block
 block discarded – undo
214 214
     }
215 215
 
216 216
     public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
217
-        if ( strpos($param, '[') ) {
218
-            $params = explode('[', $param);
217
+        if ( strpos( $param, '[' ) ) {
218
+            $params = explode( '[', $param );
219 219
             $param = $params[0];
220 220
         }
221 221
 
222 222
 		if ( $src == 'get' ) {
223
-            $value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
224
-            if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
225
-                $value = stripslashes_deep( htmlspecialchars_decode( urldecode( $_GET[ $param ] ) ) );
223
+            $value = isset( $_POST[$param] ) ? stripslashes_deep( $_POST[$param] ) : ( isset( $_GET[$param] ) ? stripslashes_deep( $_GET[$param] ) : $default );
224
+            if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) {
225
+                $value = stripslashes_deep( htmlspecialchars_decode( urldecode( $_GET[$param] ) ) );
226 226
             }
227 227
 			self::sanitize_value( $sanitize, $value );
228 228
 		} else {
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 
232 232
 		if ( isset( $params ) && is_array( $value ) && ! empty( $value ) ) {
233 233
             foreach ( $params as $k => $p ) {
234
-                if ( ! $k || ! is_array($value) ) {
234
+                if ( ! $k || ! is_array( $value ) ) {
235 235
                     continue;
236 236
                 }
237 237
 
238
-                $p = trim($p, ']');
239
-                $value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
238
+                $p = trim( $p, ']' );
239
+                $value = isset( $value[$p] ) ? $value[$p] : $default;
240 240
             }
241 241
         }
242 242
 
@@ -278,16 +278,16 @@  discard block
 block discarded – undo
278 278
 
279 279
 		$value = $args['default'];
280 280
 		if ( $args['type'] == 'get' ) {
281
-			if ( $_GET && isset( $_GET[ $args['param'] ] ) ) {
282
-				$value = $_GET[ $args['param'] ];
281
+			if ( $_GET && isset( $_GET[$args['param']] ) ) {
282
+				$value = $_GET[$args['param']];
283 283
 			}
284 284
 		} else if ( $args['type'] == 'post' ) {
285
-			if ( isset( $_POST[ $args['param'] ] ) ) {
286
-				$value = stripslashes_deep( maybe_unserialize( $_POST[ $args['param'] ] ) );
285
+			if ( isset( $_POST[$args['param']] ) ) {
286
+				$value = stripslashes_deep( maybe_unserialize( $_POST[$args['param']] ) );
287 287
 			}
288 288
 		} else {
289
-			if ( isset( $_REQUEST[ $args['param'] ] ) ) {
290
-				$value = $_REQUEST[ $args['param'] ];
289
+			if ( isset( $_REQUEST[$args['param']] ) ) {
290
+				$value = $_REQUEST[$args['param']];
291 291
 			}
292 292
 		}
293 293
 
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
     public static function sanitize_request( $sanitize_method, &$values ) {
324 324
         $temp_values = $values;
325 325
         foreach ( $temp_values as $k => $val ) {
326
-            if ( isset( $sanitize_method[ $k ] ) ) {
327
-				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
326
+            if ( isset( $sanitize_method[$k] ) ) {
327
+				$values[$k] = call_user_func( $sanitize_method[$k], $val );
328 328
             }
329 329
         }
330 330
     }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	public static function sanitize_array( &$values ) {
333 333
 		$temp_values = $values;
334 334
 		foreach ( $temp_values as $k => $val ) {
335
-			$values[ $k ] = wp_kses_post( $val );
335
+			$values[$k] = wp_kses_post( $val );
336 336
 		}
337 337
 	}
338 338
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 		$allowed_html = array();
354 354
 		foreach ( $allowed as $a ) {
355
-			$allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array();
355
+			$allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array();
356 356
 		}
357 357
 
358 358
 		return wp_kses( $value, $allowed_html );
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
      * @since 2.0
364 364
      */
365 365
     public static function remove_get_action() {
366
-        if ( ! isset($_GET) ) {
366
+        if ( ! isset( $_GET ) ) {
367 367
             return;
368 368
         }
369 369
 
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
         }
386 386
 
387 387
         global $wp_query;
388
-        if ( isset( $wp_query->query_vars[ $param ] ) ) {
389
-            $value = $wp_query->query_vars[ $param ];
388
+        if ( isset( $wp_query->query_vars[$param] ) ) {
389
+            $value = $wp_query->query_vars[$param];
390 390
         }
391 391
 
392 392
         return $value;
@@ -397,9 +397,9 @@  discard block
 block discarded – undo
397 397
      */
398 398
     public static function trigger_hook_load( $type, $object = null ) {
399 399
         // only load the form hooks once
400
-        $hooks_loaded = apply_filters('frm_'. $type .'_hooks_loaded', false, $object);
400
+        $hooks_loaded = apply_filters( 'frm_' . $type . '_hooks_loaded', false, $object );
401 401
         if ( ! $hooks_loaded ) {
402
-            do_action('frm_load_'. $type .'_hooks');
402
+            do_action( 'frm_load_' . $type . '_hooks' );
403 403
         }
404 404
     }
405 405
 
@@ -415,16 +415,16 @@  discard block
 block discarded – undo
415 415
      * @return mixed $results The cache or query results
416 416
      */
417 417
     public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
418
-        $results = wp_cache_get($cache_key, $group);
419
-        if ( ! self::is_empty_value( $results, false ) || empty($query) ) {
418
+        $results = wp_cache_get( $cache_key, $group );
419
+        if ( ! self::is_empty_value( $results, false ) || empty( $query ) ) {
420 420
             return $results;
421 421
         }
422 422
 
423 423
         if ( 'get_posts' == $type ) {
424
-            $results = get_posts($query);
424
+            $results = get_posts( $query );
425 425
         } else {
426 426
             global $wpdb;
427
-            $results = $wpdb->{$type}($query);
427
+            $results = $wpdb->{$type}( $query );
428 428
         }
429 429
 
430 430
 		if ( ! self::prevent_caching() ) {
@@ -448,9 +448,9 @@  discard block
 block discarded – undo
448 448
         }
449 449
 
450 450
         // then check the transient
451
-        $results = get_transient($cache_key);
451
+        $results = get_transient( $cache_key );
452 452
         if ( $results ) {
453
-            wp_cache_set($cache_key, $results);
453
+            wp_cache_set( $cache_key, $results );
454 454
         }
455 455
 
456 456
         return $results;
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
      * @param string $cache_key
462 462
      */
463 463
 	public static function delete_cache_and_transient( $cache_key ) {
464
-        delete_transient($cache_key);
465
-        wp_cache_delete($cache_key);
464
+        delete_transient( $cache_key );
465
+        wp_cache_delete( $cache_key );
466 466
     }
467 467
 
468 468
     /**
@@ -476,9 +476,9 @@  discard block
 block discarded – undo
476 476
 	public static function cache_delete_group( $group ) {
477 477
     	global $wp_object_cache;
478 478
 
479
-        if ( isset( $wp_object_cache->cache[ $group ] ) ) {
480
-            foreach ( $wp_object_cache->cache[ $group ] as $k => $v ) {
481
-                wp_cache_delete($k, $group);
479
+        if ( isset( $wp_object_cache->cache[$group] ) ) {
480
+            foreach ( $wp_object_cache->cache[$group] as $k => $v ) {
481
+                wp_cache_delete( $k, $group );
482 482
             }
483 483
             return true;
484 484
         }
@@ -509,29 +509,29 @@  discard block
 block discarded – undo
509 509
 	public static function load_scripts( $scripts ) {
510 510
         _deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_script' );
511 511
         foreach ( (array) $scripts as $s ) {
512
-            wp_enqueue_script($s);
512
+            wp_enqueue_script( $s );
513 513
         }
514 514
     }
515 515
 
516 516
 	public static function load_styles( $styles ) {
517 517
         _deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_style' );
518 518
         foreach ( (array) $styles as $s ) {
519
-            wp_enqueue_style($s);
519
+            wp_enqueue_style( $s );
520 520
         }
521 521
     }
522 522
 
523 523
     public static function get_pages() {
524
-		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
524
+		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => - 1, 'orderby' => 'title', 'order' => 'ASC' ) );
525 525
     }
526 526
 
527 527
     public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
528 528
         $pages = self::get_pages();
529 529
 		$selected = self::get_post_param( $field_name, $page_id, 'absint' );
530 530
     ?>
531
-        <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" class="frm-pages-dropdown">
531
+        <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" class="frm-pages-dropdown">
532 532
             <option value=""> </option>
533 533
             <?php foreach ( $pages as $page ) { ?>
534
-				<option value="<?php echo esc_attr($page->ID); ?>" <?php selected( $selected, $page->ID ) ?>>
534
+				<option value="<?php echo esc_attr( $page->ID ); ?>" <?php selected( $selected, $page->ID ) ?>>
535 535
 					<?php echo esc_html( $truncate ? self::truncate( $page->post_title, $truncate ) : $page->post_title ); ?>
536 536
 				</option>
537 537
             <?php } ?>
@@ -540,26 +540,26 @@  discard block
 block discarded – undo
540 540
     }
541 541
 
542 542
 	public static function post_edit_link( $post_id ) {
543
-        $post = get_post($post_id);
543
+        $post = get_post( $post_id );
544 544
         if ( $post ) {
545
-            return '<a href="'. esc_url(admin_url('post.php') .'?post='. $post_id .'&action=edit') .'">'. self::truncate($post->post_title, 50) .'</a>';
545
+            return '<a href="' . esc_url( admin_url( 'post.php' ) . '?post=' . $post_id . '&action=edit' ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
546 546
         }
547 547
         return '';
548 548
     }
549 549
 
550 550
 	public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
551 551
     ?>
552
-        <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" <?php
552
+        <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" <?php
553 553
             echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
554 554
             ?> class="frm_multiselect">
555
-            <?php self::roles_options($capability); ?>
555
+            <?php self::roles_options( $capability ); ?>
556 556
         </select>
557 557
     <?php
558 558
     }
559 559
 
560 560
 	public static function roles_options( $capability ) {
561 561
         global $frm_vars;
562
-        if ( isset($frm_vars['editable_roles']) ) {
562
+        if ( isset( $frm_vars['editable_roles'] ) ) {
563 563
             $editable_roles = $frm_vars['editable_roles'];
564 564
         } else {
565 565
             $editable_roles = get_editable_roles();
@@ -567,10 +567,10 @@  discard block
 block discarded – undo
567 567
         }
568 568
 
569 569
         foreach ( $editable_roles as $role => $details ) {
570
-            $name = translate_user_role($details['name'] ); ?>
571
-        <option value="<?php echo esc_attr($role) ?>" <?php echo in_array($role, (array) $capability) ? ' selected="selected"' : ''; ?>><?php echo esc_attr($name) ?> </option>
570
+            $name = translate_user_role( $details['name'] ); ?>
571
+        <option value="<?php echo esc_attr( $role ) ?>" <?php echo in_array( $role, (array) $capability ) ? ' selected="selected"' : ''; ?>><?php echo esc_attr( $name ) ?> </option>
572 572
 <?php
573
-            unset($role, $details);
573
+            unset( $role, $details );
574 574
         }
575 575
     }
576 576
 
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
     public static function maybe_add_permissions() {
627 627
 		self::force_capability( 'frm_view_entries' );
628 628
 
629
-        if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
629
+        if ( ! current_user_can( 'administrator' ) || current_user_can( 'frm_view_forms' ) ) {
630 630
             return;
631 631
         }
632 632
 
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
         $frm_roles = self::frm_capabilities();
636 636
         foreach ( $frm_roles as $frm_role => $frm_role_description ) {
637 637
 			$user->add_cap( $frm_role );
638
-            unset($frm_role, $frm_role_description);
638
+            unset( $frm_role, $frm_role_description );
639 639
         }
640 640
     }
641 641
 
@@ -660,12 +660,12 @@  discard block
 block discarded – undo
660 660
      * @param string $permission
661 661
      */
662 662
 	public static function permission_check( $permission, $show_message = 'show' ) {
663
-        $permission_error = self::permission_nonce_error($permission);
663
+        $permission_error = self::permission_nonce_error( $permission );
664 664
         if ( $permission_error !== false ) {
665 665
             if ( 'hide' == $show_message ) {
666 666
                 $permission_error = '';
667 667
             }
668
-            wp_die($permission_error);
668
+            wp_die( $permission_error );
669 669
         }
670 670
     }
671 671
 
@@ -682,11 +682,11 @@  discard block
 block discarded – undo
682 682
 		}
683 683
 
684 684
 		$error = false;
685
-        if ( empty($nonce_name) ) {
685
+        if ( empty( $nonce_name ) ) {
686 686
             return $error;
687 687
         }
688 688
 
689
-        if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
689
+        if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $_REQUEST[$nonce_name], $nonce ) ) ) {
690 690
             $frm_settings = self::get_settings();
691 691
             $error = $frm_settings->admin_permission;
692 692
         }
@@ -702,9 +702,9 @@  discard block
 block discarded – undo
702 702
 
703 703
 	public static function check_selected( $values, $current ) {
704 704
         $values = self::recursive_function_map( $values, 'trim' );
705
-        $current = trim($current);
705
+        $current = trim( $current );
706 706
 
707
-        return ( is_array($values) && in_array($current, $values) ) || ( ! is_array($values) && $values == $current );
707
+        return ( is_array( $values ) && in_array( $current, $values ) ) || ( ! is_array( $values ) && $values == $current );
708 708
     }
709 709
 
710 710
     /**
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 			} else {
766 766
 				foreach ( $value as $k => $v ) {
767 767
 					if ( ! is_array( $v ) ) {
768
-						$value[ $k ] = call_user_func( $original_function, $v );
768
+						$value[$k] = call_user_func( $original_function, $v );
769 769
 					}
770 770
 				}
771 771
 			}
@@ -786,11 +786,11 @@  discard block
 block discarded – undo
786 786
 	public static function array_flatten( $array, $keys = 'keep' ) {
787 787
         $return = array();
788 788
         foreach ( $array as $key => $value ) {
789
-            if ( is_array($value) ) {
789
+            if ( is_array( $value ) ) {
790 790
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
791 791
             } else {
792 792
 				if ( $keys == 'keep' ) {
793
-					$return[ $key ] = $value;
793
+					$return[$key] = $value;
794 794
 				} else {
795 795
 					$return[] = $value;
796 796
 				}
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
     }
801 801
 
802 802
     public static function esc_textarea( $text ) {
803
-        $safe_text = str_replace('&quot;', '"', $text);
803
+        $safe_text = str_replace( '&quot;', '"', $text );
804 804
         $safe_text = htmlspecialchars( $safe_text, ENT_NOQUOTES );
805 805
     	return apply_filters( 'esc_textarea', $safe_text, $text );
806 806
     }
@@ -810,8 +810,8 @@  discard block
 block discarded – undo
810 810
      * @since 2.0
811 811
      */
812 812
 	public static function use_wpautop( $content ) {
813
-        if ( apply_filters('frm_use_wpautop', true) ) {
814
-            $content = wpautop(str_replace( '<br>', '<br />', $content));
813
+        if ( apply_filters( 'frm_use_wpautop', true ) ) {
814
+            $content = wpautop( str_replace( '<br>', '<br />', $content ) );
815 815
         }
816 816
         return $content;
817 817
     }
@@ -829,8 +829,8 @@  discard block
 block discarded – undo
829 829
      * @return string The base Google APIS url for the current version of jQuery UI
830 830
      */
831 831
     public static function jquery_ui_base_url() {
832
-        $url = 'http'. ( is_ssl() ? 's' : '' ) .'://ajax.googleapis.com/ajax/libs/jqueryui/'. self::script_version('jquery-ui-core');
833
-        $url = apply_filters('frm_jquery_ui_base_url', $url);
832
+        $url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core' );
833
+        $url = apply_filters( 'frm_jquery_ui_base_url', $url );
834 834
         return $url;
835 835
     }
836 836
 
@@ -845,11 +845,11 @@  discard block
 block discarded – undo
845 845
 
846 846
         $ver = 0;
847 847
 
848
-        if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
848
+        if ( ! isset( $wp_scripts->registered[$handle] ) ) {
849 849
             return $ver;
850 850
         }
851 851
 
852
-        $query = $wp_scripts->registered[ $handle ];
852
+        $query = $wp_scripts->registered[$handle];
853 853
     	if ( is_object( $query ) ) {
854 854
     	    $ver = $query->ver;
855 855
     	}
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
     }
863 863
 
864 864
 	public static function get_user_id_param( $user_id ) {
865
-        if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
865
+        if ( ! $user_id || empty( $user_id ) || is_numeric( $user_id ) ) {
866 866
             return $user_id;
867 867
         }
868 868
 
@@ -870,29 +870,29 @@  discard block
 block discarded – undo
870 870
             $user_ID = get_current_user_id();
871 871
             $user_id = $user_ID;
872 872
 		} else {
873
-            if ( is_email($user_id) ) {
874
-                $user = get_user_by('email', $user_id);
873
+            if ( is_email( $user_id ) ) {
874
+                $user = get_user_by( 'email', $user_id );
875 875
             } else {
876
-                $user = get_user_by('login', $user_id);
876
+                $user = get_user_by( 'login', $user_id );
877 877
             }
878 878
 
879 879
             if ( $user ) {
880 880
                 $user_id = $user->ID;
881 881
             }
882
-            unset($user);
882
+            unset( $user );
883 883
         }
884 884
 
885 885
         return $user_id;
886 886
     }
887 887
 
888 888
 	public static function get_file_contents( $filename, $atts = array() ) {
889
-        if ( ! is_file($filename) ) {
889
+        if ( ! is_file( $filename ) ) {
890 890
             return false;
891 891
         }
892 892
 
893
-        extract($atts);
893
+        extract( $atts );
894 894
         ob_start();
895
-        include($filename);
895
+        include( $filename );
896 896
         $contents = ob_get_contents();
897 897
         ob_end_clean();
898 898
         return $contents;
@@ -908,28 +908,28 @@  discard block
 block discarded – undo
908 908
         $key = '';
909 909
 
910 910
         if ( ! empty( $name ) ) {
911
-            $key = sanitize_key($name);
911
+            $key = sanitize_key( $name );
912 912
         }
913 913
 
914 914
 		if ( empty( $key ) ) {
915
-            $max_slug_value = pow(36, $num_chars);
915
+            $max_slug_value = pow( 36, $num_chars );
916 916
             $min_slug_value = 37; // we want to have at least 2 characters in the slug
917
-            $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
917
+            $key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 );
918 918
         }
919 919
 
920
-		if ( is_numeric($key) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
921
-            $key = $key .'a';
920
+		if ( is_numeric( $key ) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
921
+            $key = $key . 'a';
922 922
         }
923 923
 
924 924
 		$key_check = FrmDb::get_var( $table_name, array( $column => $key, 'ID !' => $id ), $column );
925 925
 
926
-        if ( $key_check || is_numeric($key_check) ) {
926
+        if ( $key_check || is_numeric( $key_check ) ) {
927 927
             $suffix = 2;
928 928
 			do {
929 929
 				$alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
930 930
 				$key_check = FrmDb::get_var( $table_name, array( $column => $alt_post_name, 'ID !' => $id ), $column );
931
-				$suffix++;
932
-			} while ($key_check || is_numeric($key_check));
931
+				$suffix ++;
932
+			} while ( $key_check || is_numeric( $key_check ) );
933 933
 			$key = $alt_post_name;
934 934
         }
935 935
         return $key;
@@ -947,32 +947,32 @@  discard block
 block discarded – undo
947 947
 
948 948
         global $frm_vars;
949 949
 
950
-        if ( empty($post_values) ) {
951
-            $post_values = stripslashes_deep($_POST);
950
+        if ( empty( $post_values ) ) {
951
+            $post_values = stripslashes_deep( $_POST );
952 952
         }
953 953
 
954 954
 		$values = array( 'id' => $record->id, 'fields' => array() );
955 955
 
956 956
 		foreach ( array( 'name', 'description' ) as $var ) {
957
-            $default_val = isset($record->{$var}) ? $record->{$var} : '';
958
-            $values[ $var ] = self::get_param( $var, $default_val );
959
-            unset($var, $default_val);
957
+            $default_val = isset( $record->{$var}) ? $record->{$var} : '';
958
+            $values[$var] = self::get_param( $var, $default_val );
959
+            unset( $var, $default_val );
960 960
         }
961 961
 
962
-        $values['description'] = self::use_wpautop($values['description']);
962
+        $values['description'] = self::use_wpautop( $values['description'] );
963 963
         $frm_settings = self::get_settings();
964
-        $is_form_builder = self::is_admin_page('formidable' );
964
+        $is_form_builder = self::is_admin_page( 'formidable' );
965 965
 
966 966
         foreach ( (array) $fields as $field ) {
967 967
             // Make sure to filter default values (for placeholder text), but not on the form builder page
968 968
             if ( ! $is_form_builder ) {
969
-                $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
969
+                $field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true );
970 970
             }
971 971
 			$parent_form_id = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
972
-			self::fill_field_defaults($field, $record, $values, compact('default', 'post_values', 'frm_settings', 'parent_form_id' ) );
972
+			self::fill_field_defaults( $field, $record, $values, compact( 'default', 'post_values', 'frm_settings', 'parent_form_id' ) );
973 973
         }
974 974
 
975
-        self::fill_form_opts($record, $table, $post_values, $values);
975
+        self::fill_form_opts( $record, $table, $post_values, $values );
976 976
 
977 977
         if ( $table == 'entries' ) {
978 978
             $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
@@ -989,8 +989,8 @@  discard block
 block discarded – undo
989 989
         if ( $args['default'] ) {
990 990
             $meta_value = $field->default_value;
991 991
         } else {
992
-            if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
993
-                if ( ! isset($field->field_options['custom_field']) ) {
992
+            if ( $record->post_id && self::pro_is_installed() && isset( $field->field_options['post_field'] ) && $field->field_options['post_field'] ) {
993
+                if ( ! isset( $field->field_options['custom_field'] ) ) {
994 994
                     $field->field_options['custom_field'] = '';
995 995
                 }
996 996
 				$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 ) );
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
             }
1000 1000
         }
1001 1001
 
1002
-        $field_type = isset( $post_values['field_options'][ 'type_'. $field->id ] ) ? $post_values['field_options'][ 'type_'. $field->id ] : $field->type;
1003
-        $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1002
+        $field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type;
1003
+        $new_value = isset( $post_values['item_meta'][$field->id] ) ? maybe_unserialize( $post_values['item_meta'][$field->id] ) : $meta_value;
1004 1004
 
1005 1005
         $field_array = array(
1006 1006
             'id'            => $field->id,
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
             'default_value' => $field->default_value,
1009 1009
             'name'          => $field->name,
1010 1010
             'description'   => $field->description,
1011
-            'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1011
+            'type'          => apply_filters( 'frm_field_type', $field_type, $field, $new_value ),
1012 1012
             'options'       => $field->options,
1013 1013
             'required'      => $field->required,
1014 1014
             'field_key'     => $field->field_key,
@@ -1018,38 +1018,38 @@  discard block
 block discarded – undo
1018 1018
         );
1019 1019
 
1020 1020
         $args['field_type'] = $field_type;
1021
-        self::fill_field_opts($field, $field_array, $args);
1021
+        self::fill_field_opts( $field, $field_array, $args );
1022 1022
 
1023
-        $field_array = apply_filters('frm_setup_edit_fields_vars', $field_array, $field, $values['id']);
1023
+        $field_array = apply_filters( 'frm_setup_edit_fields_vars', $field_array, $field, $values['id'] );
1024 1024
 
1025
-        if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1025
+        if ( ! isset( $field_array['unique'] ) || ! $field_array['unique'] ) {
1026 1026
             $field_array['unique_msg'] = '';
1027 1027
         }
1028 1028
 
1029 1029
         $field_array = array_merge( $field->field_options, $field_array );
1030 1030
 
1031
-        $values['fields'][ $field->id ] = $field_array;
1031
+        $values['fields'][$field->id] = $field_array;
1032 1032
     }
1033 1033
 
1034 1034
 	private static function fill_field_opts( $field, array &$field_array, $args ) {
1035 1035
         $post_values = $args['post_values'];
1036
-        $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1036
+        $opt_defaults = FrmFieldsHelper::get_default_field_opts( $field_array['type'], $field, true );
1037 1037
 
1038 1038
         foreach ( $opt_defaults as $opt => $default_opt ) {
1039
-            $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 );
1040
-            if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1041
-                $field_array[ $opt ] = $args['frm_settings']->blank_msg;
1042
-            } else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1039
+            $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 );
1040
+            if ( $opt == 'blank' && $field_array[$opt] == '' ) {
1041
+                $field_array[$opt] = $args['frm_settings']->blank_msg;
1042
+            } else if ( $opt == 'invalid' && $field_array[$opt] == '' ) {
1043 1043
                 if ( $args['field_type'] == 'captcha' ) {
1044
-                    $field_array[ $opt ] = $args['frm_settings']->re_msg;
1044
+                    $field_array[$opt] = $args['frm_settings']->re_msg;
1045 1045
                 } else {
1046
-                    $field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1046
+                    $field_array[$opt] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1047 1047
                 }
1048 1048
             }
1049 1049
         }
1050 1050
 
1051 1051
         if ( $field_array['custom_html'] == '' ) {
1052
-            $field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1052
+            $field_array['custom_html'] = FrmFieldsHelper::get_default_html( $args['field_type'] );
1053 1053
         }
1054 1054
     }
1055 1055
 
@@ -1068,18 +1068,18 @@  discard block
 block discarded – undo
1068 1068
             return;
1069 1069
         }
1070 1070
 
1071
-        $values['form_name'] = isset($record->form_id) ? $form->name : '';
1071
+        $values['form_name'] = isset( $record->form_id ) ? $form->name : '';
1072 1072
 		$values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
1073 1073
 
1074
-        if ( ! is_array($form->options) ) {
1074
+        if ( ! is_array( $form->options ) ) {
1075 1075
             return;
1076 1076
         }
1077 1077
 
1078 1078
         foreach ( $form->options as $opt => $value ) {
1079
-            $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1079
+            $values[$opt] = isset( $post_values[$opt] ) ? maybe_unserialize( $post_values[$opt] ) : $value;
1080 1080
         }
1081 1081
 
1082
-        self::fill_form_defaults($post_values, $values);
1082
+        self::fill_form_defaults( $post_values, $values );
1083 1083
     }
1084 1084
 
1085 1085
     /**
@@ -1089,23 +1089,23 @@  discard block
 block discarded – undo
1089 1089
         $form_defaults = FrmFormsHelper::get_default_opts();
1090 1090
 
1091 1091
         foreach ( $form_defaults as $opt => $default ) {
1092
-            if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1093
-				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1092
+            if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) {
1093
+				$values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default;
1094 1094
             }
1095 1095
 
1096
-            unset($opt, $defaut);
1096
+            unset( $opt, $defaut );
1097 1097
         }
1098 1098
 
1099
-        if ( ! isset($values['custom_style']) ) {
1099
+        if ( ! isset( $values['custom_style'] ) ) {
1100 1100
             $frm_settings = self::get_settings();
1101 1101
 			$values['custom_style'] = ( $post_values && isset( $post_values['options']['custom_style'] ) ) ? absint( $_POST['options']['custom_style'] ) : ( $frm_settings->load_style != 'none' );
1102 1102
         }
1103 1103
 
1104 1104
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1105
-            if ( ! isset( $values[ $h .'_html' ] ) ) {
1106
-                $values[ $h .'_html' ] = ( isset( $post_values['options'][ $h .'_html' ] ) ? $post_values['options'][ $h .'_html' ] : FrmFormsHelper::get_default_html( $h ) );
1105
+            if ( ! isset( $values[$h . '_html'] ) ) {
1106
+                $values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) );
1107 1107
             }
1108
-            unset($h);
1108
+            unset( $h );
1109 1109
         }
1110 1110
     }
1111 1111
 
@@ -1121,9 +1121,9 @@  discard block
 block discarded – undo
1121 1121
         }
1122 1122
     ?>
1123 1123
 <li>
1124
-    <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>
1125
-    <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>
1126
-    <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>
1124
+    <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>
1125
+    <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>
1126
+    <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>
1127 1127
 </li>
1128 1128
     <?php
1129 1129
     }
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
             return '';
1152 1152
         } else if ( $length <= 10 ) {
1153 1153
 			$sub = self::mb_function( array( 'mb_substr', 'substr' ), array( $str, 0, $length ) );
1154
-            return $sub . (($length < $original_len) ? $continue : '');
1154
+            return $sub . ( ( $length < $original_len ) ? $continue : '' );
1155 1155
         }
1156 1156
 
1157 1157
         $sub = '';
@@ -1160,23 +1160,23 @@  discard block
 block discarded – undo
1160 1160
 		$words = self::mb_function( array( 'mb_split', 'explode' ), array( ' ', $str ) );
1161 1161
 
1162 1162
 		foreach ( $words as $word ) {
1163
-            $part = (($sub != '') ? ' ' : '') . $word;
1163
+            $part = ( ( $sub != '' ) ? ' ' : '' ) . $word;
1164 1164
 			$total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1165
-            if ( $total_len > $length && str_word_count($sub) ) {
1165
+            if ( $total_len > $length && str_word_count( $sub ) ) {
1166 1166
                 break;
1167 1167
             }
1168 1168
 
1169 1169
             $sub .= $part;
1170 1170
 			$len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1171 1171
 
1172
-            if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1172
+            if ( str_word_count( $sub ) > $minword && $total_len >= $length ) {
1173 1173
                 break;
1174 1174
             }
1175 1175
 
1176
-            unset($total_len, $word);
1176
+            unset( $total_len, $word );
1177 1177
         }
1178 1178
 
1179
-        return $sub . (($len < $original_len) ? $continue : '');
1179
+        return $sub . ( ( $len < $original_len ) ? $continue : '' );
1180 1180
     }
1181 1181
 
1182 1182
 	public static function mb_function( $function_names, $args ) {
@@ -1189,17 +1189,17 @@  discard block
 block discarded – undo
1189 1189
 	}
1190 1190
 
1191 1191
 	public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1192
-        if ( empty($date) ) {
1192
+        if ( empty( $date ) ) {
1193 1193
             return $date;
1194 1194
         }
1195 1195
 
1196
-        if ( empty($date_format) ) {
1197
-            $date_format = get_option('date_format');
1196
+        if ( empty( $date_format ) ) {
1197
+            $date_format = get_option( 'date_format' );
1198 1198
         }
1199 1199
 
1200
-        if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1200
+        if ( preg_match( '/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date ) && self::pro_is_installed() ) {
1201 1201
             $frmpro_settings = new FrmProSettings();
1202
-            $date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1202
+            $date = FrmProAppHelper::convert_date( $date, $frmpro_settings->date_format, 'Y-m-d' );
1203 1203
         }
1204 1204
 
1205 1205
 		$formatted = self::get_localized_date( $date_format, $date );
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
 
1215 1215
 	private static function add_time_to_date( $time_format, $date ) {
1216 1216
 		if ( empty( $time_format ) ) {
1217
-			$time_format = get_option('time_format');
1217
+			$time_format = get_option( 'time_format' );
1218 1218
 		}
1219 1219
 
1220 1220
 		$trimmed_format = trim( $time_format );
@@ -1260,10 +1260,10 @@  discard block
 block discarded – undo
1260 1260
 		$time_strings = self::get_time_strings();
1261 1261
 
1262 1262
 		foreach ( $time_strings as $k => $v ) {
1263
-			if ( $diff[ $k ] ) {
1264
-				$time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] );
1263
+			if ( $diff[$k] ) {
1264
+				$time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] );
1265 1265
 			} else {
1266
-				unset( $time_strings[ $k ] );
1266
+				unset( $time_strings[$k] );
1267 1267
 			}
1268 1268
 		}
1269 1269
 
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
      */
1302 1302
 	public static function esc_like( $term ) {
1303 1303
         global $wpdb;
1304
-        if ( method_exists($wpdb, 'esc_like') ) {
1304
+        if ( method_exists( $wpdb, 'esc_like' ) ) {
1305 1305
 			// WP 4.0
1306 1306
             $term = $wpdb->esc_like( $term );
1307 1307
         } else {
@@ -1315,17 +1315,17 @@  discard block
 block discarded – undo
1315 1315
      * @param string $order_query
1316 1316
      */
1317 1317
 	public static function esc_order( $order_query ) {
1318
-        if ( empty($order_query) ) {
1318
+        if ( empty( $order_query ) ) {
1319 1319
             return '';
1320 1320
         }
1321 1321
 
1322 1322
         // remove ORDER BY before santizing
1323
-        $order_query = strtolower($order_query);
1324
-        if ( strpos($order_query, 'order by') !== false ) {
1325
-            $order_query = str_replace('order by', '', $order_query);
1323
+        $order_query = strtolower( $order_query );
1324
+        if ( strpos( $order_query, 'order by' ) !== false ) {
1325
+            $order_query = str_replace( 'order by', '', $order_query );
1326 1326
         }
1327 1327
 
1328
-        $order_query = explode(' ', trim($order_query));
1328
+        $order_query = explode( ' ', trim( $order_query ) );
1329 1329
 
1330 1330
         $order_fields = array(
1331 1331
             'id', 'form_key', 'name', 'description',
@@ -1333,18 +1333,18 @@  discard block
 block discarded – undo
1333 1333
             'default_template', 'status', 'created_at',
1334 1334
         );
1335 1335
 
1336
-        $order = trim(trim(reset($order_query), ','));
1337
-        if ( ! in_array($order, $order_fields) ) {
1336
+        $order = trim( trim( reset( $order_query ), ',' ) );
1337
+        if ( ! in_array( $order, $order_fields ) ) {
1338 1338
             return '';
1339 1339
         }
1340 1340
 
1341 1341
         $order_by = '';
1342
-        if ( count($order_query) > 1 ) {
1342
+        if ( count( $order_query ) > 1 ) {
1343 1343
 			$order_by = end( $order_query );
1344 1344
 			self::esc_order_by( $order_by );
1345 1345
         }
1346 1346
 
1347
-        return ' ORDER BY '. $order . ' '. $order_by;
1347
+        return ' ORDER BY ' . $order . ' ' . $order_by;
1348 1348
     }
1349 1349
 
1350 1350
 	/**
@@ -1361,24 +1361,24 @@  discard block
 block discarded – undo
1361 1361
      * @param string $limit
1362 1362
      */
1363 1363
 	public static function esc_limit( $limit ) {
1364
-        if ( empty($limit) ) {
1364
+        if ( empty( $limit ) ) {
1365 1365
             return '';
1366 1366
         }
1367 1367
 
1368
-        $limit = trim(str_replace(' limit', '', strtolower($limit)));
1369
-        if ( is_numeric($limit) ) {
1370
-            return ' LIMIT '. $limit;
1368
+        $limit = trim( str_replace( ' limit', '', strtolower( $limit ) ) );
1369
+        if ( is_numeric( $limit ) ) {
1370
+            return ' LIMIT ' . $limit;
1371 1371
         }
1372 1372
 
1373
-        $limit = explode(',', trim($limit));
1373
+        $limit = explode( ',', trim( $limit ) );
1374 1374
         foreach ( $limit as $k => $l ) {
1375 1375
             if ( is_numeric( $l ) ) {
1376
-                $limit[ $k ] = $l;
1376
+                $limit[$k] = $l;
1377 1377
             }
1378 1378
         }
1379 1379
 
1380
-        $limit = implode(',', $limit);
1381
-        return ' LIMIT '. $limit;
1380
+        $limit = implode( ',', $limit );
1381
+        return ' LIMIT ' . $limit;
1382 1382
     }
1383 1383
 
1384 1384
     /**
@@ -1386,12 +1386,12 @@  discard block
 block discarded – undo
1386 1386
      * @since 2.0
1387 1387
      */
1388 1388
     public static function prepare_array_values( $array, $type = '%s' ) {
1389
-        $placeholders = array_fill(0, count($array), $type);
1390
-        return implode(', ', $placeholders);
1389
+        $placeholders = array_fill( 0, count( $array ), $type );
1390
+        return implode( ', ', $placeholders );
1391 1391
     }
1392 1392
 
1393 1393
     public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
1394
-        if ( empty($where) ) {
1394
+        if ( empty( $where ) ) {
1395 1395
             return '';
1396 1396
         }
1397 1397
 
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
 
1438 1438
     public static function get_referer_info() {
1439 1439
         _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::get_server_value' );
1440
-        return self::get_server_value('HTTP_REFERER');
1440
+        return self::get_server_value( 'HTTP_REFERER' );
1441 1441
     }
1442 1442
 
1443 1443
 	/**
@@ -1446,19 +1446,19 @@  discard block
 block discarded – undo
1446 1446
 	public static function json_to_array( $json_vars ) {
1447 1447
         $vars = array();
1448 1448
         foreach ( $json_vars as $jv ) {
1449
-            $jv_name = explode('[', $jv['name']);
1450
-            $last = count($jv_name) - 1;
1449
+            $jv_name = explode( '[', $jv['name'] );
1450
+            $last = count( $jv_name ) - 1;
1451 1451
             foreach ( $jv_name as $p => $n ) {
1452
-                $name = trim($n, ']');
1453
-                if ( ! isset($l1) ) {
1452
+                $name = trim( $n, ']' );
1453
+                if ( ! isset( $l1 ) ) {
1454 1454
                     $l1 = $name;
1455 1455
                 }
1456 1456
 
1457
-                if ( ! isset($l2) ) {
1457
+                if ( ! isset( $l2 ) ) {
1458 1458
                     $l2 = $name;
1459 1459
                 }
1460 1460
 
1461
-                if ( ! isset($l3) ) {
1461
+                if ( ! isset( $l3 ) ) {
1462 1462
                     $l3 = $name;
1463 1463
                 }
1464 1464
 
@@ -1472,24 +1472,24 @@  discard block
 block discarded – undo
1472 1472
 
1473 1473
                     case 1:
1474 1474
                         $l2 = $name;
1475
-                        self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1475
+                        self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] );
1476 1476
                     break;
1477 1477
 
1478 1478
                     case 2:
1479 1479
                         $l3 = $name;
1480
-                        self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1480
+                        self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] );
1481 1481
                     break;
1482 1482
 
1483 1483
                     case 3:
1484 1484
                         $l4 = $name;
1485
-                        self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1485
+                        self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] );
1486 1486
                     break;
1487 1487
                 }
1488 1488
 
1489
-                unset($this_val, $n);
1489
+                unset( $this_val, $n );
1490 1490
             }
1491 1491
 
1492
-            unset($last, $jv);
1492
+            unset( $last, $jv );
1493 1493
         }
1494 1494
 
1495 1495
         return $vars;
@@ -1502,8 +1502,8 @@  discard block
 block discarded – undo
1502 1502
     public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1503 1503
         if ( $name == '' ) {
1504 1504
             $vars[] = $val;
1505
-        } else if ( ! isset( $vars[ $l1 ] ) ) {
1506
-            $vars[ $l1 ] = $val;
1505
+        } else if ( ! isset( $vars[$l1] ) ) {
1506
+            $vars[$l1] = $val;
1507 1507
         }
1508 1508
     }
1509 1509
 
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
             '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() ) ),
1519 1519
         );
1520 1520
 
1521
-        if ( ! isset( $tooltips[ $name ] ) ) {
1521
+        if ( ! isset( $tooltips[$name] ) ) {
1522 1522
             return;
1523 1523
         }
1524 1524
 
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
             echo ' class="frm_help"';
1529 1529
         }
1530 1530
 
1531
-        echo ' title="'. esc_attr( $tooltips[ $name ] );
1531
+        echo ' title="' . esc_attr( $tooltips[$name] );
1532 1532
 
1533 1533
         if ( 'open' != $class ) {
1534 1534
             echo '"';
@@ -1580,13 +1580,13 @@  discard block
 block discarded – undo
1580 1580
     }
1581 1581
 
1582 1582
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1583
-		if ( ! isset( $post_content[ $key ] ) ) {
1583
+		if ( ! isset( $post_content[$key] ) ) {
1584 1584
 			return;
1585 1585
 		}
1586 1586
 
1587 1587
 		if ( is_array( $val ) ) {
1588 1588
 			foreach ( $val as $k1 => $v1 ) {
1589
-				self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] );
1589
+				self::prepare_action_slashes( $v1, $k1, $post_content[$key] );
1590 1590
 				unset( $k1, $v1 );
1591 1591
 			}
1592 1592
 		} else {
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
 			$val = stripslashes( $val );
1595 1595
 
1596 1596
 			// Add backslashes before double quotes and forward slashes only
1597
-			$post_content[ $key ] = addcslashes( $val, '"\\/' );
1597
+			$post_content[$key] = addcslashes( $val, '"\\/' );
1598 1598
 		}
1599 1599
 	}
1600 1600
 
@@ -1611,7 +1611,7 @@  discard block
 block discarded – undo
1611 1611
 		$settings['post_content'] = FrmAppHelper::prepare_and_encode( $settings['post_content'] );
1612 1612
 
1613 1613
 		if ( empty( $settings['ID'] ) ) {
1614
-			unset( $settings['ID']);
1614
+			unset( $settings['ID'] );
1615 1615
 		}
1616 1616
 
1617 1617
 		// delete all caches for this group
@@ -1645,17 +1645,17 @@  discard block
 block discarded – undo
1645 1645
 	}
1646 1646
 
1647 1647
 	public static function maybe_json_decode( $string ) {
1648
-        if ( is_array($string) ) {
1648
+        if ( is_array( $string ) ) {
1649 1649
             return $string;
1650 1650
         }
1651 1651
 
1652
-        $new_string = json_decode($string, true);
1653
-        if ( function_exists('json_last_error') ) {
1652
+        $new_string = json_decode( $string, true );
1653
+        if ( function_exists( 'json_last_error' ) ) {
1654 1654
 			// php 5.3+
1655 1655
             if ( json_last_error() == JSON_ERROR_NONE ) {
1656 1656
                 $string = $new_string;
1657 1657
             }
1658
-        } else if ( isset($new_string) ) {
1658
+        } else if ( isset( $new_string ) ) {
1659 1659
 			// php < 5.3 fallback
1660 1660
             $string = $new_string;
1661 1661
         }
@@ -1671,11 +1671,11 @@  discard block
 block discarded – undo
1671 1671
 	public static function maybe_highlight_menu( $post_type ) {
1672 1672
         global $post, $pagenow;
1673 1673
 
1674
-        if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1674
+        if ( isset( $_REQUEST['post_type'] ) && $_REQUEST['post_type'] != $post_type ) {
1675 1675
             return;
1676 1676
         }
1677 1677
 
1678
-        if ( is_object($post) && $post->post_type != $post_type ) {
1678
+        if ( is_object( $post ) && $post->post_type != $post_type ) {
1679 1679
             return;
1680 1680
         }
1681 1681
 
@@ -1773,11 +1773,11 @@  discard block
 block discarded – undo
1773 1773
         $frm_version = self::plugin_version();
1774 1774
 
1775 1775
         // check if Formidable meets minimum requirements
1776
-        if ( version_compare($frm_version, $min_version, '>=') ) {
1776
+        if ( version_compare( $frm_version, $min_version, '>=' ) ) {
1777 1777
             return;
1778 1778
         }
1779 1779
 
1780
-        $wp_list_table = _get_list_table('WP_Plugins_List_Table');
1780
+        $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
1781 1781
 		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">' .
1782 1782
         __( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1783 1783
         '</div></td></tr>';
@@ -1785,38 +1785,38 @@  discard block
 block discarded – undo
1785 1785
 
1786 1786
     public static function locales( $type = 'date' ) {
1787 1787
         $locales = array(
1788
-            'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1789
-            'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1790
-            'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1788
+            'en' => __( 'English', 'formidable' ), '' => __( 'English/Western', 'formidable' ),
1789
+            'af' => __( 'Afrikaans', 'formidable' ), 'sq' => __( 'Albanian', 'formidable' ),
1790
+            'ar' => __( 'Arabic', 'formidable' ), 'hy' => __( 'Armenian', 'formidable' ),
1791 1791
             'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1792
-            'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1793
-            'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1792
+            'bs' => __( 'Bosnian', 'formidable' ), 'bg' => __( 'Bulgarian', 'formidable' ),
1793
+            'ca' => __( 'Catalan', 'formidable' ), 'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1794 1794
             'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1795
-            'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1796
-            'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1795
+            'hr' => __( 'Croatian', 'formidable' ), 'cs' => __( 'Czech', 'formidable' ),
1796
+            'da' => __( 'Danish', 'formidable' ), 'nl' => __( 'Dutch', 'formidable' ),
1797 1797
             'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1798
-            'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1798
+            'et' => __( 'Estonian', 'formidable' ), 'fo' => __( 'Faroese', 'formidable' ),
1799 1799
             'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1800
-            'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1800
+            'fi' => __( 'Finnish', 'formidable' ), 'fr' => __( 'French', 'formidable' ),
1801 1801
             'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1802
-            'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1802
+            'de' => __( 'German', 'formidable' ), 'de-AT' => __( 'German/Austria', 'formidable' ),
1803 1803
             'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1804
-            'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1805
-            'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1806
-            'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1807
-            'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1808
-            'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1804
+            'he' => __( 'Hebrew', 'formidable' ), 'iw' => __( 'Hebrew', 'formidable' ),
1805
+            'hi' => __( 'Hindi', 'formidable' ), 'hu' => __( 'Hungarian', 'formidable' ),
1806
+            'is' => __( 'Icelandic', 'formidable' ), 'id' => __( 'Indonesian', 'formidable' ),
1807
+            'it' => __( 'Italian', 'formidable' ), 'ja' => __( 'Japanese', 'formidable' ),
1808
+            'ko' => __( 'Korean', 'formidable' ), 'lv' => __( 'Latvian', 'formidable' ),
1809 1809
             'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1810
-            'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1810
+            'no' => __( 'Norwegian', 'formidable' ), 'pl' => __( 'Polish', 'formidable' ),
1811 1811
             'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1812 1812
             'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1813
-            'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1813
+            'ru' => __( 'Russian', 'formidable' ), 'sr' => __( 'Serbian', 'formidable' ),
1814 1814
             'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1815
-            'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1815
+            'sl' => __( 'Slovenian', 'formidable' ), 'es' => __( 'Spanish', 'formidable' ),
1816 1816
             'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1817
-            'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1818
-            'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1819
-            'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1817
+            'ta' => __( 'Tamil', 'formidable' ), 'th' => __( 'Thai', 'formidable' ),
1818
+            'tu' => __( 'Turkish', 'formidable' ), 'tr' => __( 'Turkish', 'formidable' ),
1819
+            'uk' => __( 'Ukranian', 'formidable' ), 'vi' => __( 'Vietnamese', 'formidable' ),
1820 1820
         );
1821 1821
 
1822 1822
         if ( $type == 'captcha' ) {
@@ -1835,8 +1835,8 @@  discard block
 block discarded – undo
1835 1835
             );
1836 1836
         }
1837 1837
 
1838
-        $locales = array_diff_key($locales, array_flip($unset));
1839
-        $locales = apply_filters('frm_locales', $locales);
1838
+        $locales = array_diff_key( $locales, array_flip( $unset ) );
1839
+        $locales = apply_filters( 'frm_locales', $locales );
1840 1840
 
1841 1841
         return $locales;
1842 1842
     }
Please login to merge, or discard this patch.