@@ -1,10 +1,10 @@ discard block |
||
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 |
||
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> |
@@ -1,52 +1,52 @@ discard block |
||
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,42 +54,42 @@ discard block |
||
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 ( strpos( $setting, 'color' ) !== false || in_array( $setting, array( 'error_bg', 'error_border', 'error_text' ) ) ) { |
81 | - //if is a color |
|
81 | + //if is a color |
|
82 | 82 | $new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] ); |
83 | 83 | } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) { |
84 | 84 | $new_instance['post_content'][ $setting ] = 0; |
85 | - } else if ( $setting == 'font' ) { |
|
86 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
87 | - } |
|
88 | - } |
|
85 | + } else if ( $setting == 'font' ) { |
|
86 | + $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
87 | + } |
|
88 | + } |
|
89 | 89 | |
90 | 90 | $all_instances[ $number ] = $new_instance; |
91 | 91 | |
92 | - $action_ids[] = $this->save($new_instance); |
|
92 | + $action_ids[] = $this->save($new_instance); |
|
93 | 93 | |
94 | 94 | } |
95 | 95 | |
@@ -98,26 +98,26 @@ discard block |
||
98 | 98 | return $action_ids; |
99 | 99 | } |
100 | 100 | |
101 | - /** |
|
102 | - * Create static css file |
|
103 | - */ |
|
101 | + /** |
|
102 | + * Create static css file |
|
103 | + */ |
|
104 | 104 | public function save_settings() { |
105 | 105 | $filename = FrmAppHelper::plugin_path() . '/css/custom_theme.css.php'; |
106 | 106 | update_option( 'frm_last_style_update', date('njGi') ); |
107 | 107 | |
108 | - if ( ! is_file($filename) ) { |
|
109 | - return; |
|
110 | - } |
|
108 | + if ( ! is_file($filename) ) { |
|
109 | + return; |
|
110 | + } |
|
111 | 111 | |
112 | 112 | $css = $this->get_css_content( $filename ); |
113 | 113 | |
114 | 114 | $create_file = new FrmCreateFile( array( 'folder_name' => 'formidable/css', 'file_name' => 'formidablepro.css' ) ); |
115 | 115 | $create_file->create_file( $css ); |
116 | 116 | |
117 | - update_option('frmpro_css', $css); |
|
117 | + update_option('frmpro_css', $css); |
|
118 | 118 | |
119 | - delete_transient('frmpro_css'); |
|
120 | - set_transient('frmpro_css', $css); |
|
119 | + delete_transient('frmpro_css'); |
|
120 | + set_transient('frmpro_css', $css); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | private function get_css_content( $filename ) { |
@@ -126,281 +126,281 @@ discard block |
||
126 | 126 | $saving = true; |
127 | 127 | $frm_style = $this; |
128 | 128 | |
129 | - ob_start(); |
|
130 | - include( $filename ); |
|
129 | + ob_start(); |
|
130 | + include( $filename ); |
|
131 | 131 | $css .= preg_replace( '/\/\*(.|\s)*?\*\//', '', str_replace( array( "\r\n", "\r", "\n", "\t", ' ' ), '', ob_get_contents() ) ); |
132 | - ob_end_clean(); |
|
132 | + ob_end_clean(); |
|
133 | 133 | |
134 | 134 | return $css; |
135 | 135 | } |
136 | 136 | |
137 | 137 | public function destroy( $id ) { |
138 | - return wp_delete_post($id); |
|
139 | - } |
|
138 | + return wp_delete_post($id); |
|
139 | + } |
|
140 | 140 | |
141 | - public function get_one() { |
|
142 | - if ( 'default' == $this->id ) { |
|
143 | - $style = $this->get_default_style(); |
|
144 | - if ( $style ) { |
|
145 | - $this->id = $style->ID; |
|
146 | - } else { |
|
147 | - $this->id = 0; |
|
148 | - } |
|
149 | - return $style; |
|
150 | - } |
|
141 | + public function get_one() { |
|
142 | + if ( 'default' == $this->id ) { |
|
143 | + $style = $this->get_default_style(); |
|
144 | + if ( $style ) { |
|
145 | + $this->id = $style->ID; |
|
146 | + } else { |
|
147 | + $this->id = 0; |
|
148 | + } |
|
149 | + return $style; |
|
150 | + } |
|
151 | 151 | |
152 | - $style = get_post($this->id); |
|
152 | + $style = get_post($this->id); |
|
153 | 153 | |
154 | - if ( ! $style ) { |
|
155 | - return $style; |
|
156 | - } |
|
154 | + if ( ! $style ) { |
|
155 | + return $style; |
|
156 | + } |
|
157 | 157 | |
158 | - $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
158 | + $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
159 | 159 | |
160 | - $default_values = $this->get_defaults(); |
|
160 | + $default_values = $this->get_defaults(); |
|
161 | 161 | |
162 | - // fill default values |
|
163 | - $style->post_content = $this->override_defaults($style->post_content); |
|
164 | - $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
162 | + // fill default values |
|
163 | + $style->post_content = $this->override_defaults($style->post_content); |
|
164 | + $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
165 | 165 | |
166 | - return $style; |
|
167 | - } |
|
166 | + return $style; |
|
167 | + } |
|
168 | 168 | |
169 | - public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) { |
|
170 | - $post_atts = array( |
|
169 | + public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) { |
|
170 | + $post_atts = array( |
|
171 | 171 | 'post_type' => FrmStylesController::$post_type, |
172 | 172 | 'post_status' => 'publish', |
173 | 173 | 'numberposts' => $limit, |
174 | 174 | 'orderby' => $orderby, |
175 | 175 | 'order' => $order, |
176 | - ); |
|
176 | + ); |
|
177 | 177 | |
178 | - $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts'); |
|
178 | + $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts'); |
|
179 | 179 | |
180 | - if ( empty($temp_styles) ) { |
|
181 | - global $wpdb; |
|
182 | - // make sure there wasn't a conflict with the query |
|
180 | + if ( empty($temp_styles) ) { |
|
181 | + global $wpdb; |
|
182 | + // make sure there wasn't a conflict with the query |
|
183 | 183 | $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' ); |
184 | - $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results'); |
|
185 | - |
|
186 | - if ( empty($temp_styles) ) { |
|
187 | - // create a new style if there are none |
|
188 | - $new = $this->get_new(); |
|
189 | - $new->post_title = $new->post_name = __( 'Formidable Style', 'formidable' ); |
|
190 | - $new->menu_order = 1; |
|
191 | - $new = $this->save( (array) $new); |
|
192 | - $this->update('default'); |
|
193 | - |
|
194 | - $post_atts['include'] = $new; |
|
195 | - |
|
196 | - $temp_styles = get_posts( $post_atts ); |
|
197 | - } |
|
198 | - } |
|
199 | - |
|
200 | - $default_values = $this->get_defaults(); |
|
201 | - $default_style = false; |
|
202 | - |
|
203 | - $styles = array(); |
|
204 | - foreach ( $temp_styles as $style ) { |
|
205 | - $this->id = $style->ID; |
|
206 | - if ( $style->menu_order ) { |
|
207 | - if ( $default_style ) { |
|
208 | - // only return one default |
|
209 | - $style->menu_order = 0; |
|
210 | - } else { |
|
211 | - // check for a default style |
|
212 | - $default_style = $style->ID; |
|
213 | - } |
|
214 | - } |
|
215 | - |
|
216 | - $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
217 | - |
|
218 | - // fill default values |
|
219 | - $style->post_content = $this->override_defaults($style->post_content); |
|
220 | - $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
184 | + $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results'); |
|
185 | + |
|
186 | + if ( empty($temp_styles) ) { |
|
187 | + // create a new style if there are none |
|
188 | + $new = $this->get_new(); |
|
189 | + $new->post_title = $new->post_name = __( 'Formidable Style', 'formidable' ); |
|
190 | + $new->menu_order = 1; |
|
191 | + $new = $this->save( (array) $new); |
|
192 | + $this->update('default'); |
|
193 | + |
|
194 | + $post_atts['include'] = $new; |
|
195 | + |
|
196 | + $temp_styles = get_posts( $post_atts ); |
|
197 | + } |
|
198 | + } |
|
199 | + |
|
200 | + $default_values = $this->get_defaults(); |
|
201 | + $default_style = false; |
|
202 | + |
|
203 | + $styles = array(); |
|
204 | + foreach ( $temp_styles as $style ) { |
|
205 | + $this->id = $style->ID; |
|
206 | + if ( $style->menu_order ) { |
|
207 | + if ( $default_style ) { |
|
208 | + // only return one default |
|
209 | + $style->menu_order = 0; |
|
210 | + } else { |
|
211 | + // check for a default style |
|
212 | + $default_style = $style->ID; |
|
213 | + } |
|
214 | + } |
|
215 | + |
|
216 | + $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
217 | + |
|
218 | + // fill default values |
|
219 | + $style->post_content = $this->override_defaults($style->post_content); |
|
220 | + $style->post_content = wp_parse_args( $style->post_content, $default_values); |
|
221 | 221 | |
222 | 222 | $styles[ $style->ID ] = $style; |
223 | - } |
|
223 | + } |
|
224 | 224 | |
225 | - if ( ! $default_style ) { |
|
226 | - $default_style = reset($styles); |
|
225 | + if ( ! $default_style ) { |
|
226 | + $default_style = reset($styles); |
|
227 | 227 | $styles[ $default_style->ID ]->menu_order = 1; |
228 | - } |
|
228 | + } |
|
229 | 229 | |
230 | - return $styles; |
|
231 | - } |
|
230 | + return $styles; |
|
231 | + } |
|
232 | 232 | |
233 | 233 | public function get_default_style( $styles = null ) { |
234 | - if ( ! isset($styles) ) { |
|
234 | + if ( ! isset($styles) ) { |
|
235 | 235 | $styles = $this->get_all( 'menu_order', 'DESC', 1 ); |
236 | - } |
|
236 | + } |
|
237 | 237 | |
238 | - foreach ( $styles as $style ) { |
|
239 | - if ( $style->menu_order ) { |
|
240 | - return $style; |
|
241 | - } |
|
242 | - } |
|
243 | - } |
|
238 | + foreach ( $styles as $style ) { |
|
239 | + if ( $style->menu_order ) { |
|
240 | + return $style; |
|
241 | + } |
|
242 | + } |
|
243 | + } |
|
244 | 244 | |
245 | 245 | public function override_defaults( $settings ) { |
246 | - if ( ! is_array($settings) ) { |
|
247 | - return $settings; |
|
248 | - } |
|
249 | - |
|
250 | - $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height']; |
|
251 | - |
|
252 | - if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) { |
|
253 | - $settings['form_desc_size'] = $settings['description_font_size']; |
|
254 | - $settings['form_desc_color'] = $settings['description_color']; |
|
255 | - $settings['title_color'] = $settings['label_color']; |
|
256 | - } |
|
257 | - |
|
258 | - if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) { |
|
259 | - $settings['section_color'] = $settings['label_color']; |
|
260 | - $settings['section_border_color'] = $settings['border_color']; |
|
261 | - } |
|
262 | - |
|
263 | - if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) { |
|
264 | - $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
|
265 | - $settings['submit_hover_color'] = $settings['submit_text_color']; |
|
266 | - $settings['submit_hover_border_color'] = $settings['submit_border_color']; |
|
267 | - |
|
268 | - $settings['submit_active_bg_color'] = $settings['submit_bg_color']; |
|
269 | - $settings['submit_active_color'] = $settings['submit_text_color']; |
|
270 | - $settings['submit_active_border_color'] = $settings['submit_border_color']; |
|
271 | - } |
|
272 | - |
|
273 | - return $settings; |
|
246 | + if ( ! is_array($settings) ) { |
|
247 | + return $settings; |
|
248 | + } |
|
249 | + |
|
250 | + $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height']; |
|
251 | + |
|
252 | + if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) { |
|
253 | + $settings['form_desc_size'] = $settings['description_font_size']; |
|
254 | + $settings['form_desc_color'] = $settings['description_color']; |
|
255 | + $settings['title_color'] = $settings['label_color']; |
|
256 | + } |
|
257 | + |
|
258 | + if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) { |
|
259 | + $settings['section_color'] = $settings['label_color']; |
|
260 | + $settings['section_border_color'] = $settings['border_color']; |
|
261 | + } |
|
262 | + |
|
263 | + if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) { |
|
264 | + $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
|
265 | + $settings['submit_hover_color'] = $settings['submit_text_color']; |
|
266 | + $settings['submit_hover_border_color'] = $settings['submit_border_color']; |
|
267 | + |
|
268 | + $settings['submit_active_bg_color'] = $settings['submit_bg_color']; |
|
269 | + $settings['submit_active_color'] = $settings['submit_text_color']; |
|
270 | + $settings['submit_active_border_color'] = $settings['submit_border_color']; |
|
271 | + } |
|
272 | + |
|
273 | + return $settings; |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | public function get_defaults() { |
277 | - return array( |
|
278 | - 'theme_css' => 'ui-lightness', |
|
279 | - 'theme_name' => 'UI Lightness', |
|
277 | + return array( |
|
278 | + 'theme_css' => 'ui-lightness', |
|
279 | + 'theme_name' => 'UI Lightness', |
|
280 | 280 | |
281 | 281 | 'center_form' => '', |
282 | - 'form_width' => '100%', |
|
283 | - 'form_align' => 'left', |
|
284 | - 'direction' => is_rtl() ? 'rtl' : 'ltr', |
|
285 | - 'fieldset' => '0px', |
|
286 | - 'fieldset_color' => '000000', |
|
287 | - 'fieldset_padding' => '0 0 15px 0', |
|
288 | - 'fieldset_bg_color' => '', |
|
289 | - |
|
290 | - 'title_size' => '20px', |
|
291 | - 'title_color' => '444444', |
|
282 | + 'form_width' => '100%', |
|
283 | + 'form_align' => 'left', |
|
284 | + 'direction' => is_rtl() ? 'rtl' : 'ltr', |
|
285 | + 'fieldset' => '0px', |
|
286 | + 'fieldset_color' => '000000', |
|
287 | + 'fieldset_padding' => '0 0 15px 0', |
|
288 | + 'fieldset_bg_color' => '', |
|
289 | + |
|
290 | + 'title_size' => '20px', |
|
291 | + 'title_color' => '444444', |
|
292 | 292 | 'title_margin_top' => '10px', |
293 | 293 | 'title_margin_bottom' => '10px', |
294 | - 'form_desc_size' => '14px', |
|
295 | - 'form_desc_color' => '666666', |
|
294 | + 'form_desc_size' => '14px', |
|
295 | + 'form_desc_color' => '666666', |
|
296 | 296 | 'form_desc_margin_top' => '10px', |
297 | 297 | 'form_desc_margin_bottom' => '25px', |
298 | 298 | |
299 | - 'font' => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif', |
|
300 | - 'font_size' => '14px', |
|
301 | - 'label_color' => '444444', |
|
302 | - 'weight' => 'bold', |
|
303 | - 'position' => 'none', |
|
304 | - 'align' => 'left', |
|
305 | - 'width' => '150px', |
|
306 | - 'required_color' => 'B94A48', |
|
307 | - 'required_weight' => 'bold', |
|
308 | - 'label_padding' => '0 0 3px 0', |
|
309 | - |
|
310 | - 'description_font_size' => '12px', |
|
311 | - 'description_color' => '666666', |
|
312 | - 'description_weight' => 'normal', |
|
313 | - 'description_style' => 'normal', |
|
314 | - 'description_align' => 'left', |
|
299 | + 'font' => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif', |
|
300 | + 'font_size' => '14px', |
|
301 | + 'label_color' => '444444', |
|
302 | + 'weight' => 'bold', |
|
303 | + 'position' => 'none', |
|
304 | + 'align' => 'left', |
|
305 | + 'width' => '150px', |
|
306 | + 'required_color' => 'B94A48', |
|
307 | + 'required_weight' => 'bold', |
|
308 | + 'label_padding' => '0 0 3px 0', |
|
309 | + |
|
310 | + 'description_font_size' => '12px', |
|
311 | + 'description_color' => '666666', |
|
312 | + 'description_weight' => 'normal', |
|
313 | + 'description_style' => 'normal', |
|
314 | + 'description_align' => 'left', |
|
315 | 315 | 'description_margin' => '0', |
316 | 316 | |
317 | - 'field_font_size' => '14px', |
|
318 | - 'field_height' => '32px', |
|
319 | - 'line_height' => 'normal', |
|
320 | - 'field_width' => '100%', |
|
321 | - 'auto_width' => false, |
|
322 | - 'field_pad' => '6px 10px', |
|
323 | - 'field_margin' => '20px', |
|
317 | + 'field_font_size' => '14px', |
|
318 | + 'field_height' => '32px', |
|
319 | + 'line_height' => 'normal', |
|
320 | + 'field_width' => '100%', |
|
321 | + 'auto_width' => false, |
|
322 | + 'field_pad' => '6px 10px', |
|
323 | + 'field_margin' => '20px', |
|
324 | 324 | 'field_weight' => 'normal', |
325 | - 'text_color' => '555555', |
|
326 | - //'border_color_hv' => 'cccccc', |
|
327 | - 'border_color' => 'cccccc', |
|
328 | - 'field_border_width' => '1px', |
|
329 | - 'field_border_style' => 'solid', |
|
330 | - |
|
331 | - 'bg_color' => 'ffffff', |
|
332 | - //'bg_color_hv' => 'ffffff', |
|
325 | + 'text_color' => '555555', |
|
326 | + //'border_color_hv' => 'cccccc', |
|
327 | + 'border_color' => 'cccccc', |
|
328 | + 'field_border_width' => '1px', |
|
329 | + 'field_border_style' => 'solid', |
|
330 | + |
|
331 | + 'bg_color' => 'ffffff', |
|
332 | + //'bg_color_hv' => 'ffffff', |
|
333 | 333 | 'remove_box_shadow' => '', |
334 | - 'bg_color_active' => 'ffffff', |
|
334 | + 'bg_color_active' => 'ffffff', |
|
335 | 335 | 'border_color_active' => '66afe9', |
336 | 336 | 'remove_box_shadow_active' => '', |
337 | - 'text_color_error' => '444444', |
|
338 | - 'bg_color_error' => 'ffffff', |
|
337 | + 'text_color_error' => '444444', |
|
338 | + 'bg_color_error' => 'ffffff', |
|
339 | 339 | 'border_color_error' => 'B94A48', |
340 | 340 | 'border_width_error' => '1px', |
341 | 341 | 'border_style_error' => 'solid', |
342 | - 'bg_color_disabled' => 'ffffff', |
|
343 | - 'border_color_disabled' => 'E5E5E5', |
|
344 | - 'text_color_disabled' => 'A1A1A1', |
|
345 | - |
|
346 | - 'radio_align' => 'block', |
|
347 | - 'check_align' => 'block', |
|
348 | - 'check_font_size' => '13px', |
|
349 | - 'check_label_color' => '444444', |
|
350 | - 'check_weight' => 'normal', |
|
351 | - |
|
352 | - 'section_font_size' => '18px', |
|
353 | - 'section_color' => '444444', |
|
354 | - 'section_weight' => 'bold', |
|
355 | - 'section_pad' => '15px 0 3px 0', |
|
356 | - 'section_mar_top' => '15px', |
|
342 | + 'bg_color_disabled' => 'ffffff', |
|
343 | + 'border_color_disabled' => 'E5E5E5', |
|
344 | + 'text_color_disabled' => 'A1A1A1', |
|
345 | + |
|
346 | + 'radio_align' => 'block', |
|
347 | + 'check_align' => 'block', |
|
348 | + 'check_font_size' => '13px', |
|
349 | + 'check_label_color' => '444444', |
|
350 | + 'check_weight' => 'normal', |
|
351 | + |
|
352 | + 'section_font_size' => '18px', |
|
353 | + 'section_color' => '444444', |
|
354 | + 'section_weight' => 'bold', |
|
355 | + 'section_pad' => '15px 0 3px 0', |
|
356 | + 'section_mar_top' => '15px', |
|
357 | 357 | 'section_mar_bottom' => '12px', |
358 | - 'section_bg_color' => '', |
|
359 | - 'section_border_color' => 'e8e8e8', |
|
360 | - 'section_border_width' => '2px', |
|
361 | - 'section_border_style' => 'solid', |
|
362 | - 'section_border_loc' => '-top', |
|
363 | - 'collapse_icon' => '6', |
|
364 | - 'collapse_pos' => 'after', |
|
365 | - 'repeat_icon' => '1', |
|
366 | - |
|
367 | - 'submit_style' => false, |
|
368 | - 'submit_font_size' => '14px', |
|
369 | - 'submit_width' => 'auto', |
|
370 | - 'submit_height' => 'auto', |
|
371 | - 'submit_bg_color' => 'ffffff', |
|
372 | - 'submit_border_color' => 'cccccc', |
|
373 | - 'submit_border_width' => '1px', |
|
374 | - 'submit_text_color' => '444444', |
|
375 | - 'submit_weight' => 'normal', |
|
376 | - 'submit_border_radius' => '4px', |
|
377 | - 'submit_bg_img' => '', |
|
378 | - 'submit_margin' => '10px', |
|
379 | - 'submit_padding' => '6px 11px', |
|
380 | - 'submit_shadow_color' => 'eeeeee', |
|
381 | - 'submit_hover_bg_color' => 'efefef', |
|
382 | - 'submit_hover_color' => '444444', |
|
383 | - 'submit_hover_border_color' => 'cccccc', |
|
384 | - 'submit_active_bg_color' => 'efefef', |
|
385 | - 'submit_active_color' => '444444', |
|
386 | - 'submit_active_border_color' => 'cccccc', |
|
387 | - |
|
388 | - 'border_radius' => '4px', |
|
389 | - 'error_bg' => 'F2DEDE', |
|
390 | - 'error_border' => 'EBCCD1', |
|
391 | - 'error_text' => 'B94A48', |
|
392 | - 'error_font_size' => '14px', |
|
393 | - |
|
394 | - 'success_bg_color' => 'DFF0D8', |
|
395 | - 'success_border_color' => 'D6E9C6', |
|
396 | - 'success_text_color' => '468847', |
|
397 | - 'success_font_size' => '14px', |
|
398 | - |
|
399 | - 'important_style' => false, |
|
400 | - |
|
401 | - 'custom_css' => '', |
|
402 | - ); |
|
403 | - } |
|
358 | + 'section_bg_color' => '', |
|
359 | + 'section_border_color' => 'e8e8e8', |
|
360 | + 'section_border_width' => '2px', |
|
361 | + 'section_border_style' => 'solid', |
|
362 | + 'section_border_loc' => '-top', |
|
363 | + 'collapse_icon' => '6', |
|
364 | + 'collapse_pos' => 'after', |
|
365 | + 'repeat_icon' => '1', |
|
366 | + |
|
367 | + 'submit_style' => false, |
|
368 | + 'submit_font_size' => '14px', |
|
369 | + 'submit_width' => 'auto', |
|
370 | + 'submit_height' => 'auto', |
|
371 | + 'submit_bg_color' => 'ffffff', |
|
372 | + 'submit_border_color' => 'cccccc', |
|
373 | + 'submit_border_width' => '1px', |
|
374 | + 'submit_text_color' => '444444', |
|
375 | + 'submit_weight' => 'normal', |
|
376 | + 'submit_border_radius' => '4px', |
|
377 | + 'submit_bg_img' => '', |
|
378 | + 'submit_margin' => '10px', |
|
379 | + 'submit_padding' => '6px 11px', |
|
380 | + 'submit_shadow_color' => 'eeeeee', |
|
381 | + 'submit_hover_bg_color' => 'efefef', |
|
382 | + 'submit_hover_color' => '444444', |
|
383 | + 'submit_hover_border_color' => 'cccccc', |
|
384 | + 'submit_active_bg_color' => 'efefef', |
|
385 | + 'submit_active_color' => '444444', |
|
386 | + 'submit_active_border_color' => 'cccccc', |
|
387 | + |
|
388 | + 'border_radius' => '4px', |
|
389 | + 'error_bg' => 'F2DEDE', |
|
390 | + 'error_border' => 'EBCCD1', |
|
391 | + 'error_text' => 'B94A48', |
|
392 | + 'error_font_size' => '14px', |
|
393 | + |
|
394 | + 'success_bg_color' => 'DFF0D8', |
|
395 | + 'success_border_color' => 'D6E9C6', |
|
396 | + 'success_text_color' => '468847', |
|
397 | + 'success_font_size' => '14px', |
|
398 | + |
|
399 | + 'important_style' => false, |
|
400 | + |
|
401 | + 'custom_css' => '', |
|
402 | + ); |
|
403 | + } |
|
404 | 404 | |
405 | 405 | public function get_field_name( $field_name, $post_field = 'post_content' ) { |
406 | 406 | return 'frm_style_setting' . ( empty( $post_field ) ? '' : '[' . $post_field . ']' ) . '[' . $field_name . ']'; |