Completed
Push — master ( b2aab5...cc2f1c )
by Jamie
11:42
created
classes/models/FrmStyle.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 	public $id = 0; // the id of the post
5 5
 
6 6
 	/**
7
-	 * @param int|string $id The id of the stylsheet or 'default'
7
+	 * @param integer $id The id of the stylsheet or 'default'
8 8
 	 */
9 9
 	public function __construct( $id = 0 ) {
10 10
         $this->id = $id;
@@ -120,6 +120,9 @@  discard block
 block discarded – undo
120 120
         set_transient('frmpro_css', $css);
121 121
 	}
122 122
 
123
+	/**
124
+	 * @param string $filename
125
+	 */
123 126
 	private function get_css_content( $filename ) {
124 127
 		$css = '/* ' . __( 'WARNING: Any changes made to this file will be lost when your Formidable settings are updated', 'formidable' ) . ' */' . "\n";
125 128
 
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 class FrmStyle {
3
-    public $number = false;	// Unique ID number of the current instance.
3
+    public $number = false; // Unique ID number of the current instance.
4 4
 	public $id = 0; // the id of the post
5 5
 
6 6
 	/**
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
     public function get_new() {
14 14
 		$this->id = 0;
15 15
 
16
-        $max_slug_value = pow(36, 6);
16
+        $max_slug_value = pow( 36, 6 );
17 17
         $min_slug_value = 37; // we want to have at least 2 characters in the slug
18
-        $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
18
+        $key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 );
19 19
 
20 20
         $style = array(
21 21
             'post_type'     => FrmStylesController::$post_type,
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     public function update( $id = 'default' ) {
42 42
  		$all_instances = $this->get_all();
43 43
 
44
- 		if ( empty($id) ) {
44
+ 		if ( empty( $id ) ) {
45 45
  		     $new_style = (array) $this->get_new();
46 46
  		     $all_instances[] = $new_style;
47 47
  		}
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
         $action_ids = array();
50 50
 
51 51
  		foreach ( $all_instances as $number => $new_instance ) {
52
- 			$new_instance = stripslashes_deep( (array) $new_instance);
52
+ 			$new_instance = stripslashes_deep( (array) $new_instance );
53 53
  			$this->id = $new_instance['ID'];
54
- 			if ( $id != $this->id || ! $_POST || ! isset($_POST['frm_style_setting']) ) {
55
-				$all_instances[ $number ] = $new_instance;
54
+ 			if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) {
55
+				$all_instances[$number] = $new_instance;
56 56
 
57
- 			    if ( $new_instance['menu_order'] && $_POST && empty($_POST['prev_menu_order']) && isset($_POST['frm_style_setting']['menu_order']) ) {
57
+ 			    if ( $new_instance['menu_order'] && $_POST && empty( $_POST['prev_menu_order'] ) && isset( $_POST['frm_style_setting']['menu_order'] ) ) {
58 58
  			        // this style was set to default, so remove default setting on previous default style
59 59
  			        $new_instance['menu_order'] = 0;
60
- 			        $action_ids[] = $this->save($new_instance);
60
+ 			        $action_ids[] = $this->save( $new_instance );
61 61
  			    }
62 62
 
63 63
  			    // don't continue if not saving this style
@@ -67,33 +67,33 @@  discard block
 block discarded – undo
67 67
  			$new_instance['post_title'] = sanitize_text_field( $_POST['frm_style_setting']['post_title'] );
68 68
  			$new_instance['post_content'] = $_POST['frm_style_setting']['post_content'];
69 69
  			$new_instance['post_type']  = FrmStylesController::$post_type;
70
-            $new_instance['post_status']  = 'publish';
70
+            $new_instance['post_status'] = 'publish';
71 71
 			$new_instance['menu_order']  = isset( $_POST['frm_style_setting']['menu_order'] ) ? absint( $_POST['frm_style_setting']['menu_order'] ) : 0;
72 72
 
73
-            if ( empty($id) ) {
73
+            if ( empty( $id ) ) {
74 74
                 $new_instance['post_name'] = $new_instance['post_title'];
75 75
             }
76 76
 
77 77
             $default_settings = $this->get_defaults();
78 78
 
79 79
             foreach ( $default_settings as $setting => $default ) {
80
-				if ( ! isset( $new_instance['post_content'][ $setting ] ) ) {
81
-					$new_instance['post_content'][ $setting ] = $default;
80
+				if ( ! isset( $new_instance['post_content'][$setting] ) ) {
81
+					$new_instance['post_content'][$setting] = $default;
82 82
 				}
83 83
 
84 84
 				if ( strpos( $setting, 'color' ) !== false || in_array( $setting, array( 'error_bg', 'error_border', 'error_text' ) ) ) {
85 85
                     //if is a color
86
-					$new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] );
87
-				} else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) {
88
-					$new_instance['post_content'][ $setting ] = 0;
86
+					$new_instance['post_content'][$setting] = str_replace( '#', '', $new_instance['post_content'][$setting] );
87
+				} else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][$setting] ) ) {
88
+					$new_instance['post_content'][$setting] = 0;
89 89
                 } else if ( $setting == 'font' ) {
90
-                	$new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] );
90
+                	$new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] );
91 91
                 }
92 92
             }
93 93
 
94
-			$all_instances[ $number ] = $new_instance;
94
+			$all_instances[$number] = $new_instance;
95 95
 
96
-            $action_ids[] = $this->save($new_instance);
96
+            $action_ids[] = $this->save( $new_instance );
97 97
 
98 98
  		}
99 99
 
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
      */
108 108
 	public function save_settings() {
109 109
 		$filename = FrmAppHelper::plugin_path() . '/css/custom_theme.css.php';
110
-		update_option( 'frm_last_style_update', date('njGi') );
110
+		update_option( 'frm_last_style_update', date( 'njGi' ) );
111 111
 
112
-        if ( ! is_file($filename) ) {
112
+        if ( ! is_file( $filename ) ) {
113 113
             return;
114 114
         }
115 115
 
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 		$create_file = new FrmCreateFile( array( 'folder_name' => 'formidable/css', 'file_name' => 'formidablepro.css' ) );
121 121
 		$create_file->create_file( $css );
122 122
 
123
-        update_option('frmpro_css', $css);
123
+        update_option( 'frmpro_css', $css );
124 124
 
125
-        set_transient('frmpro_css', $css);
125
+        set_transient( 'frmpro_css', $css );
126 126
 	}
127 127
 
128 128
 	private function get_css_content( $filename ) {
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	}
155 155
 
156 156
 	public function destroy( $id ) {
157
-        return wp_delete_post($id);
157
+        return wp_delete_post( $id );
158 158
     }
159 159
 
160 160
     public function get_one() {
@@ -168,19 +168,19 @@  discard block
 block discarded – undo
168 168
             return $style;
169 169
         }
170 170
 
171
-        $style = get_post($this->id);
171
+        $style = get_post( $this->id );
172 172
 
173 173
         if ( ! $style ) {
174 174
             return $style;
175 175
         }
176 176
 
177
-        $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content);
177
+        $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content );
178 178
 
179 179
         $default_values = $this->get_defaults();
180 180
 
181 181
         // fill default values
182
-        $style->post_content = $this->override_defaults($style->post_content);
183
-        $style->post_content = wp_parse_args( $style->post_content, $default_values);
182
+        $style->post_content = $this->override_defaults( $style->post_content );
183
+        $style->post_content = wp_parse_args( $style->post_content, $default_values );
184 184
 
185 185
         return $style;
186 186
     }
@@ -194,21 +194,21 @@  discard block
 block discarded – undo
194 194
 			'order'       => $order,
195 195
         );
196 196
 
197
-        $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts');
197
+        $temp_styles = FrmAppHelper::check_cache( serialize( $post_atts ), 'frm_styles', $post_atts, 'get_posts' );
198 198
 
199
-        if ( empty($temp_styles) ) {
199
+        if ( empty( $temp_styles ) ) {
200 200
             global $wpdb;
201 201
             // make sure there wasn't a conflict with the query
202 202
 			$query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->posts . ' WHERE post_type=%s AND post_status=%s ORDER BY post_title ASC LIMIT 99', FrmStylesController::$post_type, 'publish' );
203
-            $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results');
203
+            $temp_styles = FrmAppHelper::check_cache( 'frm_backup_style_check', 'frm_styles', $query, 'get_results' );
204 204
 
205
-            if ( empty($temp_styles) ) {
205
+            if ( empty( $temp_styles ) ) {
206 206
                 // create a new style if there are none
207 207
          		$new = $this->get_new();
208 208
          		$new->post_title = $new->post_name = __( 'Formidable Style', 'formidable' );
209 209
          		$new->menu_order = 1;
210
-         		$new = $this->save( (array) $new);
211
-         		$this->update('default');
210
+         		$new = $this->save( (array) $new );
211
+         		$this->update( 'default' );
212 212
 
213 213
                 $post_atts['include'] = $new;
214 214
 
@@ -232,25 +232,25 @@  discard block
 block discarded – undo
232 232
                 }
233 233
             }
234 234
 
235
-            $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content);
235
+            $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content );
236 236
 
237 237
             // fill default values
238
-            $style->post_content = $this->override_defaults($style->post_content);
239
-            $style->post_content = wp_parse_args( $style->post_content, $default_values);
238
+            $style->post_content = $this->override_defaults( $style->post_content );
239
+            $style->post_content = wp_parse_args( $style->post_content, $default_values );
240 240
 
241
-			$styles[ $style->ID ] = $style;
241
+			$styles[$style->ID] = $style;
242 242
         }
243 243
 
244 244
         if ( ! $default_style ) {
245
-            $default_style = reset($styles);
246
-			$styles[ $default_style->ID ]->menu_order = 1;
245
+            $default_style = reset( $styles );
246
+			$styles[$default_style->ID]->menu_order = 1;
247 247
         }
248 248
 
249 249
         return $styles;
250 250
     }
251 251
 
252 252
 	public function get_default_style( $styles = null ) {
253
-        if ( ! isset($styles) ) {
253
+        if ( ! isset( $styles ) ) {
254 254
 			$styles = $this->get_all( 'menu_order', 'DESC', 1 );
255 255
         }
256 256
 
@@ -262,24 +262,24 @@  discard block
 block discarded – undo
262 262
     }
263 263
 
264 264
 	public function override_defaults( $settings ) {
265
-	    if ( ! is_array($settings) ) {
265
+	    if ( ! is_array( $settings ) ) {
266 266
 	        return $settings;
267 267
 	    }
268 268
 
269
-	    $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height'];
269
+	    $settings['line_height'] = ( ! isset( $settings['field_height'] ) || $settings['field_height'] == '' || $settings['field_height'] == 'auto' ) ? 'normal' : $settings['field_height'];
270 270
 
271
-	    if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) {
271
+	    if ( ! isset( $settings['form_desc_size'] ) && isset( $settings['description_font_size'] ) ) {
272 272
 	        $settings['form_desc_size'] = $settings['description_font_size'];
273 273
 	        $settings['form_desc_color'] = $settings['description_color'];
274 274
 	        $settings['title_color'] = $settings['label_color'];
275 275
 	    }
276 276
 
277
-	    if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) {
277
+	    if ( ! isset( $settings['section_color'] ) && isset( $settings['label_color'] ) ) {
278 278
 	        $settings['section_color'] = $settings['label_color'];
279 279
 	        $settings['section_border_color'] = $settings['border_color'];
280 280
 	    }
281 281
 
282
-	    if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) {
282
+	    if ( ! isset( $settings['submit_hover_bg_color'] ) && isset( $settings['submit_bg_color'] ) ) {
283 283
 	        $settings['submit_hover_bg_color'] = $settings['submit_bg_color'];
284 284
 	        $settings['submit_hover_color'] = $settings['submit_text_color'];
285 285
 	        $settings['submit_hover_border_color'] = $settings['submit_border_color'];
Please login to merge, or discard this patch.
Indentation   +272 added lines, -272 removed lines patch added patch discarded remove patch
@@ -1,52 +1,52 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 class FrmStyle {
3
-    public $number = false;	// Unique ID number of the current instance.
3
+	public $number = false;	// Unique ID number of the current instance.
4 4
 	public $id = 0; // the id of the post
5 5
 
6 6
 	/**
7 7
 	 * @param int|string $id The id of the stylsheet or 'default'
8 8
 	 */
9 9
 	public function __construct( $id = 0 ) {
10
-        $this->id = $id;
11
-    }
10
+		$this->id = $id;
11
+	}
12 12
 
13
-    public function get_new() {
13
+	public function get_new() {
14 14
 		$this->id = 0;
15 15
 
16
-        $max_slug_value = pow(36, 6);
17
-        $min_slug_value = 37; // we want to have at least 2 characters in the slug
18
-        $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
19
-
20
-        $style = array(
21
-            'post_type'     => FrmStylesController::$post_type,
22
-            'ID'            => '',
23
-            'post_title'    => __( 'New Style', 'formidable' ),
24
-            'post_name'     => $key,
25
-            'post_content'  => $this->get_defaults(),
26
-            'menu_order'    => '',
27
-            'post_status'   => 'publish',
28
-        );
16
+		$max_slug_value = pow(36, 6);
17
+		$min_slug_value = 37; // we want to have at least 2 characters in the slug
18
+		$key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
19
+
20
+		$style = array(
21
+			'post_type'     => FrmStylesController::$post_type,
22
+			'ID'            => '',
23
+			'post_title'    => __( 'New Style', 'formidable' ),
24
+			'post_name'     => $key,
25
+			'post_content'  => $this->get_defaults(),
26
+			'menu_order'    => '',
27
+			'post_status'   => 'publish',
28
+		);
29 29
 
30
-        return (object) $style;
31
-    }
30
+		return (object) $style;
31
+	}
32 32
 
33 33
 	public function save( $settings ) {
34 34
 		return FrmAppHelper::save_settings( $settings, 'frm_styles' );
35
-    }
35
+	}
36 36
 
37 37
 	public function duplicate( $id ) {
38
-        // duplicating is a pro feature
39
-    }
38
+		// duplicating is a pro feature
39
+	}
40 40
 
41
-    public function update( $id = 'default' ) {
41
+	public function update( $id = 'default' ) {
42 42
  		$all_instances = $this->get_all();
43 43
 
44 44
  		if ( empty($id) ) {
45
- 		     $new_style = (array) $this->get_new();
46
- 		     $all_instances[] = $new_style;
45
+ 			 $new_style = (array) $this->get_new();
46
+ 			 $all_instances[] = $new_style;
47 47
  		}
48 48
 
49
-        $action_ids = array();
49
+		$action_ids = array();
50 50
 
51 51
  		foreach ( $all_instances as $number => $new_instance ) {
52 52
  			$new_instance = stripslashes_deep( (array) $new_instance);
@@ -54,46 +54,46 @@  discard block
 block discarded – undo
54 54
  			if ( $id != $this->id || ! $_POST || ! isset($_POST['frm_style_setting']) ) {
55 55
 				$all_instances[ $number ] = $new_instance;
56 56
 
57
- 			    if ( $new_instance['menu_order'] && $_POST && empty($_POST['prev_menu_order']) && isset($_POST['frm_style_setting']['menu_order']) ) {
58
- 			        // this style was set to default, so remove default setting on previous default style
59
- 			        $new_instance['menu_order'] = 0;
60
- 			        $action_ids[] = $this->save($new_instance);
61
- 			    }
57
+ 				if ( $new_instance['menu_order'] && $_POST && empty($_POST['prev_menu_order']) && isset($_POST['frm_style_setting']['menu_order']) ) {
58
+ 					// this style was set to default, so remove default setting on previous default style
59
+ 					$new_instance['menu_order'] = 0;
60
+ 					$action_ids[] = $this->save($new_instance);
61
+ 				}
62 62
 
63
- 			    // don't continue if not saving this style
64
- 			    continue;
63
+ 				// don't continue if not saving this style
64
+ 				continue;
65 65
  			}
66 66
 
67 67
  			$new_instance['post_title'] = sanitize_text_field( $_POST['frm_style_setting']['post_title'] );
68 68
  			$new_instance['post_content'] = $_POST['frm_style_setting']['post_content'];
69 69
  			$new_instance['post_type']  = FrmStylesController::$post_type;
70
-            $new_instance['post_status']  = 'publish';
70
+			$new_instance['post_status']  = 'publish';
71 71
 			$new_instance['menu_order']  = isset( $_POST['frm_style_setting']['menu_order'] ) ? absint( $_POST['frm_style_setting']['menu_order'] ) : 0;
72 72
 
73
-            if ( empty($id) ) {
74
-                $new_instance['post_name'] = $new_instance['post_title'];
75
-            }
73
+			if ( empty($id) ) {
74
+				$new_instance['post_name'] = $new_instance['post_title'];
75
+			}
76 76
 
77
-            $default_settings = $this->get_defaults();
77
+			$default_settings = $this->get_defaults();
78 78
 
79
-            foreach ( $default_settings as $setting => $default ) {
79
+			foreach ( $default_settings as $setting => $default ) {
80 80
 				if ( ! isset( $new_instance['post_content'][ $setting ] ) ) {
81 81
 					$new_instance['post_content'][ $setting ] = $default;
82 82
 				}
83 83
 
84 84
 				if ( strpos( $setting, 'color' ) !== false || in_array( $setting, array( 'error_bg', 'error_border', 'error_text' ) ) ) {
85
-                    //if is a color
85
+					//if is a color
86 86
 					$new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] );
87 87
 				} else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) {
88 88
 					$new_instance['post_content'][ $setting ] = 0;
89
-                } else if ( $setting == 'font' ) {
90
-                	$new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] );
91
-                }
92
-            }
89
+				} else if ( $setting == 'font' ) {
90
+					$new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] );
91
+				}
92
+			}
93 93
 
94 94
 			$all_instances[ $number ] = $new_instance;
95 95
 
96
-            $action_ids[] = $this->save($new_instance);
96
+			$action_ids[] = $this->save($new_instance);
97 97
 
98 98
  		}
99 99
 
@@ -102,16 +102,16 @@  discard block
 block discarded – undo
102 102
  		return $action_ids;
103 103
  	}
104 104
 
105
-    /**
106
-     * Create static css file
107
-     */
105
+	/**
106
+	 * Create static css file
107
+	 */
108 108
 	public function save_settings() {
109 109
 		$filename = FrmAppHelper::plugin_path() . '/css/custom_theme.css.php';
110 110
 		update_option( 'frm_last_style_update', date('njGi') );
111 111
 
112
-        if ( ! is_file($filename) ) {
113
-            return;
114
-        }
112
+		if ( ! is_file($filename) ) {
113
+			return;
114
+		}
115 115
 
116 116
 		$this->clear_cache();
117 117
 
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 		$create_file = new FrmCreateFile( array( 'folder_name' => 'formidable/css', 'file_name' => 'formidablepro.css' ) );
121 121
 		$create_file->create_file( $css );
122 122
 
123
-        update_option('frmpro_css', $css);
123
+		update_option('frmpro_css', $css);
124 124
 
125
-        set_transient('frmpro_css', $css);
125
+		set_transient('frmpro_css', $css);
126 126
 	}
127 127
 
128 128
 	private function get_css_content( $filename ) {
@@ -131,10 +131,10 @@  discard block
 block discarded – undo
131 131
 		$saving = true;
132 132
 		$frm_style = $this;
133 133
 
134
-        ob_start();
135
-        include( $filename );
134
+		ob_start();
135
+		include( $filename );
136 136
 		$css .= preg_replace( '/\/\*(.|\s)*?\*\//', '', str_replace( array( "\r\n", "\r", "\n", "\t", '    ' ), '', ob_get_contents() ) );
137
-        ob_end_clean();
137
+		ob_end_clean();
138 138
 
139 139
 		return $css;
140 140
 	}
@@ -154,269 +154,269 @@  discard block
 block discarded – undo
154 154
 	}
155 155
 
156 156
 	public function destroy( $id ) {
157
-        return wp_delete_post($id);
158
-    }
157
+		return wp_delete_post($id);
158
+	}
159 159
 
160
-    public function get_one() {
161
-        if ( 'default' == $this->id ) {
162
-            $style = $this->get_default_style();
163
-            if ( $style ) {
164
-                $this->id = $style->ID;
165
-            } else {
166
-                $this->id = 0;
167
-            }
168
-            return $style;
169
-        }
160
+	public function get_one() {
161
+		if ( 'default' == $this->id ) {
162
+			$style = $this->get_default_style();
163
+			if ( $style ) {
164
+				$this->id = $style->ID;
165
+			} else {
166
+				$this->id = 0;
167
+			}
168
+			return $style;
169
+		}
170 170
 
171
-        $style = get_post($this->id);
171
+		$style = get_post($this->id);
172 172
 
173
-        if ( ! $style ) {
174
-            return $style;
175
-        }
173
+		if ( ! $style ) {
174
+			return $style;
175
+		}
176 176
 
177
-        $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content);
177
+		$style->post_content = FrmAppHelper::maybe_json_decode($style->post_content);
178 178
 
179
-        $default_values = $this->get_defaults();
179
+		$default_values = $this->get_defaults();
180 180
 
181
-        // fill default values
182
-        $style->post_content = $this->override_defaults($style->post_content);
183
-        $style->post_content = wp_parse_args( $style->post_content, $default_values);
181
+		// fill default values
182
+		$style->post_content = $this->override_defaults($style->post_content);
183
+		$style->post_content = wp_parse_args( $style->post_content, $default_values);
184 184
 
185
-        return $style;
186
-    }
185
+		return $style;
186
+	}
187 187
 
188
-    public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) {
189
-        $post_atts = array(
188
+	public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) {
189
+		$post_atts = array(
190 190
 			'post_type'   => FrmStylesController::$post_type,
191 191
 			'post_status' => 'publish',
192 192
 			'numberposts' => $limit,
193 193
 			'orderby'     => $orderby,
194 194
 			'order'       => $order,
195
-        );
195
+		);
196 196
 
197
-        $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts');
197
+		$temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts');
198 198
 
199
-        if ( empty($temp_styles) ) {
200
-            global $wpdb;
201
-            // make sure there wasn't a conflict with the query
199
+		if ( empty($temp_styles) ) {
200
+			global $wpdb;
201
+			// make sure there wasn't a conflict with the query
202 202
 			$query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->posts . ' WHERE post_type=%s AND post_status=%s ORDER BY post_title ASC LIMIT 99', FrmStylesController::$post_type, 'publish' );
203
-            $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results');
203
+			$temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results');
204 204
 
205
-            if ( empty($temp_styles) ) {
206
-                // create a new style if there are none
207
-         		$new = $this->get_new();
205
+			if ( empty($temp_styles) ) {
206
+				// create a new style if there are none
207
+		 		$new = $this->get_new();
208 208
 				$new->post_title = __( 'Formidable Style', 'formidable' );
209 209
 				$new->post_name = $new->post_title;
210
-         		$new->menu_order = 1;
211
-         		$new = $this->save( (array) $new);
212
-         		$this->update('default');
213
-
214
-                $post_atts['include'] = $new;
215
-
216
-                $temp_styles = get_posts( $post_atts );
217
-            }
218
-        }
219
-
220
-        $default_values = $this->get_defaults();
221
-        $default_style = false;
222
-
223
-        $styles = array();
224
-        foreach ( $temp_styles as $style ) {
225
-            $this->id = $style->ID;
226
-            if ( $style->menu_order ) {
227
-                if ( $default_style ) {
228
-                    // only return one default
229
-                    $style->menu_order = 0;
230
-                } else {
231
-                    // check for a default style
232
-                    $default_style = $style->ID;
233
-                }
234
-            }
235
-
236
-            $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content);
237
-
238
-            // fill default values
239
-            $style->post_content = $this->override_defaults($style->post_content);
240
-            $style->post_content = wp_parse_args( $style->post_content, $default_values);
210
+		 		$new->menu_order = 1;
211
+		 		$new = $this->save( (array) $new);
212
+		 		$this->update('default');
213
+
214
+				$post_atts['include'] = $new;
215
+
216
+				$temp_styles = get_posts( $post_atts );
217
+			}
218
+		}
219
+
220
+		$default_values = $this->get_defaults();
221
+		$default_style = false;
222
+
223
+		$styles = array();
224
+		foreach ( $temp_styles as $style ) {
225
+			$this->id = $style->ID;
226
+			if ( $style->menu_order ) {
227
+				if ( $default_style ) {
228
+					// only return one default
229
+					$style->menu_order = 0;
230
+				} else {
231
+					// check for a default style
232
+					$default_style = $style->ID;
233
+				}
234
+			}
235
+
236
+			$style->post_content = FrmAppHelper::maybe_json_decode($style->post_content);
237
+
238
+			// fill default values
239
+			$style->post_content = $this->override_defaults($style->post_content);
240
+			$style->post_content = wp_parse_args( $style->post_content, $default_values);
241 241
 
242 242
 			$styles[ $style->ID ] = $style;
243
-        }
243
+		}
244 244
 
245
-        if ( ! $default_style ) {
246
-            $default_style = reset($styles);
245
+		if ( ! $default_style ) {
246
+			$default_style = reset($styles);
247 247
 			$styles[ $default_style->ID ]->menu_order = 1;
248
-        }
248
+		}
249 249
 
250
-        return $styles;
251
-    }
250
+		return $styles;
251
+	}
252 252
 
253 253
 	public function get_default_style( $styles = null ) {
254
-        if ( ! isset($styles) ) {
254
+		if ( ! isset($styles) ) {
255 255
 			$styles = $this->get_all( 'menu_order', 'DESC', 1 );
256
-        }
256
+		}
257 257
 
258
-        foreach ( $styles as $style ) {
259
-            if ( $style->menu_order ) {
260
-                return $style;
261
-            }
262
-        }
263
-    }
258
+		foreach ( $styles as $style ) {
259
+			if ( $style->menu_order ) {
260
+				return $style;
261
+			}
262
+		}
263
+	}
264 264
 
265 265
 	public function override_defaults( $settings ) {
266
-	    if ( ! is_array($settings) ) {
267
-	        return $settings;
268
-	    }
269
-
270
-	    $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height'];
271
-
272
-	    if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) {
273
-	        $settings['form_desc_size'] = $settings['description_font_size'];
274
-	        $settings['form_desc_color'] = $settings['description_color'];
275
-	        $settings['title_color'] = $settings['label_color'];
276
-	    }
277
-
278
-	    if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) {
279
-	        $settings['section_color'] = $settings['label_color'];
280
-	        $settings['section_border_color'] = $settings['border_color'];
281
-	    }
282
-
283
-	    if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) {
284
-	        $settings['submit_hover_bg_color'] = $settings['submit_bg_color'];
285
-	        $settings['submit_hover_color'] = $settings['submit_text_color'];
286
-	        $settings['submit_hover_border_color'] = $settings['submit_border_color'];
287
-
288
-	        $settings['submit_active_bg_color'] = $settings['submit_bg_color'];
289
-	        $settings['submit_active_color'] = $settings['submit_text_color'];
290
-            $settings['submit_active_border_color'] = $settings['submit_border_color'];
291
-	    }
292
-
293
-	    return $settings;
266
+		if ( ! is_array($settings) ) {
267
+			return $settings;
268
+		}
269
+
270
+		$settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height'];
271
+
272
+		if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) {
273
+			$settings['form_desc_size'] = $settings['description_font_size'];
274
+			$settings['form_desc_color'] = $settings['description_color'];
275
+			$settings['title_color'] = $settings['label_color'];
276
+		}
277
+
278
+		if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) {
279
+			$settings['section_color'] = $settings['label_color'];
280
+			$settings['section_border_color'] = $settings['border_color'];
281
+		}
282
+
283
+		if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) {
284
+			$settings['submit_hover_bg_color'] = $settings['submit_bg_color'];
285
+			$settings['submit_hover_color'] = $settings['submit_text_color'];
286
+			$settings['submit_hover_border_color'] = $settings['submit_border_color'];
287
+
288
+			$settings['submit_active_bg_color'] = $settings['submit_bg_color'];
289
+			$settings['submit_active_color'] = $settings['submit_text_color'];
290
+			$settings['submit_active_border_color'] = $settings['submit_border_color'];
291
+		}
292
+
293
+		return $settings;
294 294
 	}
295 295
 
296 296
 	public function get_defaults() {
297
-        return array(
298
-            'theme_css'         => 'ui-lightness',
299
-            'theme_name'        => 'UI Lightness',
297
+		return array(
298
+			'theme_css'         => 'ui-lightness',
299
+			'theme_name'        => 'UI Lightness',
300 300
 
301 301
 			'center_form'		=> '',
302
-            'form_width'        => '100%',
303
-            'form_align'        => 'left',
304
-            'direction'         => is_rtl() ? 'rtl' : 'ltr',
305
-            'fieldset'          => '0px',
306
-            'fieldset_color'    => '000000',
307
-            'fieldset_padding'  => '0 0 15px 0',
308
-            'fieldset_bg_color' => '',
309
-
310
-            'title_size'        => '20px',
311
-            'title_color'       => '444444',
302
+			'form_width'        => '100%',
303
+			'form_align'        => 'left',
304
+			'direction'         => is_rtl() ? 'rtl' : 'ltr',
305
+			'fieldset'          => '0px',
306
+			'fieldset_color'    => '000000',
307
+			'fieldset_padding'  => '0 0 15px 0',
308
+			'fieldset_bg_color' => '',
309
+
310
+			'title_size'        => '20px',
311
+			'title_color'       => '444444',
312 312
 			'title_margin_top'  => '10px',
313 313
 			'title_margin_bottom' => '10px',
314
-            'form_desc_size'    => '14px',
315
-            'form_desc_color'   => '666666',
314
+			'form_desc_size'    => '14px',
315
+			'form_desc_color'   => '666666',
316 316
 			'form_desc_margin_top' => '10px',
317 317
 			'form_desc_margin_bottom' => '25px',
318 318
 
319
-            'font'              => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif',
320
-            'font_size'         => '14px',
321
-            'label_color'       => '444444',
322
-            'weight'            => 'bold',
323
-            'position'          => 'none',
324
-            'align'             => 'left',
325
-            'width'             => '150px',
326
-            'required_color'    => 'B94A48',
327
-            'required_weight'   => 'bold',
328
-            'label_padding'     => '0 0 3px 0',
329
-
330
-            'description_font_size' => '12px',
331
-            'description_color' => '666666',
332
-            'description_weight' => 'normal',
333
-            'description_style' => 'normal',
334
-            'description_align' => 'left',
319
+			'font'              => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif',
320
+			'font_size'         => '14px',
321
+			'label_color'       => '444444',
322
+			'weight'            => 'bold',
323
+			'position'          => 'none',
324
+			'align'             => 'left',
325
+			'width'             => '150px',
326
+			'required_color'    => 'B94A48',
327
+			'required_weight'   => 'bold',
328
+			'label_padding'     => '0 0 3px 0',
329
+
330
+			'description_font_size' => '12px',
331
+			'description_color' => '666666',
332
+			'description_weight' => 'normal',
333
+			'description_style' => 'normal',
334
+			'description_align' => 'left',
335 335
 			'description_margin' => '0',
336 336
 
337
-            'field_font_size'   => '14px',
338
-            'field_height' 		=> '32px',
339
-            'line_height'		=> 'normal',
340
-            'field_width'       => '100%',
341
-            'auto_width'        => false,
342
-            'field_pad'         => '6px 10px',
343
-            'field_margin'      => '20px',
337
+			'field_font_size'   => '14px',
338
+			'field_height' 		=> '32px',
339
+			'line_height'		=> 'normal',
340
+			'field_width'       => '100%',
341
+			'auto_width'        => false,
342
+			'field_pad'         => '6px 10px',
343
+			'field_margin'      => '20px',
344 344
 			'field_weight' => 'normal',
345
-            'text_color'        => '555555',
346
-            //'border_color_hv'   => 'cccccc',
347
-            'border_color'      => 'cccccc',
348
-            'field_border_width' => '1px',
349
-            'field_border_style' => 'solid',
350
-
351
-            'bg_color'          => 'ffffff',
352
-            //'bg_color_hv'       => 'ffffff',
345
+			'text_color'        => '555555',
346
+			//'border_color_hv'   => 'cccccc',
347
+			'border_color'      => 'cccccc',
348
+			'field_border_width' => '1px',
349
+			'field_border_style' => 'solid',
350
+
351
+			'bg_color'          => 'ffffff',
352
+			//'bg_color_hv'       => 'ffffff',
353 353
 			'remove_box_shadow' => '',
354
-            'bg_color_active'   => 'ffffff',
354
+			'bg_color_active'   => 'ffffff',
355 355
 			'border_color_active' => '66afe9',
356 356
 			'remove_box_shadow_active' => '',
357
-            'text_color_error'  => '444444',
358
-            'bg_color_error'    => 'ffffff',
357
+			'text_color_error'  => '444444',
358
+			'bg_color_error'    => 'ffffff',
359 359
 			'border_color_error' => 'B94A48',
360 360
 			'border_width_error' => '1px',
361 361
 			'border_style_error' => 'solid',
362
-            'bg_color_disabled' => 'ffffff',
363
-            'border_color_disabled' => 'E5E5E5',
364
-            'text_color_disabled' => 'A1A1A1',
365
-
366
-            'radio_align'       => 'block',
367
-            'check_align'       => 'block',
368
-            'check_font_size'   => '13px',
369
-            'check_label_color' => '444444',
370
-            'check_weight'      => 'normal',
371
-
372
-            'section_font_size' => '18px',
373
-            'section_color'     => '444444',
374
-            'section_weight'    => 'bold',
375
-            'section_pad'       => '15px 0 3px 0',
376
-            'section_mar_top'   => '15px',
362
+			'bg_color_disabled' => 'ffffff',
363
+			'border_color_disabled' => 'E5E5E5',
364
+			'text_color_disabled' => 'A1A1A1',
365
+
366
+			'radio_align'       => 'block',
367
+			'check_align'       => 'block',
368
+			'check_font_size'   => '13px',
369
+			'check_label_color' => '444444',
370
+			'check_weight'      => 'normal',
371
+
372
+			'section_font_size' => '18px',
373
+			'section_color'     => '444444',
374
+			'section_weight'    => 'bold',
375
+			'section_pad'       => '15px 0 3px 0',
376
+			'section_mar_top'   => '15px',
377 377
 			'section_mar_bottom' => '12px',
378
-            'section_bg_color'  => '',
379
-            'section_border_color' => 'e8e8e8',
380
-            'section_border_width' => '2px',
381
-            'section_border_style' => 'solid',
382
-            'section_border_loc' => '-top',
383
-            'collapse_icon'     => '6',
384
-            'collapse_pos'      => 'after',
385
-            'repeat_icon'       => '1',
386
-
387
-            'submit_style'      => false,
388
-            'submit_font_size'  => '14px',
389
-            'submit_width'      => 'auto',
390
-            'submit_height'     => 'auto',
391
-            'submit_bg_color'   => 'ffffff',
392
-            'submit_border_color' => 'cccccc',
393
-            'submit_border_width' => '1px',
394
-            'submit_text_color' => '444444',
395
-            'submit_weight'     => 'normal',
396
-            'submit_border_radius' => '4px',
397
-            'submit_bg_img'     => '',
398
-            'submit_margin'     => '10px',
399
-            'submit_padding'    => '6px 11px',
400
-            'submit_shadow_color' => 'eeeeee',
401
-            'submit_hover_bg_color' => 'efefef',
402
-            'submit_hover_color' => '444444',
403
-            'submit_hover_border_color' => 'cccccc',
404
-            'submit_active_bg_color' => 'efefef',
405
-            'submit_active_color' => '444444',
406
-            'submit_active_border_color' => 'cccccc',
407
-
408
-            'border_radius'     => '4px',
409
-            'error_bg'          => 'F2DEDE',
410
-            'error_border'      => 'EBCCD1',
411
-            'error_text'        => 'B94A48',
412
-            'error_font_size'   => '14px',
413
-
414
-            'success_bg_color'  => 'DFF0D8',
415
-            'success_border_color' => 'D6E9C6',
416
-            'success_text_color' => '468847',
417
-            'success_font_size' => '14px',
418
-
419
-            'important_style'   => false,
378
+			'section_bg_color'  => '',
379
+			'section_border_color' => 'e8e8e8',
380
+			'section_border_width' => '2px',
381
+			'section_border_style' => 'solid',
382
+			'section_border_loc' => '-top',
383
+			'collapse_icon'     => '6',
384
+			'collapse_pos'      => 'after',
385
+			'repeat_icon'       => '1',
386
+
387
+			'submit_style'      => false,
388
+			'submit_font_size'  => '14px',
389
+			'submit_width'      => 'auto',
390
+			'submit_height'     => 'auto',
391
+			'submit_bg_color'   => 'ffffff',
392
+			'submit_border_color' => 'cccccc',
393
+			'submit_border_width' => '1px',
394
+			'submit_text_color' => '444444',
395
+			'submit_weight'     => 'normal',
396
+			'submit_border_radius' => '4px',
397
+			'submit_bg_img'     => '',
398
+			'submit_margin'     => '10px',
399
+			'submit_padding'    => '6px 11px',
400
+			'submit_shadow_color' => 'eeeeee',
401
+			'submit_hover_bg_color' => 'efefef',
402
+			'submit_hover_color' => '444444',
403
+			'submit_hover_border_color' => 'cccccc',
404
+			'submit_active_bg_color' => 'efefef',
405
+			'submit_active_color' => '444444',
406
+			'submit_active_border_color' => 'cccccc',
407
+
408
+			'border_radius'     => '4px',
409
+			'error_bg'          => 'F2DEDE',
410
+			'error_border'      => 'EBCCD1',
411
+			'error_text'        => 'B94A48',
412
+			'error_font_size'   => '14px',
413
+
414
+			'success_bg_color'  => 'DFF0D8',
415
+			'success_border_color' => 'D6E9C6',
416
+			'success_text_color' => '468847',
417
+			'success_font_size' => '14px',
418
+
419
+			'important_style'   => false,
420 420
 
421 421
 			'progress_bg_color'     => 'dddddd',
422 422
 			'progress_active_color' => 'ffffff',
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
 			'progress_border_size'  => '2px',
427 427
 			'progress_size'         => '30px',
428 428
 
429
-            'custom_css'        => '',
430
-        );
431
-    }
429
+			'custom_css'        => '',
430
+		);
431
+	}
432 432
 
433 433
 	public function get_field_name( $field_name, $post_field = 'post_content' ) {
434 434
 		return 'frm_style_setting' . ( empty( $post_field ) ? '' : '[' . $post_field . ']' ) . '[' . $field_name . ']';
Please login to merge, or discard this patch.
classes/models/FrmCreateFile.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 		$this->file_name = $atts['file_name'];
19 19
 		$this->error_message = isset( $atts['error_message'] ) ? $atts['error_message'] : '';
20 20
 		$this->uploads = wp_upload_dir();
21
-		$this->chmod_dir = defined('FS_CHMOD_DIR') ? FS_CHMOD_DIR : ( fileperms( ABSPATH ) & 0777 | 0755 );
22
-		$this->chmod_file = defined('FS_CHMOD_FILE') ? FS_CHMOD_FILE : ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 );
21
+		$this->chmod_dir = defined( 'FS_CHMOD_DIR' ) ? FS_CHMOD_DIR : ( fileperms( ABSPATH ) & 0777 | 0755 );
22
+		$this->chmod_file = defined( 'FS_CHMOD_FILE' ) ? FS_CHMOD_FILE : ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 );
23 23
 	}
24 24
 
25 25
 	public function create_file( $file_content ) {
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 	private function get_ftp_creds( $type ) {
86 86
 		$credentials = get_option( 'ftp_credentials', array( 'hostname' => '', 'username' => '' ) );
87 87
 
88
-		$credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : $credentials['hostname'];
89
-		$credentials['username'] = defined('FTP_USER') ? FTP_USER : $credentials['username'];
90
-		$credentials['password'] = defined('FTP_PASS') ? FTP_PASS : '';
88
+		$credentials['hostname'] = defined( 'FTP_HOST' ) ? FTP_HOST : $credentials['hostname'];
89
+		$credentials['username'] = defined( 'FTP_USER' ) ? FTP_USER : $credentials['username'];
90
+		$credentials['password'] = defined( 'FTP_PASS' ) ? FTP_PASS : '';
91 91
 
92 92
 		// Check to see if we are setting the public/private keys for ssh
93
-		$credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : '';
94
-		$credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : '';
93
+		$credentials['public_key'] = defined( 'FTP_PUBKEY' ) ? FTP_PUBKEY : '';
94
+		$credentials['private_key'] = defined( 'FTP_PRIKEY' ) ? FTP_PRIKEY : '';
95 95
 
96 96
 		// Sanitize the hostname, Some people might pass in odd-data:
97 97
 		$credentials['hostname'] = preg_replace( '|\w+://|', '', $credentials['hostname'] ); //Strip any schemes off
Please login to merge, or discard this patch.
classes/views/styles/_field-labels.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <div class="field-group field-group-background clearfix frm-first-row">
2 2
 	<label><?php _e( 'Color', 'formidable' ) ?></label>
3
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('label_color') ) ?>" id="frm_label_color" class="hex" value="<?php echo esc_attr( $style->post_content['label_color'] ) ?>" />
3
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'label_color' ) ) ?>" id="frm_label_color" class="hex" value="<?php echo esc_attr( $style->post_content['label_color'] ) ?>" />
4 4
 </div>
5 5
 <div class="field-group clearfix frm-first-row">
6 6
 	<label><?php _e( 'Weight', 'formidable' ) ?></label>
7
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('weight') ) ?>" id="frm_weight">
7
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'weight' ) ) ?>" id="frm_weight">
8 8
 		<?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?>
9 9
 		<option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['weight'], $value ) ?>><?php echo esc_html( $name ) ?></option>
10 10
 		<?php } ?>
@@ -12,45 +12,45 @@  discard block
 block discarded – undo
12 12
 </div>
13 13
 <div class="field-group clearfix frm-first-row">
14 14
 	<label><?php _e( 'Size', 'formidable' ) ?></label>
15
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('font_size') ) ?>" id="frm_font_size" value="<?php echo esc_attr($style->post_content['font_size']) ?>"  size="3" />
15
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'font_size' ) ) ?>" id="frm_font_size" value="<?php echo esc_attr( $style->post_content['font_size'] ) ?>"  size="3" />
16 16
 </div>
17 17
 
18 18
 <div class="field-group clearfix frm_clear">
19 19
 	<label><?php _e( 'Position', 'formidable' ) ?></label>
20
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('position') ) ?>" id="frm_position">
20
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'position' ) ) ?>" id="frm_position">
21 21
 	    <?php foreach ( array( 'none' => __( 'top', 'formidable' ), 'left' => __( 'left', 'formidable' ), 'right' => __( 'right', 'formidable' ), 'no_label' => __( 'none', 'formidable' ) ) as $pos => $pos_label ) { ?>
22
-	        <option value="<?php echo esc_attr( $pos ) ?>" <?php selected($style->post_content['position'], $pos) ?>><?php echo esc_html( $pos_label ) ?></option>
22
+	        <option value="<?php echo esc_attr( $pos ) ?>" <?php selected( $style->post_content['position'], $pos ) ?>><?php echo esc_html( $pos_label ) ?></option>
23 23
 	    <?php } ?>
24 24
 	</select>
25 25
 </div>
26 26
 
27 27
 <div class="field-group clearfix">
28 28
 	<label><?php _e( 'Align', 'formidable' ) ?></label>
29
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('align') ) ?>" id="frm_align">
30
-		<option value="left" <?php selected($style->post_content['align'], 'left') ?>><?php _e( 'left', 'formidable' ) ?></option>
31
-		<option value="right" <?php selected($style->post_content['align'], 'right') ?>><?php _e( 'right', 'formidable' ) ?></option>
29
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'align' ) ) ?>" id="frm_align">
30
+		<option value="left" <?php selected( $style->post_content['align'], 'left' ) ?>><?php _e( 'left', 'formidable' ) ?></option>
31
+		<option value="right" <?php selected( $style->post_content['align'], 'right' ) ?>><?php _e( 'right', 'formidable' ) ?></option>
32 32
 	</select>
33 33
 </div>
34 34
 
35 35
 <div class="field-group clearfix">
36 36
 	<label><?php _e( 'Width', 'formidable' ) ?></label>
37
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('width') ) ?>" id="frm_width" value="<?php echo esc_attr( $style->post_content['width'] ) ?>" />
37
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'width' ) ) ?>" id="frm_width" value="<?php echo esc_attr( $style->post_content['width'] ) ?>" />
38 38
 </div>
39 39
 
40 40
 <div class="field-group clearfix frm_clear">
41 41
 	<label><?php _e( 'Padding', 'formidable' ) ?></label>
42
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('label_padding') ) ?>" id="frm_label_padding" value="<?php echo esc_attr( $style->post_content['label_padding'] ) ?>" />
42
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'label_padding' ) ) ?>" id="frm_label_padding" value="<?php echo esc_attr( $style->post_content['label_padding'] ) ?>" />
43 43
 </div>
44 44
 
45 45
 <div class="clear"></div>
46 46
 <h3><?php _e( 'Required Indicator', 'formidable' ) ?></h3>
47 47
 <div class="field-group field-group-border clearfix after-h3">
48 48
 	<label class="background"><?php _e( 'Color', 'formidable' ) ?></label>
49
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('required_color') ) ?>" id="frm_required_color" class="hex" value="<?php echo esc_attr( $style->post_content['required_color'] ) ?>" />
49
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'required_color' ) ) ?>" id="frm_required_color" class="hex" value="<?php echo esc_attr( $style->post_content['required_color'] ) ?>" />
50 50
 </div>
51 51
 <div class="field-group clearfix after-h3">
52 52
 	<label><?php _e( 'Weight', 'formidable' ) ?></label>
53
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('required_weight') ) ?>" id="frm_required_weight">
53
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'required_weight' ) ) ?>" id="frm_required_weight">
54 54
 		<?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?>
55 55
 		<option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['required_weight'], $value ) ?>><?php echo esc_html( $name ) ?></option>
56 56
 		<?php } ?>
Please login to merge, or discard this patch.
classes/views/styles/_buttons.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <p class="frm_no_top_margin">
2 2
 	<label for="frm_submit_style">
3
-		<input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('submit_style') ) ?>" id="frm_submit_style" <?php checked( $style->post_content['submit_style'], 1 ) ?> value="1" />
3
+		<input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_style' ) ) ?>" id="frm_submit_style" <?php checked( $style->post_content['submit_style'], 1 ) ?> value="1" />
4 4
 		<?php esc_html_e( 'Disable submit button styling', 'formidable' ); ?>
5 5
 		<span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Note: If disabled, you may not see the change take effect until you make 2 more styling changes or click "Update Options".', 'formidable' ) ?>"></span>
6 6
 	</label>
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
 <div class="posttypediv">
10 10
 	<ul class="posttype-tabs add-menu-item-tabs">
11 11
 		<li <?php echo ( 'default' == $current_tab ? ' class="tabs"' : '' ); ?>>
12
-    		<a href="<?php echo esc_url('?page=formidable-styles&page-tab=default#tabs-panel-button-default') ?>" class="nav-tab-link" data-type="tabs-panel-button-default" ><?php _e( 'Default', 'formidable' ) ?></a>
12
+    		<a href="<?php echo esc_url( '?page=formidable-styles&page-tab=default#tabs-panel-button-default' ) ?>" class="nav-tab-link" data-type="tabs-panel-button-default" ><?php _e( 'Default', 'formidable' ) ?></a>
13 13
     	</li>
14 14
 		<li <?php echo ( 'button-hover' == $current_tab ? ' class="tabs"' : '' ); ?>>
15
-			<a href="<?php echo esc_url('?page=formidable-styles&page-tab=button-hover#page-button-hover') ?>" class="nav-tab-link" data-type="tabs-panel-button-hover" ><?php _e( 'Hover', 'formidable' ) ?></a>
15
+			<a href="<?php echo esc_url( '?page=formidable-styles&page-tab=button-hover#page-button-hover' ) ?>" class="nav-tab-link" data-type="tabs-panel-button-hover" ><?php _e( 'Hover', 'formidable' ) ?></a>
16 16
 		</li>
17 17
 		<li <?php echo ( 'button-click' == $current_tab ? ' class="tabs"' : '' ); ?>>
18 18
 			<a href="?page=formidable-styles&page-tab=button-click#tabs-panel-button-click" class="nav-tab-link" data-type="tabs-panel-button-click"><?php _e( 'Click', 'formidable' ) ?></a>
@@ -24,22 +24,22 @@  discard block
 block discarded – undo
24 24
 	?>">
25 25
 	    <div class="field-group field-group-border clearfix">
26 26
         	<label><?php _e( 'Size', 'formidable' ) ?></label>
27
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_font_size') ) ?>" id="frm_submit_font_size" value="<?php echo esc_attr( $style->post_content['submit_font_size'] ) ?>"  size="3" />
27
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_font_size' ) ) ?>" id="frm_submit_font_size" value="<?php echo esc_attr( $style->post_content['submit_font_size'] ) ?>"  size="3" />
28 28
         </div>
29 29
 
30 30
         <div class="field-group clearfix">
31 31
         	<label><?php _e( 'Width', 'formidable' ) ?></label>
32
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_width') ) ?>" id="frm_submit_width" value="<?php echo esc_attr( $style->post_content['submit_width'] ) ?>"  size="5" />
32
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_width' ) ) ?>" id="frm_submit_width" value="<?php echo esc_attr( $style->post_content['submit_width'] ) ?>"  size="5" />
33 33
         </div>
34 34
 
35 35
         <div class="field-group clearfix">
36 36
         	<label><?php _e( 'Height', 'formidable' ) ?></label>
37
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_height') ) ?>" id="frm_submit_height" value="<?php echo esc_attr( $style->post_content['submit_height'] ) ?>"  size="5" />
37
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_height' ) ) ?>" id="frm_submit_height" value="<?php echo esc_attr( $style->post_content['submit_height'] ) ?>"  size="5" />
38 38
         </div>
39 39
 
40 40
         <div class="field-group clearfix">
41 41
         	<label><?php _e( 'Weight', 'formidable' ) ?></label>
42
-        	<select name="<?php echo esc_attr( $frm_style->get_field_name('submit_weight') ) ?>" id="frm_submit_weight">
42
+        	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_weight' ) ) ?>" id="frm_submit_weight">
43 43
 				<?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?>
44 44
 				<option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['submit_weight'], $value ) ?>><?php echo esc_html( $name ) ?></option>
45 45
 				<?php } ?>
@@ -48,48 +48,48 @@  discard block
 block discarded – undo
48 48
 
49 49
         <div class="field-group clearfix">
50 50
         	<label><?php _e( 'Corners', 'formidable' ) ?></label>
51
-        	<input type="text" value="<?php echo esc_attr( $style->post_content['submit_border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name('submit_border_radius') ) ?>" id="frm_submit_border_radius" size="4"/>
51
+        	<input type="text" value="<?php echo esc_attr( $style->post_content['submit_border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_border_radius' ) ) ?>" id="frm_submit_border_radius" size="4"/>
52 52
         </div>
53 53
 
54 54
         <div class="field-group field-group-border clearfix">
55 55
         	<label><?php _e( 'BG Color', 'formidable' ) ?></label>
56
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_bg_color') ) ?>" id="frm_submit_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_bg_color'] ) ?>" />
56
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_bg_color' ) ) ?>" id="frm_submit_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_bg_color'] ) ?>" />
57 57
         </div>
58 58
 
59 59
         <div class="field-group clearfix">
60 60
         	<label><?php _e( 'Text', 'formidable' ) ?></label>
61
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_text_color') ) ?>" id="frm_submit_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_text_color'] ) ?>" />
61
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_text_color' ) ) ?>" id="frm_submit_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_text_color'] ) ?>" />
62 62
         </div>
63 63
 
64 64
         <div class="field-group field-group-border clearfix">
65 65
         	<label><?php _e( 'Border', 'formidable' ) ?></label>
66
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_border_color') ) ?>" id="frm_submit_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_border_color'] ) ?>" />
66
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_border_color' ) ) ?>" id="frm_submit_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_border_color'] ) ?>" />
67 67
         </div>
68 68
 
69 69
         <div class="field-group clearfix">
70 70
         	<label><?php _e( 'Thickness', 'formidable' ) ?></label>
71
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_border_width') ) ?>" id="frm_submit_border_width" value="<?php echo esc_attr( $style->post_content['submit_border_width'] ) ?>" size="4" />
71
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_border_width' ) ) ?>" id="frm_submit_border_width" value="<?php echo esc_attr( $style->post_content['submit_border_width'] ) ?>" size="4" />
72 72
         </div>
73 73
 
74 74
         <div class="field-group clearfix">
75 75
         	<label><?php _e( 'Shadow', 'formidable' ) ?></label>
76
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_shadow_color') ) ?>" id="frm_submit_shadow_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_shadow_color'] ) ?>" />
76
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_shadow_color' ) ) ?>" id="frm_submit_shadow_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_shadow_color'] ) ?>" />
77 77
         </div>
78 78
 
79 79
         <div class="clear"></div>
80 80
         <div class="field-group field-group-border frm-full">
81 81
         	<label><?php _e( 'BG Image', 'formidable' ) ?></label>
82
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_bg_img') ) ?>" id="frm_submit_bg_img" value="<?php echo esc_attr( $style->post_content['submit_bg_img'] ) ?>"  />
82
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_bg_img' ) ) ?>" id="frm_submit_bg_img" value="<?php echo esc_attr( $style->post_content['submit_bg_img'] ) ?>"  />
83 83
         </div>
84 84
 
85 85
         <div class="field-group field-group-border clearfix">
86 86
         	<label><?php _e( 'Margin', 'formidable' ) ?></label>
87
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_margin') ) ?>" id="frm_submit_margin" value="<?php echo esc_attr( $style->post_content['submit_margin'] ) ?>" size="6" />
87
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_margin' ) ) ?>" id="frm_submit_margin" value="<?php echo esc_attr( $style->post_content['submit_margin'] ) ?>" size="6" />
88 88
         </div>
89 89
 
90 90
         <div class="field-group clearfix">
91 91
         	<label><?php _e( 'Padding', 'formidable' ) ?></label>
92
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_padding') ) ?>" id="frm_submit_padding" value="<?php echo esc_attr( $style->post_content['submit_padding'] ) ?>" size="6" />
92
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_padding' ) ) ?>" id="frm_submit_padding" value="<?php echo esc_attr( $style->post_content['submit_padding'] ) ?>" size="6" />
93 93
         </div>
94 94
         <div class="clear"></div>
95 95
 	</div><!-- /.tabs-panel -->
@@ -99,17 +99,17 @@  discard block
 block discarded – undo
99 99
 	?>">
100 100
 	    <div class="field-group clearfix">
101 101
         	<label><?php _e( 'BG Color', 'formidable' ) ?></label>
102
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_hover_bg_color') ) ?>" id="frm_submit_hover_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_bg_color'] ) ?>" />
102
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_hover_bg_color' ) ) ?>" id="frm_submit_hover_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_bg_color'] ) ?>" />
103 103
         </div>
104 104
 
105 105
         <div class="field-group clearfix">
106 106
     	    <label><?php _e( 'Text', 'formidable' ) ?></label>
107
-    	    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_hover_color') ) ?>" id="frm_submit_hover_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_color'] ) ?>" />
107
+    	    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_hover_color' ) ) ?>" id="frm_submit_hover_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_color'] ) ?>" />
108 108
         </div>
109 109
 
110 110
         <div class="field-group clearfix">
111 111
             <label><?php _e( 'Border', 'formidable' ) ?></label>
112
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_hover_border_color') ) ?>" id="frm_submit_hover_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_border_color'] ) ?>" />
112
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_hover_border_color' ) ) ?>" id="frm_submit_hover_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_border_color'] ) ?>" />
113 113
         </div>
114 114
 
115 115
 	    <div class="clear"></div>
@@ -120,17 +120,17 @@  discard block
 block discarded – undo
120 120
 	?>">
121 121
 	    <div class="field-group clearfix">
122 122
         	<label><?php _e( 'BG Color', 'formidable' ) ?></label>
123
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_active_bg_color') ) ?>" id="frm_submit_active_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_bg_color'] ) ?>" />
123
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_active_bg_color' ) ) ?>" id="frm_submit_active_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_bg_color'] ) ?>" />
124 124
         </div>
125 125
 
126 126
         <div class="field-group clearfix">
127 127
     	    <label><?php _e( 'Text', 'formidable' ) ?></label>
128
-    	    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_active_color') ) ?>" id="frm_submit_active_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_color'] ) ?>" />
128
+    	    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_active_color' ) ) ?>" id="frm_submit_active_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_color'] ) ?>" />
129 129
         </div>
130 130
 
131 131
         <div class="field-group clearfix">
132 132
             <label><?php _e( 'Border', 'formidable' ) ?></label>
133
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_active_border_color') ) ?>" id="frm_submit_active_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_border_color'] ) ?>" />
133
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_active_border_color' ) ) ?>" id="frm_submit_active_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_border_color'] ) ?>" />
134 134
         </div>
135 135
 
136 136
 	    <div class="clear"></div>
Please login to merge, or discard this patch.
classes/views/styles/_field-description.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <div class="field-group field-group-background clearfix frm-first-row">
2 2
 	<label><?php _e( 'Color', 'formidable' ) ?></label>
3
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('description_color') ) ?>" id="frm_description_color" class="hex" value="<?php echo esc_attr( $style->post_content['description_color'] ) ?>" />
3
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'description_color' ) ) ?>" id="frm_description_color" class="hex" value="<?php echo esc_attr( $style->post_content['description_color'] ) ?>" />
4 4
 </div>
5 5
 <div class="field-group clearfix frm-first-row">
6 6
 	<label><?php _e( 'Weight', 'formidable' ) ?></label>
7
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('description_weight') ) ?>" id="frm_description_weight">
7
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'description_weight' ) ) ?>" id="frm_description_weight">
8 8
 		<?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?>
9 9
 		<option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['description_weight'], $value ) ?>><?php echo esc_html( $name ) ?></option>
10 10
 		<?php } ?>
@@ -12,25 +12,25 @@  discard block
 block discarded – undo
12 12
 </div>
13 13
 <div class="field-group clearfix frm-first-row">
14 14
 	<label><?php _e( 'Style', 'formidable' ) ?></label>
15
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('description_style') ) ?>" id="frm_description_style">
16
-		<option value="normal" <?php selected($style->post_content['description_style'], 'normal') ?>><?php _e( 'normal', 'formidable' ) ?></option>
17
-		<option value="italic" <?php selected($style->post_content['description_style'], 'italic') ?>><?php _e( 'italic', 'formidable' ) ?></option>
15
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'description_style' ) ) ?>" id="frm_description_style">
16
+		<option value="normal" <?php selected( $style->post_content['description_style'], 'normal' ) ?>><?php _e( 'normal', 'formidable' ) ?></option>
17
+		<option value="italic" <?php selected( $style->post_content['description_style'], 'italic' ) ?>><?php _e( 'italic', 'formidable' ) ?></option>
18 18
 	</select>
19 19
 </div>
20 20
 
21 21
 <div class="field-group clearfix">
22 22
 	<label><?php _e( 'Size', 'formidable' ) ?></label>
23
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('description_font_size') ) ?>" id="frm_description_font_size" value="<?php echo esc_attr( $style->post_content['description_font_size'] ) ?>"  size="3" />
23
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'description_font_size' ) ) ?>" id="frm_description_font_size" value="<?php echo esc_attr( $style->post_content['description_font_size'] ) ?>"  size="3" />
24 24
 </div>
25 25
 <div class="field-group clearfix">
26 26
 	<label><?php _e( 'Align', 'formidable' ) ?></label>
27
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('description_align') ) ?>" id="frm_description_align">
28
-		<option value="left" <?php selected($style->post_content['description_align'], 'left') ?>><?php _e( 'left', 'formidable' ) ?></option>
29
-		<option value="right" <?php selected($style->post_content['description_align'], 'right') ?>><?php _e( 'right', 'formidable' ) ?></option>
27
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'description_align' ) ) ?>" id="frm_description_align">
28
+		<option value="left" <?php selected( $style->post_content['description_align'], 'left' ) ?>><?php _e( 'left', 'formidable' ) ?></option>
29
+		<option value="right" <?php selected( $style->post_content['description_align'], 'right' ) ?>><?php _e( 'right', 'formidable' ) ?></option>
30 30
 	</select>
31 31
 </div>
32 32
 <div class="field-group clearfix">
33 33
 	<label><?php _e( 'Margin', 'formidable' ) ?></label>
34
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('description_margin') ) ?>" id="frm_description_margin" value="<?php echo esc_attr( $style->post_content['description_margin'] ) ?>"  size="3" />
34
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'description_margin' ) ) ?>" id="frm_description_margin" value="<?php echo esc_attr( $style->post_content['description_margin'] ) ?>"  size="3" />
35 35
 </div>
36 36
 <div class="clear"></div>
Please login to merge, or discard this patch.
classes/models/FrmDb.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -308,7 +308,7 @@
 block discarded – undo
308 308
 	 *
309 309
 	 * @since 2.02.05
310 310
 	 * @param string $key
311
-	 * @param int|string $value
311
+	 * @param string $value
312 312
 	 * @param string $where
313 313
 	 */
314 314
     private static function add_query_placeholder( $key, $value, &$where ) {
Please login to merge, or discard this patch.
Indentation   +339 added lines, -339 removed lines patch added patch discarded remove patch
@@ -1,66 +1,66 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmDb {
4
-    var $fields;
5
-    var $forms;
6
-    var $entries;
7
-    var $entry_metas;
8
-
9
-    public function __construct() {
10
-        if ( ! defined('ABSPATH') ) {
11
-            die('You are not allowed to call this page directly.');
12
-        }
13
-
14
-        global $wpdb;
15
-        $this->fields         = $wpdb->prefix . 'frm_fields';
16
-        $this->forms          = $wpdb->prefix . 'frm_forms';
17
-        $this->entries        = $wpdb->prefix . 'frm_items';
18
-        $this->entry_metas    = $wpdb->prefix . 'frm_item_metas';
19
-    }
20
-
21
-    public function upgrade( $old_db_version = false ) {
22
-	    do_action( 'frm_before_install' );
23
-
24
-        global $wpdb;
25
-        //$frm_db_version is the version of the database we're moving to
26
-        $frm_db_version = FrmAppHelper::$db_version;
27
-        $old_db_version = (float) $old_db_version;
28
-        if ( ! $old_db_version ) {
29
-            $old_db_version = get_option('frm_db_version');
30
-        }
31
-
32
-        if ( $frm_db_version != $old_db_version ) {
4
+	var $fields;
5
+	var $forms;
6
+	var $entries;
7
+	var $entry_metas;
8
+
9
+	public function __construct() {
10
+		if ( ! defined('ABSPATH') ) {
11
+			die('You are not allowed to call this page directly.');
12
+		}
13
+
14
+		global $wpdb;
15
+		$this->fields         = $wpdb->prefix . 'frm_fields';
16
+		$this->forms          = $wpdb->prefix . 'frm_forms';
17
+		$this->entries        = $wpdb->prefix . 'frm_items';
18
+		$this->entry_metas    = $wpdb->prefix . 'frm_item_metas';
19
+	}
20
+
21
+	public function upgrade( $old_db_version = false ) {
22
+		do_action( 'frm_before_install' );
23
+
24
+		global $wpdb;
25
+		//$frm_db_version is the version of the database we're moving to
26
+		$frm_db_version = FrmAppHelper::$db_version;
27
+		$old_db_version = (float) $old_db_version;
28
+		if ( ! $old_db_version ) {
29
+			$old_db_version = get_option('frm_db_version');
30
+		}
31
+
32
+		if ( $frm_db_version != $old_db_version ) {
33 33
 			// update rewrite rules for views and other custom post types
34 34
 			flush_rewrite_rules();
35 35
 
36 36
 			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
37 37
 
38
-            $this->create_tables();
39
-            $this->migrate_data($frm_db_version, $old_db_version);
38
+			$this->create_tables();
39
+			$this->migrate_data($frm_db_version, $old_db_version);
40 40
 
41
-            /***** SAVE DB VERSION *****/
42
-            update_option('frm_db_version', $frm_db_version);
41
+			/***** SAVE DB VERSION *****/
42
+			update_option('frm_db_version', $frm_db_version);
43 43
 
44
-            /**** ADD/UPDATE DEFAULT TEMPLATES ****/
45
-            FrmXMLController::add_default_templates();
46
-        }
44
+			/**** ADD/UPDATE DEFAULT TEMPLATES ****/
45
+			FrmXMLController::add_default_templates();
46
+		}
47 47
 
48
-        do_action('frm_after_install');
48
+		do_action('frm_after_install');
49 49
 
50
-        /**** update the styling settings ****/
50
+		/**** update the styling settings ****/
51 51
 		if ( is_admin() && function_exists( 'get_filesystem_method' ) ) {
52 52
 			$frm_style = new FrmStyle();
53 53
 			$frm_style->update( 'default' );
54 54
 		}
55
-    }
55
+	}
56 56
 
57
-    public function collation() {
58
-        global $wpdb;
59
-        if ( ! $wpdb->has_cap( 'collation' ) ) {
60
-            return '';
61
-        }
57
+	public function collation() {
58
+		global $wpdb;
59
+		if ( ! $wpdb->has_cap( 'collation' ) ) {
60
+			return '';
61
+		}
62 62
 
63
-        $charset_collate = '';
63
+		$charset_collate = '';
64 64
 		if ( ! empty( $wpdb->charset ) ) {
65 65
 			$charset_collate .= ' DEFAULT CHARACTER SET ' . $wpdb->charset;
66 66
 		}
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 			$charset_collate .= ' COLLATE ' . $wpdb->collate;
70 70
 		}
71 71
 
72
-        return $charset_collate;
73
-    }
72
+		return $charset_collate;
73
+	}
74 74
 
75
-    private function create_tables() {
76
-        $charset_collate = $this->collation();
77
-        $sql = array();
75
+	private function create_tables() {
76
+		$charset_collate = $this->collation();
77
+		$sql = array();
78 78
 
79
-        /* Create/Upgrade Fields Table */
79
+		/* Create/Upgrade Fields Table */
80 80
 		$sql[] = 'CREATE TABLE ' . $this->fields . ' (
81 81
                 id int(11) NOT NULL auto_increment,
82 82
 				field_key varchar(100) default NULL,
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                 UNIQUE KEY field_key (field_key)
96 96
         )';
97 97
 
98
-        /* Create/Upgrade Forms Table */
98
+		/* Create/Upgrade Forms Table */
99 99
 		$sql[] = 'CREATE TABLE ' . $this->forms . ' (
100 100
                 id int(11) NOT NULL auto_increment,
101 101
 				form_key varchar(100) default NULL,
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
                 UNIQUE KEY form_key (form_key)
114 114
         )';
115 115
 
116
-        /* Create/Upgrade Items Table */
116
+		/* Create/Upgrade Items Table */
117 117
 		$sql[] = 'CREATE TABLE ' . $this->entries . ' (
118 118
                 id int(11) NOT NULL auto_increment,
119 119
 				item_key varchar(100) default NULL,
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
                 UNIQUE KEY item_key (item_key)
137 137
         )';
138 138
 
139
-        /* Create/Upgrade Meta Table */
139
+		/* Create/Upgrade Meta Table */
140 140
 		$sql[] = 'CREATE TABLE ' . $this->entry_metas . ' (
141 141
                 id int(11) NOT NULL auto_increment,
142 142
                 meta_value longtext default NULL,
@@ -148,43 +148,43 @@  discard block
 block discarded – undo
148 148
                 KEY item_id (item_id)
149 149
         )';
150 150
 
151
-        foreach ( $sql as $q ) {
151
+		foreach ( $sql as $q ) {
152 152
 			if ( function_exists( 'dbDelta' ) ) {
153 153
 				dbDelta( $q . $charset_collate . ';' );
154 154
 			} else {
155 155
 				global $wpdb;
156 156
 				$wpdb->query( $q . $charset_collate );
157 157
 			}
158
-            unset($q);
159
-        }
160
-    }
158
+			unset($q);
159
+		}
160
+	}
161 161
 
162
-    /**
163
-     * @param integer $frm_db_version
162
+	/**
163
+	 * @param integer $frm_db_version
164 164
 	 * @param int $old_db_version
165
-     */
165
+	 */
166 166
 	private function migrate_data( $frm_db_version, $old_db_version ) {
167 167
 		$migrations = array( 4, 6, 11, 16, 17, 23, 25 );
168
-        foreach ( $migrations as $migration ) {
169
-            if ( $frm_db_version >= $migration && $old_db_version < $migration ) {
168
+		foreach ( $migrations as $migration ) {
169
+			if ( $frm_db_version >= $migration && $old_db_version < $migration ) {
170 170
 				$function_name = 'migrate_to_' . $migration;
171
-                $this->$function_name();
172
-            }
173
-        }
174
-    }
171
+				$this->$function_name();
172
+			}
173
+		}
174
+	}
175 175
 
176
-    /**
177
-     * Change array into format $wpdb->prepare can use
176
+	/**
177
+	 * Change array into format $wpdb->prepare can use
178 178
 	 *
179 179
 	 * @param array $args
180 180
 	 * @param string $starts_with
181
-     */
182
-    public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) {
183
-        if ( empty($args) ) {
181
+	 */
182
+	public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) {
183
+		if ( empty($args) ) {
184 184
 			// add an arg to prevent prepare from failing
185 185
 			$args = array( 'where' => $starts_with . '1=%d', 'values' => array( 1 ) );
186 186
 			return;
187
-        }
187
+		}
188 188
 
189 189
 		$where = '';
190 190
 		$values = array();
@@ -195,64 +195,64 @@  discard block
 block discarded – undo
195 195
 		}
196 196
 
197 197
 		$args = compact( 'where', 'values' );
198
-    }
198
+	}
199 199
 
200
-    /**
200
+	/**
201 201
 	 * @param array $args
202
-     * @param string $base_where
203
-     * @param string $where
202
+	 * @param string $base_where
203
+	 * @param string $where
204 204
 	 * @param array $values
205
-     */
206
-    public static function parse_where_from_array( $args, $base_where, &$where, &$values ) {
207
-        $condition = ' AND';
208
-        if ( isset( $args['or'] ) ) {
209
-            $condition = ' OR';
210
-            unset( $args['or'] );
211
-        }
212
-
213
-        foreach ( $args as $key => $value ) {
214
-            $where .= empty( $where ) ? $base_where : $condition;
215
-            $array_inc_null = ( ! is_numeric( $key ) && is_array( $value ) && in_array( null, $value ) );
216
-            if ( is_numeric( $key ) || $array_inc_null ) {
217
-                $where .= ' ( ';
218
-                $nested_where = '';
219
-                if ( $array_inc_null ) {
220
-                    foreach ( $value as $val ) {
221
-                        self::parse_where_from_array( array( $key => $val, 'or' => 1 ), '', $nested_where, $values );
222
-                    }
223
-                } else {
224
-                    self::parse_where_from_array( $value, '', $nested_where, $values );
225
-                }
226
-                $where .= $nested_where;
227
-                $where .= ' ) ';
228
-            } else {
229
-                self::interpret_array_to_sql( $key, $value, $where, $values );
230
-            }
231
-        }
232
-    }
233
-
234
-    /**
235
-     * @param string $key
205
+	 */
206
+	public static function parse_where_from_array( $args, $base_where, &$where, &$values ) {
207
+		$condition = ' AND';
208
+		if ( isset( $args['or'] ) ) {
209
+			$condition = ' OR';
210
+			unset( $args['or'] );
211
+		}
212
+
213
+		foreach ( $args as $key => $value ) {
214
+			$where .= empty( $where ) ? $base_where : $condition;
215
+			$array_inc_null = ( ! is_numeric( $key ) && is_array( $value ) && in_array( null, $value ) );
216
+			if ( is_numeric( $key ) || $array_inc_null ) {
217
+				$where .= ' ( ';
218
+				$nested_where = '';
219
+				if ( $array_inc_null ) {
220
+					foreach ( $value as $val ) {
221
+						self::parse_where_from_array( array( $key => $val, 'or' => 1 ), '', $nested_where, $values );
222
+					}
223
+				} else {
224
+					self::parse_where_from_array( $value, '', $nested_where, $values );
225
+				}
226
+				$where .= $nested_where;
227
+				$where .= ' ) ';
228
+			} else {
229
+				self::interpret_array_to_sql( $key, $value, $where, $values );
230
+			}
231
+		}
232
+	}
233
+
234
+	/**
235
+	 * @param string $key
236 236
 	 * @param string|array $value
237
-     * @param string $where
237
+	 * @param string $where
238 238
 	 * @param array $values
239
-     */
240
-    private static function interpret_array_to_sql( $key, $value, &$where, &$values ) {
239
+	 */
240
+	private static function interpret_array_to_sql( $key, $value, &$where, &$values ) {
241 241
 		$key = trim( $key );
242 242
 
243 243
 		if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) {
244
-            $k = explode(' ', $key);
245
-            $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key );
246
-            $values[] = '%Y-%m-%d %H:%i:%s';
247
-        } else {
244
+			$k = explode(' ', $key);
245
+			$where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key );
246
+			$values[] = '%Y-%m-%d %H:%i:%s';
247
+		} else {
248 248
 			$where .= ' ' . $key;
249
-        }
249
+		}
250 250
 
251 251
 		$lowercase_key = explode( ' ', strtolower( $key ) );
252 252
 		$lowercase_key = end( $lowercase_key );
253 253
 
254
-        if ( is_array( $value ) ) {
255
-            // translate array of values to "in"
254
+		if ( is_array( $value ) ) {
255
+			// translate array of values to "in"
256 256
 			if ( strpos( $lowercase_key, 'like' ) !== false ) {
257 257
 				$where = preg_replace('/' . $key . '$/', '', $where);
258 258
 				$where .= '(';
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 				$where .= ' in (' . FrmAppHelper::prepare_array_values( $value, '%s' ) . ')';
271 271
 				$values = array_merge( $values, $value );
272 272
 			}
273
-        } else if ( strpos( $lowercase_key, 'like' ) !== false ) {
273
+		} else if ( strpos( $lowercase_key, 'like' ) !== false ) {
274 274
 			/**
275 275
 			 * Allow string to start or end with the value
276 276
 			 * If the key is like% then skip the first % for starts with
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
 			$where .= ' %s';
291 291
 			$values[] = $start . FrmAppHelper::esc_like( $value ) . $end;
292 292
 
293
-        } else if ( $value === null ) {
294
-            $where .= ' IS NULL';
295
-        } else {
293
+		} else if ( $value === null ) {
294
+			$where .= ' IS NULL';
295
+		} else {
296 296
 			// allow a - to prevent = from being added
297 297
 			if ( substr( $key, -1 ) == '-' ) {
298 298
 				$where = rtrim( $where, '-' );
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 
303 303
 			self::add_query_placeholder( $key, $value, $where );
304 304
 
305
-            $values[] = $value;
306
-        }
307
-    }
305
+			$values[] = $value;
306
+		}
307
+	}
308 308
 
309 309
 	/**
310 310
 	 * Add %d, or %s to query
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 * @param int|string $value
315 315
 	 * @param string $where
316 316
 	 */
317
-    private static function add_query_placeholder( $key, $value, &$where ) {
317
+	private static function add_query_placeholder( $key, $value, &$where ) {
318 318
 		if ( is_numeric( $value ) && strpos( $key, 'meta_value' ) === false ) {
319 319
 			$where .= '%d';
320 320
 		} else {
@@ -322,16 +322,16 @@  discard block
 block discarded – undo
322 322
 		}
323 323
 	}
324 324
 
325
-    /**
326
-     * @param string $table
325
+	/**
326
+	 * @param string $table
327 327
 	 * @param array $where
328 328
 	 * @param array $args
329 329
 	 * @return int
330
-     */
331
-    public static function get_count( $table, $where = array(), $args = array() ) {
332
-        $count = self::get_var( $table, $where, 'COUNT(*)', $args );
333
-        return $count;
334
-    }
330
+	 */
331
+	public static function get_count( $table, $where = array(), $args = array() ) {
332
+		$count = self::get_var( $table, $where, 'COUNT(*)', $args );
333
+		return $count;
334
+	}
335 335
 
336 336
 	/**
337 337
 	 * @param string $table
@@ -342,56 +342,56 @@  discard block
 block discarded – undo
342 342
 	 * @param string $type
343 343
 	 * @return array|null|string|object
344 344
 	 */
345
-    public static function get_var( $table, $where = array(), $field = 'id', $args = array(), $limit = '', $type = 'var' ) {
346
-        $group = '';
347
-        self::get_group_and_table_name( $table, $group );
345
+	public static function get_var( $table, $where = array(), $field = 'id', $args = array(), $limit = '', $type = 'var' ) {
346
+		$group = '';
347
+		self::get_group_and_table_name( $table, $group );
348 348
 		self::convert_options_to_array( $args, '', $limit );
349 349
 
350 350
 		$query = self::generate_query_string_from_pieces( $field, $table, $where, $args );
351 351
 
352 352
 		$cache_key = str_replace( array( ' ', ',' ), '_', trim( implode( '_', FrmAppHelper::array_flatten( $where ) ) . implode( '_', $args ) . $field . '_' . $type, ' WHERE' ) );
353 353
 		$results = FrmAppHelper::check_cache( $cache_key, $group, $query, 'get_' . $type );
354
-        return $results;
355
-    }
354
+		return $results;
355
+	}
356 356
 
357
-    /**
358
-     * @param string $table
359
-     * @param array $where
357
+	/**
358
+	 * @param string $table
359
+	 * @param array $where
360 360
 	 * @param string $field
361 361
 	 * @param array $args
362 362
 	 * @param string $limit
363 363
 	 * @return mixed
364
-     */
365
-    public static function get_col( $table, $where = array(), $field = 'id', $args = array(), $limit = '' ) {
366
-        return self::get_var( $table, $where, $field, $args, $limit, 'col' );
367
-    }
368
-
369
-    /**
370
-     * @since 2.0
371
-     * @param string $table
364
+	 */
365
+	public static function get_col( $table, $where = array(), $field = 'id', $args = array(), $limit = '' ) {
366
+		return self::get_var( $table, $where, $field, $args, $limit, 'col' );
367
+	}
368
+
369
+	/**
370
+	 * @since 2.0
371
+	 * @param string $table
372 372
 	 * @param array $where
373 373
 	 * @param string $fields
374 374
 	 * @param array $args
375 375
 	 * @return mixed
376
-     */
377
-    public static function get_row( $table, $where = array(), $fields = '*', $args = array() ) {
378
-        $args['limit'] = 1;
379
-        return self::get_var( $table, $where, $fields, $args, '', 'row' );
380
-    }
381
-
382
-    /**
383
-     * Prepare a key/value array before DB call
376
+	 */
377
+	public static function get_row( $table, $where = array(), $fields = '*', $args = array() ) {
378
+		$args['limit'] = 1;
379
+		return self::get_var( $table, $where, $fields, $args, '', 'row' );
380
+	}
381
+
382
+	/**
383
+	 * Prepare a key/value array before DB call
384 384
 	 *
385
-     * @since 2.0
386
-     * @param string $table
385
+	 * @since 2.0
386
+	 * @param string $table
387 387
 	 * @param array $where
388 388
 	 * @param string $fields
389 389
 	 * @param array $args
390 390
 	 * @return mixed
391
-     */
392
-    public static function get_results( $table, $where = array(), $fields = '*', $args = array() ) {
393
-        return self::get_var( $table, $where, $fields, $args, '', 'results' );
394
-    }
391
+	 */
392
+	public static function get_results( $table, $where = array(), $fields = '*', $args = array() ) {
393
+		return self::get_var( $table, $where, $fields, $args, '', 'results' );
394
+	}
395 395
 
396 396
 	/**
397 397
 	 * Check for like, not like, in, not in, =, !=, >, <, <=, >=
@@ -428,59 +428,59 @@  discard block
 block discarded – undo
428 428
 		return '';
429 429
 	}
430 430
 
431
-    /**
432
-     * Get 'frm_forms' from wp_frm_forms or a longer table param that includes a join
433
-     * Also add the wpdb->prefix to the table if it's missing
434
-     *
435
-     * @param string $table
436
-     * @param string $group
437
-     */
438
-    private static function get_group_and_table_name( &$table, &$group ) {
431
+	/**
432
+	 * Get 'frm_forms' from wp_frm_forms or a longer table param that includes a join
433
+	 * Also add the wpdb->prefix to the table if it's missing
434
+	 *
435
+	 * @param string $table
436
+	 * @param string $group
437
+	 */
438
+	private static function get_group_and_table_name( &$table, &$group ) {
439 439
 		global $wpdb, $wpmuBaseTablePrefix;
440 440
 
441
-        $table_parts = explode(' ', $table);
442
-        $group = reset($table_parts);
443
-        $group = str_replace( $wpdb->prefix, '', $group );
441
+		$table_parts = explode(' ', $table);
442
+		$group = reset($table_parts);
443
+		$group = str_replace( $wpdb->prefix, '', $group );
444 444
 
445 445
 		$prefix = $wpmuBaseTablePrefix ? $wpmuBaseTablePrefix : $wpdb->base_prefix;
446 446
 		$group = str_replace( $prefix, '', $group );
447 447
 
448
-        if ( $group == $table ) {
449
-            $table = $wpdb->prefix . $table;
450
-        }
448
+		if ( $group == $table ) {
449
+			$table = $wpdb->prefix . $table;
450
+		}
451 451
 
452 452
 		// switch to singular group name
453 453
 		$group = rtrim( $group, 's' );
454
-    }
454
+	}
455 455
 
456
-    private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) {
457
-        if ( ! is_array($args) ) {
456
+	private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) {
457
+		if ( ! is_array($args) ) {
458 458
 			$args = array( 'order_by' => $args );
459
-        }
459
+		}
460 460
 
461
-        if ( ! empty( $order_by ) ) {
462
-            $args['order_by'] = $order_by;
463
-        }
461
+		if ( ! empty( $order_by ) ) {
462
+			$args['order_by'] = $order_by;
463
+		}
464 464
 
465
-        if ( ! empty( $limit ) ) {
466
-            $args['limit'] = $limit;
467
-        }
465
+		if ( ! empty( $limit ) ) {
466
+			$args['limit'] = $limit;
467
+		}
468 468
 
469
-        $temp_args = $args;
470
-        foreach ( $temp_args as $k => $v ) {
471
-            if ( $v == '' ) {
469
+		$temp_args = $args;
470
+		foreach ( $temp_args as $k => $v ) {
471
+			if ( $v == '' ) {
472 472
 				unset( $args[ $k ] );
473
-                continue;
474
-            }
473
+				continue;
474
+			}
475 475
 
476
-            if ( $k == 'limit' ) {
476
+			if ( $k == 'limit' ) {
477 477
 				$args[ $k ] = FrmAppHelper::esc_limit( $v );
478
-            }
479
-            $db_name = strtoupper( str_replace( '_', ' ', $k ) );
480
-            if ( strpos( $v, $db_name ) === false ) {
478
+			}
479
+			$db_name = strtoupper( str_replace( '_', ' ', $k ) );
480
+			if ( strpos( $v, $db_name ) === false ) {
481 481
 				$args[ $k ] = $db_name . ' ' . $v;
482
-            }
483
-        }
482
+			}
483
+		}
484 484
 
485 485
 		// Make sure LIMIT is the last argument
486 486
 		if ( isset( $args['order_by'] ) && isset( $args['limit'] ) ) {
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 			unset( $args['limit'] );
489 489
 			$args['limit'] = $temp_limit;
490 490
 		}
491
-    }
491
+	}
492 492
 
493 493
 	/**
494 494
 	 * Get the associative array results for the given columns, table, and where query
@@ -541,31 +541,31 @@  discard block
 block discarded – undo
541 541
 		return $query;
542 542
 	}
543 543
 
544
-    public function uninstall() {
544
+	public function uninstall() {
545 545
 		if ( ! current_user_can( 'administrator' ) ) {
546
-            $frm_settings = FrmAppHelper::get_settings();
547
-            wp_die($frm_settings->admin_permission);
548
-        }
546
+			$frm_settings = FrmAppHelper::get_settings();
547
+			wp_die($frm_settings->admin_permission);
548
+		}
549 549
 
550
-        global $wpdb, $wp_roles;
550
+		global $wpdb, $wp_roles;
551 551
 
552 552
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->fields );
553 553
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->forms );
554 554
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entries );
555 555
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entry_metas );
556 556
 
557
-        delete_option('frm_options');
558
-        delete_option('frm_db_version');
557
+		delete_option('frm_options');
558
+		delete_option('frm_db_version');
559 559
 
560
-        //delete roles
561
-        $frm_roles = FrmAppHelper::frm_capabilities();
562
-        $roles = get_editable_roles();
563
-        foreach ( $frm_roles as $frm_role => $frm_role_description ) {
564
-            foreach ( $roles as $role => $details ) {
565
-                $wp_roles->remove_cap( $role, $frm_role );
566
-                unset($role, $details);
567
-    		}
568
-    		unset($frm_role, $frm_role_description);
560
+		//delete roles
561
+		$frm_roles = FrmAppHelper::frm_capabilities();
562
+		$roles = get_editable_roles();
563
+		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
564
+			foreach ( $roles as $role => $details ) {
565
+				$wp_roles->remove_cap( $role, $frm_role );
566
+				unset($role, $details);
567
+			}
568
+			unset($frm_role, $frm_role_description);
569 569
 		}
570 570
 		unset($roles, $frm_roles);
571 571
 
@@ -589,9 +589,9 @@  discard block
 block discarded – undo
589 589
 
590 590
 		$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE %s OR option_name LIKE %s', '_transient_timeout_frm_form_fields_%', '_transient_frm_form_fields_%' ) );
591 591
 
592
-        do_action('frm_after_uninstall');
593
-        return true;
594
-    }
592
+		do_action('frm_after_uninstall');
593
+		return true;
594
+	}
595 595
 
596 596
 	/**
597 597
 	 * Migrate old styling settings. If sites are using the old
@@ -630,150 +630,150 @@  discard block
 block discarded – undo
630 630
 		}
631 631
 	}
632 632
 
633
-    /**
634
-     * Change field size from character to pixel -- Multiply by 9
635
-     */
636
-    private function migrate_to_17() {
637
-        global $wpdb;
633
+	/**
634
+	 * Change field size from character to pixel -- Multiply by 9
635
+	 */
636
+	private function migrate_to_17() {
637
+		global $wpdb;
638 638
 		$pixel_conversion = 9;
639 639
 
640
-        // Get query arguments
640
+		// Get query arguments
641 641
 		$field_types = array( 'textarea', 'text', 'number', 'email', 'url', 'rte', 'date', 'phone', 'password', 'image', 'tag', 'file' );
642 642
 		$query = array( 'type' => $field_types, 'field_options like' => 's:4:"size";', 'field_options not like' => 's:4:"size";s:0:' );
643 643
 
644
-        // Get results
644
+		// Get results
645 645
 		$fields = FrmDb::get_results( $this->fields, $query, 'id, field_options' );
646 646
 
647
-        $updated = 0;
648
-        foreach ( $fields as $f ) {
649
-            $f->field_options = maybe_unserialize($f->field_options);
650
-            if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) {
651
-                continue;
652
-            }
647
+		$updated = 0;
648
+		foreach ( $fields as $f ) {
649
+			$f->field_options = maybe_unserialize($f->field_options);
650
+			if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) {
651
+				continue;
652
+			}
653 653
 
654 654
 			$f->field_options['size'] = round( $pixel_conversion * (int) $f->field_options['size'] );
655
-            $f->field_options['size'] .= 'px';
656
-            $u = FrmField::update( $f->id, array( 'field_options' => $f->field_options ) );
657
-            if ( $u ) {
658
-                $updated++;
659
-            }
660
-            unset($f);
661
-        }
662
-
663
-        // Change the characters in widgets to pixels
664
-        $widgets = get_option('widget_frm_show_form');
665
-        if ( empty($widgets) ) {
666
-            return;
667
-        }
668
-
669
-        $widgets = maybe_unserialize($widgets);
670
-        foreach ( $widgets as $k => $widget ) {
671
-            if ( ! is_array($widget) || ! isset($widget['size']) ) {
672
-                continue;
673
-            }
655
+			$f->field_options['size'] .= 'px';
656
+			$u = FrmField::update( $f->id, array( 'field_options' => $f->field_options ) );
657
+			if ( $u ) {
658
+				$updated++;
659
+			}
660
+			unset($f);
661
+		}
662
+
663
+		// Change the characters in widgets to pixels
664
+		$widgets = get_option('widget_frm_show_form');
665
+		if ( empty($widgets) ) {
666
+			return;
667
+		}
668
+
669
+		$widgets = maybe_unserialize($widgets);
670
+		foreach ( $widgets as $k => $widget ) {
671
+			if ( ! is_array($widget) || ! isset($widget['size']) ) {
672
+				continue;
673
+			}
674 674
 			$size = round( $pixel_conversion * (int) $widget['size'] );
675
-            $size .= 'px';
675
+			$size .= 'px';
676 676
 			$widgets[ $k ]['size'] = $size;
677
-        }
678
-        update_option('widget_frm_show_form', $widgets);
679
-    }
680
-
681
-    /**
682
-     * Migrate post and email notification settings into actions
683
-     */
684
-    private function migrate_to_16() {
685
-        global $wpdb;
686
-
687
-        $forms = FrmDb::get_results( $this->forms, array(), 'id, options, is_template, default_template' );
688
-
689
-        /**
690
-        * Old email settings format:
691
-        * email_to: Email or field id
692
-        * also_email_to: array of fields ids
693
-        * reply_to: Email, field id, 'custom'
694
-        * cust_reply_to: string
695
-        * reply_to_name: field id, 'custom'
696
-        * cust_reply_to_name: string
697
-        * plain_text: 0|1
698
-        * email_message: string or ''
699
-        * email_subject: string or ''
700
-        * inc_user_info: 0|1
701
-        * update_email: 0, 1, 2
702
-        *
703
-        * Old autoresponder settings format:
704
-        * auto_responder: 0|1
705
-        * ar_email_message: string or ''
706
-        * ar_email_to: field id
707
-        * ar_plain_text: 0|1
708
-        * ar_reply_to_name: string
709
-        * ar_reply_to: string
710
-        * ar_email_subject: string
711
-        * ar_update_email: 0, 1, 2
712
-        *
713
-        * New email settings:
714
-        * post_content: json settings
715
-        * post_title: form id
716
-        * post_excerpt: message
717
-        *
718
-        */
719
-
720
-        foreach ( $forms as $form ) {
677
+		}
678
+		update_option('widget_frm_show_form', $widgets);
679
+	}
680
+
681
+	/**
682
+	 * Migrate post and email notification settings into actions
683
+	 */
684
+	private function migrate_to_16() {
685
+		global $wpdb;
686
+
687
+		$forms = FrmDb::get_results( $this->forms, array(), 'id, options, is_template, default_template' );
688
+
689
+		/**
690
+		 * Old email settings format:
691
+		 * email_to: Email or field id
692
+		 * also_email_to: array of fields ids
693
+		 * reply_to: Email, field id, 'custom'
694
+		 * cust_reply_to: string
695
+		 * reply_to_name: field id, 'custom'
696
+		 * cust_reply_to_name: string
697
+		 * plain_text: 0|1
698
+		 * email_message: string or ''
699
+		 * email_subject: string or ''
700
+		 * inc_user_info: 0|1
701
+		 * update_email: 0, 1, 2
702
+		 *
703
+		 * Old autoresponder settings format:
704
+		 * auto_responder: 0|1
705
+		 * ar_email_message: string or ''
706
+		 * ar_email_to: field id
707
+		 * ar_plain_text: 0|1
708
+		 * ar_reply_to_name: string
709
+		 * ar_reply_to: string
710
+		 * ar_email_subject: string
711
+		 * ar_update_email: 0, 1, 2
712
+		 *
713
+		 * New email settings:
714
+		 * post_content: json settings
715
+		 * post_title: form id
716
+		 * post_excerpt: message
717
+		 *
718
+		 */
719
+
720
+		foreach ( $forms as $form ) {
721 721
 			if ( $form->is_template && $form->default_template ) {
722 722
 				// don't migrate the default templates since the email will be added anyway
723 723
 				continue;
724 724
 			}
725 725
 
726
-            // Format form options
727
-            $form_options = maybe_unserialize($form->options);
726
+			// Format form options
727
+			$form_options = maybe_unserialize($form->options);
728 728
 
729
-            // Migrate settings to actions
730
-            FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id );
731
-        }
732
-    }
729
+			// Migrate settings to actions
730
+			FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id );
731
+		}
732
+	}
733 733
 
734
-    private function migrate_to_11() {
735
-        global $wpdb;
734
+	private function migrate_to_11() {
735
+		global $wpdb;
736 736
 
737
-        $forms = FrmDb::get_results( $this->forms, array(), 'id, options');
737
+		$forms = FrmDb::get_results( $this->forms, array(), 'id, options');
738 738
 
739
-        $sending = __( 'Sending', 'formidable' );
739
+		$sending = __( 'Sending', 'formidable' );
740 740
 		$img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif';
741
-        $old_default_html = <<<DEFAULT_HTML
741
+		$old_default_html = <<<DEFAULT_HTML
742 742
 <div class="frm_submit">
743 743
 [if back_button]<input type="submit" value="[back_label]" name="frm_prev_page" formnovalidate="formnovalidate" [back_hook] />[/if back_button]
744 744
 <input type="submit" value="[button_label]" [button_action] />
745 745
 <img class="frm_ajax_loading" src="$img" alt="$sending" style="visibility:hidden;" />
746 746
 </div>
747 747
 DEFAULT_HTML;
748
-        unset($sending, $img);
748
+		unset($sending, $img);
749 749
 
750
-        $new_default_html = FrmFormsHelper::get_default_html('submit');
751
-        $draft_link = FrmFormsHelper::get_draft_link();
750
+		$new_default_html = FrmFormsHelper::get_default_html('submit');
751
+		$draft_link = FrmFormsHelper::get_draft_link();
752 752
 		foreach ( $forms as $form ) {
753
-            $form->options = maybe_unserialize($form->options);
754
-            if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) {
755
-                continue;
756
-            }
753
+			$form->options = maybe_unserialize($form->options);
754
+			if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) {
755
+				continue;
756
+			}
757 757
 
758
-            if ( $form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html ) {
759
-                $form->options['submit_html'] = $new_default_html;
758
+			if ( $form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html ) {
759
+				$form->options['submit_html'] = $new_default_html;
760 760
 				$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
761 761
 			} else if ( ! strpos( $form->options['submit_html'], 'save_draft' ) ) {
762 762
 				$form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] );
763 763
 				$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
764
-            }
765
-            unset($form);
766
-        }
767
-        unset($forms);
768
-    }
764
+			}
765
+			unset($form);
766
+		}
767
+		unset($forms);
768
+	}
769 769
 
770
-    private function migrate_to_6() {
771
-        global $wpdb;
770
+	private function migrate_to_6() {
771
+		global $wpdb;
772 772
 
773 773
 		$no_save = array_merge( FrmField::no_save_fields(), array( 'form', 'hidden', 'user_id' ) );
774 774
 		$fields = FrmDb::get_results( $this->fields, array( 'type NOT' => $no_save ), 'id, field_options' );
775 775
 
776
-        $default_html = <<<DEFAULT_HTML
776
+		$default_html = <<<DEFAULT_HTML
777 777
 <div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
778 778
     <label class="frm_pos_[label_position]">[field_name]
779 779
         <span class="frm_required">[required_label]</span>
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 </div>
784 784
 DEFAULT_HTML;
785 785
 
786
-        $old_default_html = <<<DEFAULT_HTML
786
+		$old_default_html = <<<DEFAULT_HTML
787 787
 <div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
788 788
     <label class="frm_pos_[label_position]">[field_name]
789 789
         <span class="frm_required">[required_label]</span>
@@ -793,25 +793,25 @@  discard block
 block discarded – undo
793 793
 </div>
794 794
 DEFAULT_HTML;
795 795
 
796
-        $new_default_html = FrmFieldsHelper::get_default_html('text');
797
-        foreach ( $fields as $field ) {
798
-            $field->field_options = maybe_unserialize($field->field_options);
796
+		$new_default_html = FrmFieldsHelper::get_default_html('text');
797
+		foreach ( $fields as $field ) {
798
+			$field->field_options = maybe_unserialize($field->field_options);
799 799
 			if ( ! FrmField::is_option_empty( $field, 'custom_html' ) || $field->field_options['custom_html'] == $default_html || $field->field_options['custom_html'] == $old_default_html ) {
800
-                $field->field_options['custom_html'] = $new_default_html;
800
+				$field->field_options['custom_html'] = $new_default_html;
801 801
 				$wpdb->update( $this->fields, array( 'field_options' => maybe_serialize( $field->field_options ) ), array( 'id' => $field->id ) );
802
-            }
803
-            unset($field);
804
-        }
805
-        unset($default_html, $old_default_html, $fields);
806
-    }
807
-
808
-    private function migrate_to_4() {
809
-        global $wpdb;
802
+			}
803
+			unset($field);
804
+		}
805
+		unset($default_html, $old_default_html, $fields);
806
+	}
807
+
808
+	private function migrate_to_4() {
809
+		global $wpdb;
810 810
 		$user_ids = FrmEntryMeta::getAll( array( 'fi.type' => 'user_id' ) );
811
-        foreach ( $user_ids as $user_id ) {
811
+		foreach ( $user_ids as $user_id ) {
812 812
 			$wpdb->update( $this->entries, array( 'user_id' => $user_id->meta_value ), array( 'id' => $user_id->item_id ) );
813
-        }
814
-    }
813
+		}
814
+	}
815 815
 
816 816
 	public static function get_one_record( $table, $args = array(), $fields = '*', $order_by = '' ) {
817 817
 		_deprecated_function( __FUNCTION__, '2.0', 'FrmDb::get_row' );
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
     var $entry_metas;
8 8
 
9 9
     public function __construct() {
10
-        if ( ! defined('ABSPATH') ) {
11
-            die('You are not allowed to call this page directly.');
10
+        if ( ! defined( 'ABSPATH' ) ) {
11
+            die( 'You are not allowed to call this page directly.' );
12 12
         }
13 13
 
14 14
         global $wpdb;
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         $frm_db_version = FrmAppHelper::$db_version;
27 27
         $old_db_version = (float) $old_db_version;
28 28
         if ( ! $old_db_version ) {
29
-            $old_db_version = get_option('frm_db_version');
29
+            $old_db_version = get_option( 'frm_db_version' );
30 30
         }
31 31
 
32 32
         if ( $frm_db_version != $old_db_version ) {
@@ -36,16 +36,16 @@  discard block
 block discarded – undo
36 36
 			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
37 37
 
38 38
             $this->create_tables();
39
-            $this->migrate_data($frm_db_version, $old_db_version);
39
+            $this->migrate_data( $frm_db_version, $old_db_version );
40 40
 
41 41
             /***** SAVE DB VERSION *****/
42
-            update_option('frm_db_version', $frm_db_version);
42
+            update_option( 'frm_db_version', $frm_db_version );
43 43
 
44 44
             /**** ADD/UPDATE DEFAULT TEMPLATES ****/
45 45
             FrmXMLController::add_default_templates();
46 46
         }
47 47
 
48
-        do_action('frm_after_install');
48
+        do_action( 'frm_after_install' );
49 49
 
50 50
         /**** update the styling settings ****/
51 51
 		if ( is_admin() && function_exists( 'get_filesystem_method' ) ) {
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 				global $wpdb;
156 156
 				$wpdb->query( $q . $charset_collate );
157 157
 			}
158
-            unset($q);
158
+            unset( $q );
159 159
         }
160 160
     }
161 161
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 * @param string $starts_with
181 181
      */
182 182
     public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) {
183
-        if ( empty($args) ) {
183
+        if ( empty( $args ) ) {
184 184
 			// add an arg to prevent prepare from failing
185 185
 			$args = array( 'where' => $starts_with . '1=%d', 'values' => array( 1 ) );
186 186
 			return;
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		$key = trim( $key );
242 242
 
243 243
 		if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) {
244
-            $k = explode(' ', $key);
244
+            $k = explode( ' ', $key );
245 245
             $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key );
246 246
             $values[] = '%Y-%m-%d %H:%i:%s';
247 247
         } else {
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         if ( is_array( $value ) ) {
255 255
             // translate array of values to "in"
256 256
 			if ( strpos( $lowercase_key, 'like' ) !== false ) {
257
-				$where = preg_replace('/' . $key . '$/', '', $where);
257
+				$where = preg_replace( '/' . $key . '$/', '', $where );
258 258
 				$where .= '(';
259 259
 				$start = true;
260 260
 				foreach ( $value as $v ) {
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
 		);
416 416
 
417 417
 		$where_is = strtolower( $where_is );
418
-		if ( isset( $switch_to[ $where_is ] ) ) {
419
-			return ' ' . $switch_to[ $where_is ];
418
+		if ( isset( $switch_to[$where_is] ) ) {
419
+			return ' ' . $switch_to[$where_is];
420 420
 		}
421 421
 
422 422
 		// > and < need a little more work since we don't want them switched to >= and <=
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
     private static function get_group_and_table_name( &$table, &$group ) {
439 439
 		global $wpdb, $wpmuBaseTablePrefix;
440 440
 
441
-        $table_parts = explode(' ', $table);
442
-        $group = reset($table_parts);
441
+        $table_parts = explode( ' ', $table );
442
+        $group = reset( $table_parts );
443 443
         $group = str_replace( $wpdb->prefix, '', $group );
444 444
 
445 445
 		$prefix = $wpmuBaseTablePrefix ? $wpmuBaseTablePrefix : $wpdb->base_prefix;
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
     }
455 455
 
456 456
     private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) {
457
-        if ( ! is_array($args) ) {
457
+        if ( ! is_array( $args ) ) {
458 458
 			$args = array( 'order_by' => $args );
459 459
         }
460 460
 
@@ -469,16 +469,16 @@  discard block
 block discarded – undo
469 469
         $temp_args = $args;
470 470
         foreach ( $temp_args as $k => $v ) {
471 471
             if ( $v == '' ) {
472
-				unset( $args[ $k ] );
472
+				unset( $args[$k] );
473 473
                 continue;
474 474
             }
475 475
 
476 476
             if ( $k == 'limit' ) {
477
-				$args[ $k ] = FrmAppHelper::esc_limit( $v );
477
+				$args[$k] = FrmAppHelper::esc_limit( $v );
478 478
             }
479 479
             $db_name = strtoupper( str_replace( '_', ' ', $k ) );
480 480
             if ( strpos( $v, $db_name ) === false ) {
481
-				$args[ $k ] = $db_name . ' ' . $v;
481
+				$args[$k] = $db_name . ' ' . $v;
482 482
             }
483 483
         }
484 484
 
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 
506 506
 		$query = self::generate_query_string_from_pieces( $columns, $table, $where );
507 507
 
508
-		$cache_key = str_replace( array( ' ', ',' ), '_', trim( implode( '_', FrmAppHelper::array_flatten( $where ) ) . $columns . '_results_ARRAY_A' , ' WHERE' ) );
508
+		$cache_key = str_replace( array( ' ', ',' ), '_', trim( implode( '_', FrmAppHelper::array_flatten( $where ) ) . $columns . '_results_ARRAY_A', ' WHERE' ) );
509 509
 		$results = FrmAppHelper::check_cache( $cache_key, $group, $query, 'get_associative_results' );
510 510
 
511 511
 		return $results;
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
     public function uninstall() {
545 545
 		if ( ! current_user_can( 'administrator' ) ) {
546 546
             $frm_settings = FrmAppHelper::get_settings();
547
-            wp_die($frm_settings->admin_permission);
547
+            wp_die( $frm_settings->admin_permission );
548 548
         }
549 549
 
550 550
         global $wpdb, $wp_roles;
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entries );
555 555
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entry_metas );
556 556
 
557
-        delete_option('frm_options');
558
-        delete_option('frm_db_version');
557
+        delete_option( 'frm_options' );
558
+        delete_option( 'frm_db_version' );
559 559
 
560 560
         //delete roles
561 561
         $frm_roles = FrmAppHelper::frm_capabilities();
@@ -563,11 +563,11 @@  discard block
 block discarded – undo
563 563
         foreach ( $frm_roles as $frm_role => $frm_role_description ) {
564 564
             foreach ( $roles as $role => $details ) {
565 565
                 $wp_roles->remove_cap( $role, $frm_role );
566
-                unset($role, $details);
566
+                unset( $role, $details );
567 567
     		}
568
-    		unset($frm_role, $frm_role_description);
568
+    		unset( $frm_role, $frm_role_description );
569 569
 		}
570
-		unset($roles, $frm_roles);
570
+		unset( $roles, $frm_roles );
571 571
 
572 572
 		// delete actions, views, and styles
573 573
 
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 
590 590
 		$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE %s OR option_name LIKE %s', '_transient_timeout_frm_form_fields_%', '_transient_frm_form_fields_%' ) );
591 591
 
592
-        do_action('frm_after_uninstall');
592
+        do_action( 'frm_after_uninstall' );
593 593
         return true;
594 594
     }
595 595
 
@@ -646,8 +646,8 @@  discard block
 block discarded – undo
646 646
 
647 647
         $updated = 0;
648 648
         foreach ( $fields as $f ) {
649
-            $f->field_options = maybe_unserialize($f->field_options);
650
-            if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) {
649
+            $f->field_options = maybe_unserialize( $f->field_options );
650
+            if ( empty( $f->field_options['size'] ) || ! is_numeric( $f->field_options['size'] ) ) {
651 651
                 continue;
652 652
             }
653 653
 
@@ -655,27 +655,27 @@  discard block
 block discarded – undo
655 655
             $f->field_options['size'] .= 'px';
656 656
             $u = FrmField::update( $f->id, array( 'field_options' => $f->field_options ) );
657 657
             if ( $u ) {
658
-                $updated++;
658
+                $updated ++;
659 659
             }
660
-            unset($f);
660
+            unset( $f );
661 661
         }
662 662
 
663 663
         // Change the characters in widgets to pixels
664
-        $widgets = get_option('widget_frm_show_form');
665
-        if ( empty($widgets) ) {
664
+        $widgets = get_option( 'widget_frm_show_form' );
665
+        if ( empty( $widgets ) ) {
666 666
             return;
667 667
         }
668 668
 
669
-        $widgets = maybe_unserialize($widgets);
669
+        $widgets = maybe_unserialize( $widgets );
670 670
         foreach ( $widgets as $k => $widget ) {
671
-            if ( ! is_array($widget) || ! isset($widget['size']) ) {
671
+            if ( ! is_array( $widget ) || ! isset( $widget['size'] ) ) {
672 672
                 continue;
673 673
             }
674 674
 			$size = round( $pixel_conversion * (int) $widget['size'] );
675 675
             $size .= 'px';
676
-			$widgets[ $k ]['size'] = $size;
676
+			$widgets[$k]['size'] = $size;
677 677
         }
678
-        update_option('widget_frm_show_form', $widgets);
678
+        update_option( 'widget_frm_show_form', $widgets );
679 679
     }
680 680
 
681 681
     /**
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 			}
725 725
 
726 726
             // Format form options
727
-            $form_options = maybe_unserialize($form->options);
727
+            $form_options = maybe_unserialize( $form->options );
728 728
 
729 729
             // Migrate settings to actions
730 730
             FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id );
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
     private function migrate_to_11() {
735 735
         global $wpdb;
736 736
 
737
-        $forms = FrmDb::get_results( $this->forms, array(), 'id, options');
737
+        $forms = FrmDb::get_results( $this->forms, array(), 'id, options' );
738 738
 
739 739
         $sending = __( 'Sending', 'formidable' );
740 740
 		$img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif';
@@ -745,13 +745,13 @@  discard block
 block discarded – undo
745 745
 <img class="frm_ajax_loading" src="$img" alt="$sending" style="visibility:hidden;" />
746 746
 </div>
747 747
 DEFAULT_HTML;
748
-        unset($sending, $img);
748
+        unset( $sending, $img );
749 749
 
750
-        $new_default_html = FrmFormsHelper::get_default_html('submit');
750
+        $new_default_html = FrmFormsHelper::get_default_html( 'submit' );
751 751
         $draft_link = FrmFormsHelper::get_draft_link();
752 752
 		foreach ( $forms as $form ) {
753
-            $form->options = maybe_unserialize($form->options);
754
-            if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) {
753
+            $form->options = maybe_unserialize( $form->options );
754
+            if ( ! isset( $form->options['submit_html'] ) || empty( $form->options['submit_html'] ) ) {
755 755
                 continue;
756 756
             }
757 757
 
@@ -762,9 +762,9 @@  discard block
 block discarded – undo
762 762
 				$form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] );
763 763
 				$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
764 764
             }
765
-            unset($form);
765
+            unset( $form );
766 766
         }
767
-        unset($forms);
767
+        unset( $forms );
768 768
     }
769 769
 
770 770
     private function migrate_to_6() {
@@ -793,16 +793,16 @@  discard block
 block discarded – undo
793 793
 </div>
794 794
 DEFAULT_HTML;
795 795
 
796
-        $new_default_html = FrmFieldsHelper::get_default_html('text');
796
+        $new_default_html = FrmFieldsHelper::get_default_html( 'text' );
797 797
         foreach ( $fields as $field ) {
798
-            $field->field_options = maybe_unserialize($field->field_options);
798
+            $field->field_options = maybe_unserialize( $field->field_options );
799 799
 			if ( ! FrmField::is_option_empty( $field, 'custom_html' ) || $field->field_options['custom_html'] == $default_html || $field->field_options['custom_html'] == $old_default_html ) {
800 800
                 $field->field_options['custom_html'] = $new_default_html;
801 801
 				$wpdb->update( $this->fields, array( 'field_options' => maybe_serialize( $field->field_options ) ), array( 'id' => $field->id ) );
802 802
             }
803
-            unset($field);
803
+            unset( $field );
804 804
         }
805
-        unset($default_html, $old_default_html, $fields);
805
+        unset( $default_html, $old_default_html, $fields );
806 806
     }
807 807
 
808 808
     private function migrate_to_4() {
@@ -820,6 +820,6 @@  discard block
 block discarded – undo
820 820
 
821 821
 	public static function get_records( $table, $args = array(), $order_by = '', $limit = '', $fields = '*' ) {
822 822
 		_deprecated_function( __FUNCTION__, '2.0', 'FrmDb::get_results' );
823
-		return self::get_results( $table, $args, $fields, compact('order_by', 'limit') );
823
+		return self::get_results( $table, $args, $fields, compact( 'order_by', 'limit' ) );
824 824
 	}
825 825
 }
Please login to merge, or discard this patch.
classes/controllers/FrmXMLController.php 2 patches
Indentation   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -2,109 +2,109 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmXMLController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		add_submenu_page( 'formidable', 'Formidable | ' . __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route' );
7
-    }
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
 			'status' => array( null, '', 'published' ),
54 54
 		);
55 55
 		$forms = FrmForm::getAll( $where, 'name' );
56 56
 
57
-        $export_types = apply_filters( 'frm_xml_export_types',
58
-            array( 'forms' => __( 'Forms', 'formidable' ), 'items' => __( 'Entries', 'formidable' ) )
59
-        );
57
+		$export_types = apply_filters( 'frm_xml_export_types',
58
+			array( 'forms' => __( 'Forms', 'formidable' ), 'items' => __( 'Entries', 'formidable' ) )
59
+		);
60 60
 
61
-        $export_format = apply_filters( 'frm_export_formats', array(
62
-            'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ),
61
+		$export_format = apply_filters( 'frm_export_formats', array(
62
+			'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ),
63 63
 			'csv' => array( 'name' => 'CSV', 'support' => 'items', 'count' => 'single' ),
64
-        ) );
64
+		) );
65 65
 
66 66
 		include( FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php' );
67
-    }
67
+	}
68 68
 
69
-    public static function import_xml() {
70
-        $errors = array();
71
-        $message = '';
69
+	public static function import_xml() {
70
+		$errors = array();
71
+		$message = '';
72 72
 
73
-        $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce');
74
-        if ( $permission_error !== false ) {
75
-            $errors[] = $permission_error;
76
-            self::form($errors);
77
-            return;
78
-        }
73
+		$permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce');
74
+		if ( $permission_error !== false ) {
75
+			$errors[] = $permission_error;
76
+			self::form($errors);
77
+			return;
78
+		}
79 79
 
80
-        if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) {
81
-            $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' );
82
-            self::form($errors);
83
-            return;
84
-        }
80
+		if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) {
81
+			$errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' );
82
+			self::form($errors);
83
+			return;
84
+		}
85 85
 
86
-        $file = $_FILES['frm_import_file']['tmp_name'];
86
+		$file = $_FILES['frm_import_file']['tmp_name'];
87 87
 
88
-        if ( ! is_uploaded_file( $file ) ) {
89
-            unset($file);
90
-            $errors[] = __( 'The file does not exist, please try again.', 'formidable' );
91
-            self::form($errors);
92
-            return;
93
-        }
88
+		if ( ! is_uploaded_file( $file ) ) {
89
+			unset($file);
90
+			$errors[] = __( 'The file does not exist, please try again.', 'formidable' );
91
+			self::form($errors);
92
+			return;
93
+		}
94 94
 
95
-        //add_filter('upload_mimes', 'FrmXMLController::allow_mime');
95
+		//add_filter('upload_mimes', 'FrmXMLController::allow_mime');
96 96
 
97
-        $export_format = apply_filters('frm_export_formats', array(
97
+		$export_format = apply_filters('frm_export_formats', array(
98 98
 			'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ),
99 99
 		) );
100 100
 
101
-        $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION));
102
-        if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) {
103
-            // allow other file types to be imported
101
+		$file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION));
102
+		if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) {
103
+			// allow other file types to be imported
104 104
 			do_action( 'frm_before_import_' . $file_type );
105
-            return;
106
-        }
107
-        unset($file_type);
105
+			return;
106
+		}
107
+		unset($file_type);
108 108
 
109 109
 		if ( ! function_exists( 'libxml_disable_entity_loader' ) ) {
110 110
 			$errors[] = __( 'XML import is not enabled on your server.', 'formidable' );
@@ -123,145 +123,145 @@  discard block
 block discarded – undo
123 123
 		libxml_use_internal_errors( $set_err );
124 124
 		libxml_disable_entity_loader( $loader );
125 125
 
126
-        self::form($errors, $message);
127
-    }
126
+		self::form($errors, $message);
127
+	}
128 128
 
129
-    public static function export_xml() {
130
-        $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' );
131
-        if ( ! empty($error) ) {
132
-            wp_die( $error );
133
-        }
129
+	public static function export_xml() {
130
+		$error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' );
131
+		if ( ! empty($error) ) {
132
+			wp_die( $error );
133
+		}
134 134
 
135 135
 		$ids = FrmAppHelper::get_post_param( 'frm_export_forms', array() );
136 136
 		$type = FrmAppHelper::get_post_param( 'type', array() );
137 137
 		$format = FrmAppHelper::get_post_param( 'format', 'xml', 'sanitize_title' );
138 138
 
139
-        if ( ! headers_sent() && ! $type ) {
140
-            wp_redirect( esc_url_raw( admin_url( 'admin.php?page=formidable-import' ) ) );
141
-            die();
142
-        }
139
+		if ( ! headers_sent() && ! $type ) {
140
+			wp_redirect( esc_url_raw( admin_url( 'admin.php?page=formidable-import' ) ) );
141
+			die();
142
+		}
143 143
 
144
-        if ( $format == 'xml' ) {
145
-            self::generate_xml($type, compact('ids'));
144
+		if ( $format == 'xml' ) {
145
+			self::generate_xml($type, compact('ids'));
146 146
 		} if ( $format == 'csv' ) {
147 147
 			self::generate_csv( compact('ids') );
148
-        } else {
148
+		} else {
149 149
 			do_action( 'frm_export_format_' . $format, compact('ids') );
150
-        }
150
+		}
151 151
 
152
-        wp_die();
153
-    }
152
+		wp_die();
153
+	}
154 154
 
155 155
 	public static function generate_xml( $type, $args = array() ) {
156
-    	global $wpdb;
156
+		global $wpdb;
157 157
 
158
-	    self::prepare_types_array( $type );
158
+		self::prepare_types_array( $type );
159 159
 
160
-	    $tables = array(
160
+		$tables = array(
161 161
 			'items'     => $wpdb->prefix . 'frm_items',
162 162
 			'forms'     => $wpdb->prefix . 'frm_forms',
163
-	        'posts'     => $wpdb->posts,
164
-	        'styles'    => $wpdb->posts,
165
-	        'actions'   => $wpdb->posts,
166
-	    );
163
+			'posts'     => $wpdb->posts,
164
+			'styles'    => $wpdb->posts,
165
+			'actions'   => $wpdb->posts,
166
+		);
167 167
 
168 168
 		$defaults = array( 'ids' => false );
169
-	    $args = wp_parse_args( $args, $defaults );
169
+		$args = wp_parse_args( $args, $defaults );
170 170
 
171
-        $sitename = sanitize_key( get_bloginfo( 'name' ) );
171
+		$sitename = sanitize_key( get_bloginfo( 'name' ) );
172 172
 
173
-    	if ( ! empty( $sitename ) ) {
173
+		if ( ! empty( $sitename ) ) {
174 174
 			$sitename .= '.';
175 175
 		}
176
-    	$filename = $sitename . 'formidable.' . date( 'Y-m-d' ) . '.xml';
176
+		$filename = $sitename . 'formidable.' . date( 'Y-m-d' ) . '.xml';
177 177
 
178
-    	header( 'Content-Description: File Transfer' );
179
-    	header( 'Content-Disposition: attachment; filename=' . $filename );
180
-    	header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
178
+		header( 'Content-Description: File Transfer' );
179
+		header( 'Content-Disposition: attachment; filename=' . $filename );
180
+		header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
181 181
 
182
-        //make sure ids are numeric
183
-    	if ( is_array( $args['ids'] ) && ! empty( $args['ids'] ) ) {
184
-	        $args['ids'] = array_filter( $args['ids'], 'is_numeric' );
185
-	    }
182
+		//make sure ids are numeric
183
+		if ( is_array( $args['ids'] ) && ! empty( $args['ids'] ) ) {
184
+			$args['ids'] = array_filter( $args['ids'], 'is_numeric' );
185
+		}
186 186
 
187
-	    $records = array();
187
+		$records = array();
188 188
 
189 189
 		foreach ( $type as $tb_type ) {
190
-            $where = array();
190
+			$where = array();
191 191
 			$join = '';
192
-            $table = $tables[ $tb_type ];
192
+			$table = $tables[ $tb_type ];
193 193
 
194 194
 			$select = $table . '.id';
195
-            $query_vars = array();
195
+			$query_vars = array();
196 196
 
197
-            switch ( $tb_type ) {
198
-                case 'forms':
199
-                    //add forms
200
-                    if ( $args['ids'] ) {
197
+			switch ( $tb_type ) {
198
+				case 'forms':
199
+					//add forms
200
+					if ( $args['ids'] ) {
201 201
 						$where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table . '.parent_form_id' => $args['ids'] );
202
-                	} else {
202
+					} else {
203 203
 						$where[ $table . '.status !' ] = 'draft';
204
-                	}
205
-                break;
206
-                case 'actions':
204
+					}
205
+				break;
206
+				case 'actions':
207 207
 					$select = $table . '.ID';
208 208
 					$where['post_type'] = FrmFormActionsController::$action_post_type;
209
-                    if ( ! empty($args['ids']) ) {
209
+					if ( ! empty($args['ids']) ) {
210 210
 						$where['menu_order'] = $args['ids'];
211
-                    }
212
-                break;
213
-                case 'items':
214
-                    //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)";
215
-                    if ( $args['ids'] ) {
211
+					}
212
+				break;
213
+				case 'items':
214
+					//$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)";
215
+					if ( $args['ids'] ) {
216 216
 						$where[ $table . '.form_id' ] = $args['ids'];
217
-                    }
218
-                break;
219
-                case 'styles':
220
-                    // Loop through all exported forms and get their selected style IDs
217
+					}
218
+				break;
219
+				case 'styles':
220
+					// Loop through all exported forms and get their selected style IDs
221 221
 					$frm_style = new FrmStyle();
222 222
 					$default_style = $frm_style->get_default_style();
223
-                    $form_ids = $args['ids'];
224
-                    $style_ids = array();
225
-                    foreach ( $form_ids as $form_id ) {
226
-                        $form_data = FrmForm::getOne( $form_id );
227
-                        // For forms that have not been updated while running 2.0, check if custom_style is set
228
-                        if ( isset( $form_data->options['custom_style'] ) ) {
223
+					$form_ids = $args['ids'];
224
+					$style_ids = array();
225
+					foreach ( $form_ids as $form_id ) {
226
+						$form_data = FrmForm::getOne( $form_id );
227
+						// For forms that have not been updated while running 2.0, check if custom_style is set
228
+						if ( isset( $form_data->options['custom_style'] ) ) {
229 229
 							if ( $form_data->options['custom_style'] == 1 ) {
230 230
 								$style_ids[] = $default_style->ID;
231 231
 							} else {
232 232
 								$style_ids[] = $form_data->options['custom_style'];
233 233
 							}
234
-                        }
235
-                        unset( $form_id, $form_data );
236
-                    }
234
+						}
235
+						unset( $form_id, $form_data );
236
+					}
237 237
 					$select = $table . '.ID';
238
-                    $where['post_type'] = 'frm_styles';
239
-
240
-                    // Only export selected styles
241
-                    if ( ! empty( $style_ids ) ) {
242
-                        $where['ID'] = $style_ids;
243
-                    }
244
-                break;
245
-                default:
238
+					$where['post_type'] = 'frm_styles';
239
+
240
+					// Only export selected styles
241
+					if ( ! empty( $style_ids ) ) {
242
+						$where['ID'] = $style_ids;
243
+					}
244
+				break;
245
+				default:
246 246
 					$select = $table . '.ID';
247
-                    $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)';
248
-                    $where['pm.meta_key'] = 'frm_form_id';
249
-
250
-                    if ( empty($args['ids']) ) {
251
-                        $where['pm.meta_value >'] = 1;
252
-                    } else {
253
-                        $where['pm.meta_value'] = $args['ids'];
254
-                    }
255
-                break;
256
-            }
247
+					$join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)';
248
+					$where['pm.meta_key'] = 'frm_form_id';
249
+
250
+					if ( empty($args['ids']) ) {
251
+						$where['pm.meta_value >'] = 1;
252
+					} else {
253
+						$where['pm.meta_value'] = $args['ids'];
254
+					}
255
+				break;
256
+			}
257 257
 
258 258
 			$records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select );
259
-            unset($tb_type);
260
-        }
259
+			unset($tb_type);
260
+		}
261 261
 
262 262
 		echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n";
263 263
 		include( FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php' );
264
-    }
264
+	}
265 265
 
266 266
 	private static function prepare_types_array( &$type ) {
267 267
 		$type = (array) $type;
@@ -342,14 +342,14 @@  discard block
 block discarded – undo
342 342
 	}
343 343
 
344 344
 	/**
345
-	* Get the fields that should be included in the CSV export
346
-	*
347
-	* @since 2.0.19
348
-	*
349
-	* @param int $form_id
350
-	* @param object $form
351
-	* @return array $csv_fields
352
-	*/
345
+	 * Get the fields that should be included in the CSV export
346
+	 *
347
+	 * @since 2.0.19
348
+	 *
349
+	 * @param int $form_id
350
+	 * @param object $form
351
+	 * @return array $csv_fields
352
+	 */
353 353
 	private static function get_fields_for_csv_export( $form_id, $form ) {
354 354
 		// Phase frm_csv_field_ids out by 2.01.05
355 355
 		$csv_field_ids = apply_filters( 'frm_csv_field_ids', '', $form_id, array( 'form' => $form ) );
@@ -379,16 +379,16 @@  discard block
 block discarded – undo
379 379
 	}
380 380
 
381 381
 	public static function allow_mime( $mimes ) {
382
-        if ( ! isset( $mimes['csv'] ) ) {
383
-            // allow csv files
384
-            $mimes['csv'] = 'text/csv';
385
-        }
386
-
387
-        if ( ! isset( $mimes['xml'] ) ) {
388
-            // allow xml
389
-            $mimes['xml'] = 'text/xml';
390
-        }
391
-
392
-        return $mimes;
393
-    }
382
+		if ( ! isset( $mimes['csv'] ) ) {
383
+			// allow csv files
384
+			$mimes['csv'] = 'text/csv';
385
+		}
386
+
387
+		if ( ! isset( $mimes['xml'] ) ) {
388
+			// allow xml
389
+			$mimes['xml'] = 'text/xml';
390
+		}
391
+
392
+		return $mimes;
393
+	}
394 394
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -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))
@@ -70,41 +70,41 @@  discard block
 block discarded – undo
70 70
         $errors = array();
71 71
         $message = '';
72 72
 
73
-        $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce');
73
+        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'import-xml', 'import-xml-nonce' );
74 74
         if ( $permission_error !== false ) {
75 75
             $errors[] = $permission_error;
76
-            self::form($errors);
76
+            self::form( $errors );
77 77
             return;
78 78
         }
79 79
 
80
-        if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) {
80
+        if ( ! isset( $_FILES ) || ! isset( $_FILES['frm_import_file'] ) || empty( $_FILES['frm_import_file']['name'] ) || (int) $_FILES['frm_import_file']['size'] < 1 ) {
81 81
             $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' );
82
-            self::form($errors);
82
+            self::form( $errors );
83 83
             return;
84 84
         }
85 85
 
86 86
         $file = $_FILES['frm_import_file']['tmp_name'];
87 87
 
88 88
         if ( ! is_uploaded_file( $file ) ) {
89
-            unset($file);
89
+            unset( $file );
90 90
             $errors[] = __( 'The file does not exist, please try again.', 'formidable' );
91
-            self::form($errors);
91
+            self::form( $errors );
92 92
             return;
93 93
         }
94 94
 
95 95
         //add_filter('upload_mimes', 'FrmXMLController::allow_mime');
96 96
 
97
-        $export_format = apply_filters('frm_export_formats', array(
97
+        $export_format = apply_filters( 'frm_export_formats', array(
98 98
 			'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ),
99 99
 		) );
100 100
 
101
-        $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION));
102
-        if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) {
101
+        $file_type = strtolower( pathinfo( $_FILES['frm_import_file']['name'], PATHINFO_EXTENSION ) );
102
+        if ( $file_type != 'xml' && isset( $export_format[$file_type] ) ) {
103 103
             // allow other file types to be imported
104 104
 			do_action( 'frm_before_import_' . $file_type );
105 105
             return;
106 106
         }
107
-        unset($file_type);
107
+        unset( $file_type );
108 108
 
109 109
 		if ( ! function_exists( 'libxml_disable_entity_loader' ) ) {
110 110
 			$errors[] = __( 'XML import is not enabled on your server.', 'formidable' );
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
 		libxml_use_internal_errors( $set_err );
124 124
 		libxml_disable_entity_loader( $loader );
125 125
 
126
-        self::form($errors, $message);
126
+        self::form( $errors, $message );
127 127
     }
128 128
 
129 129
     public static function export_xml() {
130 130
         $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' );
131
-        if ( ! empty($error) ) {
131
+        if ( ! empty( $error ) ) {
132 132
             wp_die( $error );
133 133
         }
134 134
 
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
         }
143 143
 
144 144
         if ( $format == 'xml' ) {
145
-            self::generate_xml($type, compact('ids'));
145
+            self::generate_xml( $type, compact( 'ids' ) );
146 146
 		} if ( $format == 'csv' ) {
147
-			self::generate_csv( compact('ids') );
147
+			self::generate_csv( compact( 'ids' ) );
148 148
         } else {
149
-			do_action( 'frm_export_format_' . $format, compact('ids') );
149
+			do_action( 'frm_export_format_' . $format, compact( 'ids' ) );
150 150
         }
151 151
 
152 152
         wp_die();
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		foreach ( $type as $tb_type ) {
190 190
             $where = array();
191 191
 			$join = '';
192
-            $table = $tables[ $tb_type ];
192
+            $table = $tables[$tb_type];
193 193
 
194 194
 			$select = $table . '.id';
195 195
             $query_vars = array();
@@ -200,20 +200,20 @@  discard block
 block discarded – undo
200 200
                     if ( $args['ids'] ) {
201 201
 						$where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table . '.parent_form_id' => $args['ids'] );
202 202
                 	} else {
203
-						$where[ $table . '.status !' ] = 'draft';
203
+						$where[$table . '.status !'] = 'draft';
204 204
                 	}
205 205
                 break;
206 206
                 case 'actions':
207 207
 					$select = $table . '.ID';
208 208
 					$where['post_type'] = FrmFormActionsController::$action_post_type;
209
-                    if ( ! empty($args['ids']) ) {
209
+                    if ( ! empty( $args['ids'] ) ) {
210 210
 						$where['menu_order'] = $args['ids'];
211 211
                     }
212 212
                 break;
213 213
                 case 'items':
214 214
                     //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)";
215 215
                     if ( $args['ids'] ) {
216
-						$where[ $table . '.form_id' ] = $args['ids'];
216
+						$where[$table . '.form_id'] = $args['ids'];
217 217
                     }
218 218
                 break;
219 219
                 case 'styles':
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
                     $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)';
248 248
                     $where['pm.meta_key'] = 'frm_form_id';
249 249
 
250
-                    if ( empty($args['ids']) ) {
250
+                    if ( empty( $args['ids'] ) ) {
251 251
                         $where['pm.meta_value >'] = 1;
252 252
                     } else {
253 253
                         $where['pm.meta_value'] = $args['ids'];
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
                 break;
256 256
             }
257 257
 
258
-			$records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select );
259
-            unset($tb_type);
258
+			$records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select );
259
+            unset( $tb_type );
260 260
         }
261 261
 
262
-		echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n";
262
+		echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo( 'charset' ) ) . "\" ?>\n";
263 263
 		include( FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php' );
264 264
     }
265 265
 
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
 			$fid = FrmAppHelper::get_param( 'fid', '', 'get', 'sanitize_text_field' );
298 298
 		}
299 299
 
300
-		set_time_limit(0); //Remove time limit to execute this function
301
-		$mem_limit = str_replace('M', '', ini_get('memory_limit'));
300
+		set_time_limit( 0 ); //Remove time limit to execute this function
301
+		$mem_limit = str_replace( 'M', '', ini_get( 'memory_limit' ) );
302 302
 		if ( (int) $mem_limit < 256 ) {
303
-			ini_set('memory_limit', '256M');
303
+			ini_set( 'memory_limit', '256M' );
304 304
 		}
305 305
 
306 306
 		global $wpdb;
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 			$no_export_fields = FrmField::no_save_fields();
371 371
 			foreach ( $csv_fields as $k => $f ) {
372 372
 				if ( in_array( $f->type, $no_export_fields ) ) {
373
-					unset( $csv_fields[ $k ] );
373
+					unset( $csv_fields[$k] );
374 374
 				}
375 375
 			}
376 376
 		}
Please login to merge, or discard this patch.
classes/views/frm-fields/input.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -10,41 +10,41 @@  discard block
 block discarded – undo
10 10
 <?php
11 11
 
12 12
 } else if ( $field['type'] == 'radio' ) {
13
-    $read_only = false;
13
+	$read_only = false;
14 14
 	if ( FrmField::is_read_only( $field ) && ! FrmAppHelper::is_admin() ) {
15
-        $read_only = true; ?>
15
+		$read_only = true; ?>
16 16
 <input type="hidden" value="<?php echo esc_attr( $field['value'] ) ?>" name="<?php echo esc_attr( $field_name ) ?>" />
17 17
 <?php
18
-    }
18
+	}
19 19
 
20
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
20
+	if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
21 21
 		do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) );
22
-    } else if ( is_array($field['options']) ) {
23
-        foreach ( $field['options'] as $opt_key => $opt ) {
22
+	} else if ( is_array($field['options']) ) {
23
+		foreach ( $field['options'] as $opt_key => $opt ) {
24 24
 			if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] != $opt_key ) ) {
25
-                continue;
26
-            }
25
+				continue;
26
+			}
27 27
 
28
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
29
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); ?>
28
+			$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
29
+			$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); ?>
30 30
 			<div class="<?php echo esc_attr( apply_filters( 'frm_radio_class', 'frm_radio', $field, $field_val ) ) ?>"><?php
31 31
 
32 32
 			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
33 33
 				?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
34
-            }
35
-            $checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' ';
34
+			}
35
+			$checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' ';
36 36
 
37
-            $other_opt = false;
38
-            $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked );
39
-            ?>
37
+			$other_opt = false;
38
+			$other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked );
39
+			?>
40 40
             <input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php
41
-            echo $checked;
42
-            do_action('frm_field_input_html', $field);
41
+			echo $checked;
42
+			do_action('frm_field_input_html', $field);
43 43
 ?>/><?php
44 44
 
45 45
 			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
46 46
 				echo ' ' . $opt . '</label>';
47
-            }
47
+			}
48 48
 
49 49
 			FrmFieldsHelper::include_other_input( array(
50 50
 				'other_opt' => $other_opt, 'read_only' => $read_only,
@@ -53,58 +53,58 @@  discard block
 block discarded – undo
53 53
 				'html_id' => $html_id, 'opt_key' => $opt_key,
54 54
 			) );
55 55
 
56
-            unset( $other_opt, $other_args );
56
+			unset( $other_opt, $other_args );
57 57
 ?></div>
58 58
 <?php
59
-        }
60
-    }
59
+		}
60
+	}
61 61
 } else if ( $field['type'] == 'select' ) {
62 62
 	include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/dropdown-field.php' );
63 63
 } else if ( $field['type'] == 'checkbox' ) {
64
-    $checked_values = $field['value'];
65
-    $read_only = false;
64
+	$checked_values = $field['value'];
65
+	$read_only = false;
66 66
 
67 67
 	if ( FrmField::is_read_only( $field ) && ! FrmAppHelper::is_admin() ) {
68
-        $read_only = true;
69
-        if ( $checked_values ) {
70
-            foreach ( (array) $checked_values as $checked_value ) { ?>
68
+		$read_only = true;
69
+		if ( $checked_values ) {
70
+			foreach ( (array) $checked_values as $checked_value ) { ?>
71 71
 <input type="hidden" value="<?php echo esc_attr( $checked_value ) ?>" name="<?php echo esc_attr( $field_name ) ?>[]" />
72 72
 <?php
73
-            }
74
-        } else { ?>
73
+			}
74
+		} else { ?>
75 75
 <input type="hidden" value="" name="<?php echo esc_attr( $field_name ) ?>[]" />
76 76
 <?php
77
-        }
78
-    }
77
+		}
78
+	}
79 79
 
80
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
80
+	if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
81 81
 		do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) );
82
-    } else if ( $field['options'] ) {
83
-        foreach ( $field['options'] as $opt_key => $opt ) {
84
-            if ( isset($atts) && isset($atts['opt']) && ($atts['opt'] != $opt_key) ) {
85
-                continue;
86
-            }
87
-
88
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
89
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
90
-            $checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : '';
91
-
92
-            // Check if other opt, and get values for other field if needed
93
-            $other_opt = false;
82
+	} else if ( $field['options'] ) {
83
+		foreach ( $field['options'] as $opt_key => $opt ) {
84
+			if ( isset($atts) && isset($atts['opt']) && ($atts['opt'] != $opt_key) ) {
85
+				continue;
86
+			}
87
+
88
+			$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
89
+			$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
90
+			$checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : '';
91
+
92
+			// Check if other opt, and get values for other field if needed
93
+			$other_opt = false;
94 94
 			$other_args = FrmFieldsHelper::prepare_other_input( compact( 'field', 'field_name', 'opt_key' ), $other_opt, $checked );
95 95
 
96
-            ?>
96
+			?>
97 97
 			<div class="<?php echo esc_attr( apply_filters( 'frm_checkbox_class', 'frm_checkbox', $field, $field_val ) ) ?>" id="frm_checkbox_<?php echo esc_attr( $field['id'] ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
98 98
 
99
-            if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
100
-                ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
101
-            }
99
+			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
100
+				?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
101
+			}
102 102
 
103
-            ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php
103
+			?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php
104 104
 
105
-            if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
105
+			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
106 106
 				echo ' ' . $opt . '</label>';
107
-            }
107
+			}
108 108
 
109 109
 			FrmFieldsHelper::include_other_input( array(
110 110
 				'other_opt' => $other_opt, 'read_only' => $read_only,
@@ -113,17 +113,17 @@  discard block
 block discarded – undo
113 113
 				'html_id' => $html_id, 'opt_key' => $opt_key,
114 114
 			) );
115 115
 
116
-            unset( $other_opt, $other_args, $checked );
116
+			unset( $other_opt, $other_args, $checked );
117 117
 
118
-            ?></div>
118
+			?></div>
119 119
 <?php
120
-        }
121
-    }
120
+		}
121
+	}
122 122
 } else if ( $field['type'] == 'captcha' && ! FrmAppHelper::is_admin() ) {
123
-    $frm_settings = FrmAppHelper::get_settings();
124
-    if ( ! empty($frm_settings->pubkey) ) {
125
-        FrmFieldsHelper::display_recaptcha($field);
126
-    }
123
+	$frm_settings = FrmAppHelper::get_settings();
124
+	if ( ! empty($frm_settings->pubkey) ) {
125
+		FrmFieldsHelper::display_recaptcha($field);
126
+	}
127 127
 } else {
128 128
 	do_action( 'frm_form_fields', $field, $field_name, compact( 'errors', 'html_id' ) );
129 129
 	do_action( 'frm_form_field_' . $field['type'], $field, $field_name, compact( 'errors', 'html_id' ) );
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php if ( in_array( $field['type'], array( 'email', 'url', 'text' ) ) ) { ?>
2
-<input type="<?php echo ( $frm_settings->use_html || $field['type'] == 'password' ) ? $field['type'] : 'text'; ?>" id="<?php echo esc_attr( $html_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>" value="<?php echo esc_attr( $field['value'] ) ?>" <?php do_action('frm_field_input_html', $field) ?>/>
2
+<input type="<?php echo ( $frm_settings->use_html || $field['type'] == 'password' ) ? $field['type'] : 'text'; ?>" id="<?php echo esc_attr( $html_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>" value="<?php echo esc_attr( $field['value'] ) ?>" <?php do_action( 'frm_field_input_html', $field ) ?>/>
3 3
 <?php } else if ( $field['type'] == 'textarea' ) { ?>
4 4
 <textarea name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php
5 5
 if ( $field['max'] ) {
6 6
 	echo 'rows="' . esc_attr( $field['max'] ) . '" ';
7 7
 }
8
-do_action('frm_field_input_html', $field);
9
-?>><?php echo FrmAppHelper::esc_textarea($field['value']) ?></textarea>
8
+do_action( 'frm_field_input_html', $field );
9
+?>><?php echo FrmAppHelper::esc_textarea( $field['value'] ) ?></textarea>
10 10
 <?php
11 11
 
12 12
 } else if ( $field['type'] == 'radio' ) {
@@ -17,29 +17,29 @@  discard block
 block discarded – undo
17 17
 <?php
18 18
     }
19 19
 
20
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
20
+    if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) {
21 21
 		do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) );
22
-    } else if ( is_array($field['options']) ) {
22
+    } else if ( is_array( $field['options'] ) ) {
23 23
         foreach ( $field['options'] as $opt_key => $opt ) {
24 24
 			if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] != $opt_key ) ) {
25 25
                 continue;
26 26
             }
27 27
 
28
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
29
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); ?>
28
+            $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
29
+            $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field ); ?>
30 30
 			<div class="<?php echo esc_attr( apply_filters( 'frm_radio_class', 'frm_radio', $field, $field_val ) ) ?>"><?php
31 31
 
32 32
 			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
33 33
 				?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
34 34
             }
35
-            $checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' ';
35
+            $checked = FrmAppHelper::check_selected( $field['value'], $field_val ) ? 'checked="checked" ' : ' ';
36 36
 
37 37
             $other_opt = false;
38 38
             $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked );
39 39
             ?>
40 40
             <input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php
41 41
             echo $checked;
42
-            do_action('frm_field_input_html', $field);
42
+            do_action( 'frm_field_input_html', $field );
43 43
 ?>/><?php
44 44
 
45 45
 			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
         }
78 78
     }
79 79
 
80
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
80
+    if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) {
81 81
 		do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) );
82 82
     } else if ( $field['options'] ) {
83 83
         foreach ( $field['options'] as $opt_key => $opt ) {
84
-            if ( isset($atts) && isset($atts['opt']) && ($atts['opt'] != $opt_key) ) {
84
+            if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] != $opt_key ) ) {
85 85
                 continue;
86 86
             }
87 87
 
88
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
89
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
90
-            $checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : '';
88
+            $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
89
+            $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field );
90
+            $checked = FrmAppHelper::check_selected( $checked_values, $field_val ) ? ' checked="checked"' : '';
91 91
 
92 92
             // Check if other opt, and get values for other field if needed
93 93
             $other_opt = false;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                 ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
101 101
             }
102 102
 
103
-            ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php
103
+            ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action( 'frm_field_input_html', $field ) ?> /><?php
104 104
 
105 105
             if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
106 106
 				echo ' ' . $opt . '</label>';
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
     }
122 122
 } else if ( $field['type'] == 'captcha' && ! FrmAppHelper::is_admin() ) {
123 123
     $frm_settings = FrmAppHelper::get_settings();
124
-    if ( ! empty($frm_settings->pubkey) ) {
125
-        FrmFieldsHelper::display_recaptcha($field);
124
+    if ( ! empty( $frm_settings->pubkey ) ) {
125
+        FrmFieldsHelper::display_recaptcha( $field );
126 126
     }
127 127
 } else {
128 128
 	do_action( 'frm_form_fields', $field, $field_name, compact( 'errors', 'html_id' ) );
Please login to merge, or discard this patch.
classes/views/frm-fields/front-end/dropdown-field.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $read_only = false;
4
-if ( isset($field['post_field']) && $field['post_field'] == 'post_category' && FrmAppHelper::pro_is_installed() ) {
4
+if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' && FrmAppHelper::pro_is_installed() ) {
5 5
 	echo FrmProPost::get_category_dropdown( $field, array( 'location' => 'front', 'name' => $field_name, 'id' => $html_id ) );
6 6
 } else {
7 7
 	if ( FrmAppHelper::pro_is_installed() && FrmField::is_read_only( $field ) ) {
8 8
 		$read_only = true;
9 9
 
10 10
 		echo FrmProDropdownFieldsController::get_hidden_fields_with_readonly_values( $field, $field_name, $html_id ); ?>
11
-		<select <?php do_action('frm_field_input_html', $field) ?>> <?php
11
+		<select <?php do_action( 'frm_field_input_html', $field ) ?>> <?php
12 12
 
13 13
 	} else { ?>
14
-		<select name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php do_action('frm_field_input_html', $field) ?>>
14
+		<select name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php do_action( 'frm_field_input_html', $field ) ?>>
15 15
 	<?php   }
16 16
 
17 17
 	$other_opt = $other_checked = false;
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 			}
27 27
 		}
28 28
 		?>
29
-		<option value="<?php echo esc_attr($field_val) ?>" <?php echo $selected ? ' selected="selected"' : ''; ?><?php echo ( FrmFieldsHelper::is_other_opt( $opt_key ) ) ? ' class="frm_other_trigger"' : '';?>><?php echo esc_html( $opt == '' ? ' ' : $opt ); ?></option>
29
+		<option value="<?php echo esc_attr( $field_val ) ?>" <?php echo $selected ? ' selected="selected"' : ''; ?><?php echo ( FrmFieldsHelper::is_other_opt( $opt_key ) ) ? ' class="frm_other_trigger"' : ''; ?>><?php echo esc_html( $opt == '' ? ' ' : $opt ); ?></option>
30 30
 		<?php
31 31
 	} ?>
32 32
 	</select>
Please login to merge, or discard this patch.