@@ -2,110 +2,110 @@ discard block |
||
2 | 2 | |
3 | 3 | class FrmXMLController { |
4 | 4 | |
5 | - public static function menu() { |
|
6 | - add_submenu_page('formidable', 'Formidable | '. __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route'); |
|
7 | - } |
|
5 | + public static function menu() { |
|
6 | + add_submenu_page('formidable', 'Formidable | '. __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route'); |
|
7 | + } |
|
8 | 8 | |
9 | - public static function add_default_templates() { |
|
9 | + public static function add_default_templates() { |
|
10 | 10 | if ( ! function_exists( 'libxml_disable_entity_loader' ) ) { |
11 | - // XML import is not enabled on your server |
|
12 | - return; |
|
13 | - } |
|
11 | + // XML import is not enabled on your server |
|
12 | + return; |
|
13 | + } |
|
14 | 14 | |
15 | - $set_err = libxml_use_internal_errors(true); |
|
16 | - $loader = libxml_disable_entity_loader( true ); |
|
15 | + $set_err = libxml_use_internal_errors(true); |
|
16 | + $loader = libxml_disable_entity_loader( true ); |
|
17 | 17 | |
18 | 18 | $files = apply_filters( 'frm_default_templates_files', array( FrmAppHelper::plugin_path() . '/classes/views/xml/default-templates.xml' ) ); |
19 | 19 | |
20 | - foreach ( (array) $files as $file ) { |
|
21 | - FrmXMLHelper::import_xml($file); |
|
22 | - unset($file); |
|
23 | - } |
|
24 | - /* |
|
20 | + foreach ( (array) $files as $file ) { |
|
21 | + FrmXMLHelper::import_xml($file); |
|
22 | + unset($file); |
|
23 | + } |
|
24 | + /* |
|
25 | 25 | if(is_wp_error($result)) |
26 | 26 | $errors[] = $result->get_error_message(); |
27 | 27 | else if($result) |
28 | 28 | $message = $result; |
29 | 29 | */ |
30 | 30 | |
31 | - unset( $files ); |
|
31 | + unset( $files ); |
|
32 | 32 | |
33 | - libxml_use_internal_errors( $set_err ); |
|
34 | - libxml_disable_entity_loader( $loader ); |
|
35 | - } |
|
33 | + libxml_use_internal_errors( $set_err ); |
|
34 | + libxml_disable_entity_loader( $loader ); |
|
35 | + } |
|
36 | 36 | |
37 | - public static function route() { |
|
38 | - $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
37 | + public static function route() { |
|
38 | + $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
39 | 39 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
40 | 40 | if ( $action == 'import_xml' ) { |
41 | - return self::import_xml(); |
|
41 | + return self::import_xml(); |
|
42 | 42 | } else if ( $action == 'export_xml' ) { |
43 | - return self::export_xml(); |
|
44 | - } else { |
|
45 | - if ( apply_filters( 'frm_xml_route', true, $action ) ) { |
|
46 | - return self::form(); |
|
47 | - } |
|
48 | - } |
|
49 | - } |
|
50 | - |
|
51 | - public static function form( $errors = array(), $message = '' ) { |
|
43 | + return self::export_xml(); |
|
44 | + } else { |
|
45 | + if ( apply_filters( 'frm_xml_route', true, $action ) ) { |
|
46 | + return self::form(); |
|
47 | + } |
|
48 | + } |
|
49 | + } |
|
50 | + |
|
51 | + public static function form( $errors = array(), $message = '' ) { |
|
52 | 52 | $where = array( |
53 | 53 | 'parent_form_id' => array( null, 0 ), |
54 | 54 | 'status' => array( null, '', 'published' ) |
55 | 55 | ); |
56 | 56 | $forms = FrmForm::getAll( $where, 'name' ); |
57 | 57 | |
58 | - $export_types = apply_filters( 'frm_xml_export_types', |
|
59 | - array( 'forms' => __( 'Forms', 'formidable' ), 'items' => __( 'Entries', 'formidable' ) ) |
|
60 | - ); |
|
58 | + $export_types = apply_filters( 'frm_xml_export_types', |
|
59 | + array( 'forms' => __( 'Forms', 'formidable' ), 'items' => __( 'Entries', 'formidable' ) ) |
|
60 | + ); |
|
61 | 61 | |
62 | - $export_format = apply_filters( 'frm_export_formats', array( |
|
63 | - 'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ), |
|
62 | + $export_format = apply_filters( 'frm_export_formats', array( |
|
63 | + 'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ), |
|
64 | 64 | 'csv' => array( 'name' => 'CSV', 'support' => 'items', 'count' => 'single' ), |
65 | - ) ); |
|
65 | + ) ); |
|
66 | 66 | |
67 | - include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php'); |
|
68 | - } |
|
67 | + include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php'); |
|
68 | + } |
|
69 | 69 | |
70 | - public static function import_xml() { |
|
71 | - $errors = array(); |
|
72 | - $message = ''; |
|
70 | + public static function import_xml() { |
|
71 | + $errors = array(); |
|
72 | + $message = ''; |
|
73 | 73 | |
74 | - $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce'); |
|
75 | - if ( $permission_error !== false ) { |
|
76 | - $errors[] = $permission_error; |
|
77 | - self::form($errors); |
|
78 | - return; |
|
79 | - } |
|
74 | + $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce'); |
|
75 | + if ( $permission_error !== false ) { |
|
76 | + $errors[] = $permission_error; |
|
77 | + self::form($errors); |
|
78 | + return; |
|
79 | + } |
|
80 | 80 | |
81 | - if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
82 | - $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' ); |
|
83 | - self::form($errors); |
|
84 | - return; |
|
85 | - } |
|
81 | + if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
82 | + $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' ); |
|
83 | + self::form($errors); |
|
84 | + return; |
|
85 | + } |
|
86 | 86 | |
87 | - $file = $_FILES['frm_import_file']['tmp_name']; |
|
87 | + $file = $_FILES['frm_import_file']['tmp_name']; |
|
88 | 88 | |
89 | - if ( ! is_uploaded_file( $file ) ) { |
|
90 | - unset($file); |
|
91 | - $errors[] = __( 'The file does not exist, please try again.', 'formidable' ); |
|
92 | - self::form($errors); |
|
93 | - return; |
|
94 | - } |
|
89 | + if ( ! is_uploaded_file( $file ) ) { |
|
90 | + unset($file); |
|
91 | + $errors[] = __( 'The file does not exist, please try again.', 'formidable' ); |
|
92 | + self::form($errors); |
|
93 | + return; |
|
94 | + } |
|
95 | 95 | |
96 | - //add_filter('upload_mimes', 'FrmXMLController::allow_mime'); |
|
96 | + //add_filter('upload_mimes', 'FrmXMLController::allow_mime'); |
|
97 | 97 | |
98 | - $export_format = apply_filters('frm_export_formats', array( |
|
98 | + $export_format = apply_filters('frm_export_formats', array( |
|
99 | 99 | 'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ), |
100 | 100 | ) ); |
101 | 101 | |
102 | - $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION)); |
|
103 | - if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) { |
|
104 | - // allow other file types to be imported |
|
105 | - do_action('frm_before_import_'. $file_type ); |
|
106 | - return; |
|
107 | - } |
|
108 | - unset($file_type); |
|
102 | + $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION)); |
|
103 | + if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) { |
|
104 | + // allow other file types to be imported |
|
105 | + do_action('frm_before_import_'. $file_type ); |
|
106 | + return; |
|
107 | + } |
|
108 | + unset($file_type); |
|
109 | 109 | |
110 | 110 | if ( ! function_exists( 'libxml_disable_entity_loader' ) ) { |
111 | 111 | $errors[] = __( 'XML import is not enabled on your server.', 'formidable' ); |
@@ -124,148 +124,148 @@ discard block |
||
124 | 124 | libxml_use_internal_errors( $set_err ); |
125 | 125 | libxml_disable_entity_loader( $loader ); |
126 | 126 | |
127 | - self::form($errors, $message); |
|
128 | - } |
|
127 | + self::form($errors, $message); |
|
128 | + } |
|
129 | 129 | |
130 | - public static function export_xml() { |
|
131 | - $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' ); |
|
132 | - if ( ! empty($error) ) { |
|
133 | - wp_die( $error ); |
|
134 | - } |
|
130 | + public static function export_xml() { |
|
131 | + $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' ); |
|
132 | + if ( ! empty($error) ) { |
|
133 | + wp_die( $error ); |
|
134 | + } |
|
135 | 135 | |
136 | 136 | $ids = FrmAppHelper::get_post_param( 'frm_export_forms', array() ); |
137 | 137 | $type = FrmAppHelper::get_post_param( 'type', array() ); |
138 | 138 | $format = FrmAppHelper::get_post_param( 'format', 'xml', 'sanitize_title' ); |
139 | 139 | |
140 | - if ( ! headers_sent() && ! $type ) { |
|
141 | - wp_redirect( esc_url_raw( admin_url( 'admin.php?page=formidable-import' ) ) ); |
|
142 | - die(); |
|
143 | - } |
|
140 | + if ( ! headers_sent() && ! $type ) { |
|
141 | + wp_redirect( esc_url_raw( admin_url( 'admin.php?page=formidable-import' ) ) ); |
|
142 | + die(); |
|
143 | + } |
|
144 | 144 | |
145 | - if ( $format == 'xml' ) { |
|
146 | - self::generate_xml($type, compact('ids')); |
|
145 | + if ( $format == 'xml' ) { |
|
146 | + self::generate_xml($type, compact('ids')); |
|
147 | 147 | } if ( $format == 'csv' ) { |
148 | 148 | self::generate_csv( compact('ids') ); |
149 | - } else { |
|
150 | - do_action('frm_export_format_'. $format, compact('ids')); |
|
151 | - } |
|
149 | + } else { |
|
150 | + do_action('frm_export_format_'. $format, compact('ids')); |
|
151 | + } |
|
152 | 152 | |
153 | - wp_die(); |
|
154 | - } |
|
153 | + wp_die(); |
|
154 | + } |
|
155 | 155 | |
156 | 156 | public static function generate_xml( $type, $args = array() ) { |
157 | - global $wpdb; |
|
158 | - |
|
159 | - $type = (array) $type; |
|
160 | - if ( in_array( 'items', $type) && ! in_array( 'forms', $type) ) { |
|
161 | - // make sure the form is included if there are entries |
|
162 | - $type[] = 'forms'; |
|
163 | - } |
|
164 | - |
|
165 | - if ( in_array( 'forms', $type) ) { |
|
166 | - // include actions with forms |
|
167 | - $type[] = 'actions'; |
|
168 | - } |
|
169 | - |
|
170 | - $tables = array( |
|
171 | - 'items' => $wpdb->prefix .'frm_items', |
|
172 | - 'forms' => $wpdb->prefix .'frm_forms', |
|
173 | - 'posts' => $wpdb->posts, |
|
174 | - 'styles' => $wpdb->posts, |
|
175 | - 'actions' => $wpdb->posts, |
|
176 | - ); |
|
157 | + global $wpdb; |
|
158 | + |
|
159 | + $type = (array) $type; |
|
160 | + if ( in_array( 'items', $type) && ! in_array( 'forms', $type) ) { |
|
161 | + // make sure the form is included if there are entries |
|
162 | + $type[] = 'forms'; |
|
163 | + } |
|
164 | + |
|
165 | + if ( in_array( 'forms', $type) ) { |
|
166 | + // include actions with forms |
|
167 | + $type[] = 'actions'; |
|
168 | + } |
|
169 | + |
|
170 | + $tables = array( |
|
171 | + 'items' => $wpdb->prefix .'frm_items', |
|
172 | + 'forms' => $wpdb->prefix .'frm_forms', |
|
173 | + 'posts' => $wpdb->posts, |
|
174 | + 'styles' => $wpdb->posts, |
|
175 | + 'actions' => $wpdb->posts, |
|
176 | + ); |
|
177 | 177 | |
178 | 178 | $defaults = array( 'ids' => false ); |
179 | - $args = wp_parse_args( $args, $defaults ); |
|
179 | + $args = wp_parse_args( $args, $defaults ); |
|
180 | 180 | |
181 | - $sitename = sanitize_key( get_bloginfo( 'name' ) ); |
|
181 | + $sitename = sanitize_key( get_bloginfo( 'name' ) ); |
|
182 | 182 | |
183 | - if ( ! empty( $sitename ) ) { |
|
183 | + if ( ! empty( $sitename ) ) { |
|
184 | 184 | $sitename .= '.'; |
185 | 185 | } |
186 | - $filename = $sitename . 'formidable.' . date( 'Y-m-d' ) . '.xml'; |
|
186 | + $filename = $sitename . 'formidable.' . date( 'Y-m-d' ) . '.xml'; |
|
187 | 187 | |
188 | - header( 'Content-Description: File Transfer' ); |
|
189 | - header( 'Content-Disposition: attachment; filename=' . $filename ); |
|
190 | - header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); |
|
188 | + header( 'Content-Description: File Transfer' ); |
|
189 | + header( 'Content-Disposition: attachment; filename=' . $filename ); |
|
190 | + header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); |
|
191 | 191 | |
192 | - //make sure ids are numeric |
|
193 | - if ( is_array( $args['ids'] ) && ! empty( $args['ids'] ) ) { |
|
194 | - $args['ids'] = array_filter( $args['ids'], 'is_numeric' ); |
|
195 | - } |
|
192 | + //make sure ids are numeric |
|
193 | + if ( is_array( $args['ids'] ) && ! empty( $args['ids'] ) ) { |
|
194 | + $args['ids'] = array_filter( $args['ids'], 'is_numeric' ); |
|
195 | + } |
|
196 | 196 | |
197 | - $records = array(); |
|
197 | + $records = array(); |
|
198 | 198 | |
199 | 199 | foreach ( $type as $tb_type ) { |
200 | - $where = array(); |
|
200 | + $where = array(); |
|
201 | 201 | $join = ''; |
202 | - $table = $tables[ $tb_type ]; |
|
202 | + $table = $tables[ $tb_type ]; |
|
203 | 203 | |
204 | - $select = $table .'.id'; |
|
205 | - $query_vars = array(); |
|
204 | + $select = $table .'.id'; |
|
205 | + $query_vars = array(); |
|
206 | 206 | |
207 | - switch ( $tb_type ) { |
|
208 | - case 'forms': |
|
209 | - //add forms |
|
210 | - if ( $args['ids'] ) { |
|
207 | + switch ( $tb_type ) { |
|
208 | + case 'forms': |
|
209 | + //add forms |
|
210 | + if ( $args['ids'] ) { |
|
211 | 211 | $where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table .'.parent_form_id' => $args['ids'] ); |
212 | - } else { |
|
212 | + } else { |
|
213 | 213 | $where[ $table . '.status !' ] = 'draft'; |
214 | - } |
|
215 | - break; |
|
216 | - case 'actions': |
|
217 | - $select = $table .'.ID'; |
|
214 | + } |
|
215 | + break; |
|
216 | + case 'actions': |
|
217 | + $select = $table .'.ID'; |
|
218 | 218 | $where['post_type'] = FrmFormActionsController::$action_post_type; |
219 | - if ( ! empty($args['ids']) ) { |
|
219 | + if ( ! empty($args['ids']) ) { |
|
220 | 220 | $where['menu_order'] = $args['ids']; |
221 | - } |
|
222 | - break; |
|
223 | - case 'items': |
|
224 | - //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
|
225 | - if ( $args['ids'] ) { |
|
221 | + } |
|
222 | + break; |
|
223 | + case 'items': |
|
224 | + //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
|
225 | + if ( $args['ids'] ) { |
|
226 | 226 | $where[ $table . '.form_id' ] = $args['ids']; |
227 | - } |
|
228 | - break; |
|
229 | - case 'styles': |
|
230 | - // Loop through all exported forms and get their selected style IDs |
|
231 | - $form_ids = $args['ids']; |
|
232 | - $style_ids = array(); |
|
233 | - foreach ( $form_ids as $form_id ) { |
|
234 | - $form_data = FrmForm::getOne( $form_id ); |
|
235 | - // For forms that have not been updated while running 2.0, check if custom_style is set |
|
236 | - if ( isset( $form_data->options['custom_style'] ) ) { |
|
237 | - $style_ids[] = $form_data->options['custom_style']; |
|
238 | - } |
|
239 | - unset( $form_id, $form_data ); |
|
240 | - } |
|
241 | - $select = $table .'.ID'; |
|
242 | - $where['post_type'] = 'frm_styles'; |
|
243 | - |
|
244 | - // Only export selected styles |
|
245 | - if ( ! empty( $style_ids ) ) { |
|
246 | - $where['ID'] = $style_ids; |
|
247 | - } |
|
248 | - break; |
|
249 | - default: |
|
250 | - $select = $table .'.ID'; |
|
251 | - $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)'; |
|
252 | - $where['pm.meta_key'] = 'frm_form_id'; |
|
253 | - |
|
254 | - if ( empty($args['ids']) ) { |
|
255 | - $where['pm.meta_value >'] = 1; |
|
256 | - } else { |
|
257 | - $where['pm.meta_value'] = $args['ids']; |
|
258 | - } |
|
259 | - break; |
|
260 | - } |
|
227 | + } |
|
228 | + break; |
|
229 | + case 'styles': |
|
230 | + // Loop through all exported forms and get their selected style IDs |
|
231 | + $form_ids = $args['ids']; |
|
232 | + $style_ids = array(); |
|
233 | + foreach ( $form_ids as $form_id ) { |
|
234 | + $form_data = FrmForm::getOne( $form_id ); |
|
235 | + // For forms that have not been updated while running 2.0, check if custom_style is set |
|
236 | + if ( isset( $form_data->options['custom_style'] ) ) { |
|
237 | + $style_ids[] = $form_data->options['custom_style']; |
|
238 | + } |
|
239 | + unset( $form_id, $form_data ); |
|
240 | + } |
|
241 | + $select = $table .'.ID'; |
|
242 | + $where['post_type'] = 'frm_styles'; |
|
243 | + |
|
244 | + // Only export selected styles |
|
245 | + if ( ! empty( $style_ids ) ) { |
|
246 | + $where['ID'] = $style_ids; |
|
247 | + } |
|
248 | + break; |
|
249 | + default: |
|
250 | + $select = $table .'.ID'; |
|
251 | + $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)'; |
|
252 | + $where['pm.meta_key'] = 'frm_form_id'; |
|
253 | + |
|
254 | + if ( empty($args['ids']) ) { |
|
255 | + $where['pm.meta_value >'] = 1; |
|
256 | + } else { |
|
257 | + $where['pm.meta_value'] = $args['ids']; |
|
258 | + } |
|
259 | + break; |
|
260 | + } |
|
261 | 261 | |
262 | 262 | $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
263 | - unset($tb_type); |
|
264 | - } |
|
263 | + unset($tb_type); |
|
264 | + } |
|
265 | 265 | |
266 | 266 | echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n"; |
267 | - include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php'); |
|
268 | - } |
|
267 | + include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php'); |
|
268 | + } |
|
269 | 269 | |
270 | 270 | |
271 | 271 | public static function generate_csv( $atts ) { |
@@ -336,14 +336,14 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
339 | - * Get the fields that should be included in the CSV export |
|
340 | - * |
|
341 | - * @since 2.0.19 |
|
342 | - * |
|
343 | - * @param int $form_id |
|
344 | - * @param object $form |
|
345 | - * @return array $csv_fields |
|
346 | - */ |
|
339 | + * Get the fields that should be included in the CSV export |
|
340 | + * |
|
341 | + * @since 2.0.19 |
|
342 | + * |
|
343 | + * @param int $form_id |
|
344 | + * @param object $form |
|
345 | + * @return array $csv_fields |
|
346 | + */ |
|
347 | 347 | private static function get_fields_for_csv_export( $form_id, $form ) { |
348 | 348 | $csv_field_ids = apply_filters( 'frm_csv_field_ids', '', $form_id, array( 'form' => $form ) ); |
349 | 349 | |
@@ -371,16 +371,16 @@ discard block |
||
371 | 371 | } |
372 | 372 | |
373 | 373 | public static function allow_mime( $mimes ) { |
374 | - if ( ! isset( $mimes['csv'] ) ) { |
|
375 | - // allow csv files |
|
376 | - $mimes['csv'] = 'text/csv'; |
|
377 | - } |
|
378 | - |
|
379 | - if ( ! isset( $mimes['xml'] ) ) { |
|
380 | - // allow xml |
|
381 | - $mimes['xml'] = 'text/xml'; |
|
382 | - } |
|
383 | - |
|
384 | - return $mimes; |
|
385 | - } |
|
374 | + if ( ! isset( $mimes['csv'] ) ) { |
|
375 | + // allow csv files |
|
376 | + $mimes['csv'] = 'text/csv'; |
|
377 | + } |
|
378 | + |
|
379 | + if ( ! isset( $mimes['xml'] ) ) { |
|
380 | + // allow xml |
|
381 | + $mimes['xml'] = 'text/xml'; |
|
382 | + } |
|
383 | + |
|
384 | + return $mimes; |
|
385 | + } |
|
386 | 386 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | class FrmXMLController { |
4 | 4 | |
5 | 5 | public static function menu() { |
6 | - add_submenu_page('formidable', 'Formidable | '. __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route'); |
|
6 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route' ); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | public static function add_default_templates() { |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | return; |
13 | 13 | } |
14 | 14 | |
15 | - $set_err = libxml_use_internal_errors(true); |
|
15 | + $set_err = libxml_use_internal_errors( true ); |
|
16 | 16 | $loader = libxml_disable_entity_loader( true ); |
17 | 17 | |
18 | 18 | $files = apply_filters( 'frm_default_templates_files', array( FrmAppHelper::plugin_path() . '/classes/views/xml/default-templates.xml' ) ); |
19 | 19 | |
20 | 20 | foreach ( (array) $files as $file ) { |
21 | - FrmXMLHelper::import_xml($file); |
|
22 | - unset($file); |
|
21 | + FrmXMLHelper::import_xml( $file ); |
|
22 | + unset( $file ); |
|
23 | 23 | } |
24 | 24 | /* |
25 | 25 | if(is_wp_error($result)) |
@@ -64,48 +64,48 @@ discard block |
||
64 | 64 | 'csv' => array( 'name' => 'CSV', 'support' => 'items', 'count' => 'single' ), |
65 | 65 | ) ); |
66 | 66 | |
67 | - include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php'); |
|
67 | + include( FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php' ); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | public static function import_xml() { |
71 | 71 | $errors = array(); |
72 | 72 | $message = ''; |
73 | 73 | |
74 | - $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce'); |
|
74 | + $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'import-xml', 'import-xml-nonce' ); |
|
75 | 75 | if ( $permission_error !== false ) { |
76 | 76 | $errors[] = $permission_error; |
77 | - self::form($errors); |
|
77 | + self::form( $errors ); |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | |
81 | - if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
81 | + if ( ! isset( $_FILES ) || ! isset( $_FILES['frm_import_file'] ) || empty( $_FILES['frm_import_file']['name'] ) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
82 | 82 | $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' ); |
83 | - self::form($errors); |
|
83 | + self::form( $errors ); |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | |
87 | 87 | $file = $_FILES['frm_import_file']['tmp_name']; |
88 | 88 | |
89 | 89 | if ( ! is_uploaded_file( $file ) ) { |
90 | - unset($file); |
|
90 | + unset( $file ); |
|
91 | 91 | $errors[] = __( 'The file does not exist, please try again.', 'formidable' ); |
92 | - self::form($errors); |
|
92 | + self::form( $errors ); |
|
93 | 93 | return; |
94 | 94 | } |
95 | 95 | |
96 | 96 | //add_filter('upload_mimes', 'FrmXMLController::allow_mime'); |
97 | 97 | |
98 | - $export_format = apply_filters('frm_export_formats', array( |
|
98 | + $export_format = apply_filters( 'frm_export_formats', array( |
|
99 | 99 | 'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ), |
100 | 100 | ) ); |
101 | 101 | |
102 | - $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION)); |
|
103 | - if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) { |
|
102 | + $file_type = strtolower( pathinfo( $_FILES['frm_import_file']['name'], PATHINFO_EXTENSION ) ); |
|
103 | + if ( $file_type != 'xml' && isset( $export_format[$file_type] ) ) { |
|
104 | 104 | // allow other file types to be imported |
105 | - do_action('frm_before_import_'. $file_type ); |
|
105 | + do_action( 'frm_before_import_' . $file_type ); |
|
106 | 106 | return; |
107 | 107 | } |
108 | - unset($file_type); |
|
108 | + unset( $file_type ); |
|
109 | 109 | |
110 | 110 | if ( ! function_exists( 'libxml_disable_entity_loader' ) ) { |
111 | 111 | $errors[] = __( 'XML import is not enabled on your server.', 'formidable' ); |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | libxml_use_internal_errors( $set_err ); |
125 | 125 | libxml_disable_entity_loader( $loader ); |
126 | 126 | |
127 | - self::form($errors, $message); |
|
127 | + self::form( $errors, $message ); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | public static function export_xml() { |
131 | 131 | $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' ); |
132 | - if ( ! empty($error) ) { |
|
132 | + if ( ! empty( $error ) ) { |
|
133 | 133 | wp_die( $error ); |
134 | 134 | } |
135 | 135 | |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | if ( $format == 'xml' ) { |
146 | - self::generate_xml($type, compact('ids')); |
|
146 | + self::generate_xml( $type, compact( 'ids' ) ); |
|
147 | 147 | } if ( $format == 'csv' ) { |
148 | - self::generate_csv( compact('ids') ); |
|
148 | + self::generate_csv( compact( 'ids' ) ); |
|
149 | 149 | } else { |
150 | - do_action('frm_export_format_'. $format, compact('ids')); |
|
150 | + do_action( 'frm_export_format_' . $format, compact( 'ids' ) ); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | wp_die(); |
@@ -157,19 +157,19 @@ discard block |
||
157 | 157 | global $wpdb; |
158 | 158 | |
159 | 159 | $type = (array) $type; |
160 | - if ( in_array( 'items', $type) && ! in_array( 'forms', $type) ) { |
|
160 | + if ( in_array( 'items', $type ) && ! in_array( 'forms', $type ) ) { |
|
161 | 161 | // make sure the form is included if there are entries |
162 | 162 | $type[] = 'forms'; |
163 | 163 | } |
164 | 164 | |
165 | - if ( in_array( 'forms', $type) ) { |
|
165 | + if ( in_array( 'forms', $type ) ) { |
|
166 | 166 | // include actions with forms |
167 | 167 | $type[] = 'actions'; |
168 | 168 | } |
169 | 169 | |
170 | 170 | $tables = array( |
171 | - 'items' => $wpdb->prefix .'frm_items', |
|
172 | - 'forms' => $wpdb->prefix .'frm_forms', |
|
171 | + 'items' => $wpdb->prefix . 'frm_items', |
|
172 | + 'forms' => $wpdb->prefix . 'frm_forms', |
|
173 | 173 | 'posts' => $wpdb->posts, |
174 | 174 | 'styles' => $wpdb->posts, |
175 | 175 | 'actions' => $wpdb->posts, |
@@ -199,31 +199,31 @@ discard block |
||
199 | 199 | foreach ( $type as $tb_type ) { |
200 | 200 | $where = array(); |
201 | 201 | $join = ''; |
202 | - $table = $tables[ $tb_type ]; |
|
202 | + $table = $tables[$tb_type]; |
|
203 | 203 | |
204 | - $select = $table .'.id'; |
|
204 | + $select = $table . '.id'; |
|
205 | 205 | $query_vars = array(); |
206 | 206 | |
207 | 207 | switch ( $tb_type ) { |
208 | 208 | case 'forms': |
209 | 209 | //add forms |
210 | 210 | if ( $args['ids'] ) { |
211 | - $where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table .'.parent_form_id' => $args['ids'] ); |
|
211 | + $where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table . '.parent_form_id' => $args['ids'] ); |
|
212 | 212 | } else { |
213 | - $where[ $table . '.status !' ] = 'draft'; |
|
213 | + $where[$table . '.status !'] = 'draft'; |
|
214 | 214 | } |
215 | 215 | break; |
216 | 216 | case 'actions': |
217 | - $select = $table .'.ID'; |
|
217 | + $select = $table . '.ID'; |
|
218 | 218 | $where['post_type'] = FrmFormActionsController::$action_post_type; |
219 | - if ( ! empty($args['ids']) ) { |
|
219 | + if ( ! empty( $args['ids'] ) ) { |
|
220 | 220 | $where['menu_order'] = $args['ids']; |
221 | 221 | } |
222 | 222 | break; |
223 | 223 | case 'items': |
224 | 224 | //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
225 | 225 | if ( $args['ids'] ) { |
226 | - $where[ $table . '.form_id' ] = $args['ids']; |
|
226 | + $where[$table . '.form_id'] = $args['ids']; |
|
227 | 227 | } |
228 | 228 | break; |
229 | 229 | case 'styles': |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | } |
239 | 239 | unset( $form_id, $form_data ); |
240 | 240 | } |
241 | - $select = $table .'.ID'; |
|
241 | + $select = $table . '.ID'; |
|
242 | 242 | $where['post_type'] = 'frm_styles'; |
243 | 243 | |
244 | 244 | // Only export selected styles |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | } |
248 | 248 | break; |
249 | 249 | default: |
250 | - $select = $table .'.ID'; |
|
250 | + $select = $table . '.ID'; |
|
251 | 251 | $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)'; |
252 | 252 | $where['pm.meta_key'] = 'frm_form_id'; |
253 | 253 | |
254 | - if ( empty($args['ids']) ) { |
|
254 | + if ( empty( $args['ids'] ) ) { |
|
255 | 255 | $where['pm.meta_value >'] = 1; |
256 | 256 | } else { |
257 | 257 | $where['pm.meta_value'] = $args['ids']; |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | break; |
260 | 260 | } |
261 | 261 | |
262 | - $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
|
263 | - unset($tb_type); |
|
262 | + $records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select ); |
|
263 | + unset( $tb_type ); |
|
264 | 264 | } |
265 | 265 | |
266 | - echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n"; |
|
267 | - include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php'); |
|
266 | + echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo( 'charset' ) ) . "\" ?>\n"; |
|
267 | + include( FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php' ); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | $fid = FrmAppHelper::get_param( 'fid', '', 'get', 'sanitize_text_field' ); |
290 | 290 | } |
291 | 291 | |
292 | - if ( ! ini_get('safe_mode') ) { |
|
293 | - set_time_limit(0); //Remove time limit to execute this function |
|
294 | - $mem_limit = str_replace('M', '', ini_get('memory_limit')); |
|
292 | + if ( ! ini_get( 'safe_mode' ) ) { |
|
293 | + set_time_limit( 0 ); //Remove time limit to execute this function |
|
294 | + $mem_limit = str_replace( 'M', '', ini_get( 'memory_limit' ) ); |
|
295 | 295 | if ( (int) $mem_limit < 256 ) { |
296 | - ini_set('memory_limit', '256M'); |
|
296 | + ini_set( 'memory_limit', '256M' ); |
|
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | */ |
324 | 324 | $query = apply_filters( 'frm_csv_where', $query, compact( 'form_id', 'search', 'fid', 'item_id' ) ); |
325 | 325 | |
326 | - $entry_ids = FrmDb::get_col( $wpdb->prefix .'frm_items it', $query ); |
|
326 | + $entry_ids = FrmDb::get_col( $wpdb->prefix . 'frm_items it', $query ); |
|
327 | 327 | unset( $query ); |
328 | 328 | |
329 | 329 | if ( empty( $entry_ids ) ) { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | $no_export_fields = FrmField::no_save_fields(); |
365 | 365 | foreach ( $csv_fields as $k => $f ) { |
366 | 366 | if ( in_array( $f->type, $no_export_fields ) ) { |
367 | - unset( $csv_fields[ $k ] ); |
|
367 | + unset( $csv_fields[$k] ); |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | /** |
46 | 46 | * Get the singleton instance of this class |
47 | 47 | * |
48 | - * @return object |
|
48 | + * @return FrmPointers |
|
49 | 49 | */ |
50 | 50 | public static function get_instance() { |
51 | 51 | if ( ! ( self::$instance instanceof self ) ) { |
@@ -184,7 +184,7 @@ |
||
184 | 184 | private function do_page_pointer( $page ) { |
185 | 185 | $selector = 'h2'; |
186 | 186 | |
187 | - $pointer = call_user_func( array( $this, $this->admin_pages[ $page ] ) ); |
|
187 | + $pointer = call_user_func( array( $this, $this->admin_pages[$page] ) ); |
|
188 | 188 | |
189 | 189 | $opt_arr = array( |
190 | 190 | 'content' => $pointer['content'], |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $selector = 'li.toplevel_page_formidable'; |
166 | 166 | |
167 | 167 | $content = '<h3>' . __( 'Congratulations!', 'formidable' ) . '</h3>' |
168 | - .'<p>' . $this->opening_line() . ' ' . sprintf( __( 'Click “Start Tour” to view a quick introduction of this plugin’s core functionality.' ), 'formidable' ) . '</p>'; |
|
168 | + .'<p>' . $this->opening_line() . ' ' . sprintf( __( 'Click “Start Tour” to view a quick introduction of this plugin’s core functionality.' ), 'formidable' ) . '</p>'; |
|
169 | 169 | $opt_arr = array( |
170 | 170 | 'content' => $content, |
171 | 171 | 'position' => array( 'edge' => 'top', 'align' => 'center' ), |
@@ -243,16 +243,16 @@ discard block |
||
243 | 243 | |
244 | 244 | return array( |
245 | 245 | 'content' => '<h3>' . __( 'Forms', 'formidable' ) . '</h3>' |
246 | - . '<p>' . __( 'All your forms will be listed on this page. Create your first form by clicking on the "Add New" button.', 'formidable' ) . '</p>' |
|
247 | - . '<p><strong>' . __( 'Subscribe to our Newsletter', 'formidable' ) . '</strong><br/>' |
|
248 | - . sprintf( __( 'If you would like to hear about new features and updates for %1$s, subscribe to our newsletter:', 'formidable' ), 'Formidable' ) . '</p>' |
|
249 | - . '<form target="_blank" action="//formidablepro.us1.list-manage.com/subscribe/post?u=a4a913790ffb892daacc6f271&id=7e7df15967" method="post" selector="newsletter-form" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">' |
|
250 | - . '<p>' |
|
251 | - . '<input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" selector="newsletter-email" placeholder="' . esc_attr__( 'Email', 'formidable' ) . '"/>' |
|
246 | + . '<p>' . __( 'All your forms will be listed on this page. Create your first form by clicking on the "Add New" button.', 'formidable' ) . '</p>' |
|
247 | + . '<p><strong>' . __( 'Subscribe to our Newsletter', 'formidable' ) . '</strong><br/>' |
|
248 | + . sprintf( __( 'If you would like to hear about new features and updates for %1$s, subscribe to our newsletter:', 'formidable' ), 'Formidable' ) . '</p>' |
|
249 | + . '<form target="_blank" action="//formidablepro.us1.list-manage.com/subscribe/post?u=a4a913790ffb892daacc6f271&id=7e7df15967" method="post" selector="newsletter-form" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">' |
|
250 | + . '<p>' |
|
251 | + . '<input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" selector="newsletter-email" placeholder="' . esc_attr__( 'Email', 'formidable' ) . '"/>' |
|
252 | 252 | . '<input type="hidden" name="group[4505]" value="4" />' |
253 | - . '<button type="submit" class="button-primary">' . esc_html__( 'Subscribe', 'formidable' ) . '</button>' |
|
254 | - . '</p>' |
|
255 | - . '</form>', |
|
253 | + . '<button type="submit" class="button-primary">' . esc_html__( 'Subscribe', 'formidable' ) . '</button>' |
|
254 | + . '</p>' |
|
255 | + . '</form>', |
|
256 | 256 | 'next_page' => 'entries', |
257 | 257 | ); |
258 | 258 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | private function entries_pointer() { |
266 | 266 | return array( |
267 | 267 | 'content' => '<h3>' . __( 'Entries', 'formidable' ) . '</h3>' |
268 | - . '<p>' . __( 'Each time one of your forms is submitted, an entry is created. You will find every form submission listed here so you will always have a backup if an email fails.', 'formidable' ) . '</p>', |
|
268 | + . '<p>' . __( 'Each time one of your forms is submitted, an entry is created. You will find every form submission listed here so you will always have a backup if an email fails.', 'formidable' ) . '</p>', |
|
269 | 269 | 'prev_page' => '', |
270 | 270 | 'next_page' => 'styles', |
271 | 271 | 'selector' => '.wp-list-table', |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | private function styles_pointer() { |
282 | 282 | return array( |
283 | 283 | 'content' => '<h3>' . __( 'Styles', 'formidable' ) . '</h3>' |
284 | - . '<p>' . __( 'Want to make changes to the way your forms look? Make all the changes you would like right here, and watch the sample form change before your eyes.', 'formidable' ) . '</p>', |
|
284 | + . '<p>' . __( 'Want to make changes to the way your forms look? Make all the changes you would like right here, and watch the sample form change before your eyes.', 'formidable' ) . '</p>', |
|
285 | 285 | 'prev_page' => 'entries', |
286 | 286 | 'next_page' => 'import', |
287 | 287 | 'selector' => '.general-style', |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | private function import_pointer() { |
298 | 298 | return array( |
299 | 299 | 'content' => '<h3>' . __( 'Import/Export', 'formidable' ) . '</h3>' |
300 | - . '<p>' . __( 'Import and export forms and styles when copying from one site to another or sharing with someone else. Your entries can be exported to a CSV as well. The Premium version also includes the option to import entries to your site from a CSV.', 'formidable' ) . '</p>', |
|
300 | + . '<p>' . __( 'Import and export forms and styles when copying from one site to another or sharing with someone else. Your entries can be exported to a CSV as well. The Premium version also includes the option to import entries to your site from a CSV.', 'formidable' ) . '</p>', |
|
301 | 301 | 'prev_page' => 'styles', |
302 | 302 | 'next_page' => 'settings', |
303 | 303 | 'selector' => '.inside.with_frm_style', |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | . __( 'Turn stylesheets and scripts off, set which user roles have access to change and create forms, setup your reCaptcha, and set default messages for new forms and fields.', 'formidable' ) |
318 | 318 | . '<p><strong>' . __( 'Plugin Licenses', 'formidable' ) . '</strong><br/>' |
319 | 319 | . sprintf( __( 'Once you’ve purchased %1$s or any addons, you’ll have to enter a license key to get access to all of their powerful features. A Plugin Licenses tab will appear here for you to enter your license key.', 'formidable' ), 'Formidable Pro' ) |
320 | - . '</p>', |
|
320 | + . '</p>', |
|
321 | 321 | 'prev_page' => 'import', |
322 | 322 | 'next_page' => 'addons', |
323 | 323 | ); |
@@ -331,10 +331,10 @@ discard block |
||
331 | 331 | private function addons_pointer() { |
332 | 332 | return array( |
333 | 333 | 'content' => '<h3>' . __( 'Addons', 'formidable' ) . '</h3>' |
334 | - . '<p>' . sprintf( __( 'The powerful functions of %1$s can be extended with %2$spremium plugins%3$s. You can read all about the Formidable Premium Plugins %2$shere%3$s.', 'formidable' ), 'Formidable', '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) |
|
334 | + . '<p>' . sprintf( __( 'The powerful functions of %1$s can be extended with %2$spremium plugins%3$s. You can read all about the Formidable Premium Plugins %2$shere%3$s.', 'formidable' ), 'Formidable', '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) |
|
335 | 335 | . '</p>' |
336 | - . '<p><strong>' . __( 'Like this plugin?', 'formidable' ) . '</strong><br/>' . sprintf( __( 'So, we’ve come to the end of the tour. If you like the plugin, please %srate it 5 stars on WordPress.org%s!', 'formidable' ), '<a target="_blank" href="https://wordpress.org/plugins/formidable/">', '</a>' ) . '</p>' |
|
337 | - . '<p>' . sprintf( __( 'Thank you for using our plugin and good luck with your forms!<br/><br/>Best,<br/>Team Formidable - %1$sformidablepro.com%2$s', 'formidable' ), '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) . '</p>', |
|
336 | + . '<p><strong>' . __( 'Like this plugin?', 'formidable' ) . '</strong><br/>' . sprintf( __( 'So, we’ve come to the end of the tour. If you like the plugin, please %srate it 5 stars on WordPress.org%s!', 'formidable' ), '<a target="_blank" href="https://wordpress.org/plugins/formidable/">', '</a>' ) . '</p>' |
|
337 | + . '<p>' . sprintf( __( 'Thank you for using our plugin and good luck with your forms!<br/><br/>Best,<br/>Team Formidable - %1$sformidablepro.com%2$s', 'formidable' ), '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) . '</p>', |
|
338 | 338 | 'prev_page' => 'settings', |
339 | 339 | ); |
340 | 340 | } |
@@ -1,8 +1,8 @@ |
||
1 | -<div class="general_settings metabox-holder tabs-panel frm_license_box <?php echo ($a == 'general_settings') ? 'frm_block' : 'frm_hidden'; ?>"> |
|
1 | +<div class="general_settings metabox-holder tabs-panel frm_license_box <?php echo ( $a == 'general_settings' ) ? 'frm_block' : 'frm_hidden'; ?>"> |
|
2 | 2 | <?php if ( ! is_multisite() || is_super_admin() ) { ?> |
3 | 3 | <div class="postbox"> |
4 | 4 | <div class="inside"> |
5 | - <p class="alignright"><?php printf( __( '%1$sClick here%2$s to get it now', 'formidable' ), '<a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com' ) ) . '">', '</a>' ) ?> »</p> |
|
5 | + <p class="alignright"><?php printf( __( '%1$sClick here%2$s to get it now', 'formidable' ), '<a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com' ) ) . '">', '</a>' ) ?> »</p> |
|
6 | 6 | <p><?php _e( 'Ready to take your forms to the next level?<br/>Formidable Forms will help you create views, manage data, and get reports.', 'formidable' ) ?></p> |
7 | 7 | |
8 | 8 | <p>Already signed up? <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/knowledgebase/install-formidable-forms/' ) ) ?>" target="_blank"><?php _e( 'Click here', 'formidable' ) ?></a> to get installation instructions and download the pro version.</p> |
@@ -2,200 +2,200 @@ discard block |
||
2 | 2 | |
3 | 3 | class FrmEntriesController { |
4 | 4 | |
5 | - public static function menu() { |
|
5 | + public static function menu() { |
|
6 | 6 | FrmAppHelper::force_capability( 'frm_view_entries' ); |
7 | 7 | |
8 | - add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
8 | + add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
9 | 9 | |
10 | 10 | if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) { |
11 | - $frm_settings = FrmAppHelper::get_settings(); |
|
11 | + $frm_settings = FrmAppHelper::get_settings(); |
|
12 | 12 | add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' ); |
13 | 13 | add_filter( 'get_user_option_manage' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' ); |
14 | 14 | add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' ); |
15 | - } |
|
16 | - } |
|
15 | + } |
|
16 | + } |
|
17 | 17 | |
18 | - /* Display in Back End */ |
|
19 | - public static function route() { |
|
18 | + /* Display in Back End */ |
|
19 | + public static function route() { |
|
20 | 20 | $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
21 | 21 | |
22 | - switch ( $action ) { |
|
23 | - case 'show': |
|
24 | - case 'destroy': |
|
25 | - case 'destroy_all': |
|
26 | - return self::$action(); |
|
22 | + switch ( $action ) { |
|
23 | + case 'show': |
|
24 | + case 'destroy': |
|
25 | + case 'destroy_all': |
|
26 | + return self::$action(); |
|
27 | 27 | |
28 | - default: |
|
29 | - do_action( 'frm_entry_action_route', $action ); |
|
30 | - if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
31 | - return; |
|
32 | - } |
|
28 | + default: |
|
29 | + do_action( 'frm_entry_action_route', $action ); |
|
30 | + if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
31 | + return; |
|
32 | + } |
|
33 | 33 | |
34 | - return self::display_list(); |
|
35 | - } |
|
36 | - } |
|
34 | + return self::display_list(); |
|
35 | + } |
|
36 | + } |
|
37 | 37 | |
38 | 38 | public static function contextual_help( $help, $screen_id, $screen ) { |
39 | - // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
40 | - if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
41 | - return $help; |
|
42 | - } |
|
39 | + // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
40 | + if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
41 | + return $help; |
|
42 | + } |
|
43 | 43 | |
44 | 44 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
45 | 45 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
46 | 46 | if ( $page != 'formidable-entries' || ( ! empty( $action ) && $action != 'list' ) ) { |
47 | - return $help; |
|
48 | - } |
|
47 | + return $help; |
|
48 | + } |
|
49 | 49 | |
50 | 50 | unset( $action, $page ); |
51 | 51 | |
52 | - $screen->add_help_tab( array( |
|
53 | - 'id' => 'formidable-entries-tab', |
|
54 | - 'title' => __( 'Overview', 'formidable' ), |
|
52 | + $screen->add_help_tab( array( |
|
53 | + 'id' => 'formidable-entries-tab', |
|
54 | + 'title' => __( 'Overview', 'formidable' ), |
|
55 | 55 | 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) .'</p> <p>'. esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
56 | - )); |
|
56 | + )); |
|
57 | 57 | |
58 | - $screen->set_help_sidebar( |
|
58 | + $screen->set_help_sidebar( |
|
59 | 59 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
60 | 60 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' . |
61 | 61 | '<p><a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>' |
62 | - ); |
|
62 | + ); |
|
63 | 63 | |
64 | - return $help; |
|
65 | - } |
|
64 | + return $help; |
|
65 | + } |
|
66 | 66 | |
67 | 67 | public static function manage_columns( $columns ) { |
68 | - global $frm_vars, $wpdb; |
|
68 | + global $frm_vars, $wpdb; |
|
69 | 69 | $form_id = FrmForm::get_current_form_id(); |
70 | 70 | |
71 | - $columns[ $form_id .'_id' ] = 'ID'; |
|
71 | + $columns[ $form_id .'_id' ] = 'ID'; |
|
72 | 72 | $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
73 | 73 | |
74 | - if ( ! $form_id ) { |
|
75 | - return $columns; |
|
76 | - } |
|
74 | + if ( ! $form_id ) { |
|
75 | + return $columns; |
|
76 | + } |
|
77 | 77 | |
78 | - $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
78 | + $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
79 | 79 | |
80 | - foreach ( $form_cols as $form_col ) { |
|
80 | + foreach ( $form_cols as $form_col ) { |
|
81 | 81 | if ( FrmField::is_no_save_field( $form_col->type ) ) { |
82 | - continue; |
|
83 | - } |
|
82 | + continue; |
|
83 | + } |
|
84 | 84 | |
85 | - if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) { |
|
85 | + if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) { |
|
86 | 86 | $sub_form_cols = FrmField::get_all_for_form( $form_col->field_options['form_select'] ); |
87 | 87 | |
88 | - if ( $sub_form_cols ) { |
|
89 | - foreach ( $sub_form_cols as $k => $sub_form_col ) { |
|
88 | + if ( $sub_form_cols ) { |
|
89 | + foreach ( $sub_form_cols as $k => $sub_form_col ) { |
|
90 | 90 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
91 | - unset( $sub_form_cols[ $k ] ); |
|
92 | - continue; |
|
93 | - } |
|
91 | + unset( $sub_form_cols[ $k ] ); |
|
92 | + continue; |
|
93 | + } |
|
94 | 94 | $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
95 | - unset($sub_form_col); |
|
96 | - } |
|
97 | - } |
|
98 | - unset($sub_form_cols); |
|
99 | - } else { |
|
100 | - $col_id = $form_col->field_key; |
|
101 | - if ( $form_col->form_id != $form_id ) { |
|
102 | - $col_id .= '-_-form'. $form_col->form_id; |
|
103 | - } |
|
104 | - |
|
105 | - if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
106 | - $columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
107 | - } |
|
108 | - $columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
109 | - } |
|
110 | - } |
|
111 | - |
|
112 | - $columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
113 | - $columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
114 | - $columns[ $form_id .'_ip' ] = 'IP'; |
|
115 | - |
|
116 | - $frm_vars['cols'] = $columns; |
|
95 | + unset($sub_form_col); |
|
96 | + } |
|
97 | + } |
|
98 | + unset($sub_form_cols); |
|
99 | + } else { |
|
100 | + $col_id = $form_col->field_key; |
|
101 | + if ( $form_col->form_id != $form_id ) { |
|
102 | + $col_id .= '-_-form'. $form_col->form_id; |
|
103 | + } |
|
104 | + |
|
105 | + if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
106 | + $columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
107 | + } |
|
108 | + $columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
109 | + } |
|
110 | + } |
|
111 | + |
|
112 | + $columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
113 | + $columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
114 | + $columns[ $form_id .'_ip' ] = 'IP'; |
|
115 | + |
|
116 | + $frm_vars['cols'] = $columns; |
|
117 | 117 | |
118 | 118 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
119 | 119 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) { |
120 | 120 | add_screen_option( 'per_page', array( 'label' => __( 'Entries', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_entries_per_page' ) ); |
121 | - } |
|
121 | + } |
|
122 | 122 | |
123 | - return $columns; |
|
124 | - } |
|
123 | + return $columns; |
|
124 | + } |
|
125 | 125 | |
126 | 126 | public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) { |
127 | - $frm_settings = FrmAppHelper::get_settings(); |
|
128 | - if ( $meta_key != 'manage'. sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) { |
|
129 | - return $check; |
|
130 | - } |
|
127 | + $frm_settings = FrmAppHelper::get_settings(); |
|
128 | + if ( $meta_key != 'manage'. sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) { |
|
129 | + return $check; |
|
130 | + } |
|
131 | 131 | |
132 | 132 | if ( empty( $prev_value ) ) { |
133 | 133 | $prev_value = get_metadata( 'user', $object_id, $meta_key, true ); |
134 | 134 | } |
135 | 135 | |
136 | - global $frm_vars; |
|
137 | - //add a check so we don't create a loop |
|
138 | - $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
136 | + global $frm_vars; |
|
137 | + //add a check so we don't create a loop |
|
138 | + $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
139 | 139 | |
140 | - return $check; |
|
141 | - } |
|
140 | + return $check; |
|
141 | + } |
|
142 | 142 | |
143 | - //add hidden columns back from other forms |
|
143 | + //add hidden columns back from other forms |
|
144 | 144 | public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) { |
145 | - $frm_settings = FrmAppHelper::get_settings(); |
|
146 | - |
|
147 | - $sanitized = sanitize_title($frm_settings->menu); |
|
148 | - if ( $meta_key != 'manage'. $sanitized .'_page_formidable-entriescolumnshidden' ) { |
|
149 | - return; |
|
150 | - } |
|
151 | - |
|
152 | - global $frm_vars; |
|
153 | - if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
154 | - return; //don't continue if there's no previous value |
|
155 | - } |
|
156 | - |
|
157 | - foreach ( $meta_value as $mk => $mv ) { |
|
158 | - //remove blank values |
|
159 | - if ( empty( $mv ) ) { |
|
160 | - unset( $meta_value[ $mk ] ); |
|
161 | - } |
|
162 | - } |
|
163 | - |
|
164 | - $cur_form_prefix = reset($meta_value); |
|
165 | - $cur_form_prefix = explode('_', $cur_form_prefix); |
|
166 | - $cur_form_prefix = $cur_form_prefix[0]; |
|
167 | - $save = false; |
|
168 | - |
|
169 | - foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
145 | + $frm_settings = FrmAppHelper::get_settings(); |
|
146 | + |
|
147 | + $sanitized = sanitize_title($frm_settings->menu); |
|
148 | + if ( $meta_key != 'manage'. $sanitized .'_page_formidable-entriescolumnshidden' ) { |
|
149 | + return; |
|
150 | + } |
|
151 | + |
|
152 | + global $frm_vars; |
|
153 | + if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
154 | + return; //don't continue if there's no previous value |
|
155 | + } |
|
156 | + |
|
157 | + foreach ( $meta_value as $mk => $mv ) { |
|
158 | + //remove blank values |
|
159 | + if ( empty( $mv ) ) { |
|
160 | + unset( $meta_value[ $mk ] ); |
|
161 | + } |
|
162 | + } |
|
163 | + |
|
164 | + $cur_form_prefix = reset($meta_value); |
|
165 | + $cur_form_prefix = explode('_', $cur_form_prefix); |
|
166 | + $cur_form_prefix = $cur_form_prefix[0]; |
|
167 | + $save = false; |
|
168 | + |
|
169 | + foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
170 | 170 | if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) { |
171 | - //don't add blank cols or process included cols |
|
172 | - continue; |
|
173 | - } |
|
171 | + //don't add blank cols or process included cols |
|
172 | + continue; |
|
173 | + } |
|
174 | 174 | |
175 | 175 | $form_prefix = explode( '_', $prev_hidden ); |
176 | - $form_prefix = $form_prefix[0]; |
|
177 | - if ( $form_prefix == $cur_form_prefix ) { |
|
178 | - //don't add back columns that are meant to be hidden |
|
179 | - continue; |
|
180 | - } |
|
176 | + $form_prefix = $form_prefix[0]; |
|
177 | + if ( $form_prefix == $cur_form_prefix ) { |
|
178 | + //don't add back columns that are meant to be hidden |
|
179 | + continue; |
|
180 | + } |
|
181 | 181 | |
182 | - $meta_value[] = $prev_hidden; |
|
183 | - $save = true; |
|
184 | - unset($form_prefix); |
|
185 | - } |
|
182 | + $meta_value[] = $prev_hidden; |
|
183 | + $save = true; |
|
184 | + unset($form_prefix); |
|
185 | + } |
|
186 | 186 | |
187 | 187 | if ( $save ) { |
188 | - $user = wp_get_current_user(); |
|
189 | - update_user_option( $user->ID, 'manage'. $sanitized .'_page_formidable-entriescolumnshidden', $meta_value, true ); |
|
190 | - } |
|
191 | - } |
|
188 | + $user = wp_get_current_user(); |
|
189 | + update_user_option( $user->ID, 'manage'. $sanitized .'_page_formidable-entriescolumnshidden', $meta_value, true ); |
|
190 | + } |
|
191 | + } |
|
192 | 192 | |
193 | 193 | public static function save_per_page( $save, $option, $value ) { |
194 | - if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
195 | - $save = (int) $value; |
|
196 | - } |
|
197 | - return $save; |
|
198 | - } |
|
194 | + if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
195 | + $save = (int) $value; |
|
196 | + } |
|
197 | + return $save; |
|
198 | + } |
|
199 | 199 | |
200 | 200 | public static function sortable_columns() { |
201 | 201 | $form_id = FrmForm::get_current_form_id(); |
@@ -221,226 +221,226 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | public static function hidden_columns( $result ) { |
224 | - global $frm_vars; |
|
224 | + global $frm_vars; |
|
225 | 225 | |
226 | 226 | $form_id = FrmForm::get_current_form_id(); |
227 | 227 | |
228 | - $return = false; |
|
229 | - foreach ( (array) $result as $r ) { |
|
230 | - if ( ! empty( $r ) ) { |
|
231 | - $form_prefix = explode( '_', $r ); |
|
232 | - $form_prefix = $form_prefix[0]; |
|
228 | + $return = false; |
|
229 | + foreach ( (array) $result as $r ) { |
|
230 | + if ( ! empty( $r ) ) { |
|
231 | + $form_prefix = explode( '_', $r ); |
|
232 | + $form_prefix = $form_prefix[0]; |
|
233 | 233 | |
234 | - if ( (int) $form_prefix == (int) $form_id ) { |
|
235 | - $return = true; |
|
236 | - break; |
|
237 | - } |
|
234 | + if ( (int) $form_prefix == (int) $form_id ) { |
|
235 | + $return = true; |
|
236 | + break; |
|
237 | + } |
|
238 | 238 | |
239 | - unset($form_prefix); |
|
240 | - } |
|
241 | - } |
|
239 | + unset($form_prefix); |
|
240 | + } |
|
241 | + } |
|
242 | 242 | |
243 | - if ( $return ) { |
|
243 | + if ( $return ) { |
|
244 | 244 | return $result; |
245 | 245 | } |
246 | 246 | |
247 | - $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
248 | - $max_columns = 8; |
|
249 | - if ( $i <= $max_columns ) { |
|
247 | + $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
248 | + $max_columns = 8; |
|
249 | + if ( $i <= $max_columns ) { |
|
250 | 250 | return $result; |
251 | 251 | } |
252 | 252 | |
253 | - global $frm_vars; |
|
254 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
255 | - $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
256 | - } |
|
253 | + global $frm_vars; |
|
254 | + if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
255 | + $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
256 | + } |
|
257 | 257 | |
258 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
259 | - $result = $frm_vars['current_form']->options['hidden_cols']; |
|
260 | - } else { |
|
261 | - $cols = $frm_vars['cols']; |
|
262 | - $cols = array_reverse($cols, true); |
|
258 | + if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
259 | + $result = $frm_vars['current_form']->options['hidden_cols']; |
|
260 | + } else { |
|
261 | + $cols = $frm_vars['cols']; |
|
262 | + $cols = array_reverse($cols, true); |
|
263 | 263 | |
264 | - $result[] = $form_id .'_id'; |
|
265 | - $i--; |
|
264 | + $result[] = $form_id .'_id'; |
|
265 | + $i--; |
|
266 | 266 | |
267 | - $result[] = $form_id .'_item_key'; |
|
268 | - $i--; |
|
267 | + $result[] = $form_id .'_item_key'; |
|
268 | + $i--; |
|
269 | 269 | |
270 | 270 | foreach ( $cols as $col_key => $col ) { |
271 | - if ( $i > $max_columns ) { |
|
271 | + if ( $i > $max_columns ) { |
|
272 | 272 | $result[] = $col_key; |
273 | 273 | } |
274 | - //remove some columns by default |
|
275 | - $i--; |
|
276 | - unset($col_key, $col); |
|
277 | - } |
|
278 | - } |
|
274 | + //remove some columns by default |
|
275 | + $i--; |
|
276 | + unset($col_key, $col); |
|
277 | + } |
|
278 | + } |
|
279 | 279 | |
280 | - return $result; |
|
281 | - } |
|
280 | + return $result; |
|
281 | + } |
|
282 | 282 | |
283 | 283 | public static function display_list( $message = '', $errors = array() ) { |
284 | - global $wpdb, $frm_vars; |
|
284 | + global $wpdb, $frm_vars; |
|
285 | 285 | |
286 | 286 | $form = FrmForm::get_current_form(); |
287 | 287 | $params = FrmForm::get_admin_params( $form ); |
288 | 288 | |
289 | - if ( $form ) { |
|
290 | - $params['form'] = $form->id; |
|
291 | - $frm_vars['current_form'] = $form; |
|
289 | + if ( $form ) { |
|
290 | + $params['form'] = $form->id; |
|
291 | + $frm_vars['current_form'] = $form; |
|
292 | 292 | |
293 | - if ( 'trash' == $form->status ) { |
|
294 | - $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); |
|
295 | - $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) ); |
|
296 | - $errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete ); |
|
297 | - unset( $time_to_delete, $delete_timestamp ); |
|
298 | - } |
|
293 | + if ( 'trash' == $form->status ) { |
|
294 | + $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); |
|
295 | + $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) ); |
|
296 | + $errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete ); |
|
297 | + unset( $time_to_delete, $delete_timestamp ); |
|
298 | + } |
|
299 | 299 | } |
300 | 300 | |
301 | - $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
301 | + $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
302 | 302 | |
303 | - $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
303 | + $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
304 | 304 | |
305 | - $pagenum = $wp_list_table->get_pagenum(); |
|
305 | + $pagenum = $wp_list_table->get_pagenum(); |
|
306 | 306 | |
307 | - $wp_list_table->prepare_items(); |
|
307 | + $wp_list_table->prepare_items(); |
|
308 | 308 | |
309 | - $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
310 | - if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
309 | + $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
310 | + if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
311 | 311 | $url = add_query_arg( 'paged', $total_pages ); |
312 | - if ( headers_sent() ) { |
|
313 | - echo FrmAppHelper::js_redirect($url); |
|
314 | - } else { |
|
315 | - wp_redirect( esc_url_raw( $url ) ); |
|
316 | - } |
|
317 | - die(); |
|
318 | - } |
|
319 | - |
|
320 | - if ( empty($message) && isset($_GET['import-message']) ) { |
|
321 | - $message = __( 'Your import is complete', 'formidable' ); |
|
322 | - } |
|
323 | - |
|
324 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php'); |
|
325 | - } |
|
326 | - |
|
327 | - /* Back End CRUD */ |
|
312 | + if ( headers_sent() ) { |
|
313 | + echo FrmAppHelper::js_redirect($url); |
|
314 | + } else { |
|
315 | + wp_redirect( esc_url_raw( $url ) ); |
|
316 | + } |
|
317 | + die(); |
|
318 | + } |
|
319 | + |
|
320 | + if ( empty($message) && isset($_GET['import-message']) ) { |
|
321 | + $message = __( 'Your import is complete', 'formidable' ); |
|
322 | + } |
|
323 | + |
|
324 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php'); |
|
325 | + } |
|
326 | + |
|
327 | + /* Back End CRUD */ |
|
328 | 328 | public static function show( $id = 0 ) { |
329 | - FrmAppHelper::permission_check('frm_view_entries'); |
|
329 | + FrmAppHelper::permission_check('frm_view_entries'); |
|
330 | 330 | |
331 | - if ( ! $id ) { |
|
331 | + if ( ! $id ) { |
|
332 | 332 | $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
333 | 333 | |
334 | - if ( ! $id ) { |
|
334 | + if ( ! $id ) { |
|
335 | 335 | $id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' ); |
336 | - } |
|
337 | - } |
|
336 | + } |
|
337 | + } |
|
338 | 338 | |
339 | - $entry = FrmEntry::getOne($id, true); |
|
339 | + $entry = FrmEntry::getOne($id, true); |
|
340 | 340 | |
341 | - $data = maybe_unserialize($entry->description); |
|
341 | + $data = maybe_unserialize($entry->description); |
|
342 | 342 | if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) { |
343 | 343 | $data = array( 'referrer' => $data ); |
344 | 344 | } |
345 | 345 | |
346 | 346 | $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' ); |
347 | - $to_emails = array(); |
|
347 | + $to_emails = array(); |
|
348 | 348 | |
349 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php'); |
|
350 | - } |
|
349 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php'); |
|
350 | + } |
|
351 | 351 | |
352 | - public static function destroy() { |
|
353 | - FrmAppHelper::permission_check('frm_delete_entries'); |
|
352 | + public static function destroy() { |
|
353 | + FrmAppHelper::permission_check('frm_delete_entries'); |
|
354 | 354 | |
355 | 355 | $params = FrmForm::get_admin_params(); |
356 | 356 | |
357 | - if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
358 | - //unlink entry from post |
|
359 | - global $wpdb; |
|
357 | + if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
358 | + //unlink entry from post |
|
359 | + global $wpdb; |
|
360 | 360 | $wpdb->update( $wpdb->prefix .'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
361 | - } |
|
361 | + } |
|
362 | 362 | |
363 | - $message = ''; |
|
364 | - if ( FrmEntry::destroy( $params['id'] ) ) { |
|
365 | - $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
366 | - } |
|
363 | + $message = ''; |
|
364 | + if ( FrmEntry::destroy( $params['id'] ) ) { |
|
365 | + $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
366 | + } |
|
367 | 367 | |
368 | - self::display_list( $message ); |
|
369 | - } |
|
368 | + self::display_list( $message ); |
|
369 | + } |
|
370 | 370 | |
371 | - public static function destroy_all() { |
|
372 | - if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
373 | - $frm_settings = FrmAppHelper::get_settings(); |
|
374 | - wp_die( $frm_settings->admin_permission ); |
|
375 | - } |
|
371 | + public static function destroy_all() { |
|
372 | + if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
373 | + $frm_settings = FrmAppHelper::get_settings(); |
|
374 | + wp_die( $frm_settings->admin_permission ); |
|
375 | + } |
|
376 | 376 | |
377 | - global $wpdb; |
|
377 | + global $wpdb; |
|
378 | 378 | $params = FrmForm::get_admin_params(); |
379 | - $message = ''; |
|
380 | - $errors = array(); |
|
381 | - $form_id = (int) $params['form']; |
|
379 | + $message = ''; |
|
380 | + $errors = array(); |
|
381 | + $form_id = (int) $params['form']; |
|
382 | 382 | |
383 | - if ( $form_id ) { |
|
384 | - $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
383 | + if ( $form_id ) { |
|
384 | + $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
385 | 385 | $action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 ); |
386 | 386 | |
387 | - if ( $action ) { |
|
388 | - // this action takes a while, so only trigger it if there are posts to delete |
|
389 | - foreach ( $entry_ids as $entry_id ) { |
|
390 | - do_action( 'frm_before_destroy_entry', $entry_id ); |
|
391 | - unset( $entry_id ); |
|
392 | - } |
|
393 | - } |
|
394 | - |
|
395 | - $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) ); |
|
396 | - $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) ); |
|
397 | - if ( $results ) { |
|
398 | - $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
399 | - } |
|
400 | - } else { |
|
401 | - $errors = __( 'No entries were specified', 'formidable' ); |
|
402 | - } |
|
403 | - |
|
404 | - self::display_list( $message, $errors ); |
|
405 | - } |
|
406 | - |
|
407 | - public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
408 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
409 | - return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
410 | - } |
|
411 | - |
|
412 | - public static function get_form( $filename, $form, $title, $description ) { |
|
413 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
414 | - return FrmFormsController::get_form( $form, $title, $description ); |
|
415 | - } |
|
416 | - |
|
417 | - public static function process_entry( $errors = '', $ajax = false ) { |
|
387 | + if ( $action ) { |
|
388 | + // this action takes a while, so only trigger it if there are posts to delete |
|
389 | + foreach ( $entry_ids as $entry_id ) { |
|
390 | + do_action( 'frm_before_destroy_entry', $entry_id ); |
|
391 | + unset( $entry_id ); |
|
392 | + } |
|
393 | + } |
|
394 | + |
|
395 | + $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) ); |
|
396 | + $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) ); |
|
397 | + if ( $results ) { |
|
398 | + $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
399 | + } |
|
400 | + } else { |
|
401 | + $errors = __( 'No entries were specified', 'formidable' ); |
|
402 | + } |
|
403 | + |
|
404 | + self::display_list( $message, $errors ); |
|
405 | + } |
|
406 | + |
|
407 | + public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
408 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
409 | + return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
410 | + } |
|
411 | + |
|
412 | + public static function get_form( $filename, $form, $title, $description ) { |
|
413 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
414 | + return FrmFormsController::get_form( $form, $title, $description ); |
|
415 | + } |
|
416 | + |
|
417 | + public static function process_entry( $errors = '', $ajax = false ) { |
|
418 | 418 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
419 | 419 | if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { |
420 | - return; |
|
421 | - } |
|
420 | + return; |
|
421 | + } |
|
422 | 422 | |
423 | - global $frm_vars; |
|
423 | + global $frm_vars; |
|
424 | 424 | |
425 | 425 | $form = FrmForm::getOne( $form_id ); |
426 | - if ( ! $form ) { |
|
427 | - return; |
|
428 | - } |
|
426 | + if ( ! $form ) { |
|
427 | + return; |
|
428 | + } |
|
429 | 429 | |
430 | 430 | $params = FrmForm::get_params( $form ); |
431 | 431 | |
432 | - if ( ! isset( $frm_vars['form_params'] ) ) { |
|
433 | - $frm_vars['form_params'] = array(); |
|
434 | - } |
|
432 | + if ( ! isset( $frm_vars['form_params'] ) ) { |
|
433 | + $frm_vars['form_params'] = array(); |
|
434 | + } |
|
435 | 435 | $frm_vars['form_params'][ $form->id ] = $params; |
436 | 436 | |
437 | 437 | if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
438 | - return; |
|
439 | - } |
|
438 | + return; |
|
439 | + } |
|
440 | 440 | |
441 | - if ( $errors == '' ) { |
|
441 | + if ( $errors == '' ) { |
|
442 | 442 | $errors = FrmEntryValidate::validate( $_POST ); |
443 | - } |
|
443 | + } |
|
444 | 444 | |
445 | 445 | /** |
446 | 446 | * Use this filter to add trigger actions and add errors after |
@@ -451,102 +451,102 @@ discard block |
||
451 | 451 | |
452 | 452 | $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
453 | 453 | |
454 | - if ( empty( $errors ) ) { |
|
454 | + if ( empty( $errors ) ) { |
|
455 | 455 | $_POST['frm_skip_cookie'] = 1; |
456 | - if ( $params['action'] == 'create' ) { |
|
456 | + if ( $params['action'] == 'create' ) { |
|
457 | 457 | if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
458 | 458 | $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
459 | - } |
|
460 | - } |
|
459 | + } |
|
460 | + } |
|
461 | 461 | |
462 | - do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
462 | + do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
463 | 463 | unset( $_POST['frm_skip_cookie'] ); |
464 | - } |
|
465 | - } |
|
466 | - |
|
467 | - public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
468 | - self::_delete_entry( $atts['id'], $form ); |
|
469 | - return $url; |
|
470 | - } |
|
471 | - |
|
472 | - //Delete entry if not redirected |
|
473 | - public static function delete_entry_after_save( $atts ) { |
|
474 | - self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
475 | - } |
|
476 | - |
|
477 | - private static function _delete_entry( $entry_id, $form ) { |
|
478 | - if ( ! $form ) { |
|
479 | - return; |
|
480 | - } |
|
481 | - |
|
482 | - $form->options = maybe_unserialize( $form->options ); |
|
483 | - if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
484 | - FrmEntry::destroy( $entry_id ); |
|
485 | - } |
|
486 | - } |
|
464 | + } |
|
465 | + } |
|
466 | + |
|
467 | + public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
468 | + self::_delete_entry( $atts['id'], $form ); |
|
469 | + return $url; |
|
470 | + } |
|
471 | + |
|
472 | + //Delete entry if not redirected |
|
473 | + public static function delete_entry_after_save( $atts ) { |
|
474 | + self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
475 | + } |
|
476 | + |
|
477 | + private static function _delete_entry( $entry_id, $form ) { |
|
478 | + if ( ! $form ) { |
|
479 | + return; |
|
480 | + } |
|
481 | + |
|
482 | + $form->options = maybe_unserialize( $form->options ); |
|
483 | + if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
484 | + FrmEntry::destroy( $entry_id ); |
|
485 | + } |
|
486 | + } |
|
487 | 487 | |
488 | 488 | public static function show_entry_shortcode( $atts ) { |
489 | 489 | return FrmEntryFormat::show_entry( $atts ); |
490 | 490 | } |
491 | 491 | |
492 | - public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
|
493 | - $field = FrmField::getOne($meta->field_id); |
|
494 | - if ( ! $field ) { |
|
495 | - return $value; |
|
496 | - } |
|
492 | + public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
|
493 | + $field = FrmField::getOne($meta->field_id); |
|
494 | + if ( ! $field ) { |
|
495 | + return $value; |
|
496 | + } |
|
497 | 497 | |
498 | - $value = self::filter_display_value($value, $field, $atts); |
|
499 | - return $value; |
|
500 | - } |
|
498 | + $value = self::filter_display_value($value, $field, $atts); |
|
499 | + return $value; |
|
500 | + } |
|
501 | 501 | |
502 | 502 | public static function &filter_shortcode_value( $value, $tag, $atts, $field ) { |
503 | - $plain_text = add_filter('frm_plain_text_email', true); |
|
503 | + $plain_text = add_filter('frm_plain_text_email', true); |
|
504 | 504 | FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value ); |
505 | 505 | |
506 | - if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
507 | - return $value; |
|
508 | - } |
|
506 | + if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
507 | + return $value; |
|
508 | + } |
|
509 | 509 | |
510 | - return self::filter_display_value($value, $field, $atts); |
|
511 | - } |
|
510 | + return self::filter_display_value($value, $field, $atts); |
|
511 | + } |
|
512 | 512 | |
513 | - public static function &filter_display_value( $value, $field, $atts = array() ) { |
|
514 | - $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
513 | + public static function &filter_display_value( $value, $field, $atts = array() ) { |
|
514 | + $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
515 | 515 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) { |
516 | - return $value; |
|
517 | - } |
|
518 | - |
|
519 | - $f_values = $f_labels = array(); |
|
520 | - |
|
521 | - foreach ( $field->options as $opt_key => $opt ) { |
|
522 | - if ( ! is_array($opt) ) { |
|
523 | - continue; |
|
524 | - } |
|
525 | - |
|
526 | - $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
527 | - $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
528 | - if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
529 | - unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
530 | - } |
|
531 | - unset($opt_key, $opt); |
|
532 | - } |
|
533 | - |
|
534 | - if ( ! empty($f_values) ) { |
|
535 | - foreach ( (array) $value as $v_key => $val ) { |
|
536 | - if ( in_array($val, $f_values) ) { |
|
537 | - $opt = array_search($val, $f_values); |
|
538 | - if ( is_array($value) ) { |
|
539 | - $value[ $v_key ] = $f_labels[ $opt ]; |
|
540 | - } else { |
|
541 | - $value = $f_labels[ $opt ]; |
|
542 | - } |
|
543 | - } |
|
544 | - unset($v_key, $val); |
|
545 | - } |
|
546 | - } |
|
547 | - |
|
548 | - return $value; |
|
549 | - } |
|
516 | + return $value; |
|
517 | + } |
|
518 | + |
|
519 | + $f_values = $f_labels = array(); |
|
520 | + |
|
521 | + foreach ( $field->options as $opt_key => $opt ) { |
|
522 | + if ( ! is_array($opt) ) { |
|
523 | + continue; |
|
524 | + } |
|
525 | + |
|
526 | + $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
527 | + $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
528 | + if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
529 | + unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
530 | + } |
|
531 | + unset($opt_key, $opt); |
|
532 | + } |
|
533 | + |
|
534 | + if ( ! empty($f_values) ) { |
|
535 | + foreach ( (array) $value as $v_key => $val ) { |
|
536 | + if ( in_array($val, $f_values) ) { |
|
537 | + $opt = array_search($val, $f_values); |
|
538 | + if ( is_array($value) ) { |
|
539 | + $value[ $v_key ] = $f_labels[ $opt ]; |
|
540 | + } else { |
|
541 | + $value = $f_labels[ $opt ]; |
|
542 | + } |
|
543 | + } |
|
544 | + unset($v_key, $val); |
|
545 | + } |
|
546 | + } |
|
547 | + |
|
548 | + return $value; |
|
549 | + } |
|
550 | 550 | |
551 | 551 | public static function get_params( $form = null ) { |
552 | 552 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_params' ); |
@@ -554,13 +554,13 @@ discard block |
||
554 | 554 | } |
555 | 555 | |
556 | 556 | public static function entry_sidebar( $entry ) { |
557 | - $data = maybe_unserialize($entry->description); |
|
558 | - $date_format = get_option('date_format'); |
|
559 | - $time_format = get_option('time_format'); |
|
557 | + $data = maybe_unserialize($entry->description); |
|
558 | + $date_format = get_option('date_format'); |
|
559 | + $time_format = get_option('time_format'); |
|
560 | 560 | if ( isset( $data['browser'] ) ) { |
561 | 561 | $browser = FrmEntryFormat::get_browser( $data['browser'] ); |
562 | 562 | } |
563 | 563 | |
564 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php'); |
|
565 | - } |
|
564 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php'); |
|
565 | + } |
|
566 | 566 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | public static function menu() { |
6 | 6 | FrmAppHelper::force_capability( 'frm_view_entries' ); |
7 | 7 | |
8 | - add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
8 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
9 | 9 | |
10 | 10 | if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) { |
11 | 11 | $frm_settings = FrmAppHelper::get_settings(); |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | $screen->add_help_tab( array( |
53 | 53 | 'id' => 'formidable-entries-tab', |
54 | 54 | 'title' => __( 'Overview', 'formidable' ), |
55 | - 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) .'</p> <p>'. esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
|
56 | - )); |
|
55 | + 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
|
56 | + ) ); |
|
57 | 57 | |
58 | 58 | $screen->set_help_sidebar( |
59 | 59 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
60 | 60 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' . |
61 | - '<p><a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>' |
|
61 | + '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>' |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | return $help; |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | global $frm_vars, $wpdb; |
69 | 69 | $form_id = FrmForm::get_current_form_id(); |
70 | 70 | |
71 | - $columns[ $form_id .'_id' ] = 'ID'; |
|
72 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
71 | + $columns[$form_id . '_id'] = 'ID'; |
|
72 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
73 | 73 | |
74 | 74 | if ( ! $form_id ) { |
75 | 75 | return $columns; |
76 | 76 | } |
77 | 77 | |
78 | - $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
78 | + $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' ); |
|
79 | 79 | |
80 | 80 | foreach ( $form_cols as $form_col ) { |
81 | 81 | if ( FrmField::is_no_save_field( $form_col->type ) ) { |
@@ -88,30 +88,30 @@ discard block |
||
88 | 88 | if ( $sub_form_cols ) { |
89 | 89 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
90 | 90 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
91 | - unset( $sub_form_cols[ $k ] ); |
|
91 | + unset( $sub_form_cols[$k] ); |
|
92 | 92 | continue; |
93 | 93 | } |
94 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
95 | - unset($sub_form_col); |
|
94 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
95 | + unset( $sub_form_col ); |
|
96 | 96 | } |
97 | 97 | } |
98 | - unset($sub_form_cols); |
|
98 | + unset( $sub_form_cols ); |
|
99 | 99 | } else { |
100 | 100 | $col_id = $form_col->field_key; |
101 | 101 | if ( $form_col->form_id != $form_id ) { |
102 | - $col_id .= '-_-form'. $form_col->form_id; |
|
102 | + $col_id .= '-_-form' . $form_col->form_id; |
|
103 | 103 | } |
104 | 104 | |
105 | - if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
106 | - $columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
105 | + if ( isset( $form_col->field_options['separate_value'] ) && $form_col->field_options['separate_value'] ) { |
|
106 | + $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
107 | 107 | } |
108 | - $columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
108 | + $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | - $columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
113 | - $columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
114 | - $columns[ $form_id .'_ip' ] = 'IP'; |
|
112 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
113 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
114 | + $columns[$form_id . '_ip'] = 'IP'; |
|
115 | 115 | |
116 | 116 | $frm_vars['cols'] = $columns; |
117 | 117 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) { |
127 | 127 | $frm_settings = FrmAppHelper::get_settings(); |
128 | - if ( $meta_key != 'manage'. sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) { |
|
128 | + if ( $meta_key != 'manage' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) { |
|
129 | 129 | return $check; |
130 | 130 | } |
131 | 131 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | global $frm_vars; |
137 | 137 | //add a check so we don't create a loop |
138 | - $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
138 | + $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
139 | 139 | |
140 | 140 | return $check; |
141 | 141 | } |
@@ -144,25 +144,25 @@ discard block |
||
144 | 144 | public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) { |
145 | 145 | $frm_settings = FrmAppHelper::get_settings(); |
146 | 146 | |
147 | - $sanitized = sanitize_title($frm_settings->menu); |
|
148 | - if ( $meta_key != 'manage'. $sanitized .'_page_formidable-entriescolumnshidden' ) { |
|
147 | + $sanitized = sanitize_title( $frm_settings->menu ); |
|
148 | + if ( $meta_key != 'manage' . $sanitized . '_page_formidable-entriescolumnshidden' ) { |
|
149 | 149 | return; |
150 | 150 | } |
151 | 151 | |
152 | 152 | global $frm_vars; |
153 | - if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
153 | + if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) { |
|
154 | 154 | return; //don't continue if there's no previous value |
155 | 155 | } |
156 | 156 | |
157 | 157 | foreach ( $meta_value as $mk => $mv ) { |
158 | 158 | //remove blank values |
159 | - if ( empty( $mv ) ) { |
|
160 | - unset( $meta_value[ $mk ] ); |
|
159 | + if ( empty( $mv ) ) { |
|
160 | + unset( $meta_value[$mk] ); |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | - $cur_form_prefix = reset($meta_value); |
|
165 | - $cur_form_prefix = explode('_', $cur_form_prefix); |
|
164 | + $cur_form_prefix = reset( $meta_value ); |
|
165 | + $cur_form_prefix = explode( '_', $cur_form_prefix ); |
|
166 | 166 | $cur_form_prefix = $cur_form_prefix[0]; |
167 | 167 | $save = false; |
168 | 168 | |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | |
182 | 182 | $meta_value[] = $prev_hidden; |
183 | 183 | $save = true; |
184 | - unset($form_prefix); |
|
184 | + unset( $form_prefix ); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | if ( $save ) { |
188 | 188 | $user = wp_get_current_user(); |
189 | - update_user_option( $user->ID, 'manage'. $sanitized .'_page_formidable-entriescolumnshidden', $meta_value, true ); |
|
189 | + update_user_option( $user->ID, 'manage' . $sanitized . '_page_formidable-entriescolumnshidden', $meta_value, true ); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | foreach ( $fields as $field ) { |
214 | 214 | if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) { |
215 | 215 | // Can't sort on checkboxes because they are stored serialized, or post fields |
216 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
216 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | break; |
237 | 237 | } |
238 | 238 | |
239 | - unset($form_prefix); |
|
239 | + unset( $form_prefix ); |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
@@ -244,36 +244,36 @@ discard block |
||
244 | 244 | return $result; |
245 | 245 | } |
246 | 246 | |
247 | - $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
247 | + $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0; |
|
248 | 248 | $max_columns = 8; |
249 | 249 | if ( $i <= $max_columns ) { |
250 | 250 | return $result; |
251 | 251 | } |
252 | 252 | |
253 | 253 | global $frm_vars; |
254 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
255 | - $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
254 | + if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] ) { |
|
255 | + $frm_vars['current_form']->options = maybe_unserialize( $frm_vars['current_form']->options ); |
|
256 | 256 | } |
257 | 257 | |
258 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
258 | + if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) ) { |
|
259 | 259 | $result = $frm_vars['current_form']->options['hidden_cols']; |
260 | 260 | } else { |
261 | 261 | $cols = $frm_vars['cols']; |
262 | - $cols = array_reverse($cols, true); |
|
262 | + $cols = array_reverse( $cols, true ); |
|
263 | 263 | |
264 | - $result[] = $form_id .'_id'; |
|
265 | - $i--; |
|
264 | + $result[] = $form_id . '_id'; |
|
265 | + $i --; |
|
266 | 266 | |
267 | - $result[] = $form_id .'_item_key'; |
|
268 | - $i--; |
|
267 | + $result[] = $form_id . '_item_key'; |
|
268 | + $i --; |
|
269 | 269 | |
270 | 270 | foreach ( $cols as $col_key => $col ) { |
271 | 271 | if ( $i > $max_columns ) { |
272 | 272 | $result[] = $col_key; |
273 | 273 | } |
274 | 274 | //remove some columns by default |
275 | - $i--; |
|
276 | - unset($col_key, $col); |
|
275 | + $i --; |
|
276 | + unset( $col_key, $col ); |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | |
@@ -310,23 +310,23 @@ discard block |
||
310 | 310 | if ( $pagenum > $total_pages && $total_pages > 0 ) { |
311 | 311 | $url = add_query_arg( 'paged', $total_pages ); |
312 | 312 | if ( headers_sent() ) { |
313 | - echo FrmAppHelper::js_redirect($url); |
|
313 | + echo FrmAppHelper::js_redirect( $url ); |
|
314 | 314 | } else { |
315 | 315 | wp_redirect( esc_url_raw( $url ) ); |
316 | 316 | } |
317 | 317 | die(); |
318 | 318 | } |
319 | 319 | |
320 | - if ( empty($message) && isset($_GET['import-message']) ) { |
|
320 | + if ( empty( $message ) && isset( $_GET['import-message'] ) ) { |
|
321 | 321 | $message = __( 'Your import is complete', 'formidable' ); |
322 | 322 | } |
323 | 323 | |
324 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php'); |
|
324 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' ); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /* Back End CRUD */ |
328 | 328 | public static function show( $id = 0 ) { |
329 | - FrmAppHelper::permission_check('frm_view_entries'); |
|
329 | + FrmAppHelper::permission_check( 'frm_view_entries' ); |
|
330 | 330 | |
331 | 331 | if ( ! $id ) { |
332 | 332 | $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
339 | - $entry = FrmEntry::getOne($id, true); |
|
339 | + $entry = FrmEntry::getOne( $id, true ); |
|
340 | 340 | |
341 | - $data = maybe_unserialize($entry->description); |
|
341 | + $data = maybe_unserialize( $entry->description ); |
|
342 | 342 | if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) { |
343 | 343 | $data = array( 'referrer' => $data ); |
344 | 344 | } |
@@ -346,18 +346,18 @@ discard block |
||
346 | 346 | $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' ); |
347 | 347 | $to_emails = array(); |
348 | 348 | |
349 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php'); |
|
349 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' ); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | public static function destroy() { |
353 | - FrmAppHelper::permission_check('frm_delete_entries'); |
|
353 | + FrmAppHelper::permission_check( 'frm_delete_entries' ); |
|
354 | 354 | |
355 | 355 | $params = FrmForm::get_admin_params(); |
356 | 356 | |
357 | - if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
357 | + if ( isset( $params['keep_post'] ) && $params['keep_post'] ) { |
|
358 | 358 | //unlink entry from post |
359 | 359 | global $wpdb; |
360 | - $wpdb->update( $wpdb->prefix .'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
|
360 | + $wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | $message = ''; |
@@ -432,9 +432,9 @@ discard block |
||
432 | 432 | if ( ! isset( $frm_vars['form_params'] ) ) { |
433 | 433 | $frm_vars['form_params'] = array(); |
434 | 434 | } |
435 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
435 | + $frm_vars['form_params'][$form->id] = $params; |
|
436 | 436 | |
437 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
437 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
438 | 438 | return; |
439 | 439 | } |
440 | 440 | |
@@ -449,13 +449,13 @@ discard block |
||
449 | 449 | */ |
450 | 450 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
451 | 451 | |
452 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
452 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
453 | 453 | |
454 | 454 | if ( empty( $errors ) ) { |
455 | 455 | $_POST['frm_skip_cookie'] = 1; |
456 | 456 | if ( $params['action'] == 'create' ) { |
457 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
458 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
|
457 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
458 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); |
|
459 | 459 | } |
460 | 460 | } |
461 | 461 | |
@@ -490,28 +490,28 @@ discard block |
||
490 | 490 | } |
491 | 491 | |
492 | 492 | public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
493 | - $field = FrmField::getOne($meta->field_id); |
|
493 | + $field = FrmField::getOne( $meta->field_id ); |
|
494 | 494 | if ( ! $field ) { |
495 | 495 | return $value; |
496 | 496 | } |
497 | 497 | |
498 | - $value = self::filter_display_value($value, $field, $atts); |
|
498 | + $value = self::filter_display_value( $value, $field, $atts ); |
|
499 | 499 | return $value; |
500 | 500 | } |
501 | 501 | |
502 | 502 | public static function &filter_shortcode_value( $value, $tag, $atts, $field ) { |
503 | - $plain_text = add_filter('frm_plain_text_email', true); |
|
503 | + $plain_text = add_filter( 'frm_plain_text_email', true ); |
|
504 | 504 | FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value ); |
505 | 505 | |
506 | - if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
506 | + if ( isset( $atts['show'] ) && $atts['show'] == 'value' ) { |
|
507 | 507 | return $value; |
508 | 508 | } |
509 | 509 | |
510 | - return self::filter_display_value($value, $field, $atts); |
|
510 | + return self::filter_display_value( $value, $field, $atts ); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | public static function &filter_display_value( $value, $field, $atts = array() ) { |
514 | - $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
514 | + $saved_value = ( isset( $atts['saved_value'] ) && $atts['saved_value'] ) ? true : false; |
|
515 | 515 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) { |
516 | 516 | return $value; |
517 | 517 | } |
@@ -519,29 +519,29 @@ discard block |
||
519 | 519 | $f_values = $f_labels = array(); |
520 | 520 | |
521 | 521 | foreach ( $field->options as $opt_key => $opt ) { |
522 | - if ( ! is_array($opt) ) { |
|
522 | + if ( ! is_array( $opt ) ) { |
|
523 | 523 | continue; |
524 | 524 | } |
525 | 525 | |
526 | - $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
527 | - $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
528 | - if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
529 | - unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
526 | + $f_labels[$opt_key] = isset( $opt['label'] ) ? $opt['label'] : reset( $opt ); |
|
527 | + $f_values[$opt_key] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[$opt_key]; |
|
528 | + if ( $f_labels[$opt_key] == $f_values[$opt_key] ) { |
|
529 | + unset( $f_values[$opt_key], $f_labels[$opt_key] ); |
|
530 | 530 | } |
531 | - unset($opt_key, $opt); |
|
531 | + unset( $opt_key, $opt ); |
|
532 | 532 | } |
533 | 533 | |
534 | - if ( ! empty($f_values) ) { |
|
534 | + if ( ! empty( $f_values ) ) { |
|
535 | 535 | foreach ( (array) $value as $v_key => $val ) { |
536 | - if ( in_array($val, $f_values) ) { |
|
537 | - $opt = array_search($val, $f_values); |
|
538 | - if ( is_array($value) ) { |
|
539 | - $value[ $v_key ] = $f_labels[ $opt ]; |
|
536 | + if ( in_array( $val, $f_values ) ) { |
|
537 | + $opt = array_search( $val, $f_values ); |
|
538 | + if ( is_array( $value ) ) { |
|
539 | + $value[$v_key] = $f_labels[$opt]; |
|
540 | 540 | } else { |
541 | - $value = $f_labels[ $opt ]; |
|
541 | + $value = $f_labels[$opt]; |
|
542 | 542 | } |
543 | 543 | } |
544 | - unset($v_key, $val); |
|
544 | + unset( $v_key, $val ); |
|
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
@@ -554,13 +554,13 @@ discard block |
||
554 | 554 | } |
555 | 555 | |
556 | 556 | public static function entry_sidebar( $entry ) { |
557 | - $data = maybe_unserialize($entry->description); |
|
558 | - $date_format = get_option('date_format'); |
|
559 | - $time_format = get_option('time_format'); |
|
557 | + $data = maybe_unserialize( $entry->description ); |
|
558 | + $date_format = get_option( 'date_format' ); |
|
559 | + $time_format = get_option( 'time_format' ); |
|
560 | 560 | if ( isset( $data['browser'] ) ) { |
561 | 561 | $browser = FrmEntryFormat::get_browser( $data['browser'] ); |
562 | 562 | } |
563 | 563 | |
564 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php'); |
|
564 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' ); |
|
565 | 565 | } |
566 | 566 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | <a href="?page=formidable-styles&page-tab=default#tabs-panel-default-color" class="nav-tab-link" data-type="tabs-panel-default-color"><?php _e( 'Default', 'formidable' ) ?></a> |
5 | 5 | </li> |
6 | 6 | <li <?php echo ( 'active-color' == $current_tab ? ' class="tabs"' : '' ); ?>> |
7 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=active-color#page-active-color') ?>" class="nav-tab-link" data-type="tabs-panel-active-color"><?php _e( 'Active', 'formidable' ) ?></a> |
|
7 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=active-color#page-active-color' ) ?>" class="nav-tab-link" data-type="tabs-panel-active-color"><?php _e( 'Active', 'formidable' ) ?></a> |
|
8 | 8 | </li> |
9 | 9 | <li <?php echo ( 'active-error' == $current_tab ? ' class="tabs"' : '' ); ?>> |
10 | 10 | <a href="?page=formidable-styles&page-tab=active-error#tabs-panel-active-error" class="nav-tab-link" data-type="tabs-panel-active-error"><?php _e( 'Error', 'formidable' ) ?></a> |
@@ -19,34 +19,34 @@ discard block |
||
19 | 19 | ?>"> |
20 | 20 | <div class="field-group field-group-border clearfix"> |
21 | 21 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
22 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color') ) ?>" id="frm_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color'] ) ?>" /> |
|
22 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color' ) ) ?>" id="frm_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color'] ) ?>" /> |
|
23 | 23 | </div> |
24 | 24 | <div class="field-group clearfix"> |
25 | 25 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
26 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('text_color') ) ?>" id="frm_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['text_color'] ) ?>" /> |
|
26 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'text_color' ) ) ?>" id="frm_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['text_color'] ) ?>" /> |
|
27 | 27 | </div> |
28 | 28 | |
29 | 29 | <div class="field-group field-group-border clearfix"> |
30 | 30 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
31 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color') ) ?>" id="frm_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['border_color'] ) ?>" /> |
|
31 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color' ) ) ?>" id="frm_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['border_color'] ) ?>" /> |
|
32 | 32 | </div> |
33 | 33 | <div class="field-group clearfix"> |
34 | 34 | <label><?php _e( 'Thickness', 'formidable' ) ?></label> |
35 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_border_width') ) ?>" id="frm_field_border_width" value="<?php echo esc_attr( $style->post_content['field_border_width'] ) ?>" size="4" /> |
|
35 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_border_width' ) ) ?>" id="frm_field_border_width" value="<?php echo esc_attr( $style->post_content['field_border_width'] ) ?>" size="4" /> |
|
36 | 36 | </div> |
37 | 37 | <div class="field-group clearfix"> |
38 | 38 | <label><?php _e( 'Style', 'formidable' ) ?></label> |
39 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('field_border_style') ) ?>" id="frm_field_border_style"> |
|
40 | - <option value="solid" <?php selected($style->post_content['field_border_style'], 'solid') ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
41 | - <option value="dotted" <?php selected($style->post_content['field_border_style'], 'dotted') ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
42 | - <option value="dashed" <?php selected($style->post_content['field_border_style'], 'dashed') ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
43 | - <option value="double" <?php selected($style->post_content['field_border_style'], 'double') ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
39 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'field_border_style' ) ) ?>" id="frm_field_border_style"> |
|
40 | + <option value="solid" <?php selected( $style->post_content['field_border_style'], 'solid' ) ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
41 | + <option value="dotted" <?php selected( $style->post_content['field_border_style'], 'dotted' ) ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
42 | + <option value="dashed" <?php selected( $style->post_content['field_border_style'], 'dashed' ) ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
43 | + <option value="double" <?php selected( $style->post_content['field_border_style'], 'double' ) ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
44 | 44 | </select> |
45 | 45 | </div> |
46 | 46 | <div class="clear"></div> |
47 | 47 | <p class="frm_no_bottom_margin"> |
48 | 48 | <label> |
49 | - <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('remove_box_shadow') ) ?>" id="frm_remove_box_shadow" value="1" <?php checked($style->post_content['remove_box_shadow'], 1) ?> /> |
|
49 | + <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'remove_box_shadow' ) ) ?>" id="frm_remove_box_shadow" value="1" <?php checked( $style->post_content['remove_box_shadow'], 1 ) ?> /> |
|
50 | 50 | <?php _e( 'Remove box shadow', 'formidable' ) ?> |
51 | 51 | </label> |
52 | 52 | </p> |
@@ -57,16 +57,16 @@ discard block |
||
57 | 57 | ?>"> |
58 | 58 | <div class="field-group field-group-border clearfix"> |
59 | 59 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
60 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color_active') ) ?>" id="frm_bg_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_active'] ) ?>" /> |
|
60 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color_active' ) ) ?>" id="frm_bg_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_active'] ) ?>" /> |
|
61 | 61 | </div> |
62 | 62 | <div class="field-group clearfix"> |
63 | 63 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
64 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color_active') ) ?>" id="frm_border_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_active'] ) ?>" /> |
|
64 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color_active' ) ) ?>" id="frm_border_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_active'] ) ?>" /> |
|
65 | 65 | </div> |
66 | 66 | <div class="clear"></div> |
67 | 67 | <p class="frm_no_bottom_margin"> |
68 | 68 | <label> |
69 | - <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('remove_box_shadow_active') ) ?>" id="frm_remove_box_shadow_active" value="1" <?php checked($style->post_content['remove_box_shadow_active'], 1) ?> /> |
|
69 | + <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'remove_box_shadow_active' ) ) ?>" id="frm_remove_box_shadow_active" value="1" <?php checked( $style->post_content['remove_box_shadow_active'], 1 ) ?> /> |
|
70 | 70 | <?php _e( 'Remove box shadow', 'formidable' ) ?> |
71 | 71 | </label> |
72 | 72 | </p> |
@@ -77,28 +77,28 @@ discard block |
||
77 | 77 | ?>"> |
78 | 78 | <div class="field-group field-group-border clearfix"> |
79 | 79 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
80 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color_error') ) ?>" id="frm_bg_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_error'] ) ?>" /> |
|
80 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color_error' ) ) ?>" id="frm_bg_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_error'] ) ?>" /> |
|
81 | 81 | </div> |
82 | 82 | <div class="field-group clearfix"> |
83 | 83 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
84 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('text_color_error') ) ?>" id="frm_text_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_error'] ) ?>" /> |
|
84 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'text_color_error' ) ) ?>" id="frm_text_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_error'] ) ?>" /> |
|
85 | 85 | </div> |
86 | 86 | |
87 | 87 | <div class="field-group field-group-border clearfix"> |
88 | 88 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
89 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color_error') ) ?>" id="frm_border_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_error'] ) ?>" /> |
|
89 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color_error' ) ) ?>" id="frm_border_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_error'] ) ?>" /> |
|
90 | 90 | </div> |
91 | 91 | <div class="field-group clearfix"> |
92 | 92 | <label><?php _e( 'Thickness', 'formidable' ) ?></label> |
93 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_width_error') ) ?>" id="frm_border_width_error" value="<?php echo esc_attr( $style->post_content['border_width_error'] ) ?>" size="4" /> |
|
93 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_width_error' ) ) ?>" id="frm_border_width_error" value="<?php echo esc_attr( $style->post_content['border_width_error'] ) ?>" size="4" /> |
|
94 | 94 | </div> |
95 | 95 | <div class="field-group clearfix"> |
96 | 96 | <label><?php _e( 'Style', 'formidable' ) ?></label> |
97 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('border_style_error') ) ?>" id="frm_border_style_error"> |
|
98 | - <option value="solid" <?php selected($style->post_content['border_style_error'], 'solid') ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
99 | - <option value="dotted" <?php selected($style->post_content['border_style_error'], 'dotted') ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
100 | - <option value="dashed" <?php selected($style->post_content['border_style_error'], 'dashed') ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
101 | - <option value="double" <?php selected($style->post_content['border_style_error'], 'double') ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
97 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'border_style_error' ) ) ?>" id="frm_border_style_error"> |
|
98 | + <option value="solid" <?php selected( $style->post_content['border_style_error'], 'solid' ) ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
99 | + <option value="dotted" <?php selected( $style->post_content['border_style_error'], 'dotted' ) ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
100 | + <option value="dashed" <?php selected( $style->post_content['border_style_error'], 'dashed' ) ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
101 | + <option value="double" <?php selected( $style->post_content['border_style_error'], 'double' ) ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
102 | 102 | </select> |
103 | 103 | </div> |
104 | 104 | |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | ?>"> |
111 | 111 | <div class="field-group field-group-border clearfix"> |
112 | 112 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
113 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color_disabled') ) ?>" id="frm_bg_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_disabled'] ) ?>" /> |
|
113 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color_disabled' ) ) ?>" id="frm_bg_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_disabled'] ) ?>" /> |
|
114 | 114 | </div> |
115 | 115 | <div class="field-group clearfix"> |
116 | 116 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
117 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('text_color_disabled') ) ?>" id="frm_text_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_disabled'] ) ?>" /> |
|
117 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'text_color_disabled' ) ) ?>" id="frm_text_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_disabled'] ) ?>" /> |
|
118 | 118 | </div> |
119 | 119 | |
120 | 120 | <div class="field-group clearfix"> |
121 | 121 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
122 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color_disabled') ) ?>" id="frm_border_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_disabled'] ) ?>" /> |
|
122 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color_disabled' ) ) ?>" id="frm_border_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_disabled'] ) ?>" /> |
|
123 | 123 | </div> |
124 | 124 | <div class="clear"></div> |
125 | 125 | </div><!-- /.tabs-panel --> |
@@ -1,42 +1,42 @@ |
||
1 | 1 | <div class="field-group clearfix frm-first-row"> |
2 | 2 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_font_size') ) ?>" id="frm_field_font_size" value="<?php echo esc_attr( $style->post_content['field_font_size'] ) ?>" /> |
|
3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_font_size' ) ) ?>" id="frm_field_font_size" value="<?php echo esc_attr( $style->post_content['field_font_size'] ) ?>" /> |
|
4 | 4 | </div> |
5 | 5 | |
6 | 6 | <div class="field-group clearfix frm-first-row"> |
7 | 7 | <label><?php _e( 'Height', 'formidable' ) ?></label> |
8 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_height') ) ?>" id="frm_field_height" value="<?php echo esc_attr( $style->post_content['field_height'] ) ?>" /> |
|
8 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_height' ) ) ?>" id="frm_field_height" value="<?php echo esc_attr( $style->post_content['field_height'] ) ?>" /> |
|
9 | 9 | </div> |
10 | 10 | |
11 | 11 | <div class="field-group clearfix frm-first-row"> |
12 | 12 | <label><?php _e( 'Width', 'formidable' ) ?></label> |
13 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_width') ) ?>" id="frm_field_width" value="<?php echo esc_attr( $style->post_content['field_width'] ) ?>" /> |
|
13 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_width' ) ) ?>" id="frm_field_width" value="<?php echo esc_attr( $style->post_content['field_width'] ) ?>" /> |
|
14 | 14 | </div> |
15 | 15 | |
16 | 16 | <div class="clear"></div> |
17 | 17 | <p class="frm_no_bottom_margin"> |
18 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('auto_width') ) ?>" id="frm_auto_width" value="1" <?php checked( $style->post_content['auto_width'], 1 ) ?> /> |
|
18 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'auto_width' ) ) ?>" id="frm_auto_width" value="1" <?php checked( $style->post_content['auto_width'], 1 ) ?> /> |
|
19 | 19 | <?php _e( 'Automatic Width for drop-down fields', 'formidable' ) ?></label> |
20 | 20 | </p> |
21 | 21 | |
22 | 22 | <div class="field-group clearfix"> |
23 | 23 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
24 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_pad') ) ?>" id="frm_field_pad" value="<?php echo esc_attr( $style->post_content['field_pad'] ) ?>" /> |
|
24 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_pad' ) ) ?>" id="frm_field_pad" value="<?php echo esc_attr( $style->post_content['field_pad'] ) ?>" /> |
|
25 | 25 | </div> |
26 | 26 | |
27 | 27 | <div class="field-group clearfix"> |
28 | 28 | <label><?php _e( 'Margin', 'formidable' ) ?></label> |
29 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_margin') ) ?>" id="frm_field_margin" value="<?php echo esc_attr( $style->post_content['field_margin'] ) ?>" /> |
|
29 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_margin' ) ) ?>" id="frm_field_margin" value="<?php echo esc_attr( $style->post_content['field_margin'] ) ?>" /> |
|
30 | 30 | </div> |
31 | 31 | |
32 | 32 | <div class="field-group clearfix"> |
33 | 33 | <label><?php _e( 'Corners', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Formidable uses CSS3 border-radius for corner rounding, which is not currently supported by Internet Explorer.', 'formidable' ) ?>" ></span></label> |
34 | - <input type="text" value="<?php echo esc_attr( $style->post_content['border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name('border_radius') ) ?>" id="frm_border_radius" /> |
|
34 | + <input type="text" value="<?php echo esc_attr( $style->post_content['border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_radius' ) ) ?>" id="frm_border_radius" /> |
|
35 | 35 | </div> |
36 | 36 | |
37 | 37 | <div class="field-group clearfix frm-first-row"> |
38 | 38 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
39 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('field_weight') ) ?>" id="frm_field_weight"> |
|
39 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'field_weight' ) ) ?>" id="frm_field_weight"> |
|
40 | 40 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
41 | 41 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['field_weight'], $value ) ?>><?php echo $name ?></option> |
42 | 42 | <?php } ?> |
@@ -1,59 +1,59 @@ |
||
1 | 1 | <p> |
2 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('center_form') ) ?>" id="frm_center_form" value="1" <?php checked($style->post_content['center_form'], 1) ?> /> |
|
2 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'center_form' ) ) ?>" id="frm_center_form" value="1" <?php checked( $style->post_content['center_form'], 1 ) ?> /> |
|
3 | 3 | <?php _e( 'Center form on page', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'This will center your form on the page where it is published if the form width is less than the available width on the page.', 'formidable' ) ?>" ></span> |
4 | 4 | </label> |
5 | 5 | </p> |
6 | 6 | |
7 | 7 | <div class="field-group clearfix frm-first-row"> |
8 | 8 | <label><?php _e( 'Alignment', 'formidable' ) ?></label> |
9 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('form_align') ) ?>" id="frm_form_align"> |
|
10 | - <option value="left" <?php selected($style->post_content['form_align'], 'left') ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
11 | - <option value="right" <?php selected($style->post_content['form_align'], 'right') ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
12 | - <option value="center" <?php selected($style->post_content['form_align'], 'center') ?>><?php _e( 'center', 'formidable' ) ?></option> |
|
9 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'form_align' ) ) ?>" id="frm_form_align"> |
|
10 | + <option value="left" <?php selected( $style->post_content['form_align'], 'left' ) ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
11 | + <option value="right" <?php selected( $style->post_content['form_align'], 'right' ) ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
12 | + <option value="center" <?php selected( $style->post_content['form_align'], 'center' ) ?>><?php _e( 'center', 'formidable' ) ?></option> |
|
13 | 13 | </select> |
14 | 14 | </div> |
15 | 15 | |
16 | 16 | <div class="field-group clearfix frm-first-row"> |
17 | 17 | <label><?php _e( 'Max Width', 'formidable' ) ?></label> |
18 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_width') ) ?>" value="<?php echo esc_attr( $style->post_content['form_width'] ) ?>"/> |
|
18 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_width' ) ) ?>" value="<?php echo esc_attr( $style->post_content['form_width'] ) ?>"/> |
|
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class="field-group clearfix frm-first-row"> |
22 | 22 | <label><?php _e( 'Background', 'formidable' ) ?></label> |
23 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_bg_color') ) ?>" id="frm_fieldset_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_bg_color'] ) ?>" size="4" /> |
|
23 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_bg_color' ) ) ?>" id="frm_fieldset_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_bg_color'] ) ?>" size="4" /> |
|
24 | 24 | </div> |
25 | 25 | |
26 | 26 | <div class="field-group field-group-border clearfix"> |
27 | 27 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
28 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset') ) ?>" id="frm_fieldset" value="<?php echo esc_attr( $style->post_content['fieldset'] ) ?>" size="4" /> |
|
28 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset' ) ) ?>" id="frm_fieldset" value="<?php echo esc_attr( $style->post_content['fieldset'] ) ?>" size="4" /> |
|
29 | 29 | </div> |
30 | 30 | |
31 | 31 | <div class="field-group clearfix"> |
32 | 32 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
33 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_color') ) ?>" id="frm_fieldset_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_color'] ) ?>" /> |
|
33 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_color' ) ) ?>" id="frm_fieldset_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_color'] ) ?>" /> |
|
34 | 34 | </div> |
35 | 35 | |
36 | 36 | <div class="field-group clearfix"> |
37 | 37 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
38 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_padding') ) ?>" id="frm_fieldset_padding" value="<?php echo esc_attr( $style->post_content['fieldset_padding'] ) ?>" size="4" /> |
|
38 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_padding' ) ) ?>" id="frm_fieldset_padding" value="<?php echo esc_attr( $style->post_content['fieldset_padding'] ) ?>" size="4" /> |
|
39 | 39 | </div> |
40 | 40 | |
41 | 41 | <div id="frm_gen_font_box" class="field-group clearfix"> |
42 | 42 | <label><?php _e( 'Font Family', 'formidable' ) ?></label> |
43 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('font') ) ?>" id="frm_font" value="<?php echo esc_attr( $style->post_content['font'] ) ?>" class="frm_full_width" /> |
|
43 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'font' ) ) ?>" id="frm_font" value="<?php echo esc_attr( $style->post_content['font'] ) ?>" class="frm_full_width" /> |
|
44 | 44 | </div> |
45 | 45 | |
46 | 46 | <div class="field-group clearfix frm-half"> |
47 | 47 | <label><?php _e( 'Direction', 'formidable' ) ?></label> |
48 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('direction') ) ?>" id="frm_direction"> |
|
49 | - <option value="ltr" <?php selected($style->post_content['direction'], 'ltr') ?>><?php _e( 'Left to Right', 'formidable' ) ?></option> |
|
50 | - <option value="rtl" <?php selected($style->post_content['direction'], 'rtl') ?>><?php _e( 'Right to Left', 'formidable' ) ?></option> |
|
48 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'direction' ) ) ?>" id="frm_direction"> |
|
49 | + <option value="ltr" <?php selected( $style->post_content['direction'], 'ltr' ) ?>><?php _e( 'Left to Right', 'formidable' ) ?></option> |
|
50 | + <option value="rtl" <?php selected( $style->post_content['direction'], 'rtl' ) ?>><?php _e( 'Right to Left', 'formidable' ) ?></option> |
|
51 | 51 | </select> |
52 | 52 | </div> |
53 | 53 | |
54 | 54 | <div class="clear"></div> |
55 | 55 | <p class="frm_no_bottom_margin"> |
56 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('important_style') ) ?>" id="frm_important_style" value="1" <?php checked($style->post_content['important_style'], 1) ?> /> |
|
56 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'important_style' ) ) ?>" id="frm_important_style" value="1" <?php checked( $style->post_content['important_style'], 1 ) ?> /> |
|
57 | 57 | <?php _e( 'Override theme styling', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'This will add !important to many of the lines in the Formidable styling to make sure it will be used.', 'formidable' ) ?>" ></span> |
58 | 58 | </label> |
59 | 59 | </p> |
@@ -121,6 +121,9 @@ |
||
121 | 121 | $stylesheet_urls['formidable'] = $url; |
122 | 122 | } |
123 | 123 | |
124 | + /** |
|
125 | + * @param string $version |
|
126 | + */ |
|
124 | 127 | private static function get_css_version( $css_key, $version ) { |
125 | 128 | if ( 'formidable' == $css_key ) { |
126 | 129 | $this_version = get_option( 'frm_last_style_update' ); |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | class FrmStylesController { |
4 | - public static $post_type = 'frm_styles'; |
|
5 | - public static $screen = 'formidable_page_formidable-styles'; |
|
6 | - |
|
7 | - public static function load_pro_hooks() { |
|
8 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
9 | - FrmProStylesController::load_pro_hooks(); |
|
10 | - } |
|
11 | - } |
|
12 | - |
|
13 | - public static function register_post_types() { |
|
14 | - register_post_type( self::$post_type, array( |
|
15 | - 'label' => __( 'Styles', 'formidable' ), |
|
16 | - 'public' => false, |
|
17 | - 'show_ui' => false, |
|
18 | - 'capability_type' => 'page', |
|
4 | + public static $post_type = 'frm_styles'; |
|
5 | + public static $screen = 'formidable_page_formidable-styles'; |
|
6 | + |
|
7 | + public static function load_pro_hooks() { |
|
8 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
9 | + FrmProStylesController::load_pro_hooks(); |
|
10 | + } |
|
11 | + } |
|
12 | + |
|
13 | + public static function register_post_types() { |
|
14 | + register_post_type( self::$post_type, array( |
|
15 | + 'label' => __( 'Styles', 'formidable' ), |
|
16 | + 'public' => false, |
|
17 | + 'show_ui' => false, |
|
18 | + 'capability_type' => 'page', |
|
19 | 19 | 'capabilities' => array( |
20 | 20 | 'edit_post' => 'frm_change_settings', |
21 | 21 | 'edit_posts' => 'frm_change_settings', |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | 'delete_posts' => 'frm_change_settings', |
26 | 26 | 'read_private_posts' => 'read_private_posts', |
27 | 27 | ), |
28 | - 'supports' => array( |
|
28 | + 'supports' => array( |
|
29 | 29 | 'title', |
30 | - ), |
|
31 | - 'has_archive' => false, |
|
32 | - 'labels' => array( |
|
30 | + ), |
|
31 | + 'has_archive' => false, |
|
32 | + 'labels' => array( |
|
33 | 33 | 'name' => __( 'Styles', 'formidable' ), |
34 | 34 | 'singular_name' => __( 'Style', 'formidable' ), |
35 | 35 | 'menu_name' => __( 'Style', 'formidable' ), |
@@ -37,31 +37,31 @@ discard block |
||
37 | 37 | 'add_new_item' => __( 'Create a New Style', 'formidable' ), |
38 | 38 | 'edit_item' => __( 'Edit Style', 'formidable' ), |
39 | 39 | ), |
40 | - ) ); |
|
41 | - } |
|
40 | + ) ); |
|
41 | + } |
|
42 | 42 | |
43 | - public static function menu() { |
|
44 | - add_submenu_page('formidable', 'Formidable | '. __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route'); |
|
45 | - } |
|
43 | + public static function menu() { |
|
44 | + add_submenu_page('formidable', 'Formidable | '. __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route'); |
|
45 | + } |
|
46 | 46 | |
47 | - public static function admin_init() { |
|
48 | - if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) { |
|
49 | - return; |
|
50 | - } |
|
47 | + public static function admin_init() { |
|
48 | + if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) { |
|
49 | + return; |
|
50 | + } |
|
51 | 51 | |
52 | - self::load_pro_hooks(); |
|
53 | - wp_enqueue_script('jquery-ui-datepicker'); |
|
52 | + self::load_pro_hooks(); |
|
53 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
54 | 54 | |
55 | - $version = FrmAppHelper::plugin_version(); |
|
55 | + $version = FrmAppHelper::plugin_version(); |
|
56 | 56 | wp_enqueue_script( 'jquery-frm-themepicker', FrmAppHelper::plugin_url() . '/js/jquery/jquery-ui-themepicker.js', array( 'jquery' ), $version ); |
57 | 57 | |
58 | 58 | wp_enqueue_style( 'frm-custom-theme', admin_url('admin-ajax.php?action=frmpro_css' ) ); |
59 | 59 | |
60 | - $style = apply_filters('frm_style_head', false); |
|
61 | - if ( $style ) { |
|
60 | + $style = apply_filters('frm_style_head', false); |
|
61 | + if ( $style ) { |
|
62 | 62 | wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) .'&'. http_build_query( $style->post_content ) ); |
63 | - } |
|
64 | - } |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | 66 | public static function enqueue_css( $register = 'enqueue' ) { |
67 | 67 | global $frm_vars; |
@@ -141,230 +141,230 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | public static function new_style( $return = '' ) { |
144 | - self::load_styler('default'); |
|
145 | - } |
|
144 | + self::load_styler('default'); |
|
145 | + } |
|
146 | 146 | |
147 | 147 | public static function duplicate() { |
148 | 148 | self::load_styler('default'); |
149 | 149 | } |
150 | 150 | |
151 | 151 | public static function edit( $style_id = false, $message = '' ) { |
152 | - if ( ! $style_id ) { |
|
152 | + if ( ! $style_id ) { |
|
153 | 153 | $style_id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
154 | - if ( empty($style_id) ) { |
|
155 | - $style_id = 'default'; |
|
156 | - } |
|
157 | - } |
|
158 | - |
|
159 | - if ( 'default' == $style_id ) { |
|
160 | - $style = 'default'; |
|
161 | - } else { |
|
162 | - $frm_style = new FrmStyle($style_id); |
|
163 | - $style = $frm_style->get_one(); |
|
164 | - $style = $style->ID; |
|
165 | - } |
|
166 | - |
|
167 | - self::load_styler($style, $message); |
|
168 | - } |
|
169 | - |
|
170 | - public static function save() { |
|
171 | - $frm_style = new FrmStyle(); |
|
172 | - $message = ''; |
|
154 | + if ( empty($style_id) ) { |
|
155 | + $style_id = 'default'; |
|
156 | + } |
|
157 | + } |
|
158 | + |
|
159 | + if ( 'default' == $style_id ) { |
|
160 | + $style = 'default'; |
|
161 | + } else { |
|
162 | + $frm_style = new FrmStyle($style_id); |
|
163 | + $style = $frm_style->get_one(); |
|
164 | + $style = $style->ID; |
|
165 | + } |
|
166 | + |
|
167 | + self::load_styler($style, $message); |
|
168 | + } |
|
169 | + |
|
170 | + public static function save() { |
|
171 | + $frm_style = new FrmStyle(); |
|
172 | + $message = ''; |
|
173 | 173 | $post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_title' ); |
174 | 174 | $style_nonce = FrmAppHelper::get_post_param( 'frm_style', '', 'sanitize_text_field' ); |
175 | 175 | |
176 | 176 | if ( $post_id !== false && wp_verify_nonce( $style_nonce, 'frm_style_nonce' ) ) { |
177 | - $id = $frm_style->update($post_id); |
|
178 | - if ( empty($post_id) && ! empty($id) ) { |
|
179 | - // set the post id to the new style so it will be loaded for editing |
|
180 | - $post_id = reset($id); |
|
181 | - } |
|
182 | - // include the CSS that includes this style |
|
177 | + $id = $frm_style->update($post_id); |
|
178 | + if ( empty($post_id) && ! empty($id) ) { |
|
179 | + // set the post id to the new style so it will be loaded for editing |
|
180 | + $post_id = reset($id); |
|
181 | + } |
|
182 | + // include the CSS that includes this style |
|
183 | 183 | echo '<link href="' . esc_url( admin_url( 'admin-ajax.php?action=frmpro_css' ) ) . '" type="text/css" rel="Stylesheet" class="frm-custom-theme" />'; |
184 | - $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
185 | - } |
|
184 | + $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
185 | + } |
|
186 | 186 | |
187 | - return self::edit($post_id, $message); |
|
188 | - } |
|
187 | + return self::edit($post_id, $message); |
|
188 | + } |
|
189 | 189 | |
190 | 190 | public static function load_styler( $style, $message = '' ) { |
191 | - global $frm_settings; |
|
191 | + global $frm_settings; |
|
192 | 192 | |
193 | - $frm_style = new FrmStyle(); |
|
194 | - $styles = $frm_style->get_all(); |
|
193 | + $frm_style = new FrmStyle(); |
|
194 | + $styles = $frm_style->get_all(); |
|
195 | 195 | |
196 | - if ( is_numeric($style) ) { |
|
197 | - $style = $styles[ $style ]; |
|
198 | - } else if ( 'default' == $style ) { |
|
199 | - $style = $frm_style->get_default_style($styles); |
|
200 | - } |
|
196 | + if ( is_numeric($style) ) { |
|
197 | + $style = $styles[ $style ]; |
|
198 | + } else if ( 'default' == $style ) { |
|
199 | + $style = $frm_style->get_default_style($styles); |
|
200 | + } |
|
201 | 201 | |
202 | - self::add_meta_boxes(); |
|
202 | + self::add_meta_boxes(); |
|
203 | 203 | |
204 | - include(FrmAppHelper::plugin_path() .'/classes/views/styles/show.php'); |
|
205 | - } |
|
204 | + include(FrmAppHelper::plugin_path() .'/classes/views/styles/show.php'); |
|
205 | + } |
|
206 | 206 | |
207 | 207 | /** |
208 | 208 | * @param string $message |
209 | 209 | * @param array|object $forms |
210 | 210 | */ |
211 | 211 | private static function manage( $message = '', $forms = array() ) { |
212 | - $frm_style = new FrmStyle(); |
|
213 | - $styles = $frm_style->get_all(); |
|
214 | - $default_style = $frm_style->get_default_style($styles); |
|
212 | + $frm_style = new FrmStyle(); |
|
213 | + $styles = $frm_style->get_all(); |
|
214 | + $default_style = $frm_style->get_default_style($styles); |
|
215 | 215 | |
216 | - if ( empty($forms) ) { |
|
217 | - $forms = FrmForm::get_published_forms(); |
|
218 | - } |
|
216 | + if ( empty($forms) ) { |
|
217 | + $forms = FrmForm::get_published_forms(); |
|
218 | + } |
|
219 | 219 | |
220 | - include(FrmAppHelper::plugin_path() .'/classes/views/styles/manage.php'); |
|
221 | - } |
|
220 | + include(FrmAppHelper::plugin_path() .'/classes/views/styles/manage.php'); |
|
221 | + } |
|
222 | 222 | |
223 | - private static function manage_styles() { |
|
223 | + private static function manage_styles() { |
|
224 | 224 | $style_nonce = FrmAppHelper::get_post_param( 'frm_manage_style', '', 'sanitize_text_field' ); |
225 | 225 | if ( ! $_POST || ! isset( $_POST['style'] ) || ! wp_verify_nonce( $style_nonce, 'frm_manage_style_nonce' ) ) { |
226 | - return self::manage(); |
|
227 | - } |
|
226 | + return self::manage(); |
|
227 | + } |
|
228 | 228 | |
229 | - global $wpdb; |
|
229 | + global $wpdb; |
|
230 | 230 | |
231 | 231 | $forms = FrmForm::get_published_forms(); |
232 | - foreach ( $forms as $form ) { |
|
233 | - if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
234 | - continue; |
|
235 | - } |
|
232 | + foreach ( $forms as $form ) { |
|
233 | + if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
234 | + continue; |
|
235 | + } |
|
236 | 236 | |
237 | - $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
237 | + $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
238 | 238 | |
239 | 239 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) ); |
240 | - unset($form); |
|
241 | - } |
|
240 | + unset($form); |
|
241 | + } |
|
242 | 242 | |
243 | - $message = __( 'Your form styles have been saved.', 'formidable' ); |
|
244 | - return self::manage($message, $forms); |
|
245 | - } |
|
243 | + $message = __( 'Your form styles have been saved.', 'formidable' ); |
|
244 | + return self::manage($message, $forms); |
|
245 | + } |
|
246 | 246 | |
247 | - public static function custom_css( $message = '', $style = null ) { |
|
248 | - wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css'); |
|
249 | - wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7'); |
|
250 | - wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' ); |
|
247 | + public static function custom_css( $message = '', $style = null ) { |
|
248 | + wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css'); |
|
249 | + wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7'); |
|
250 | + wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' ); |
|
251 | 251 | |
252 | - if ( ! isset($style) ) { |
|
253 | - $frm_style = new FrmStyle(); |
|
254 | - $style = $frm_style->get_default_style(); |
|
255 | - } |
|
252 | + if ( ! isset($style) ) { |
|
253 | + $frm_style = new FrmStyle(); |
|
254 | + $style = $frm_style->get_default_style(); |
|
255 | + } |
|
256 | 256 | |
257 | - include(FrmAppHelper::plugin_path() .'/classes/views/styles/custom_css.php'); |
|
258 | - } |
|
257 | + include(FrmAppHelper::plugin_path() .'/classes/views/styles/custom_css.php'); |
|
258 | + } |
|
259 | 259 | |
260 | - public static function save_css() { |
|
261 | - $frm_style = new FrmStyle(); |
|
260 | + public static function save_css() { |
|
261 | + $frm_style = new FrmStyle(); |
|
262 | 262 | |
263 | - $message = ''; |
|
263 | + $message = ''; |
|
264 | 264 | $post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_text_field' ); |
265 | 265 | $nonce = FrmAppHelper::get_post_param( 'frm_custom_css', '', 'sanitize_text_field' ); |
266 | 266 | if ( wp_verify_nonce( $nonce, 'frm_custom_css_nonce' ) ) { |
267 | - $frm_style->update($post_id); |
|
268 | - $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
269 | - } |
|
267 | + $frm_style->update($post_id); |
|
268 | + $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
269 | + } |
|
270 | 270 | |
271 | - return self::custom_css($message); |
|
272 | - } |
|
271 | + return self::custom_css($message); |
|
272 | + } |
|
273 | 273 | |
274 | - public static function route() { |
|
274 | + public static function route() { |
|
275 | 275 | $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
276 | 276 | |
277 | - switch ( $action ) { |
|
278 | - case 'edit': |
|
279 | - case 'save': |
|
280 | - case 'manage': |
|
281 | - case 'manage_styles': |
|
282 | - case 'custom_css': |
|
283 | - case 'save_css': |
|
277 | + switch ( $action ) { |
|
278 | + case 'edit': |
|
279 | + case 'save': |
|
280 | + case 'manage': |
|
281 | + case 'manage_styles': |
|
282 | + case 'custom_css': |
|
283 | + case 'save_css': |
|
284 | 284 | return self::$action(); |
285 | - default: |
|
286 | - do_action( 'frm_style_action_route', $action ); |
|
287 | - if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) { |
|
288 | - return; |
|
289 | - } |
|
285 | + default: |
|
286 | + do_action( 'frm_style_action_route', $action ); |
|
287 | + if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) { |
|
288 | + return; |
|
289 | + } |
|
290 | 290 | |
291 | - if ( 'new_style' == $action || 'duplicate' == $action ) { |
|
292 | - return self::$action(); |
|
293 | - } |
|
291 | + if ( 'new_style' == $action || 'duplicate' == $action ) { |
|
292 | + return self::$action(); |
|
293 | + } |
|
294 | 294 | |
295 | - return self::edit(); |
|
296 | - } |
|
297 | - } |
|
295 | + return self::edit(); |
|
296 | + } |
|
297 | + } |
|
298 | 298 | |
299 | - public static function reset_styling() { |
|
299 | + public static function reset_styling() { |
|
300 | 300 | FrmAppHelper::permission_check('frm_change_settings'); |
301 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
302 | - |
|
303 | - $frm_style = new FrmStyle(); |
|
304 | - $defaults = $frm_style->get_defaults(); |
|
305 | - |
|
306 | - echo json_encode( $defaults ); |
|
307 | - wp_die(); |
|
308 | - } |
|
309 | - |
|
310 | - public static function change_styling() { |
|
311 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
312 | - |
|
313 | - $frm_style = new FrmStyle(); |
|
314 | - $defaults = $frm_style->get_defaults(); |
|
315 | - |
|
316 | - // remove the # from the colors |
|
317 | - foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) { |
|
318 | - if ( ! is_array($v) && strpos($v, '#') === 0 ) { |
|
319 | - $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v ); |
|
320 | - } |
|
321 | - } |
|
322 | - |
|
323 | - echo '<style type="text/css">'; |
|
324 | - include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php'); |
|
325 | - echo '</style>'; |
|
326 | - wp_die(); |
|
327 | - } |
|
328 | - |
|
329 | - private static function add_meta_boxes() { |
|
330 | - |
|
331 | - // setup meta boxes |
|
332 | - $meta_boxes = array( |
|
333 | - 'general' => __( 'General', 'formidable' ), |
|
334 | - 'form-title' => __( 'Form Title', 'formidable' ), |
|
335 | - 'form-description' => __( 'Form Description', 'formidable' ), |
|
336 | - 'field-labels' => __( 'Field Labels', 'formidable' ), |
|
337 | - 'field-description' => __( 'Field Description', 'formidable' ), |
|
338 | - 'field-colors' => __( 'Field Colors', 'formidable' ), |
|
339 | - 'field-sizes' => __( 'Field Settings', 'formidable' ), |
|
340 | - 'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ), |
|
341 | - 'section-fields' => __( 'Section Fields', 'formidable' ), |
|
342 | - 'date-fields' => __( 'Date Fields', 'formidable' ), |
|
343 | - 'buttons' => __( 'Buttons', 'formidable' ), |
|
344 | - 'form-messages' => __( 'Form Messages', 'formidable' ), |
|
345 | - ); |
|
346 | - |
|
347 | - foreach ( $meta_boxes as $nicename => $name ) { |
|
348 | - add_meta_box( $nicename .'-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename ); |
|
349 | - unset($nicename, $name); |
|
350 | - } |
|
351 | - } |
|
301 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
302 | + |
|
303 | + $frm_style = new FrmStyle(); |
|
304 | + $defaults = $frm_style->get_defaults(); |
|
305 | + |
|
306 | + echo json_encode( $defaults ); |
|
307 | + wp_die(); |
|
308 | + } |
|
309 | + |
|
310 | + public static function change_styling() { |
|
311 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
312 | + |
|
313 | + $frm_style = new FrmStyle(); |
|
314 | + $defaults = $frm_style->get_defaults(); |
|
315 | + |
|
316 | + // remove the # from the colors |
|
317 | + foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) { |
|
318 | + if ( ! is_array($v) && strpos($v, '#') === 0 ) { |
|
319 | + $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v ); |
|
320 | + } |
|
321 | + } |
|
322 | + |
|
323 | + echo '<style type="text/css">'; |
|
324 | + include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php'); |
|
325 | + echo '</style>'; |
|
326 | + wp_die(); |
|
327 | + } |
|
328 | + |
|
329 | + private static function add_meta_boxes() { |
|
330 | + |
|
331 | + // setup meta boxes |
|
332 | + $meta_boxes = array( |
|
333 | + 'general' => __( 'General', 'formidable' ), |
|
334 | + 'form-title' => __( 'Form Title', 'formidable' ), |
|
335 | + 'form-description' => __( 'Form Description', 'formidable' ), |
|
336 | + 'field-labels' => __( 'Field Labels', 'formidable' ), |
|
337 | + 'field-description' => __( 'Field Description', 'formidable' ), |
|
338 | + 'field-colors' => __( 'Field Colors', 'formidable' ), |
|
339 | + 'field-sizes' => __( 'Field Settings', 'formidable' ), |
|
340 | + 'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ), |
|
341 | + 'section-fields' => __( 'Section Fields', 'formidable' ), |
|
342 | + 'date-fields' => __( 'Date Fields', 'formidable' ), |
|
343 | + 'buttons' => __( 'Buttons', 'formidable' ), |
|
344 | + 'form-messages' => __( 'Form Messages', 'formidable' ), |
|
345 | + ); |
|
346 | + |
|
347 | + foreach ( $meta_boxes as $nicename => $name ) { |
|
348 | + add_meta_box( $nicename .'-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename ); |
|
349 | + unset($nicename, $name); |
|
350 | + } |
|
351 | + } |
|
352 | 352 | |
353 | 353 | public static function include_style_section( $atts, $sec ) { |
354 | - extract($atts); |
|
354 | + extract($atts); |
|
355 | 355 | $current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' ); |
356 | - include(FrmAppHelper::plugin_path() .'/classes/views/styles/_'. $sec['args'] .'.php'); |
|
357 | - } |
|
356 | + include(FrmAppHelper::plugin_path() .'/classes/views/styles/_'. $sec['args'] .'.php'); |
|
357 | + } |
|
358 | 358 | |
359 | - public static function load_css() { |
|
360 | - header('Content-type: text/css'); |
|
359 | + public static function load_css() { |
|
360 | + header('Content-type: text/css'); |
|
361 | 361 | |
362 | - $frm_style = new FrmStyle(); |
|
363 | - $defaults = $frm_style->get_defaults(); |
|
362 | + $frm_style = new FrmStyle(); |
|
363 | + $defaults = $frm_style->get_defaults(); |
|
364 | 364 | |
365 | - include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php'); |
|
366 | - wp_die(); |
|
367 | - } |
|
365 | + include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php'); |
|
366 | + wp_die(); |
|
367 | + } |
|
368 | 368 | |
369 | 369 | public static function load_saved_css() { |
370 | 370 | $css = get_transient( 'frmpro_css' ); |
@@ -373,142 +373,142 @@ discard block |
||
373 | 373 | wp_die(); |
374 | 374 | } |
375 | 375 | |
376 | - /** |
|
377 | - * Check if the Formidable styling should be loaded, |
|
378 | - * then enqueue it for the footer |
|
379 | - * @since 2.0 |
|
380 | - */ |
|
381 | - public static function enqueue_style() { |
|
382 | - global $frm_vars; |
|
383 | - |
|
384 | - if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) { |
|
385 | - // the CSS has already been loaded |
|
386 | - return; |
|
387 | - } |
|
388 | - |
|
389 | - $frm_settings = FrmAppHelper::get_settings(); |
|
390 | - if ( $frm_settings->load_style != 'none' ) { |
|
391 | - wp_enqueue_style( 'formidable' ); |
|
392 | - $frm_vars['css_loaded'] = true; |
|
393 | - } |
|
394 | - } |
|
395 | - |
|
396 | - // Get the stylesheets for the form settings page |
|
397 | - public static function get_style_opts() { |
|
398 | - $frm_style = new FrmStyle(); |
|
399 | - $styles = $frm_style->get_all(); |
|
400 | - |
|
401 | - return $styles; |
|
402 | - } |
|
403 | - |
|
404 | - public static function get_form_style( $form = 'default' ) { |
|
405 | - $style = FrmFormsHelper::get_form_style( $form ); |
|
406 | - |
|
407 | - if ( empty( $style ) || 1 == $style ) { |
|
408 | - $style = 'default'; |
|
409 | - } |
|
410 | - |
|
411 | - $frm_style = new FrmStyle( $style ); |
|
412 | - return $frm_style->get_one(); |
|
413 | - } |
|
414 | - |
|
415 | - /** |
|
416 | - * @param string $class |
|
417 | - * @param string $style |
|
418 | - */ |
|
376 | + /** |
|
377 | + * Check if the Formidable styling should be loaded, |
|
378 | + * then enqueue it for the footer |
|
379 | + * @since 2.0 |
|
380 | + */ |
|
381 | + public static function enqueue_style() { |
|
382 | + global $frm_vars; |
|
383 | + |
|
384 | + if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) { |
|
385 | + // the CSS has already been loaded |
|
386 | + return; |
|
387 | + } |
|
388 | + |
|
389 | + $frm_settings = FrmAppHelper::get_settings(); |
|
390 | + if ( $frm_settings->load_style != 'none' ) { |
|
391 | + wp_enqueue_style( 'formidable' ); |
|
392 | + $frm_vars['css_loaded'] = true; |
|
393 | + } |
|
394 | + } |
|
395 | + |
|
396 | + // Get the stylesheets for the form settings page |
|
397 | + public static function get_style_opts() { |
|
398 | + $frm_style = new FrmStyle(); |
|
399 | + $styles = $frm_style->get_all(); |
|
400 | + |
|
401 | + return $styles; |
|
402 | + } |
|
403 | + |
|
404 | + public static function get_form_style( $form = 'default' ) { |
|
405 | + $style = FrmFormsHelper::get_form_style( $form ); |
|
406 | + |
|
407 | + if ( empty( $style ) || 1 == $style ) { |
|
408 | + $style = 'default'; |
|
409 | + } |
|
410 | + |
|
411 | + $frm_style = new FrmStyle( $style ); |
|
412 | + return $frm_style->get_one(); |
|
413 | + } |
|
414 | + |
|
415 | + /** |
|
416 | + * @param string $class |
|
417 | + * @param string $style |
|
418 | + */ |
|
419 | 419 | public static function get_form_style_class( $class, $style ) { |
420 | - if ( 1 == $style ) { |
|
421 | - $style = 'default'; |
|
422 | - } |
|
420 | + if ( 1 == $style ) { |
|
421 | + $style = 'default'; |
|
422 | + } |
|
423 | 423 | |
424 | - $frm_style = new FrmStyle($style); |
|
425 | - $style = $frm_style->get_one(); |
|
424 | + $frm_style = new FrmStyle($style); |
|
425 | + $style = $frm_style->get_one(); |
|
426 | 426 | |
427 | - if ( $style ) { |
|
428 | - $class .= ' frm_style_'. $style->post_name; |
|
429 | - } |
|
427 | + if ( $style ) { |
|
428 | + $class .= ' frm_style_'. $style->post_name; |
|
429 | + } |
|
430 | 430 | |
431 | - return $class; |
|
432 | - } |
|
431 | + return $class; |
|
432 | + } |
|
433 | 433 | |
434 | - /** |
|
435 | - * @param string $val |
|
436 | - */ |
|
434 | + /** |
|
435 | + * @param string $val |
|
436 | + */ |
|
437 | 437 | public static function get_style_val( $val, $form = 'default' ) { |
438 | - $style = self::get_form_style($form); |
|
439 | - if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
440 | - return $style->post_content[ $val ]; |
|
441 | - } |
|
442 | - } |
|
438 | + $style = self::get_form_style($form); |
|
439 | + if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
440 | + return $style->post_content[ $val ]; |
|
441 | + } |
|
442 | + } |
|
443 | 443 | |
444 | 444 | public static function show_entry_styles( $default_styles ) { |
445 | - $frm_style = new FrmStyle('default'); |
|
446 | - $style = $frm_style->get_one(); |
|
447 | - |
|
448 | - if ( ! $style ) { |
|
449 | - return $default_styles; |
|
450 | - } |
|
451 | - |
|
452 | - foreach ( $default_styles as $name => $val ) { |
|
453 | - $setting = $name; |
|
454 | - if ( 'border_width' == $name ) { |
|
455 | - $setting = 'field_border_width'; |
|
456 | - } else if ( 'alt_bg_color' == $name ) { |
|
457 | - $setting = 'bg_color_active'; |
|
458 | - } |
|
459 | - $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
460 | - unset($name, $val); |
|
461 | - } |
|
462 | - |
|
463 | - return $default_styles; |
|
464 | - } |
|
445 | + $frm_style = new FrmStyle('default'); |
|
446 | + $style = $frm_style->get_one(); |
|
447 | + |
|
448 | + if ( ! $style ) { |
|
449 | + return $default_styles; |
|
450 | + } |
|
451 | + |
|
452 | + foreach ( $default_styles as $name => $val ) { |
|
453 | + $setting = $name; |
|
454 | + if ( 'border_width' == $name ) { |
|
455 | + $setting = 'field_border_width'; |
|
456 | + } else if ( 'alt_bg_color' == $name ) { |
|
457 | + $setting = 'bg_color_active'; |
|
458 | + } |
|
459 | + $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
460 | + unset($name, $val); |
|
461 | + } |
|
462 | + |
|
463 | + return $default_styles; |
|
464 | + } |
|
465 | 465 | |
466 | 466 | public static function &important_style( $important, $field ) { |
467 | - $important = self::get_style_val('important_style', $field['form_id']); |
|
468 | - return $important; |
|
469 | - } |
|
467 | + $important = self::get_style_val('important_style', $field['form_id']); |
|
468 | + return $important; |
|
469 | + } |
|
470 | 470 | |
471 | - /** |
|
472 | - * Fallback for WP < 3.6 |
|
473 | - */ |
|
474 | - public static function do_accordion_sections( $screen, $context, $object ) { |
|
475 | - if ( function_exists( 'do_accordion_sections' ) ) { |
|
476 | - return do_accordion_sections( $screen, $context, $object ); |
|
477 | - } |
|
471 | + /** |
|
472 | + * Fallback for WP < 3.6 |
|
473 | + */ |
|
474 | + public static function do_accordion_sections( $screen, $context, $object ) { |
|
475 | + if ( function_exists( 'do_accordion_sections' ) ) { |
|
476 | + return do_accordion_sections( $screen, $context, $object ); |
|
477 | + } |
|
478 | 478 | |
479 | - global $wp_meta_boxes; |
|
479 | + global $wp_meta_boxes; |
|
480 | 480 | |
481 | - $screen = 'formidable_page_formidable-styles'; |
|
482 | - $screen = convert_to_screen( $screen ); |
|
481 | + $screen = 'formidable_page_formidable-styles'; |
|
482 | + $screen = convert_to_screen( $screen ); |
|
483 | 483 | |
484 | - $page = $screen->id; |
|
484 | + $page = $screen->id; |
|
485 | 485 | |
486 | - $hidden = get_hidden_meta_boxes( $screen ); |
|
487 | - ?> |
|
486 | + $hidden = get_hidden_meta_boxes( $screen ); |
|
487 | + ?> |
|
488 | 488 | <div id="side-sortables" class="accordion-container"> |
489 | 489 | <?php |
490 | - $i = 0; |
|
491 | - $first_open = false; |
|
492 | - do { |
|
490 | + $i = 0; |
|
491 | + $first_open = false; |
|
492 | + do { |
|
493 | 493 | if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
494 | 494 | break; |
495 | 495 | } |
496 | 496 | |
497 | - foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
|
498 | - if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
499 | - foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
500 | - if ( false == $box || ! $box['title'] ) { |
|
501 | - continue; |
|
497 | + foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
|
498 | + if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
499 | + foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
500 | + if ( false == $box || ! $box['title'] ) { |
|
501 | + continue; |
|
502 | 502 | } |
503 | 503 | |
504 | - $i++; |
|
505 | - $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
|
504 | + $i++; |
|
505 | + $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
|
506 | 506 | |
507 | - if ( ! $first_open && empty( $hidden_class ) ) { |
|
508 | - $first_open = true; |
|
509 | - } |
|
507 | + if ( ! $first_open && empty( $hidden_class ) ) { |
|
508 | + $first_open = true; |
|
509 | + } |
|
510 | 510 | |
511 | - ?> |
|
511 | + ?> |
|
512 | 512 | <div class="postbox <?php echo esc_attr( $box['id'] ); ?>"> |
513 | 513 | <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'formidable' ) ?>"><br/></div> |
514 | 514 | <h3 class='hndle'><span><?php echo esc_html( $box['title'] ); ?></span></h3> |
@@ -519,13 +519,13 @@ discard block |
||
519 | 519 | </div><!-- .accordion-section-content --> |
520 | 520 | </div><!-- .postbox --> |
521 | 521 | <?php |
522 | - } |
|
523 | - } |
|
524 | - } |
|
525 | - } while ( 0 ); |
|
526 | - ?> |
|
522 | + } |
|
523 | + } |
|
524 | + } |
|
525 | + } while ( 0 ); |
|
526 | + ?> |
|
527 | 527 | </div><!-- .accordion-container --> |
528 | 528 | <?php |
529 | - return $i; |
|
530 | - } |
|
529 | + return $i; |
|
530 | + } |
|
531 | 531 | } |
@@ -41,25 +41,25 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | public static function menu() { |
44 | - add_submenu_page('formidable', 'Formidable | '. __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route'); |
|
44 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' ); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public static function admin_init() { |
48 | - if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) { |
|
48 | + if ( ! FrmAppHelper::is_admin_page( 'formidable-styles' ) ) { |
|
49 | 49 | return; |
50 | 50 | } |
51 | 51 | |
52 | 52 | self::load_pro_hooks(); |
53 | - wp_enqueue_script('jquery-ui-datepicker'); |
|
53 | + wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
54 | 54 | |
55 | 55 | $version = FrmAppHelper::plugin_version(); |
56 | 56 | wp_enqueue_script( 'jquery-frm-themepicker', FrmAppHelper::plugin_url() . '/js/jquery/jquery-ui-themepicker.js', array( 'jquery' ), $version ); |
57 | 57 | |
58 | - wp_enqueue_style( 'frm-custom-theme', admin_url('admin-ajax.php?action=frmpro_css' ) ); |
|
58 | + wp_enqueue_style( 'frm-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_css' ) ); |
|
59 | 59 | |
60 | - $style = apply_filters('frm_style_head', false); |
|
60 | + $style = apply_filters( 'frm_style_head', false ); |
|
61 | 61 | if ( $style ) { |
62 | - wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) .'&'. http_build_query( $style->post_content ) ); |
|
62 | + wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ) ); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
@@ -141,17 +141,17 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | public static function new_style( $return = '' ) { |
144 | - self::load_styler('default'); |
|
144 | + self::load_styler( 'default' ); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | public static function duplicate() { |
148 | - self::load_styler('default'); |
|
148 | + self::load_styler( 'default' ); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | public static function edit( $style_id = false, $message = '' ) { |
152 | 152 | if ( ! $style_id ) { |
153 | 153 | $style_id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
154 | - if ( empty($style_id) ) { |
|
154 | + if ( empty( $style_id ) ) { |
|
155 | 155 | $style_id = 'default'; |
156 | 156 | } |
157 | 157 | } |
@@ -159,12 +159,12 @@ discard block |
||
159 | 159 | if ( 'default' == $style_id ) { |
160 | 160 | $style = 'default'; |
161 | 161 | } else { |
162 | - $frm_style = new FrmStyle($style_id); |
|
162 | + $frm_style = new FrmStyle( $style_id ); |
|
163 | 163 | $style = $frm_style->get_one(); |
164 | 164 | $style = $style->ID; |
165 | 165 | } |
166 | 166 | |
167 | - self::load_styler($style, $message); |
|
167 | + self::load_styler( $style, $message ); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | public static function save() { |
@@ -174,17 +174,17 @@ discard block |
||
174 | 174 | $style_nonce = FrmAppHelper::get_post_param( 'frm_style', '', 'sanitize_text_field' ); |
175 | 175 | |
176 | 176 | if ( $post_id !== false && wp_verify_nonce( $style_nonce, 'frm_style_nonce' ) ) { |
177 | - $id = $frm_style->update($post_id); |
|
178 | - if ( empty($post_id) && ! empty($id) ) { |
|
177 | + $id = $frm_style->update( $post_id ); |
|
178 | + if ( empty( $post_id ) && ! empty( $id ) ) { |
|
179 | 179 | // set the post id to the new style so it will be loaded for editing |
180 | - $post_id = reset($id); |
|
180 | + $post_id = reset( $id ); |
|
181 | 181 | } |
182 | 182 | // include the CSS that includes this style |
183 | 183 | echo '<link href="' . esc_url( admin_url( 'admin-ajax.php?action=frmpro_css' ) ) . '" type="text/css" rel="Stylesheet" class="frm-custom-theme" />'; |
184 | 184 | $message = __( 'Your styling settings have been saved.', 'formidable' ); |
185 | 185 | } |
186 | 186 | |
187 | - return self::edit($post_id, $message); |
|
187 | + return self::edit( $post_id, $message ); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | public static function load_styler( $style, $message = '' ) { |
@@ -193,15 +193,15 @@ discard block |
||
193 | 193 | $frm_style = new FrmStyle(); |
194 | 194 | $styles = $frm_style->get_all(); |
195 | 195 | |
196 | - if ( is_numeric($style) ) { |
|
197 | - $style = $styles[ $style ]; |
|
196 | + if ( is_numeric( $style ) ) { |
|
197 | + $style = $styles[$style]; |
|
198 | 198 | } else if ( 'default' == $style ) { |
199 | - $style = $frm_style->get_default_style($styles); |
|
199 | + $style = $frm_style->get_default_style( $styles ); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | self::add_meta_boxes(); |
203 | 203 | |
204 | - include(FrmAppHelper::plugin_path() .'/classes/views/styles/show.php'); |
|
204 | + include( FrmAppHelper::plugin_path() . '/classes/views/styles/show.php' ); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | private static function manage( $message = '', $forms = array() ) { |
212 | 212 | $frm_style = new FrmStyle(); |
213 | 213 | $styles = $frm_style->get_all(); |
214 | - $default_style = $frm_style->get_default_style($styles); |
|
214 | + $default_style = $frm_style->get_default_style( $styles ); |
|
215 | 215 | |
216 | - if ( empty($forms) ) { |
|
216 | + if ( empty( $forms ) ) { |
|
217 | 217 | $forms = FrmForm::get_published_forms(); |
218 | 218 | } |
219 | 219 | |
220 | - include(FrmAppHelper::plugin_path() .'/classes/views/styles/manage.php'); |
|
220 | + include( FrmAppHelper::plugin_path() . '/classes/views/styles/manage.php' ); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | private static function manage_styles() { |
@@ -230,31 +230,31 @@ discard block |
||
230 | 230 | |
231 | 231 | $forms = FrmForm::get_published_forms(); |
232 | 232 | foreach ( $forms as $form ) { |
233 | - if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
233 | + if ( $_POST['style'][$form->id] == $_POST['prev_style'][$form->id] ) { |
|
234 | 234 | continue; |
235 | 235 | } |
236 | 236 | |
237 | - $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
237 | + $form->options['custom_style'] = $_POST['style'][$form->id]; |
|
238 | 238 | |
239 | 239 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) ); |
240 | - unset($form); |
|
240 | + unset( $form ); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | $message = __( 'Your form styles have been saved.', 'formidable' ); |
244 | - return self::manage($message, $forms); |
|
244 | + return self::manage( $message, $forms ); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | public static function custom_css( $message = '', $style = null ) { |
248 | - wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css'); |
|
249 | - wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7'); |
|
248 | + wp_enqueue_style( 'codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css' ); |
|
249 | + wp_enqueue_script( 'codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7' ); |
|
250 | 250 | wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' ); |
251 | 251 | |
252 | - if ( ! isset($style) ) { |
|
252 | + if ( ! isset( $style ) ) { |
|
253 | 253 | $frm_style = new FrmStyle(); |
254 | 254 | $style = $frm_style->get_default_style(); |
255 | 255 | } |
256 | 256 | |
257 | - include(FrmAppHelper::plugin_path() .'/classes/views/styles/custom_css.php'); |
|
257 | + include( FrmAppHelper::plugin_path() . '/classes/views/styles/custom_css.php' ); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | public static function save_css() { |
@@ -264,11 +264,11 @@ discard block |
||
264 | 264 | $post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_text_field' ); |
265 | 265 | $nonce = FrmAppHelper::get_post_param( 'frm_custom_css', '', 'sanitize_text_field' ); |
266 | 266 | if ( wp_verify_nonce( $nonce, 'frm_custom_css_nonce' ) ) { |
267 | - $frm_style->update($post_id); |
|
267 | + $frm_style->update( $post_id ); |
|
268 | 268 | $message = __( 'Your styling settings have been saved.', 'formidable' ); |
269 | 269 | } |
270 | 270 | |
271 | - return self::custom_css($message); |
|
271 | + return self::custom_css( $message ); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | public static function route() { |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | public static function reset_styling() { |
300 | - FrmAppHelper::permission_check('frm_change_settings'); |
|
300 | + FrmAppHelper::permission_check( 'frm_change_settings' ); |
|
301 | 301 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
302 | 302 | |
303 | 303 | $frm_style = new FrmStyle(); |
@@ -315,13 +315,13 @@ discard block |
||
315 | 315 | |
316 | 316 | // remove the # from the colors |
317 | 317 | foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) { |
318 | - if ( ! is_array($v) && strpos($v, '#') === 0 ) { |
|
319 | - $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v ); |
|
318 | + if ( ! is_array( $v ) && strpos( $v, '#' ) === 0 ) { |
|
319 | + $_GET['frm_style_setting']['post_content'][$k] = str_replace( '#', '', $v ); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | 323 | echo '<style type="text/css">'; |
324 | - include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php'); |
|
324 | + include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' ); |
|
325 | 325 | echo '</style>'; |
326 | 326 | wp_die(); |
327 | 327 | } |
@@ -345,24 +345,24 @@ discard block |
||
345 | 345 | ); |
346 | 346 | |
347 | 347 | foreach ( $meta_boxes as $nicename => $name ) { |
348 | - add_meta_box( $nicename .'-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename ); |
|
349 | - unset($nicename, $name); |
|
348 | + add_meta_box( $nicename . '-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename ); |
|
349 | + unset( $nicename, $name ); |
|
350 | 350 | } |
351 | 351 | } |
352 | 352 | |
353 | 353 | public static function include_style_section( $atts, $sec ) { |
354 | - extract($atts); |
|
354 | + extract( $atts ); |
|
355 | 355 | $current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' ); |
356 | - include(FrmAppHelper::plugin_path() .'/classes/views/styles/_'. $sec['args'] .'.php'); |
|
356 | + include( FrmAppHelper::plugin_path() . '/classes/views/styles/_' . $sec['args'] . '.php' ); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | public static function load_css() { |
360 | - header('Content-type: text/css'); |
|
360 | + header( 'Content-type: text/css' ); |
|
361 | 361 | |
362 | 362 | $frm_style = new FrmStyle(); |
363 | 363 | $defaults = $frm_style->get_defaults(); |
364 | 364 | |
365 | - include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php'); |
|
365 | + include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' ); |
|
366 | 366 | wp_die(); |
367 | 367 | } |
368 | 368 | |
@@ -421,11 +421,11 @@ discard block |
||
421 | 421 | $style = 'default'; |
422 | 422 | } |
423 | 423 | |
424 | - $frm_style = new FrmStyle($style); |
|
424 | + $frm_style = new FrmStyle( $style ); |
|
425 | 425 | $style = $frm_style->get_one(); |
426 | 426 | |
427 | 427 | if ( $style ) { |
428 | - $class .= ' frm_style_'. $style->post_name; |
|
428 | + $class .= ' frm_style_' . $style->post_name; |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | return $class; |
@@ -435,14 +435,14 @@ discard block |
||
435 | 435 | * @param string $val |
436 | 436 | */ |
437 | 437 | public static function get_style_val( $val, $form = 'default' ) { |
438 | - $style = self::get_form_style($form); |
|
439 | - if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
440 | - return $style->post_content[ $val ]; |
|
438 | + $style = self::get_form_style( $form ); |
|
439 | + if ( $style && isset( $style->post_content[$val] ) ) { |
|
440 | + return $style->post_content[$val]; |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | |
444 | 444 | public static function show_entry_styles( $default_styles ) { |
445 | - $frm_style = new FrmStyle('default'); |
|
445 | + $frm_style = new FrmStyle( 'default' ); |
|
446 | 446 | $style = $frm_style->get_one(); |
447 | 447 | |
448 | 448 | if ( ! $style ) { |
@@ -456,15 +456,15 @@ discard block |
||
456 | 456 | } else if ( 'alt_bg_color' == $name ) { |
457 | 457 | $setting = 'bg_color_active'; |
458 | 458 | } |
459 | - $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
460 | - unset($name, $val); |
|
459 | + $default_styles[$name] = $style->post_content[$setting]; |
|
460 | + unset( $name, $val ); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | return $default_styles; |
464 | 464 | } |
465 | 465 | |
466 | 466 | public static function &important_style( $important, $field ) { |
467 | - $important = self::get_style_val('important_style', $field['form_id']); |
|
467 | + $important = self::get_style_val( 'important_style', $field['form_id'] ); |
|
468 | 468 | return $important; |
469 | 469 | } |
470 | 470 | |
@@ -490,18 +490,18 @@ discard block |
||
490 | 490 | $i = 0; |
491 | 491 | $first_open = false; |
492 | 492 | do { |
493 | - if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
|
493 | + if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) { |
|
494 | 494 | break; |
495 | 495 | } |
496 | 496 | |
497 | 497 | foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
498 | - if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
499 | - foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
498 | + if ( isset( $wp_meta_boxes[$page][$context][$priority] ) ) { |
|
499 | + foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) { |
|
500 | 500 | if ( false == $box || ! $box['title'] ) { |
501 | 501 | continue; |
502 | 502 | } |
503 | 503 | |
504 | - $i++; |
|
504 | + $i ++; |
|
505 | 505 | $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
506 | 506 | |
507 | 507 | if ( ! $first_open && empty( $hidden_class ) ) { |
@@ -7,10 +7,10 @@ |
||
7 | 7 | continue; |
8 | 8 | } |
9 | 9 | |
10 | - if ( isset( $plugin_names[ $addon['info']['slug'] ] ) ) { |
|
11 | - $installed = is_dir( WP_PLUGIN_DIR . '/' . $plugin_names[ $addon['info']['slug'] ] ); |
|
10 | + if ( isset( $plugin_names[$addon['info']['slug']] ) ) { |
|
11 | + $installed = is_dir( WP_PLUGIN_DIR . '/' . $plugin_names[$addon['info']['slug']] ); |
|
12 | 12 | } else { |
13 | - $installed = isset( $installed_addons[ $addon['info']['slug'] ] ) || is_dir( WP_PLUGIN_DIR . '/formidable-' . $addon['info']['slug'] ); |
|
13 | + $installed = isset( $installed_addons[$addon['info']['slug']] ) || is_dir( WP_PLUGIN_DIR . '/formidable-' . $addon['info']['slug'] ); |
|
14 | 14 | } |
15 | 15 | $has_thumbnail = ! empty( $addon['info']['thumbnail'] ); |
16 | 16 | if ( $addon['info']['slug'] == 'formidable-pro' ) { |