@@ -4,7 +4,7 @@ discard block |
||
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 |
||
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 |
@@ -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 = 2147483647; |
|
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 = 2147483647; |
|
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 . ']'; |
@@ -1,6 +1,6 @@ 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 | /** |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | $max_slug_value = 2147483647; |
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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,22 +194,22 @@ discard block |
||
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 = __( 'Formidable Style', 'formidable' ); |
209 | 209 | $new->post_name = $new->post_title; |
210 | 210 | $new->menu_order = 1; |
211 | - $new = $this->save( (array) $new); |
|
212 | - $this->update('default'); |
|
211 | + $new = $this->save( (array) $new ); |
|
212 | + $this->update( 'default' ); |
|
213 | 213 | |
214 | 214 | $post_atts['include'] = $new; |
215 | 215 | |
@@ -233,25 +233,25 @@ discard block |
||
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | - $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content); |
|
236 | + $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content ); |
|
237 | 237 | |
238 | 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); |
|
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 | - $styles[ $style->ID ] = $style; |
|
242 | + $styles[$style->ID] = $style; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | if ( ! $default_style ) { |
246 | - $default_style = reset($styles); |
|
247 | - $styles[ $default_style->ID ]->menu_order = 1; |
|
246 | + $default_style = reset( $styles ); |
|
247 | + $styles[$default_style->ID]->menu_order = 1; |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | return $styles; |
251 | 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 | |
@@ -263,24 +263,24 @@ discard block |
||
263 | 263 | } |
264 | 264 | |
265 | 265 | public function override_defaults( $settings ) { |
266 | - if ( ! is_array($settings) ) { |
|
266 | + if ( ! is_array( $settings ) ) { |
|
267 | 267 | return $settings; |
268 | 268 | } |
269 | 269 | |
270 | - $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height']; |
|
270 | + $settings['line_height'] = ( ! isset( $settings['field_height'] ) || $settings['field_height'] == '' || $settings['field_height'] == 'auto' ) ? 'normal' : $settings['field_height']; |
|
271 | 271 | |
272 | - if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) { |
|
272 | + if ( ! isset( $settings['form_desc_size'] ) && isset( $settings['description_font_size'] ) ) { |
|
273 | 273 | $settings['form_desc_size'] = $settings['description_font_size']; |
274 | 274 | $settings['form_desc_color'] = $settings['description_color']; |
275 | 275 | $settings['title_color'] = $settings['label_color']; |
276 | 276 | } |
277 | 277 | |
278 | - if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) { |
|
278 | + if ( ! isset( $settings['section_color'] ) && isset( $settings['label_color'] ) ) { |
|
279 | 279 | $settings['section_color'] = $settings['label_color']; |
280 | 280 | $settings['section_border_color'] = $settings['border_color']; |
281 | 281 | } |
282 | 282 | |
283 | - if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) { |
|
283 | + if ( ! isset( $settings['submit_hover_bg_color'] ) && isset( $settings['submit_bg_color'] ) ) { |
|
284 | 284 | $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
285 | 285 | $settings['submit_hover_color'] = $settings['submit_text_color']; |
286 | 286 | $settings['submit_hover_border_color'] = $settings['submit_border_color']; |
@@ -18,8 +18,8 @@ discard block |
||
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 |
||
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 |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | <a href="javascript:void(0)" class="show_field_custom_html frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="<?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="' . esc_attr( $sname['title'] ) . '"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a> |
23 | 23 | </li> |
24 | 24 | <?php |
25 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
26 | - unset($skey, $sname); |
|
25 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
26 | + unset( $skey, $sname ); |
|
27 | 27 | } |
28 | 28 | ?> |
29 | 29 | </ul> |
@@ -36,18 +36,18 @@ discard block |
||
36 | 36 | 'form_key' => __( 'Form Key', 'formidable' ), 'deletelink' => __( 'Delete Entry Link', 'formidable' ), |
37 | 37 | ) as $skey => $sname ) { ?> |
38 | 38 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
39 | - <a href="javascript:void(0)" class="show_before_html show_after_html frmbutton button frm_insert_code" data-code="<?php echo esc_attr($skey) ?>"><?php echo esc_html( $sname ); ?></a> |
|
39 | + <a href="javascript:void(0)" class="show_before_html show_after_html frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $skey ) ?>"><?php echo esc_html( $sname ); ?></a> |
|
40 | 40 | </li> |
41 | 41 | <?php |
42 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
42 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | foreach ( array( 'button_label' => __( 'Button Label', 'formidable' ), 'button_action' => __( 'Button Hook', 'formidable' ) ) as $skey => $sname ) { ?> |
46 | 46 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
47 | - <a href="javascript:void(0)" class="show_submit_html frmbutton button frm_insert_code" data-code="<?php echo esc_attr($skey) ?>"><?php echo esc_html( $sname ); ?></a> |
|
47 | + <a href="javascript:void(0)" class="show_submit_html frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $skey ) ?>"><?php echo esc_html( $sname ); ?></a> |
|
48 | 48 | </li> |
49 | 49 | <?php |
50 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
50 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
51 | 51 | } ?> |
52 | 52 | </ul> |
53 | 53 | </div> |
@@ -1,53 +1,53 @@ |
||
1 | 1 | <div id="frm-html-tags" class="tabs-panel"> |
2 | 2 | <ul class="frm_code_list"> |
3 | 3 | <?php |
4 | - $col = 'one'; |
|
5 | - $entry_shortcodes = array( |
|
6 | - 'id' => __( 'Field ID', 'formidable' ), |
|
7 | - 'key' => __( 'Field Key', 'formidable' ), |
|
8 | - 'field_name' => __( 'Field Name', 'formidable' ), |
|
9 | - 'description' => __( 'Field Description', 'formidable' ), |
|
10 | - 'label_position' => __( 'Label Position', 'formidable' ), |
|
11 | - 'required_label' => __( 'Required Label', 'formidable' ), |
|
12 | - 'input' => __( 'Input Field', 'formidable' ), |
|
4 | + $col = 'one'; |
|
5 | + $entry_shortcodes = array( |
|
6 | + 'id' => __( 'Field ID', 'formidable' ), |
|
7 | + 'key' => __( 'Field Key', 'formidable' ), |
|
8 | + 'field_name' => __( 'Field Name', 'formidable' ), |
|
9 | + 'description' => __( 'Field Description', 'formidable' ), |
|
10 | + 'label_position' => __( 'Label Position', 'formidable' ), |
|
11 | + 'required_label' => __( 'Required Label', 'formidable' ), |
|
12 | + 'input' => __( 'Input Field', 'formidable' ), |
|
13 | 13 | 'input opt=1' => array( 'label' => __( 'Single Option', 'formidable' ), 'title' => __( 'Show a single radio or checkbox option by replacing 1 with the order of the option', 'formidable' ) ), |
14 | - 'input label=0' => __( 'Hide Option Label', 'formidable' ), |
|
14 | + 'input label=0' => __( 'Hide Option Label', 'formidable' ), |
|
15 | 15 | 'required_class' => array( 'label' => __( 'Required Class', 'formidable' ), 'title' => __( 'Add class name if field is required', 'formidable' ) ), |
16 | 16 | 'error_class' => array( 'label' => __( 'Error Class', 'formidable' ), 'title' => __( 'Add class name if field has an error on form submit', 'formidable' ) ), |
17 | - ); |
|
17 | + ); |
|
18 | 18 | |
19 | 19 | foreach ( $entry_shortcodes as $skey => $sname ) { |
20 | - ?> |
|
20 | + ?> |
|
21 | 21 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
22 | 22 | <a href="javascript:void(0)" class="show_field_custom_html frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="<?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="' . esc_attr( $sname['title'] ) . '"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a> |
23 | 23 | </li> |
24 | 24 | <?php |
25 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
26 | - unset($skey, $sname); |
|
27 | - } |
|
28 | - ?> |
|
25 | + $col = ($col == 'one') ? 'two' : 'one'; |
|
26 | + unset($skey, $sname); |
|
27 | + } |
|
28 | + ?> |
|
29 | 29 | </ul> |
30 | 30 | |
31 | 31 | <ul class="frm_code_list frm_clear"> |
32 | 32 | <?php |
33 | - $col = 'one'; |
|
33 | + $col = 'one'; |
|
34 | 34 | foreach ( array( |
35 | - 'form_name' => __( 'Form Name', 'formidable' ), 'form_description' => __( 'Form Description', 'formidable' ), |
|
36 | - 'form_key' => __( 'Form Key', 'formidable' ), 'deletelink' => __( 'Delete Entry Link', 'formidable' ), |
|
35 | + 'form_name' => __( 'Form Name', 'formidable' ), 'form_description' => __( 'Form Description', 'formidable' ), |
|
36 | + 'form_key' => __( 'Form Key', 'formidable' ), 'deletelink' => __( 'Delete Entry Link', 'formidable' ), |
|
37 | 37 | ) as $skey => $sname ) { ?> |
38 | 38 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
39 | 39 | <a href="javascript:void(0)" class="show_before_html show_after_html frmbutton button frm_insert_code" data-code="<?php echo esc_attr($skey) ?>"><?php echo esc_html( $sname ); ?></a> |
40 | 40 | </li> |
41 | 41 | <?php |
42 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
43 | - } |
|
42 | + $col = ($col == 'one') ? 'two' : 'one'; |
|
43 | + } |
|
44 | 44 | |
45 | - foreach ( array( 'button_label' => __( 'Button Label', 'formidable' ), 'button_action' => __( 'Button Hook', 'formidable' ) ) as $skey => $sname ) { ?> |
|
45 | + foreach ( array( 'button_label' => __( 'Button Label', 'formidable' ), 'button_action' => __( 'Button Hook', 'formidable' ) ) as $skey => $sname ) { ?> |
|
46 | 46 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
47 | 47 | <a href="javascript:void(0)" class="show_submit_html frmbutton button frm_insert_code" data-code="<?php echo esc_attr($skey) ?>"><?php echo esc_html( $sname ); ?></a> |
48 | 48 | </li> |
49 | 49 | <?php |
50 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
51 | - } ?> |
|
50 | + $col = ($col == 'one') ? 'two' : 'one'; |
|
51 | + } ?> |
|
52 | 52 | </ul> |
53 | 53 | </div> |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if ( ! $item_ids ) { |
4 | - return; |
|
4 | + return; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | global $wp_query; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | if ( empty( $taxonomies ) ) { |
68 | - return; |
|
68 | + return; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | global $frm_inc_tax; |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | |
76 | 76 | foreach ( (array) $terms as $term ) { |
77 | 77 | if ( in_array( $term->term_id, $frm_inc_tax ) ) { |
78 | - return; |
|
78 | + return; |
|
79 | 79 | } |
80 | 80 | |
81 | - $frm_inc_tax[] = $term->term_id; |
|
82 | - $label = ($term->taxonomy == 'category' || $term->taxonomy == 'tag') ? $term->taxonomy : 'term'; ?> |
|
81 | + $frm_inc_tax[] = $term->term_id; |
|
82 | + $label = ($term->taxonomy == 'category' || $term->taxonomy == 'tag') ? $term->taxonomy : 'term'; ?> |
|
83 | 83 | <term><term_id><?php echo esc_html( $term->term_id ) ?></term_id><term_taxonomy><?php echo esc_html( $term->taxonomy ); ?></term_taxonomy><?php |
84 | - if ( ! empty( $term->name ) ) { |
|
85 | - echo '<term_name>' . FrmXMLHelper::cdata( $term->name ) . '</term_name>'; |
|
86 | - } |
|
87 | - if ( ! empty( $term->description ) ) { |
|
88 | - ?><term_description><?php echo FrmXMLHelper::cdata( $term->description ) ?></term_description><?php |
|
89 | - } |
|
90 | - ?><term_slug><?php echo esc_html( $term->slug ); ?></term_slug></term> |
|
84 | + if ( ! empty( $term->name ) ) { |
|
85 | + echo '<term_name>' . FrmXMLHelper::cdata( $term->name ) . '</term_name>'; |
|
86 | + } |
|
87 | + if ( ! empty( $term->description ) ) { |
|
88 | + ?><term_description><?php echo FrmXMLHelper::cdata( $term->description ) ?></term_description><?php |
|
89 | + } |
|
90 | + ?><term_slug><?php echo esc_html( $term->slug ); ?></term_slug></term> |
|
91 | 91 | <?php |
92 | 92 | } |
@@ -79,7 +79,7 @@ |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | $frm_inc_tax[] = $term->term_id; |
82 | - $label = ($term->taxonomy == 'category' || $term->taxonomy == 'tag') ? $term->taxonomy : 'term'; ?> |
|
82 | + $label = ( $term->taxonomy == 'category' || $term->taxonomy == 'tag' ) ? $term->taxonomy : 'term'; ?> |
|
83 | 83 | <term><term_id><?php echo esc_html( $term->term_id ) ?></term_id><term_taxonomy><?php echo esc_html( $term->taxonomy ); ?></term_taxonomy><?php |
84 | 84 | if ( ! empty( $term->name ) ) { |
85 | 85 | echo '<term_name>' . FrmXMLHelper::cdata( $term->name ) . '</term_name>'; |
@@ -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> |
@@ -308,7 +308,7 @@ |
||
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 ) { |
@@ -1,70 +1,70 @@ discard block |
||
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(); |
|
44 | + /**** ADD/UPDATE DEFAULT TEMPLATES ****/ |
|
45 | + FrmXMLController::add_default_templates(); |
|
46 | 46 | |
47 | 47 | if ( ! $old_db_version ) { |
48 | 48 | $this->maybe_create_contact_form(); |
49 | 49 | } |
50 | - } |
|
50 | + } |
|
51 | 51 | |
52 | - do_action('frm_after_install'); |
|
52 | + do_action('frm_after_install'); |
|
53 | 53 | |
54 | - /**** update the styling settings ****/ |
|
54 | + /**** update the styling settings ****/ |
|
55 | 55 | if ( is_admin() && function_exists( 'get_filesystem_method' ) ) { |
56 | 56 | $frm_style = new FrmStyle(); |
57 | 57 | $frm_style->update( 'default' ); |
58 | 58 | } |
59 | - } |
|
59 | + } |
|
60 | 60 | |
61 | - public function collation() { |
|
62 | - global $wpdb; |
|
63 | - if ( ! $wpdb->has_cap( 'collation' ) ) { |
|
64 | - return ''; |
|
65 | - } |
|
61 | + public function collation() { |
|
62 | + global $wpdb; |
|
63 | + if ( ! $wpdb->has_cap( 'collation' ) ) { |
|
64 | + return ''; |
|
65 | + } |
|
66 | 66 | |
67 | - $charset_collate = ''; |
|
67 | + $charset_collate = ''; |
|
68 | 68 | if ( ! empty( $wpdb->charset ) ) { |
69 | 69 | $charset_collate .= ' DEFAULT CHARACTER SET ' . $wpdb->charset; |
70 | 70 | } |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | $charset_collate .= ' COLLATE ' . $wpdb->collate; |
74 | 74 | } |
75 | 75 | |
76 | - return $charset_collate; |
|
77 | - } |
|
76 | + return $charset_collate; |
|
77 | + } |
|
78 | 78 | |
79 | - private function create_tables() { |
|
80 | - $charset_collate = $this->collation(); |
|
81 | - $sql = array(); |
|
79 | + private function create_tables() { |
|
80 | + $charset_collate = $this->collation(); |
|
81 | + $sql = array(); |
|
82 | 82 | |
83 | - /* Create/Upgrade Fields Table */ |
|
83 | + /* Create/Upgrade Fields Table */ |
|
84 | 84 | $sql[] = 'CREATE TABLE ' . $this->fields . ' ( |
85 | 85 | id BIGINT(20) NOT NULL auto_increment, |
86 | 86 | field_key varchar(100) default NULL, |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | UNIQUE KEY field_key (field_key) |
100 | 100 | )'; |
101 | 101 | |
102 | - /* Create/Upgrade Forms Table */ |
|
102 | + /* Create/Upgrade Forms Table */ |
|
103 | 103 | $sql[] = 'CREATE TABLE ' . $this->forms . ' ( |
104 | 104 | id int(11) NOT NULL auto_increment, |
105 | 105 | form_key varchar(100) default NULL, |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | UNIQUE KEY form_key (form_key) |
118 | 118 | )'; |
119 | 119 | |
120 | - /* Create/Upgrade Items Table */ |
|
120 | + /* Create/Upgrade Items Table */ |
|
121 | 121 | $sql[] = 'CREATE TABLE ' . $this->entries . ' ( |
122 | 122 | id BIGINT(20) NOT NULL auto_increment, |
123 | 123 | item_key varchar(100) default NULL, |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | UNIQUE KEY item_key (item_key) |
141 | 141 | )'; |
142 | 142 | |
143 | - /* Create/Upgrade Meta Table */ |
|
143 | + /* Create/Upgrade Meta Table */ |
|
144 | 144 | $sql[] = 'CREATE TABLE ' . $this->entry_metas . ' ( |
145 | 145 | id BIGINT(20) NOT NULL auto_increment, |
146 | 146 | meta_value longtext default NULL, |
@@ -152,16 +152,16 @@ discard block |
||
152 | 152 | KEY item_id (item_id) |
153 | 153 | )'; |
154 | 154 | |
155 | - foreach ( $sql as $q ) { |
|
155 | + foreach ( $sql as $q ) { |
|
156 | 156 | if ( function_exists( 'dbDelta' ) ) { |
157 | 157 | dbDelta( $q . $charset_collate . ';' ); |
158 | 158 | } else { |
159 | 159 | global $wpdb; |
160 | 160 | $wpdb->query( $q . $charset_collate ); |
161 | 161 | } |
162 | - unset($q); |
|
163 | - } |
|
164 | - } |
|
162 | + unset($q); |
|
163 | + } |
|
164 | + } |
|
165 | 165 | |
166 | 166 | private function maybe_create_contact_form() { |
167 | 167 | $template_id = FrmForm::getIdByKey( 'contact' ); |
@@ -177,32 +177,32 @@ discard block |
||
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | - /** |
|
181 | - * @param integer $frm_db_version |
|
180 | + /** |
|
181 | + * @param integer $frm_db_version |
|
182 | 182 | * @param int $old_db_version |
183 | - */ |
|
183 | + */ |
|
184 | 184 | private function migrate_data( $frm_db_version, $old_db_version ) { |
185 | 185 | $migrations = array( 4, 6, 11, 16, 17, 23, 25 ); |
186 | - foreach ( $migrations as $migration ) { |
|
187 | - if ( $frm_db_version >= $migration && $old_db_version < $migration ) { |
|
186 | + foreach ( $migrations as $migration ) { |
|
187 | + if ( $frm_db_version >= $migration && $old_db_version < $migration ) { |
|
188 | 188 | $function_name = 'migrate_to_' . $migration; |
189 | - $this->$function_name(); |
|
190 | - } |
|
191 | - } |
|
192 | - } |
|
189 | + $this->$function_name(); |
|
190 | + } |
|
191 | + } |
|
192 | + } |
|
193 | 193 | |
194 | - /** |
|
195 | - * Change array into format $wpdb->prepare can use |
|
194 | + /** |
|
195 | + * Change array into format $wpdb->prepare can use |
|
196 | 196 | * |
197 | 197 | * @param array $args |
198 | 198 | * @param string $starts_with |
199 | - */ |
|
200 | - public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) { |
|
201 | - if ( empty($args) ) { |
|
199 | + */ |
|
200 | + public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) { |
|
201 | + if ( empty($args) ) { |
|
202 | 202 | // add an arg to prevent prepare from failing |
203 | 203 | $args = array( 'where' => $starts_with . '1=%d', 'values' => array( 1 ) ); |
204 | 204 | return; |
205 | - } |
|
205 | + } |
|
206 | 206 | |
207 | 207 | $where = ''; |
208 | 208 | $values = array(); |
@@ -213,64 +213,64 @@ discard block |
||
213 | 213 | } |
214 | 214 | |
215 | 215 | $args = compact( 'where', 'values' ); |
216 | - } |
|
216 | + } |
|
217 | 217 | |
218 | - /** |
|
218 | + /** |
|
219 | 219 | * @param array $args |
220 | - * @param string $base_where |
|
221 | - * @param string $where |
|
220 | + * @param string $base_where |
|
221 | + * @param string $where |
|
222 | 222 | * @param array $values |
223 | - */ |
|
224 | - public static function parse_where_from_array( $args, $base_where, &$where, &$values ) { |
|
225 | - $condition = ' AND'; |
|
226 | - if ( isset( $args['or'] ) ) { |
|
227 | - $condition = ' OR'; |
|
228 | - unset( $args['or'] ); |
|
229 | - } |
|
230 | - |
|
231 | - foreach ( $args as $key => $value ) { |
|
232 | - $where .= empty( $where ) ? $base_where : $condition; |
|
233 | - $array_inc_null = ( ! is_numeric( $key ) && is_array( $value ) && in_array( null, $value ) ); |
|
234 | - if ( is_numeric( $key ) || $array_inc_null ) { |
|
235 | - $where .= ' ( '; |
|
236 | - $nested_where = ''; |
|
237 | - if ( $array_inc_null ) { |
|
238 | - foreach ( $value as $val ) { |
|
239 | - self::parse_where_from_array( array( $key => $val, 'or' => 1 ), '', $nested_where, $values ); |
|
240 | - } |
|
241 | - } else { |
|
242 | - self::parse_where_from_array( $value, '', $nested_where, $values ); |
|
243 | - } |
|
244 | - $where .= $nested_where; |
|
245 | - $where .= ' ) '; |
|
246 | - } else { |
|
247 | - self::interpret_array_to_sql( $key, $value, $where, $values ); |
|
248 | - } |
|
249 | - } |
|
250 | - } |
|
251 | - |
|
252 | - /** |
|
253 | - * @param string $key |
|
223 | + */ |
|
224 | + public static function parse_where_from_array( $args, $base_where, &$where, &$values ) { |
|
225 | + $condition = ' AND'; |
|
226 | + if ( isset( $args['or'] ) ) { |
|
227 | + $condition = ' OR'; |
|
228 | + unset( $args['or'] ); |
|
229 | + } |
|
230 | + |
|
231 | + foreach ( $args as $key => $value ) { |
|
232 | + $where .= empty( $where ) ? $base_where : $condition; |
|
233 | + $array_inc_null = ( ! is_numeric( $key ) && is_array( $value ) && in_array( null, $value ) ); |
|
234 | + if ( is_numeric( $key ) || $array_inc_null ) { |
|
235 | + $where .= ' ( '; |
|
236 | + $nested_where = ''; |
|
237 | + if ( $array_inc_null ) { |
|
238 | + foreach ( $value as $val ) { |
|
239 | + self::parse_where_from_array( array( $key => $val, 'or' => 1 ), '', $nested_where, $values ); |
|
240 | + } |
|
241 | + } else { |
|
242 | + self::parse_where_from_array( $value, '', $nested_where, $values ); |
|
243 | + } |
|
244 | + $where .= $nested_where; |
|
245 | + $where .= ' ) '; |
|
246 | + } else { |
|
247 | + self::interpret_array_to_sql( $key, $value, $where, $values ); |
|
248 | + } |
|
249 | + } |
|
250 | + } |
|
251 | + |
|
252 | + /** |
|
253 | + * @param string $key |
|
254 | 254 | * @param string|array $value |
255 | - * @param string $where |
|
255 | + * @param string $where |
|
256 | 256 | * @param array $values |
257 | - */ |
|
258 | - private static function interpret_array_to_sql( $key, $value, &$where, &$values ) { |
|
257 | + */ |
|
258 | + private static function interpret_array_to_sql( $key, $value, &$where, &$values ) { |
|
259 | 259 | $key = trim( $key ); |
260 | 260 | |
261 | 261 | if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) { |
262 | - $k = explode(' ', $key); |
|
263 | - $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key ); |
|
264 | - $values[] = '%Y-%m-%d %H:%i:%s'; |
|
265 | - } else { |
|
262 | + $k = explode(' ', $key); |
|
263 | + $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key ); |
|
264 | + $values[] = '%Y-%m-%d %H:%i:%s'; |
|
265 | + } else { |
|
266 | 266 | $where .= ' ' . $key; |
267 | - } |
|
267 | + } |
|
268 | 268 | |
269 | 269 | $lowercase_key = explode( ' ', strtolower( $key ) ); |
270 | 270 | $lowercase_key = end( $lowercase_key ); |
271 | 271 | |
272 | - if ( is_array( $value ) ) { |
|
273 | - // translate array of values to "in" |
|
272 | + if ( is_array( $value ) ) { |
|
273 | + // translate array of values to "in" |
|
274 | 274 | if ( strpos( $lowercase_key, 'like' ) !== false ) { |
275 | 275 | $where = preg_replace('/' . $key . '$/', '', $where); |
276 | 276 | $where .= '('; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $where .= ' in (' . FrmAppHelper::prepare_array_values( $value, '%s' ) . ')'; |
289 | 289 | $values = array_merge( $values, $value ); |
290 | 290 | } |
291 | - } else if ( strpos( $lowercase_key, 'like' ) !== false ) { |
|
291 | + } else if ( strpos( $lowercase_key, 'like' ) !== false ) { |
|
292 | 292 | /** |
293 | 293 | * Allow string to start or end with the value |
294 | 294 | * If the key is like% then skip the first % for starts with |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | $where .= ' %s'; |
309 | 309 | $values[] = $start . FrmAppHelper::esc_like( $value ) . $end; |
310 | 310 | |
311 | - } else if ( $value === null ) { |
|
312 | - $where .= ' IS NULL'; |
|
313 | - } else { |
|
311 | + } else if ( $value === null ) { |
|
312 | + $where .= ' IS NULL'; |
|
313 | + } else { |
|
314 | 314 | // allow a - to prevent = from being added |
315 | 315 | if ( substr( $key, -1 ) == '-' ) { |
316 | 316 | $where = rtrim( $where, '-' ); |
@@ -320,9 +320,9 @@ discard block |
||
320 | 320 | |
321 | 321 | self::add_query_placeholder( $key, $value, $where ); |
322 | 322 | |
323 | - $values[] = $value; |
|
324 | - } |
|
325 | - } |
|
323 | + $values[] = $value; |
|
324 | + } |
|
325 | + } |
|
326 | 326 | |
327 | 327 | /** |
328 | 328 | * Add %d, or %s to query |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @param int|string $value |
333 | 333 | * @param string $where |
334 | 334 | */ |
335 | - private static function add_query_placeholder( $key, $value, &$where ) { |
|
335 | + private static function add_query_placeholder( $key, $value, &$where ) { |
|
336 | 336 | if ( is_numeric( $value ) && ( strpos( $key, 'meta_value' ) === false || strpos( $key, '+0' ) !== false ) ) { |
337 | 337 | $where .= '%d'; |
338 | 338 | } else { |
@@ -340,16 +340,16 @@ discard block |
||
340 | 340 | } |
341 | 341 | } |
342 | 342 | |
343 | - /** |
|
344 | - * @param string $table |
|
343 | + /** |
|
344 | + * @param string $table |
|
345 | 345 | * @param array $where |
346 | 346 | * @param array $args |
347 | 347 | * @return int |
348 | - */ |
|
349 | - public static function get_count( $table, $where = array(), $args = array() ) { |
|
350 | - $count = self::get_var( $table, $where, 'COUNT(*)', $args ); |
|
351 | - return $count; |
|
352 | - } |
|
348 | + */ |
|
349 | + public static function get_count( $table, $where = array(), $args = array() ) { |
|
350 | + $count = self::get_var( $table, $where, 'COUNT(*)', $args ); |
|
351 | + return $count; |
|
352 | + } |
|
353 | 353 | |
354 | 354 | /** |
355 | 355 | * @param string $table |
@@ -360,17 +360,17 @@ discard block |
||
360 | 360 | * @param string $type |
361 | 361 | * @return array|null|string|object |
362 | 362 | */ |
363 | - public static function get_var( $table, $where = array(), $field = 'id', $args = array(), $limit = '', $type = 'var' ) { |
|
364 | - $group = ''; |
|
365 | - self::get_group_and_table_name( $table, $group ); |
|
363 | + public static function get_var( $table, $where = array(), $field = 'id', $args = array(), $limit = '', $type = 'var' ) { |
|
364 | + $group = ''; |
|
365 | + self::get_group_and_table_name( $table, $group ); |
|
366 | 366 | self::convert_options_to_array( $args, '', $limit ); |
367 | 367 | |
368 | 368 | $query = self::generate_query_string_from_pieces( $field, $table, $where, $args ); |
369 | 369 | |
370 | 370 | $cache_key = self::generate_cache_key( $where, $args, $field, $type ); |
371 | 371 | $results = FrmAppHelper::check_cache( $cache_key, $group, $query, 'get_' . $type ); |
372 | - return $results; |
|
373 | - } |
|
372 | + return $results; |
|
373 | + } |
|
374 | 374 | |
375 | 375 | /** |
376 | 376 | * Generate a cache key from the where query, field, type, and other arguments |
@@ -396,44 +396,44 @@ discard block |
||
396 | 396 | return $cache_key; |
397 | 397 | } |
398 | 398 | |
399 | - /** |
|
400 | - * @param string $table |
|
401 | - * @param array $where |
|
399 | + /** |
|
400 | + * @param string $table |
|
401 | + * @param array $where |
|
402 | 402 | * @param string $field |
403 | 403 | * @param array $args |
404 | 404 | * @param string $limit |
405 | 405 | * @return mixed |
406 | - */ |
|
407 | - public static function get_col( $table, $where = array(), $field = 'id', $args = array(), $limit = '' ) { |
|
408 | - return self::get_var( $table, $where, $field, $args, $limit, 'col' ); |
|
409 | - } |
|
410 | - |
|
411 | - /** |
|
412 | - * @since 2.0 |
|
413 | - * @param string $table |
|
406 | + */ |
|
407 | + public static function get_col( $table, $where = array(), $field = 'id', $args = array(), $limit = '' ) { |
|
408 | + return self::get_var( $table, $where, $field, $args, $limit, 'col' ); |
|
409 | + } |
|
410 | + |
|
411 | + /** |
|
412 | + * @since 2.0 |
|
413 | + * @param string $table |
|
414 | 414 | * @param array $where |
415 | 415 | * @param string $fields |
416 | 416 | * @param array $args |
417 | 417 | * @return mixed |
418 | - */ |
|
419 | - public static function get_row( $table, $where = array(), $fields = '*', $args = array() ) { |
|
420 | - $args['limit'] = 1; |
|
421 | - return self::get_var( $table, $where, $fields, $args, '', 'row' ); |
|
422 | - } |
|
423 | - |
|
424 | - /** |
|
425 | - * Prepare a key/value array before DB call |
|
418 | + */ |
|
419 | + public static function get_row( $table, $where = array(), $fields = '*', $args = array() ) { |
|
420 | + $args['limit'] = 1; |
|
421 | + return self::get_var( $table, $where, $fields, $args, '', 'row' ); |
|
422 | + } |
|
423 | + |
|
424 | + /** |
|
425 | + * Prepare a key/value array before DB call |
|
426 | 426 | * |
427 | - * @since 2.0 |
|
428 | - * @param string $table |
|
427 | + * @since 2.0 |
|
428 | + * @param string $table |
|
429 | 429 | * @param array $where |
430 | 430 | * @param string $fields |
431 | 431 | * @param array $args |
432 | 432 | * @return mixed |
433 | - */ |
|
434 | - public static function get_results( $table, $where = array(), $fields = '*', $args = array() ) { |
|
435 | - return self::get_var( $table, $where, $fields, $args, '', 'results' ); |
|
436 | - } |
|
433 | + */ |
|
434 | + public static function get_results( $table, $where = array(), $fields = '*', $args = array() ) { |
|
435 | + return self::get_var( $table, $where, $fields, $args, '', 'results' ); |
|
436 | + } |
|
437 | 437 | |
438 | 438 | /** |
439 | 439 | * Check for like, not like, in, not in, =, !=, >, <, <=, >= |
@@ -470,59 +470,59 @@ discard block |
||
470 | 470 | return ''; |
471 | 471 | } |
472 | 472 | |
473 | - /** |
|
474 | - * Get 'frm_forms' from wp_frm_forms or a longer table param that includes a join |
|
475 | - * Also add the wpdb->prefix to the table if it's missing |
|
476 | - * |
|
477 | - * @param string $table |
|
478 | - * @param string $group |
|
479 | - */ |
|
480 | - private static function get_group_and_table_name( &$table, &$group ) { |
|
473 | + /** |
|
474 | + * Get 'frm_forms' from wp_frm_forms or a longer table param that includes a join |
|
475 | + * Also add the wpdb->prefix to the table if it's missing |
|
476 | + * |
|
477 | + * @param string $table |
|
478 | + * @param string $group |
|
479 | + */ |
|
480 | + private static function get_group_and_table_name( &$table, &$group ) { |
|
481 | 481 | global $wpdb, $wpmuBaseTablePrefix; |
482 | 482 | |
483 | - $table_parts = explode(' ', $table); |
|
484 | - $group = reset($table_parts); |
|
485 | - $group = str_replace( $wpdb->prefix, '', $group ); |
|
483 | + $table_parts = explode(' ', $table); |
|
484 | + $group = reset($table_parts); |
|
485 | + $group = str_replace( $wpdb->prefix, '', $group ); |
|
486 | 486 | |
487 | 487 | $prefix = $wpmuBaseTablePrefix ? $wpmuBaseTablePrefix : $wpdb->base_prefix; |
488 | 488 | $group = str_replace( $prefix, '', $group ); |
489 | 489 | |
490 | - if ( $group == $table ) { |
|
491 | - $table = $wpdb->prefix . $table; |
|
492 | - } |
|
490 | + if ( $group == $table ) { |
|
491 | + $table = $wpdb->prefix . $table; |
|
492 | + } |
|
493 | 493 | |
494 | 494 | // switch to singular group name |
495 | 495 | $group = rtrim( $group, 's' ); |
496 | - } |
|
496 | + } |
|
497 | 497 | |
498 | - private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) { |
|
499 | - if ( ! is_array($args) ) { |
|
498 | + private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) { |
|
499 | + if ( ! is_array($args) ) { |
|
500 | 500 | $args = array( 'order_by' => $args ); |
501 | - } |
|
501 | + } |
|
502 | 502 | |
503 | - if ( ! empty( $order_by ) ) { |
|
504 | - $args['order_by'] = $order_by; |
|
505 | - } |
|
503 | + if ( ! empty( $order_by ) ) { |
|
504 | + $args['order_by'] = $order_by; |
|
505 | + } |
|
506 | 506 | |
507 | - if ( ! empty( $limit ) ) { |
|
508 | - $args['limit'] = $limit; |
|
509 | - } |
|
507 | + if ( ! empty( $limit ) ) { |
|
508 | + $args['limit'] = $limit; |
|
509 | + } |
|
510 | 510 | |
511 | - $temp_args = $args; |
|
512 | - foreach ( $temp_args as $k => $v ) { |
|
513 | - if ( $v == '' ) { |
|
511 | + $temp_args = $args; |
|
512 | + foreach ( $temp_args as $k => $v ) { |
|
513 | + if ( $v == '' ) { |
|
514 | 514 | unset( $args[ $k ] ); |
515 | - continue; |
|
516 | - } |
|
515 | + continue; |
|
516 | + } |
|
517 | 517 | |
518 | - if ( $k == 'limit' ) { |
|
518 | + if ( $k == 'limit' ) { |
|
519 | 519 | $args[ $k ] = FrmAppHelper::esc_limit( $v ); |
520 | - } |
|
521 | - $db_name = strtoupper( str_replace( '_', ' ', $k ) ); |
|
522 | - if ( strpos( $v, $db_name ) === false ) { |
|
520 | + } |
|
521 | + $db_name = strtoupper( str_replace( '_', ' ', $k ) ); |
|
522 | + if ( strpos( $v, $db_name ) === false ) { |
|
523 | 523 | $args[ $k ] = $db_name . ' ' . $v; |
524 | - } |
|
525 | - } |
|
524 | + } |
|
525 | + } |
|
526 | 526 | |
527 | 527 | // Make sure LIMIT is the last argument |
528 | 528 | if ( isset( $args['order_by'] ) && isset( $args['limit'] ) ) { |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | unset( $args['limit'] ); |
531 | 531 | $args['limit'] = $temp_limit; |
532 | 532 | } |
533 | - } |
|
533 | + } |
|
534 | 534 | |
535 | 535 | /** |
536 | 536 | * Get the associative array results for the given columns, table, and where query |
@@ -583,31 +583,31 @@ discard block |
||
583 | 583 | return $query; |
584 | 584 | } |
585 | 585 | |
586 | - public function uninstall() { |
|
586 | + public function uninstall() { |
|
587 | 587 | if ( ! current_user_can( 'administrator' ) ) { |
588 | - $frm_settings = FrmAppHelper::get_settings(); |
|
589 | - wp_die($frm_settings->admin_permission); |
|
590 | - } |
|
588 | + $frm_settings = FrmAppHelper::get_settings(); |
|
589 | + wp_die($frm_settings->admin_permission); |
|
590 | + } |
|
591 | 591 | |
592 | - global $wpdb, $wp_roles; |
|
592 | + global $wpdb, $wp_roles; |
|
593 | 593 | |
594 | 594 | $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->fields ); |
595 | 595 | $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->forms ); |
596 | 596 | $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entries ); |
597 | 597 | $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entry_metas ); |
598 | 598 | |
599 | - delete_option('frm_options'); |
|
600 | - delete_option('frm_db_version'); |
|
599 | + delete_option('frm_options'); |
|
600 | + delete_option('frm_db_version'); |
|
601 | 601 | |
602 | - //delete roles |
|
603 | - $frm_roles = FrmAppHelper::frm_capabilities(); |
|
604 | - $roles = get_editable_roles(); |
|
605 | - foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
|
606 | - foreach ( $roles as $role => $details ) { |
|
607 | - $wp_roles->remove_cap( $role, $frm_role ); |
|
608 | - unset($role, $details); |
|
609 | - } |
|
610 | - unset($frm_role, $frm_role_description); |
|
602 | + //delete roles |
|
603 | + $frm_roles = FrmAppHelper::frm_capabilities(); |
|
604 | + $roles = get_editable_roles(); |
|
605 | + foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
|
606 | + foreach ( $roles as $role => $details ) { |
|
607 | + $wp_roles->remove_cap( $role, $frm_role ); |
|
608 | + unset($role, $details); |
|
609 | + } |
|
610 | + unset($frm_role, $frm_role_description); |
|
611 | 611 | } |
612 | 612 | unset($roles, $frm_roles); |
613 | 613 | |
@@ -631,9 +631,9 @@ discard block |
||
631 | 631 | |
632 | 632 | $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_%' ) ); |
633 | 633 | |
634 | - do_action('frm_after_uninstall'); |
|
635 | - return true; |
|
636 | - } |
|
634 | + do_action('frm_after_uninstall'); |
|
635 | + return true; |
|
636 | + } |
|
637 | 637 | |
638 | 638 | /** |
639 | 639 | * Migrate old styling settings. If sites are using the old |
@@ -672,150 +672,150 @@ discard block |
||
672 | 672 | } |
673 | 673 | } |
674 | 674 | |
675 | - /** |
|
676 | - * Change field size from character to pixel -- Multiply by 9 |
|
677 | - */ |
|
678 | - private function migrate_to_17() { |
|
679 | - global $wpdb; |
|
675 | + /** |
|
676 | + * Change field size from character to pixel -- Multiply by 9 |
|
677 | + */ |
|
678 | + private function migrate_to_17() { |
|
679 | + global $wpdb; |
|
680 | 680 | $pixel_conversion = 9; |
681 | 681 | |
682 | - // Get query arguments |
|
682 | + // Get query arguments |
|
683 | 683 | $field_types = array( 'textarea', 'text', 'number', 'email', 'url', 'rte', 'date', 'phone', 'password', 'image', 'tag', 'file' ); |
684 | 684 | $query = array( 'type' => $field_types, 'field_options like' => 's:4:"size";', 'field_options not like' => 's:4:"size";s:0:' ); |
685 | 685 | |
686 | - // Get results |
|
686 | + // Get results |
|
687 | 687 | $fields = FrmDb::get_results( $this->fields, $query, 'id, field_options' ); |
688 | 688 | |
689 | - $updated = 0; |
|
690 | - foreach ( $fields as $f ) { |
|
691 | - $f->field_options = maybe_unserialize($f->field_options); |
|
692 | - if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) { |
|
693 | - continue; |
|
694 | - } |
|
689 | + $updated = 0; |
|
690 | + foreach ( $fields as $f ) { |
|
691 | + $f->field_options = maybe_unserialize($f->field_options); |
|
692 | + if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) { |
|
693 | + continue; |
|
694 | + } |
|
695 | 695 | |
696 | 696 | $f->field_options['size'] = round( $pixel_conversion * (int) $f->field_options['size'] ); |
697 | - $f->field_options['size'] .= 'px'; |
|
698 | - $u = FrmField::update( $f->id, array( 'field_options' => $f->field_options ) ); |
|
699 | - if ( $u ) { |
|
700 | - $updated++; |
|
701 | - } |
|
702 | - unset($f); |
|
703 | - } |
|
704 | - |
|
705 | - // Change the characters in widgets to pixels |
|
706 | - $widgets = get_option('widget_frm_show_form'); |
|
707 | - if ( empty($widgets) ) { |
|
708 | - return; |
|
709 | - } |
|
710 | - |
|
711 | - $widgets = maybe_unserialize($widgets); |
|
712 | - foreach ( $widgets as $k => $widget ) { |
|
713 | - if ( ! is_array($widget) || ! isset($widget['size']) ) { |
|
714 | - continue; |
|
715 | - } |
|
697 | + $f->field_options['size'] .= 'px'; |
|
698 | + $u = FrmField::update( $f->id, array( 'field_options' => $f->field_options ) ); |
|
699 | + if ( $u ) { |
|
700 | + $updated++; |
|
701 | + } |
|
702 | + unset($f); |
|
703 | + } |
|
704 | + |
|
705 | + // Change the characters in widgets to pixels |
|
706 | + $widgets = get_option('widget_frm_show_form'); |
|
707 | + if ( empty($widgets) ) { |
|
708 | + return; |
|
709 | + } |
|
710 | + |
|
711 | + $widgets = maybe_unserialize($widgets); |
|
712 | + foreach ( $widgets as $k => $widget ) { |
|
713 | + if ( ! is_array($widget) || ! isset($widget['size']) ) { |
|
714 | + continue; |
|
715 | + } |
|
716 | 716 | $size = round( $pixel_conversion * (int) $widget['size'] ); |
717 | - $size .= 'px'; |
|
717 | + $size .= 'px'; |
|
718 | 718 | $widgets[ $k ]['size'] = $size; |
719 | - } |
|
720 | - update_option('widget_frm_show_form', $widgets); |
|
721 | - } |
|
722 | - |
|
723 | - /** |
|
724 | - * Migrate post and email notification settings into actions |
|
725 | - */ |
|
726 | - private function migrate_to_16() { |
|
727 | - global $wpdb; |
|
728 | - |
|
729 | - $forms = FrmDb::get_results( $this->forms, array(), 'id, options, is_template, default_template' ); |
|
730 | - |
|
731 | - /** |
|
732 | - * Old email settings format: |
|
733 | - * email_to: Email or field id |
|
734 | - * also_email_to: array of fields ids |
|
735 | - * reply_to: Email, field id, 'custom' |
|
736 | - * cust_reply_to: string |
|
737 | - * reply_to_name: field id, 'custom' |
|
738 | - * cust_reply_to_name: string |
|
739 | - * plain_text: 0|1 |
|
740 | - * email_message: string or '' |
|
741 | - * email_subject: string or '' |
|
742 | - * inc_user_info: 0|1 |
|
743 | - * update_email: 0, 1, 2 |
|
744 | - * |
|
745 | - * Old autoresponder settings format: |
|
746 | - * auto_responder: 0|1 |
|
747 | - * ar_email_message: string or '' |
|
748 | - * ar_email_to: field id |
|
749 | - * ar_plain_text: 0|1 |
|
750 | - * ar_reply_to_name: string |
|
751 | - * ar_reply_to: string |
|
752 | - * ar_email_subject: string |
|
753 | - * ar_update_email: 0, 1, 2 |
|
754 | - * |
|
755 | - * New email settings: |
|
756 | - * post_content: json settings |
|
757 | - * post_title: form id |
|
758 | - * post_excerpt: message |
|
759 | - * |
|
760 | - */ |
|
761 | - |
|
762 | - foreach ( $forms as $form ) { |
|
719 | + } |
|
720 | + update_option('widget_frm_show_form', $widgets); |
|
721 | + } |
|
722 | + |
|
723 | + /** |
|
724 | + * Migrate post and email notification settings into actions |
|
725 | + */ |
|
726 | + private function migrate_to_16() { |
|
727 | + global $wpdb; |
|
728 | + |
|
729 | + $forms = FrmDb::get_results( $this->forms, array(), 'id, options, is_template, default_template' ); |
|
730 | + |
|
731 | + /** |
|
732 | + * Old email settings format: |
|
733 | + * email_to: Email or field id |
|
734 | + * also_email_to: array of fields ids |
|
735 | + * reply_to: Email, field id, 'custom' |
|
736 | + * cust_reply_to: string |
|
737 | + * reply_to_name: field id, 'custom' |
|
738 | + * cust_reply_to_name: string |
|
739 | + * plain_text: 0|1 |
|
740 | + * email_message: string or '' |
|
741 | + * email_subject: string or '' |
|
742 | + * inc_user_info: 0|1 |
|
743 | + * update_email: 0, 1, 2 |
|
744 | + * |
|
745 | + * Old autoresponder settings format: |
|
746 | + * auto_responder: 0|1 |
|
747 | + * ar_email_message: string or '' |
|
748 | + * ar_email_to: field id |
|
749 | + * ar_plain_text: 0|1 |
|
750 | + * ar_reply_to_name: string |
|
751 | + * ar_reply_to: string |
|
752 | + * ar_email_subject: string |
|
753 | + * ar_update_email: 0, 1, 2 |
|
754 | + * |
|
755 | + * New email settings: |
|
756 | + * post_content: json settings |
|
757 | + * post_title: form id |
|
758 | + * post_excerpt: message |
|
759 | + * |
|
760 | + */ |
|
761 | + |
|
762 | + foreach ( $forms as $form ) { |
|
763 | 763 | if ( $form->is_template && $form->default_template ) { |
764 | 764 | // don't migrate the default templates since the email will be added anyway |
765 | 765 | continue; |
766 | 766 | } |
767 | 767 | |
768 | - // Format form options |
|
769 | - $form_options = maybe_unserialize($form->options); |
|
768 | + // Format form options |
|
769 | + $form_options = maybe_unserialize($form->options); |
|
770 | 770 | |
771 | - // Migrate settings to actions |
|
772 | - FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id ); |
|
773 | - } |
|
774 | - } |
|
771 | + // Migrate settings to actions |
|
772 | + FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id ); |
|
773 | + } |
|
774 | + } |
|
775 | 775 | |
776 | - private function migrate_to_11() { |
|
777 | - global $wpdb; |
|
776 | + private function migrate_to_11() { |
|
777 | + global $wpdb; |
|
778 | 778 | |
779 | - $forms = FrmDb::get_results( $this->forms, array(), 'id, options'); |
|
779 | + $forms = FrmDb::get_results( $this->forms, array(), 'id, options'); |
|
780 | 780 | |
781 | - $sending = __( 'Sending', 'formidable' ); |
|
781 | + $sending = __( 'Sending', 'formidable' ); |
|
782 | 782 | $img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif'; |
783 | - $old_default_html = <<<DEFAULT_HTML |
|
783 | + $old_default_html = <<<DEFAULT_HTML |
|
784 | 784 | <div class="frm_submit"> |
785 | 785 | [if back_button]<input type="submit" value="[back_label]" name="frm_prev_page" formnovalidate="formnovalidate" [back_hook] />[/if back_button] |
786 | 786 | <input type="submit" value="[button_label]" [button_action] /> |
787 | 787 | <img class="frm_ajax_loading" src="$img" alt="$sending" style="visibility:hidden;" /> |
788 | 788 | </div> |
789 | 789 | DEFAULT_HTML; |
790 | - unset($sending, $img); |
|
790 | + unset($sending, $img); |
|
791 | 791 | |
792 | - $new_default_html = FrmFormsHelper::get_default_html('submit'); |
|
793 | - $draft_link = FrmFormsHelper::get_draft_link(); |
|
792 | + $new_default_html = FrmFormsHelper::get_default_html('submit'); |
|
793 | + $draft_link = FrmFormsHelper::get_draft_link(); |
|
794 | 794 | foreach ( $forms as $form ) { |
795 | - $form->options = maybe_unserialize($form->options); |
|
796 | - if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) { |
|
797 | - continue; |
|
798 | - } |
|
795 | + $form->options = maybe_unserialize($form->options); |
|
796 | + if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) { |
|
797 | + continue; |
|
798 | + } |
|
799 | 799 | |
800 | - if ( $form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html ) { |
|
801 | - $form->options['submit_html'] = $new_default_html; |
|
800 | + if ( $form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html ) { |
|
801 | + $form->options['submit_html'] = $new_default_html; |
|
802 | 802 | $wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) ); |
803 | 803 | } else if ( ! strpos( $form->options['submit_html'], 'save_draft' ) ) { |
804 | 804 | $form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] ); |
805 | 805 | $wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) ); |
806 | - } |
|
807 | - unset($form); |
|
808 | - } |
|
809 | - unset($forms); |
|
810 | - } |
|
806 | + } |
|
807 | + unset($form); |
|
808 | + } |
|
809 | + unset($forms); |
|
810 | + } |
|
811 | 811 | |
812 | - private function migrate_to_6() { |
|
813 | - global $wpdb; |
|
812 | + private function migrate_to_6() { |
|
813 | + global $wpdb; |
|
814 | 814 | |
815 | 815 | $no_save = array_merge( FrmField::no_save_fields(), array( 'form', 'hidden', 'user_id' ) ); |
816 | 816 | $fields = FrmDb::get_results( $this->fields, array( 'type NOT' => $no_save ), 'id, field_options' ); |
817 | 817 | |
818 | - $default_html = <<<DEFAULT_HTML |
|
818 | + $default_html = <<<DEFAULT_HTML |
|
819 | 819 | <div id="frm_field_[id]_container" class="form-field [required_class] [error_class]"> |
820 | 820 | <label class="frm_pos_[label_position]">[field_name] |
821 | 821 | <span class="frm_required">[required_label]</span> |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | </div> |
826 | 826 | DEFAULT_HTML; |
827 | 827 | |
828 | - $old_default_html = <<<DEFAULT_HTML |
|
828 | + $old_default_html = <<<DEFAULT_HTML |
|
829 | 829 | <div id="frm_field_[id]_container" class="form-field [required_class] [error_class]"> |
830 | 830 | <label class="frm_pos_[label_position]">[field_name] |
831 | 831 | <span class="frm_required">[required_label]</span> |
@@ -835,24 +835,24 @@ discard block |
||
835 | 835 | </div> |
836 | 836 | DEFAULT_HTML; |
837 | 837 | |
838 | - $new_default_html = FrmFieldsHelper::get_default_html('text'); |
|
839 | - foreach ( $fields as $field ) { |
|
840 | - $field->field_options = maybe_unserialize($field->field_options); |
|
838 | + $new_default_html = FrmFieldsHelper::get_default_html('text'); |
|
839 | + foreach ( $fields as $field ) { |
|
840 | + $field->field_options = maybe_unserialize($field->field_options); |
|
841 | 841 | $html = FrmField::get_option( $field, 'custom_html' ); |
842 | 842 | if ( $html == $default_html || $html == $old_default_html ) { |
843 | - $field->field_options['custom_html'] = $new_default_html; |
|
843 | + $field->field_options['custom_html'] = $new_default_html; |
|
844 | 844 | $wpdb->update( $this->fields, array( 'field_options' => maybe_serialize( $field->field_options ) ), array( 'id' => $field->id ) ); |
845 | - } |
|
846 | - unset($field); |
|
847 | - } |
|
848 | - unset($default_html, $old_default_html, $fields); |
|
849 | - } |
|
850 | - |
|
851 | - private function migrate_to_4() { |
|
852 | - global $wpdb; |
|
845 | + } |
|
846 | + unset($field); |
|
847 | + } |
|
848 | + unset($default_html, $old_default_html, $fields); |
|
849 | + } |
|
850 | + |
|
851 | + private function migrate_to_4() { |
|
852 | + global $wpdb; |
|
853 | 853 | $user_ids = FrmEntryMeta::getAll( array( 'fi.type' => 'user_id' ) ); |
854 | - foreach ( $user_ids as $user_id ) { |
|
854 | + foreach ( $user_ids as $user_id ) { |
|
855 | 855 | $wpdb->update( $this->entries, array( 'user_id' => $user_id->meta_value ), array( 'id' => $user_id->item_id ) ); |
856 | - } |
|
857 | - } |
|
856 | + } |
|
857 | + } |
|
858 | 858 | } |
@@ -7,8 +7,8 @@ discard block |
||
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 |
||
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,10 +36,10 @@ discard block |
||
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(); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
52 | - do_action('frm_after_install'); |
|
52 | + do_action( 'frm_after_install' ); |
|
53 | 53 | |
54 | 54 | /**** update the styling settings ****/ |
55 | 55 | if ( is_admin() && function_exists( 'get_filesystem_method' ) ) { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | global $wpdb; |
160 | 160 | $wpdb->query( $q . $charset_collate ); |
161 | 161 | } |
162 | - unset($q); |
|
162 | + unset( $q ); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @param string $starts_with |
199 | 199 | */ |
200 | 200 | public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) { |
201 | - if ( empty($args) ) { |
|
201 | + if ( empty( $args ) ) { |
|
202 | 202 | // add an arg to prevent prepare from failing |
203 | 203 | $args = array( 'where' => $starts_with . '1=%d', 'values' => array( 1 ) ); |
204 | 204 | return; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $key = trim( $key ); |
260 | 260 | |
261 | 261 | if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) { |
262 | - $k = explode(' ', $key); |
|
262 | + $k = explode( ' ', $key ); |
|
263 | 263 | $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key ); |
264 | 264 | $values[] = '%Y-%m-%d %H:%i:%s'; |
265 | 265 | } else { |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | if ( is_array( $value ) ) { |
273 | 273 | // translate array of values to "in" |
274 | 274 | if ( strpos( $lowercase_key, 'like' ) !== false ) { |
275 | - $where = preg_replace('/' . $key . '$/', '', $where); |
|
275 | + $where = preg_replace( '/' . $key . '$/', '', $where ); |
|
276 | 276 | $where .= '('; |
277 | 277 | $start = true; |
278 | 278 | foreach ( $value as $v ) { |
@@ -457,8 +457,8 @@ discard block |
||
457 | 457 | ); |
458 | 458 | |
459 | 459 | $where_is = strtolower( $where_is ); |
460 | - if ( isset( $switch_to[ $where_is ] ) ) { |
|
461 | - return ' ' . $switch_to[ $where_is ]; |
|
460 | + if ( isset( $switch_to[$where_is] ) ) { |
|
461 | + return ' ' . $switch_to[$where_is]; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | // > and < need a little more work since we don't want them switched to >= and <= |
@@ -480,8 +480,8 @@ discard block |
||
480 | 480 | private static function get_group_and_table_name( &$table, &$group ) { |
481 | 481 | global $wpdb, $wpmuBaseTablePrefix; |
482 | 482 | |
483 | - $table_parts = explode(' ', $table); |
|
484 | - $group = reset($table_parts); |
|
483 | + $table_parts = explode( ' ', $table ); |
|
484 | + $group = reset( $table_parts ); |
|
485 | 485 | $group = str_replace( $wpdb->prefix, '', $group ); |
486 | 486 | |
487 | 487 | $prefix = $wpmuBaseTablePrefix ? $wpmuBaseTablePrefix : $wpdb->base_prefix; |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | } |
497 | 497 | |
498 | 498 | private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) { |
499 | - if ( ! is_array($args) ) { |
|
499 | + if ( ! is_array( $args ) ) { |
|
500 | 500 | $args = array( 'order_by' => $args ); |
501 | 501 | } |
502 | 502 | |
@@ -511,16 +511,16 @@ discard block |
||
511 | 511 | $temp_args = $args; |
512 | 512 | foreach ( $temp_args as $k => $v ) { |
513 | 513 | if ( $v == '' ) { |
514 | - unset( $args[ $k ] ); |
|
514 | + unset( $args[$k] ); |
|
515 | 515 | continue; |
516 | 516 | } |
517 | 517 | |
518 | 518 | if ( $k == 'limit' ) { |
519 | - $args[ $k ] = FrmAppHelper::esc_limit( $v ); |
|
519 | + $args[$k] = FrmAppHelper::esc_limit( $v ); |
|
520 | 520 | } |
521 | 521 | $db_name = strtoupper( str_replace( '_', ' ', $k ) ); |
522 | 522 | if ( strpos( $v, $db_name ) === false ) { |
523 | - $args[ $k ] = $db_name . ' ' . $v; |
|
523 | + $args[$k] = $db_name . ' ' . $v; |
|
524 | 524 | } |
525 | 525 | } |
526 | 526 | |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | |
548 | 548 | $query = self::generate_query_string_from_pieces( $columns, $table, $where ); |
549 | 549 | |
550 | - $cache_key = str_replace( array( ' ', ',' ), '_', trim( implode( '_', FrmAppHelper::array_flatten( $where ) ) . $columns . '_results_ARRAY_A' , ' WHERE' ) ); |
|
550 | + $cache_key = str_replace( array( ' ', ',' ), '_', trim( implode( '_', FrmAppHelper::array_flatten( $where ) ) . $columns . '_results_ARRAY_A', ' WHERE' ) ); |
|
551 | 551 | $results = FrmAppHelper::check_cache( $cache_key, $group, $query, 'get_associative_results' ); |
552 | 552 | |
553 | 553 | return $results; |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | public function uninstall() { |
587 | 587 | if ( ! current_user_can( 'administrator' ) ) { |
588 | 588 | $frm_settings = FrmAppHelper::get_settings(); |
589 | - wp_die($frm_settings->admin_permission); |
|
589 | + wp_die( $frm_settings->admin_permission ); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | global $wpdb, $wp_roles; |
@@ -596,8 +596,8 @@ discard block |
||
596 | 596 | $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entries ); |
597 | 597 | $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entry_metas ); |
598 | 598 | |
599 | - delete_option('frm_options'); |
|
600 | - delete_option('frm_db_version'); |
|
599 | + delete_option( 'frm_options' ); |
|
600 | + delete_option( 'frm_db_version' ); |
|
601 | 601 | |
602 | 602 | //delete roles |
603 | 603 | $frm_roles = FrmAppHelper::frm_capabilities(); |
@@ -605,11 +605,11 @@ discard block |
||
605 | 605 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
606 | 606 | foreach ( $roles as $role => $details ) { |
607 | 607 | $wp_roles->remove_cap( $role, $frm_role ); |
608 | - unset($role, $details); |
|
608 | + unset( $role, $details ); |
|
609 | 609 | } |
610 | - unset($frm_role, $frm_role_description); |
|
610 | + unset( $frm_role, $frm_role_description ); |
|
611 | 611 | } |
612 | - unset($roles, $frm_roles); |
|
612 | + unset( $roles, $frm_roles ); |
|
613 | 613 | |
614 | 614 | // delete actions, views, and styles |
615 | 615 | |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | |
632 | 632 | $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_%' ) ); |
633 | 633 | |
634 | - do_action('frm_after_uninstall'); |
|
634 | + do_action( 'frm_after_uninstall' ); |
|
635 | 635 | return true; |
636 | 636 | } |
637 | 637 | |
@@ -688,8 +688,8 @@ discard block |
||
688 | 688 | |
689 | 689 | $updated = 0; |
690 | 690 | foreach ( $fields as $f ) { |
691 | - $f->field_options = maybe_unserialize($f->field_options); |
|
692 | - if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) { |
|
691 | + $f->field_options = maybe_unserialize( $f->field_options ); |
|
692 | + if ( empty( $f->field_options['size'] ) || ! is_numeric( $f->field_options['size'] ) ) { |
|
693 | 693 | continue; |
694 | 694 | } |
695 | 695 | |
@@ -697,27 +697,27 @@ discard block |
||
697 | 697 | $f->field_options['size'] .= 'px'; |
698 | 698 | $u = FrmField::update( $f->id, array( 'field_options' => $f->field_options ) ); |
699 | 699 | if ( $u ) { |
700 | - $updated++; |
|
700 | + $updated ++; |
|
701 | 701 | } |
702 | - unset($f); |
|
702 | + unset( $f ); |
|
703 | 703 | } |
704 | 704 | |
705 | 705 | // Change the characters in widgets to pixels |
706 | - $widgets = get_option('widget_frm_show_form'); |
|
707 | - if ( empty($widgets) ) { |
|
706 | + $widgets = get_option( 'widget_frm_show_form' ); |
|
707 | + if ( empty( $widgets ) ) { |
|
708 | 708 | return; |
709 | 709 | } |
710 | 710 | |
711 | - $widgets = maybe_unserialize($widgets); |
|
711 | + $widgets = maybe_unserialize( $widgets ); |
|
712 | 712 | foreach ( $widgets as $k => $widget ) { |
713 | - if ( ! is_array($widget) || ! isset($widget['size']) ) { |
|
713 | + if ( ! is_array( $widget ) || ! isset( $widget['size'] ) ) { |
|
714 | 714 | continue; |
715 | 715 | } |
716 | 716 | $size = round( $pixel_conversion * (int) $widget['size'] ); |
717 | 717 | $size .= 'px'; |
718 | - $widgets[ $k ]['size'] = $size; |
|
718 | + $widgets[$k]['size'] = $size; |
|
719 | 719 | } |
720 | - update_option('widget_frm_show_form', $widgets); |
|
720 | + update_option( 'widget_frm_show_form', $widgets ); |
|
721 | 721 | } |
722 | 722 | |
723 | 723 | /** |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | } |
767 | 767 | |
768 | 768 | // Format form options |
769 | - $form_options = maybe_unserialize($form->options); |
|
769 | + $form_options = maybe_unserialize( $form->options ); |
|
770 | 770 | |
771 | 771 | // Migrate settings to actions |
772 | 772 | FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id ); |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | private function migrate_to_11() { |
777 | 777 | global $wpdb; |
778 | 778 | |
779 | - $forms = FrmDb::get_results( $this->forms, array(), 'id, options'); |
|
779 | + $forms = FrmDb::get_results( $this->forms, array(), 'id, options' ); |
|
780 | 780 | |
781 | 781 | $sending = __( 'Sending', 'formidable' ); |
782 | 782 | $img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif'; |
@@ -787,13 +787,13 @@ discard block |
||
787 | 787 | <img class="frm_ajax_loading" src="$img" alt="$sending" style="visibility:hidden;" /> |
788 | 788 | </div> |
789 | 789 | DEFAULT_HTML; |
790 | - unset($sending, $img); |
|
790 | + unset( $sending, $img ); |
|
791 | 791 | |
792 | - $new_default_html = FrmFormsHelper::get_default_html('submit'); |
|
792 | + $new_default_html = FrmFormsHelper::get_default_html( 'submit' ); |
|
793 | 793 | $draft_link = FrmFormsHelper::get_draft_link(); |
794 | 794 | foreach ( $forms as $form ) { |
795 | - $form->options = maybe_unserialize($form->options); |
|
796 | - if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) { |
|
795 | + $form->options = maybe_unserialize( $form->options ); |
|
796 | + if ( ! isset( $form->options['submit_html'] ) || empty( $form->options['submit_html'] ) ) { |
|
797 | 797 | continue; |
798 | 798 | } |
799 | 799 | |
@@ -804,9 +804,9 @@ discard block |
||
804 | 804 | $form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] ); |
805 | 805 | $wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) ); |
806 | 806 | } |
807 | - unset($form); |
|
807 | + unset( $form ); |
|
808 | 808 | } |
809 | - unset($forms); |
|
809 | + unset( $forms ); |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | private function migrate_to_6() { |
@@ -835,17 +835,17 @@ discard block |
||
835 | 835 | </div> |
836 | 836 | DEFAULT_HTML; |
837 | 837 | |
838 | - $new_default_html = FrmFieldsHelper::get_default_html('text'); |
|
838 | + $new_default_html = FrmFieldsHelper::get_default_html( 'text' ); |
|
839 | 839 | foreach ( $fields as $field ) { |
840 | - $field->field_options = maybe_unserialize($field->field_options); |
|
840 | + $field->field_options = maybe_unserialize( $field->field_options ); |
|
841 | 841 | $html = FrmField::get_option( $field, 'custom_html' ); |
842 | 842 | if ( $html == $default_html || $html == $old_default_html ) { |
843 | 843 | $field->field_options['custom_html'] = $new_default_html; |
844 | 844 | $wpdb->update( $this->fields, array( 'field_options' => maybe_serialize( $field->field_options ) ), array( 'id' => $field->id ) ); |
845 | 845 | } |
846 | - unset($field); |
|
846 | + unset( $field ); |
|
847 | 847 | } |
848 | - unset($default_html, $old_default_html, $fields); |
|
848 | + unset( $default_html, $old_default_html, $fields ); |
|
849 | 849 | } |
850 | 850 | |
851 | 851 | private function migrate_to_4() { |
@@ -2,109 +2,109 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -12,14 +12,14 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -3,32 +3,32 @@ |
||
3 | 3 | <?php } else if ( $field['type'] == 'textarea' ) { ?> |
4 | 4 | <textarea name="<?php echo esc_attr( $field_name ) ?>" <?php |
5 | 5 | echo ( FrmField::is_option_true( $field, 'size' ) ) ? esc_attr( 'style="width:' . $field['size'] . ( is_numeric( $field['size'] ) ? 'px' : '' ) . ';"' ) : ''; |
6 | - ?> rows="<?php echo esc_attr( $field['max'] ); ?>" id="<?php echo esc_attr( $html_id ) ?>" class="dyn_default_value"><?php echo FrmAppHelper::esc_textarea(force_balance_tags($field['default_value'])); ?></textarea> |
|
6 | + ?> rows="<?php echo esc_attr( $field['max'] ); ?>" id="<?php echo esc_attr( $html_id ) ?>" class="dyn_default_value"><?php echo FrmAppHelper::esc_textarea(force_balance_tags($field['default_value'])); ?></textarea> |
|
7 | 7 | |
8 | 8 | <?php |
9 | 9 | |
10 | 10 | } else if ( $field['type'] == 'radio' || $field['type'] == 'checkbox' ) { |
11 | - $field['default_value'] = maybe_unserialize($field['default_value']); |
|
12 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
11 | + $field['default_value'] = maybe_unserialize($field['default_value']); |
|
12 | + if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
13 | 13 | do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) ); |
14 | - } else { |
|
15 | - do_action('frm_add_multiple_opts_labels', $field); ?> |
|
14 | + } else { |
|
15 | + do_action('frm_add_multiple_opts_labels', $field); ?> |
|
16 | 16 | <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts frm_clear<?php echo (count($field['options']) > 10) ? ' frm_field_opts_list' : ''; ?>"> |
17 | 17 | <?php include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php' ); ?> |
18 | 18 | </ul> |
19 | 19 | <?php |
20 | - } |
|
20 | + } |
|
21 | 21 | } else if ( $field['type'] == 'select' ) { |
22 | 22 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/dropdown-field.php' ); |
23 | 23 | } else if ( $field['type'] == 'captcha' ) { |
24 | 24 | if ( empty($frm_settings->pubkey) ) { ?> |
25 | 25 | <div class="howto frm_no_captcha_text"><?php printf(__( 'Your captcha will not appear on your form until you %1$sset up%2$s the Site and Secret Keys', 'formidable' ), '<a href="?page=formidable-settings">', '</a>') ?></div> |
26 | 26 | <?php |
27 | - } ?> |
|
27 | + } ?> |
|
28 | 28 | <img src="<?php echo esc_url( FrmAppHelper::plugin_url() . '/images/recaptcha.png' ) ?>" class="recaptcha_placeholder" alt="reCaptcha"/> |
29 | 29 | <input type="hidden" name="<?php echo esc_attr( $field_name ) ?>" value="1" /> |
30 | 30 | <?php |
31 | 31 | } else { |
32 | - do_action( 'frm_display_added_fields', $field ); |
|
32 | + do_action( 'frm_display_added_fields', $field ); |
|
33 | 33 | do_action( 'frm_display_added_' . $field['type'] . '_field', $field ); |
34 | 34 | } |
@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | <?php } else if ( $field['type'] == 'textarea' ) { ?> |
4 | 4 | <textarea name="<?php echo esc_attr( $field_name ) ?>" <?php |
5 | 5 | echo ( FrmField::is_option_true( $field, 'size' ) ) ? esc_attr( 'style="width:' . $field['size'] . ( is_numeric( $field['size'] ) ? 'px' : '' ) . ';"' ) : ''; |
6 | - ?> rows="<?php echo esc_attr( $field['max'] ); ?>" id="<?php echo esc_attr( $html_id ) ?>" class="dyn_default_value"><?php echo FrmAppHelper::esc_textarea(force_balance_tags($field['default_value'])); ?></textarea> |
|
6 | + ?> rows="<?php echo esc_attr( $field['max'] ); ?>" id="<?php echo esc_attr( $html_id ) ?>" class="dyn_default_value"><?php echo FrmAppHelper::esc_textarea( force_balance_tags( $field['default_value'] ) ); ?></textarea> |
|
7 | 7 | |
8 | 8 | <?php |
9 | 9 | |
10 | 10 | } else if ( $field['type'] == 'radio' || $field['type'] == 'checkbox' ) { |
11 | - $field['default_value'] = maybe_unserialize($field['default_value']); |
|
12 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
11 | + $field['default_value'] = maybe_unserialize( $field['default_value'] ); |
|
12 | + if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) { |
|
13 | 13 | do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) ); |
14 | 14 | } else { |
15 | - do_action('frm_add_multiple_opts_labels', $field); ?> |
|
16 | - <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts frm_clear<?php echo (count($field['options']) > 10) ? ' frm_field_opts_list' : ''; ?>"> |
|
15 | + do_action( 'frm_add_multiple_opts_labels', $field ); ?> |
|
16 | + <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts frm_clear<?php echo ( count( $field['options'] ) > 10 ) ? ' frm_field_opts_list' : ''; ?>"> |
|
17 | 17 | <?php include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php' ); ?> |
18 | 18 | </ul> |
19 | 19 | <?php |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | } else if ( $field['type'] == 'select' ) { |
22 | 22 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/dropdown-field.php' ); |
23 | 23 | } else if ( $field['type'] == 'captcha' ) { |
24 | - if ( empty($frm_settings->pubkey) ) { ?> |
|
25 | - <div class="howto frm_no_captcha_text"><?php printf(__( 'Your captcha will not appear on your form until you %1$sset up%2$s the Site and Secret Keys', 'formidable' ), '<a href="?page=formidable-settings">', '</a>') ?></div> |
|
24 | + if ( empty( $frm_settings->pubkey ) ) { ?> |
|
25 | + <div class="howto frm_no_captcha_text"><?php printf( __( 'Your captcha will not appear on your form until you %1$sset up%2$s the Site and Secret Keys', 'formidable' ), '<a href="?page=formidable-settings">', '</a>' ) ?></div> |
|
26 | 26 | <?php |
27 | 27 | } ?> |
28 | 28 | <img src="<?php echo esc_url( FrmAppHelper::plugin_url() . '/images/recaptcha.png' ) ?>" class="recaptcha_placeholder" alt="reCaptcha"/> |
@@ -70,7 +70,7 @@ |
||
70 | 70 | * @uses api_request() |
71 | 71 | * |
72 | 72 | * @param array $_transient_data Update array build by WordPress. |
73 | - * @return array Modified update array with custom plugin data. |
|
73 | + * @return stdClass Modified update array with custom plugin data. |
|
74 | 74 | */ |
75 | 75 | public function check_update( $_transient_data ) { |
76 | 76 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $this->version = $_api_data['version']; |
44 | 44 | $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false; |
45 | 45 | |
46 | - $frm_edd_plugin_data[ $this->slug ] = $this->api_data; |
|
46 | + $frm_edd_plugin_data[$this->slug] = $this->api_data; |
|
47 | 47 | |
48 | 48 | // Set up hooks. |
49 | 49 | $this->init(); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $_transient_data = new stdClass; |
84 | 84 | } |
85 | 85 | |
86 | - if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) { |
|
86 | + if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[$this->name] ) && false === $this->wp_override ) { |
|
87 | 87 | return $_transient_data; |
88 | 88 | } |
89 | 89 | |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | $version_info->plugin = $this->name; |
98 | 98 | } |
99 | 99 | |
100 | - $_transient_data->response[ $this->name ] = $version_info; |
|
100 | + $_transient_data->response[$this->name] = $version_info; |
|
101 | 101 | |
102 | 102 | } |
103 | 103 | |
104 | 104 | $_transient_data->last_checked = time(); |
105 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
105 | + $_transient_data->checked[$this->name] = $this->version; |
|
106 | 106 | |
107 | 107 | } |
108 | 108 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | wp_die( __( 'You do not have permission to install plugin updates', 'formidable' ), __( 'Error', 'formidable' ), array( 'response' => 403 ) ); |
246 | 246 | } |
247 | 247 | |
248 | - $data = $frm_edd_plugin_data[ $_REQUEST['slug'] ]; |
|
248 | + $data = $frm_edd_plugin_data[$_REQUEST['slug']]; |
|
249 | 249 | $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_version_info' ); |
250 | 250 | $version_info = get_transient( $cache_key ); |
251 | 251 |