Completed
Push — master ( ae12eb...603d32 )
by Stephanie
02:47
created
classes/models/FrmStyle.php 2 patches
Indentation   +226 added lines, -226 removed lines patch added patch discarded remove patch
@@ -7,46 +7,46 @@  discard block
 block discarded – undo
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 = 2147483647;
17
-        $min_slug_value = 37; // we want to have at least 2 characters in the slug
16
+		$max_slug_value = 2147483647;
17
+		$min_slug_value = 37; // we want to have at least 2 characters in the slug
18 18
 		$key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 );
19 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
-        );
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 FrmDb::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 );
@@ -55,28 +55,28 @@  discard block
 block discarded – undo
55 55
 				$all_instances[ $number ] = $new_instance;
56 56
 
57 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;
58
+ 					// this style was set to default, so remove default setting on previous default style
59
+ 					$new_instance['menu_order'] = 0;
60 60
 					$action_ids[] = $this->save( $new_instance );
61
- 			    }
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'] = isset( $_POST['frm_style_setting']['post_title'] ) ? sanitize_text_field( $_POST['frm_style_setting']['post_title'] ) : '';
68 68
  			$new_instance['post_content'] = isset( $_POST['frm_style_setting']['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 73
 			if ( empty( $id ) ) {
74
-                $new_instance['post_name'] = $new_instance['post_title'];
75
-            }
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
 				}
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
 					$new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] );
86 86
 				} else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) {
87 87
 					$new_instance['post_content'][ $setting ] = 0;
88
-                } else if ( $setting == 'font' ) {
89
-                	$new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] );
90
-                }
91
-            }
88
+				} else if ( $setting == 'font' ) {
89
+					$new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] );
90
+				}
91
+			}
92 92
 
93 93
 			$all_instances[ $number ] = $new_instance;
94 94
 
@@ -118,16 +118,16 @@  discard block
 block discarded – undo
118 118
 		return array_filter( $settings, array( $this, 'is_color' ) );
119 119
 	}
120 120
 
121
-    /**
122
-     * Create static css file
123
-     */
121
+	/**
122
+	 * Create static css file
123
+	 */
124 124
 	public function save_settings() {
125 125
 		$filename = FrmAppHelper::plugin_path() . '/css/custom_theme.css.php';
126 126
 		update_option( 'frm_last_style_update', date( 'njGi' ) );
127 127
 
128 128
 		if ( ! is_file( $filename ) ) {
129
-            return;
130
-        }
129
+			return;
130
+		}
131 131
 
132 132
 		$this->clear_cache();
133 133
 
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 		$saving = true;
152 152
 		$frm_style = $this;
153 153
 
154
-        ob_start();
155
-        include( $filename );
154
+		ob_start();
155
+		include( $filename );
156 156
 		$css .= preg_replace( '/\/\*(.|\s)*?\*\//', '', str_replace( array( "\r\n", "\r", "\n", "\t", '    ' ), '', ob_get_contents() ) );
157
-        ob_end_clean();
157
+		ob_end_clean();
158 158
 
159 159
 		return $css;
160 160
 	}
@@ -175,83 +175,83 @@  discard block
 block discarded – undo
175 175
 
176 176
 	public function destroy( $id ) {
177 177
 		return wp_delete_post( $id );
178
-    }
179
-
180
-    public function get_one() {
181
-        if ( 'default' == $this->id ) {
182
-            $style = $this->get_default_style();
183
-            if ( $style ) {
184
-                $this->id = $style->ID;
185
-            } else {
186
-                $this->id = 0;
187
-            }
188
-            return $style;
189
-        }
178
+	}
179
+
180
+	public function get_one() {
181
+		if ( 'default' == $this->id ) {
182
+			$style = $this->get_default_style();
183
+			if ( $style ) {
184
+				$this->id = $style->ID;
185
+			} else {
186
+				$this->id = 0;
187
+			}
188
+			return $style;
189
+		}
190 190
 
191 191
 		$style = get_post( $this->id );
192 192
 
193
-        if ( ! $style ) {
194
-            return $style;
195
-        }
193
+		if ( ! $style ) {
194
+			return $style;
195
+		}
196 196
 
197 197
 		$style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content );
198 198
 
199
-        $default_values = $this->get_defaults();
199
+		$default_values = $this->get_defaults();
200 200
 
201 201
 		// fill default values
202 202
 		$style->post_content = $this->override_defaults( $style->post_content );
203 203
 		$style->post_content = wp_parse_args( $style->post_content, $default_values );
204 204
 
205
-        return $style;
206
-    }
205
+		return $style;
206
+	}
207 207
 
208
-    public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) {
209
-        $post_atts = array(
208
+	public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) {
209
+		$post_atts = array(
210 210
 			'post_type'   => FrmStylesController::$post_type,
211 211
 			'post_status' => 'publish',
212 212
 			'numberposts' => $limit,
213 213
 			'orderby'     => $orderby,
214 214
 			'order'       => $order,
215
-        );
215
+		);
216 216
 
217 217
 		$temp_styles = FrmDb::check_cache( serialize( $post_atts ), 'frm_styles', $post_atts, 'get_posts' );
218 218
 
219 219
 		if ( empty( $temp_styles ) ) {
220
-            global $wpdb;
221
-            // make sure there wasn't a conflict with the query
220
+			global $wpdb;
221
+			// make sure there wasn't a conflict with the query
222 222
 			$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' );
223 223
 			$temp_styles = FrmDb::check_cache( 'frm_backup_style_check', 'frm_styles', $query, 'get_results' );
224 224
 
225 225
 			if ( empty( $temp_styles ) ) {
226
-                // create a new style if there are none
227
-         		$new = $this->get_new();
226
+				// create a new style if there are none
227
+		 		$new = $this->get_new();
228 228
 				$new->post_title = __( 'Formidable Style', 'formidable' );
229 229
 				$new->post_name = $new->post_title;
230
-         		$new->menu_order = 1;
230
+		 		$new->menu_order = 1;
231 231
 				$new = $this->save( (array) $new );
232 232
 				$this->update( 'default' );
233 233
 
234
-                $post_atts['include'] = $new;
234
+				$post_atts['include'] = $new;
235 235
 
236
-                $temp_styles = get_posts( $post_atts );
237
-            }
238
-        }
239
-
240
-        $default_values = $this->get_defaults();
241
-        $default_style = false;
236
+				$temp_styles = get_posts( $post_atts );
237
+			}
238
+		}
242 239
 
243
-        $styles = array();
244
-        foreach ( $temp_styles as $style ) {
245
-            $this->id = $style->ID;
246
-            if ( $style->menu_order ) {
247
-                if ( $default_style ) {
248
-                    // only return one default
249
-                    $style->menu_order = 0;
250
-                } else {
251
-                    // check for a default style
252
-                    $default_style = $style->ID;
253
-                }
254
-            }
240
+		$default_values = $this->get_defaults();
241
+		$default_style = false;
242
+
243
+		$styles = array();
244
+		foreach ( $temp_styles as $style ) {
245
+			$this->id = $style->ID;
246
+			if ( $style->menu_order ) {
247
+				if ( $default_style ) {
248
+					// only return one default
249
+					$style->menu_order = 0;
250
+				} else {
251
+					// check for a default style
252
+					$default_style = $style->ID;
253
+				}
254
+			}
255 255
 
256 256
 			$style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content );
257 257
 
@@ -260,183 +260,183 @@  discard block
 block discarded – undo
260 260
 			$style->post_content = wp_parse_args( $style->post_content, $default_values );
261 261
 
262 262
 			$styles[ $style->ID ] = $style;
263
-        }
263
+		}
264 264
 
265
-        if ( ! $default_style ) {
265
+		if ( ! $default_style ) {
266 266
 			$default_style = reset( $styles );
267 267
 			$styles[ $default_style->ID ]->menu_order = 1;
268
-        }
268
+		}
269 269
 
270
-        return $styles;
271
-    }
270
+		return $styles;
271
+	}
272 272
 
273 273
 	public function get_default_style( $styles = null ) {
274 274
 		if ( ! isset( $styles ) ) {
275 275
 			$styles = $this->get_all( 'menu_order', 'DESC', 1 );
276
-        }
276
+		}
277 277
 
278
-        foreach ( $styles as $style ) {
279
-            if ( $style->menu_order ) {
280
-                return $style;
281
-            }
282
-        }
283
-    }
278
+		foreach ( $styles as $style ) {
279
+			if ( $style->menu_order ) {
280
+				return $style;
281
+			}
282
+		}
283
+	}
284 284
 
285 285
 	public function override_defaults( $settings ) {
286 286
 		if ( ! is_array( $settings ) ) {
287
-	        return $settings;
288
-	    }
287
+			return $settings;
288
+		}
289 289
 
290 290
 		$settings['line_height'] = ( ! isset( $settings['field_height'] ) || $settings['field_height'] == '' || $settings['field_height'] == 'auto' ) ? 'normal' : $settings['field_height'];
291 291
 
292 292
 		if ( ! isset( $settings['form_desc_size'] ) && isset( $settings['description_font_size'] ) ) {
293
-	        $settings['form_desc_size'] = $settings['description_font_size'];
294
-	        $settings['form_desc_color'] = $settings['description_color'];
295
-	        $settings['title_color'] = $settings['label_color'];
296
-	    }
293
+			$settings['form_desc_size'] = $settings['description_font_size'];
294
+			$settings['form_desc_color'] = $settings['description_color'];
295
+			$settings['title_color'] = $settings['label_color'];
296
+		}
297 297
 
298 298
 		if ( ! isset( $settings['section_color'] ) && isset( $settings['label_color'] ) ) {
299
-	        $settings['section_color'] = $settings['label_color'];
300
-	        $settings['section_border_color'] = $settings['border_color'];
301
-	    }
299
+			$settings['section_color'] = $settings['label_color'];
300
+			$settings['section_border_color'] = $settings['border_color'];
301
+		}
302 302
 
303 303
 		if ( ! isset( $settings['submit_hover_bg_color'] ) && isset( $settings['submit_bg_color'] ) ) {
304
-	        $settings['submit_hover_bg_color'] = $settings['submit_bg_color'];
305
-	        $settings['submit_hover_color'] = $settings['submit_text_color'];
306
-	        $settings['submit_hover_border_color'] = $settings['submit_border_color'];
304
+			$settings['submit_hover_bg_color'] = $settings['submit_bg_color'];
305
+			$settings['submit_hover_color'] = $settings['submit_text_color'];
306
+			$settings['submit_hover_border_color'] = $settings['submit_border_color'];
307 307
 
308
-	        $settings['submit_active_bg_color'] = $settings['submit_bg_color'];
309
-	        $settings['submit_active_color'] = $settings['submit_text_color'];
310
-            $settings['submit_active_border_color'] = $settings['submit_border_color'];
311
-	    }
308
+			$settings['submit_active_bg_color'] = $settings['submit_bg_color'];
309
+			$settings['submit_active_color'] = $settings['submit_text_color'];
310
+			$settings['submit_active_border_color'] = $settings['submit_border_color'];
311
+		}
312 312
 
313
-	    return apply_filters( 'frm_override_default_styles', $settings );
313
+		return apply_filters( 'frm_override_default_styles', $settings );
314 314
 	}
315 315
 
316 316
 	public function get_defaults() {
317 317
 		$defaults = array(
318
-            'theme_css'         => 'ui-lightness',
319
-            'theme_name'        => 'UI Lightness',
318
+			'theme_css'         => 'ui-lightness',
319
+			'theme_name'        => 'UI Lightness',
320 320
 
321 321
 			'center_form'       => '',
322
-            'form_width'        => '100%',
323
-            'form_align'        => 'left',
324
-            'direction'         => is_rtl() ? 'rtl' : 'ltr',
325
-            'fieldset'          => '0px',
326
-            'fieldset_color'    => '000000',
327
-            'fieldset_padding'  => '0 0 15px 0',
328
-            'fieldset_bg_color' => '',
329
-
330
-            'title_size'        => '20px',
331
-            'title_color'       => '444444',
322
+			'form_width'        => '100%',
323
+			'form_align'        => 'left',
324
+			'direction'         => is_rtl() ? 'rtl' : 'ltr',
325
+			'fieldset'          => '0px',
326
+			'fieldset_color'    => '000000',
327
+			'fieldset_padding'  => '0 0 15px 0',
328
+			'fieldset_bg_color' => '',
329
+
330
+			'title_size'        => '20px',
331
+			'title_color'       => '444444',
332 332
 			'title_margin_top'  => '10px',
333 333
 			'title_margin_bottom' => '10px',
334
-            'form_desc_size'    => '14px',
335
-            'form_desc_color'   => '666666',
334
+			'form_desc_size'    => '14px',
335
+			'form_desc_color'   => '666666',
336 336
 			'form_desc_margin_top' => '10px',
337 337
 			'form_desc_margin_bottom' => '25px',
338 338
 
339
-            'font'              => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif',
340
-            'font_size'         => '14px',
341
-            'label_color'       => '444444',
342
-            'weight'            => 'bold',
343
-            'position'          => 'none',
344
-            'align'             => 'left',
345
-            'width'             => '150px',
346
-            'required_color'    => 'B94A48',
347
-            'required_weight'   => 'bold',
348
-            'label_padding'     => '0 0 3px 0',
349
-
350
-            'description_font_size' => '12px',
351
-            'description_color' => '666666',
352
-            'description_weight' => 'normal',
353
-            'description_style' => 'normal',
354
-            'description_align' => 'left',
339
+			'font'              => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif',
340
+			'font_size'         => '14px',
341
+			'label_color'       => '444444',
342
+			'weight'            => 'bold',
343
+			'position'          => 'none',
344
+			'align'             => 'left',
345
+			'width'             => '150px',
346
+			'required_color'    => 'B94A48',
347
+			'required_weight'   => 'bold',
348
+			'label_padding'     => '0 0 3px 0',
349
+
350
+			'description_font_size' => '12px',
351
+			'description_color' => '666666',
352
+			'description_weight' => 'normal',
353
+			'description_style' => 'normal',
354
+			'description_align' => 'left',
355 355
 			'description_margin' => '0',
356 356
 
357
-            'field_font_size'   => '14px',
358
-            'field_height'      => '32px',
359
-            'line_height'       => 'normal',
360
-            'field_width'       => '100%',
361
-            'auto_width'        => false,
362
-            'field_pad'         => '6px 10px',
363
-            'field_margin'      => '20px',
357
+			'field_font_size'   => '14px',
358
+			'field_height'      => '32px',
359
+			'line_height'       => 'normal',
360
+			'field_width'       => '100%',
361
+			'auto_width'        => false,
362
+			'field_pad'         => '6px 10px',
363
+			'field_margin'      => '20px',
364 364
 			'field_weight' => 'normal',
365
-            'text_color'        => '555555',
366
-            //'border_color_hv'   => 'cccccc',
367
-            'border_color'      => 'cccccc',
368
-            'field_border_width' => '1px',
369
-            'field_border_style' => 'solid',
370
-
371
-            'bg_color'          => 'ffffff',
372
-            //'bg_color_hv'       => 'ffffff',
365
+			'text_color'        => '555555',
366
+			//'border_color_hv'   => 'cccccc',
367
+			'border_color'      => 'cccccc',
368
+			'field_border_width' => '1px',
369
+			'field_border_style' => 'solid',
370
+
371
+			'bg_color'          => 'ffffff',
372
+			//'bg_color_hv'       => 'ffffff',
373 373
 			'remove_box_shadow' => '',
374
-            'bg_color_active'   => 'ffffff',
374
+			'bg_color_active'   => 'ffffff',
375 375
 			'border_color_active' => '66afe9',
376 376
 			'remove_box_shadow_active' => '',
377
-            'text_color_error'  => '444444',
378
-            'bg_color_error'    => 'ffffff',
377
+			'text_color_error'  => '444444',
378
+			'bg_color_error'    => 'ffffff',
379 379
 			'border_color_error' => 'B94A48',
380 380
 			'border_width_error' => '1px',
381 381
 			'border_style_error' => 'solid',
382
-            'bg_color_disabled' => 'ffffff',
383
-            'border_color_disabled' => 'E5E5E5',
384
-            'text_color_disabled' => 'A1A1A1',
385
-
386
-            'radio_align'       => 'block',
387
-            'check_align'       => 'block',
388
-            'check_font_size'   => '13px',
389
-            'check_label_color' => '444444',
390
-            'check_weight'      => 'normal',
391
-
392
-            'section_font_size' => '18px',
393
-            'section_color'     => '444444',
394
-            'section_weight'    => 'bold',
395
-            'section_pad'       => '15px 0 3px 0',
396
-            'section_mar_top'   => '15px',
382
+			'bg_color_disabled' => 'ffffff',
383
+			'border_color_disabled' => 'E5E5E5',
384
+			'text_color_disabled' => 'A1A1A1',
385
+
386
+			'radio_align'       => 'block',
387
+			'check_align'       => 'block',
388
+			'check_font_size'   => '13px',
389
+			'check_label_color' => '444444',
390
+			'check_weight'      => 'normal',
391
+
392
+			'section_font_size' => '18px',
393
+			'section_color'     => '444444',
394
+			'section_weight'    => 'bold',
395
+			'section_pad'       => '15px 0 3px 0',
396
+			'section_mar_top'   => '15px',
397 397
 			'section_mar_bottom' => '12px',
398
-            'section_bg_color'  => '',
399
-            'section_border_color' => 'e8e8e8',
400
-            'section_border_width' => '2px',
401
-            'section_border_style' => 'solid',
402
-            'section_border_loc' => '-top',
403
-            'collapse_icon'     => '6',
404
-            'collapse_pos'      => 'after',
405
-            'repeat_icon'       => '1',
406
-
407
-            'submit_style'      => false,
408
-            'submit_font_size'  => '14px',
409
-            'submit_width'      => 'auto',
410
-            'submit_height'     => 'auto',
411
-            'submit_bg_color'   => 'ffffff',
412
-            'submit_border_color' => 'cccccc',
413
-            'submit_border_width' => '1px',
414
-            'submit_text_color' => '444444',
415
-            'submit_weight'     => 'normal',
416
-            'submit_border_radius' => '4px',
417
-            'submit_bg_img'     => '',
418
-            'submit_margin'     => '10px',
419
-            'submit_padding'    => '6px 11px',
420
-            'submit_shadow_color' => 'eeeeee',
421
-            'submit_hover_bg_color' => 'efefef',
422
-            'submit_hover_color' => '444444',
423
-            'submit_hover_border_color' => 'cccccc',
424
-            'submit_active_bg_color' => 'efefef',
425
-            'submit_active_color' => '444444',
426
-            'submit_active_border_color' => 'cccccc',
427
-
428
-            'border_radius'     => '4px',
429
-            'error_bg'          => 'F2DEDE',
430
-            'error_border'      => 'EBCCD1',
431
-            'error_text'        => 'B94A48',
432
-            'error_font_size'   => '14px',
433
-
434
-            'success_bg_color'  => 'DFF0D8',
435
-            'success_border_color' => 'D6E9C6',
436
-            'success_text_color' => '468847',
437
-            'success_font_size' => '14px',
438
-
439
-            'important_style'   => false,
398
+			'section_bg_color'  => '',
399
+			'section_border_color' => 'e8e8e8',
400
+			'section_border_width' => '2px',
401
+			'section_border_style' => 'solid',
402
+			'section_border_loc' => '-top',
403
+			'collapse_icon'     => '6',
404
+			'collapse_pos'      => 'after',
405
+			'repeat_icon'       => '1',
406
+
407
+			'submit_style'      => false,
408
+			'submit_font_size'  => '14px',
409
+			'submit_width'      => 'auto',
410
+			'submit_height'     => 'auto',
411
+			'submit_bg_color'   => 'ffffff',
412
+			'submit_border_color' => 'cccccc',
413
+			'submit_border_width' => '1px',
414
+			'submit_text_color' => '444444',
415
+			'submit_weight'     => 'normal',
416
+			'submit_border_radius' => '4px',
417
+			'submit_bg_img'     => '',
418
+			'submit_margin'     => '10px',
419
+			'submit_padding'    => '6px 11px',
420
+			'submit_shadow_color' => 'eeeeee',
421
+			'submit_hover_bg_color' => 'efefef',
422
+			'submit_hover_color' => '444444',
423
+			'submit_hover_border_color' => 'cccccc',
424
+			'submit_active_bg_color' => 'efefef',
425
+			'submit_active_color' => '444444',
426
+			'submit_active_border_color' => 'cccccc',
427
+
428
+			'border_radius'     => '4px',
429
+			'error_bg'          => 'F2DEDE',
430
+			'error_border'      => 'EBCCD1',
431
+			'error_text'        => 'B94A48',
432
+			'error_font_size'   => '14px',
433
+
434
+			'success_bg_color'  => 'DFF0D8',
435
+			'success_border_color' => 'D6E9C6',
436
+			'success_text_color' => '468847',
437
+			'success_font_size' => '14px',
438
+
439
+			'important_style'   => false,
440 440
 
441 441
 			'progress_bg_color'     => 'dddddd',
442 442
 			'progress_active_color' => 'ffffff',
@@ -446,10 +446,10 @@  discard block
 block discarded – undo
446 446
 			'progress_border_size'  => '2px',
447 447
 			'progress_size'         => '30px',
448 448
 
449
-            'custom_css'        => '',
449
+			'custom_css'        => '',
450 450
 		);
451 451
 		return apply_filters( 'frm_default_style_settings', $defaults );
452
-    }
452
+	}
453 453
 
454 454
 	public function get_field_name( $field_name, $post_field = 'post_content' ) {
455 455
 		return 'frm_style_setting' . ( empty( $post_field ) ? '' : '[' . $post_field . ']' ) . '[' . $field_name . ']';
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
  			$new_instance = stripslashes_deep( (array) $new_instance );
53 53
  			$this->id = $new_instance['ID'];
54 54
  			if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) {
55
-				$all_instances[ $number ] = $new_instance;
55
+				$all_instances[$number] = $new_instance;
56 56
 
57 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
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
  			$new_instance['post_title'] = isset( $_POST['frm_style_setting']['post_title'] ) ? sanitize_text_field( $_POST['frm_style_setting']['post_title'] ) : '';
68 68
  			$new_instance['post_content'] = isset( $_POST['frm_style_setting']['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 73
 			if ( empty( $id ) ) {
@@ -77,20 +77,20 @@  discard block
 block discarded – undo
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 ( $this->is_color( $setting ) ) {
85
-					$new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] );
86
-				} else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) {
87
-					$new_instance['post_content'][ $setting ] = 0;
85
+					$new_instance['post_content'][$setting] = str_replace( '#', '', $new_instance['post_content'][$setting] );
86
+				} else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][$setting] ) ) {
87
+					$new_instance['post_content'][$setting] = 0;
88 88
                 } else if ( $setting == 'font' ) {
89
-                	$new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] );
89
+                	$new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] );
90 90
                 }
91 91
             }
92 92
 
93
-			$all_instances[ $number ] = $new_instance;
93
+			$all_instances[$number] = $new_instance;
94 94
 
95 95
 			$action_ids[] = $this->save( $new_instance );
96 96
 
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
 			$style->post_content = $this->override_defaults( $style->post_content );
260 260
 			$style->post_content = wp_parse_args( $style->post_content, $default_values );
261 261
 
262
-			$styles[ $style->ID ] = $style;
262
+			$styles[$style->ID] = $style;
263 263
         }
264 264
 
265 265
         if ( ! $default_style ) {
266 266
 			$default_style = reset( $styles );
267
-			$styles[ $default_style->ID ]->menu_order = 1;
267
+			$styles[$default_style->ID]->menu_order = 1;
268 268
         }
269 269
 
270 270
         return $styles;
Please login to merge, or discard this patch.