@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | class FrmAppController { |
4 | 4 | |
5 | 5 | public static function menu() { |
6 | - FrmAppHelper::maybe_add_permissions(); |
|
7 | - if ( ! current_user_can( 'frm_view_forms' ) ) { |
|
8 | - return; |
|
9 | - } |
|
6 | + FrmAppHelper::maybe_add_permissions(); |
|
7 | + if ( ! current_user_can( 'frm_view_forms' ) ) { |
|
8 | + return; |
|
9 | + } |
|
10 | 10 | |
11 | - $frm_settings = FrmAppHelper::get_settings(); |
|
12 | - add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() ); |
|
13 | - } |
|
11 | + $frm_settings = FrmAppHelper::get_settings(); |
|
12 | + add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() ); |
|
13 | + } |
|
14 | 14 | |
15 | 15 | private static function get_menu_position() { |
16 | 16 | $count = count( get_post_types( array( 'show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) ); |
@@ -19,39 +19,39 @@ discard block |
||
19 | 19 | return $pos; |
20 | 20 | } |
21 | 21 | |
22 | - public static function load_wp_admin_style() { |
|
23 | - FrmAppHelper::load_font_style(); |
|
24 | - } |
|
22 | + public static function load_wp_admin_style() { |
|
23 | + FrmAppHelper::load_font_style(); |
|
24 | + } |
|
25 | 25 | |
26 | 26 | public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) { |
27 | - global $pagenow, $frm_vars; |
|
27 | + global $pagenow, $frm_vars; |
|
28 | 28 | |
29 | 29 | $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' ); |
30 | - if ( empty( $show_nav ) ) { |
|
31 | - return; |
|
32 | - } |
|
30 | + if ( empty( $show_nav ) ) { |
|
31 | + return; |
|
32 | + } |
|
33 | 33 | |
34 | 34 | $current_page = isset( $_GET['page'] ) ? FrmAppHelper::simple_get( 'page', 'sanitize_title' ) : FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' ); |
35 | 35 | if ( $pagenow == 'post.php' || $pagenow == 'post-new.php' ) { |
36 | 36 | $current_page = 'frm_display'; |
37 | 37 | } |
38 | 38 | |
39 | - if ( $form ) { |
|
39 | + if ( $form ) { |
|
40 | 40 | FrmForm::maybe_get_form( $form ); |
41 | 41 | |
42 | - if ( is_object( $form ) ) { |
|
43 | - $id = $form->id; |
|
44 | - } |
|
45 | - } |
|
42 | + if ( is_object( $form ) ) { |
|
43 | + $id = $form->id; |
|
44 | + } |
|
45 | + } |
|
46 | 46 | |
47 | - if ( ! isset( $id ) ) { |
|
48 | - $form = $id = false; |
|
49 | - } |
|
47 | + if ( ! isset( $id ) ) { |
|
48 | + $form = $id = false; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | $nav_items = self::get_form_nav_items( $id ); |
52 | 52 | |
53 | - include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' ); |
|
54 | - } |
|
53 | + include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' ); |
|
54 | + } |
|
55 | 55 | |
56 | 56 | private static function get_form_nav_items( $id ) { |
57 | 57 | $nav_items = array( |
@@ -82,26 +82,26 @@ discard block |
||
82 | 82 | return $nav_items; |
83 | 83 | } |
84 | 84 | |
85 | - // Adds a settings link to the plugins page |
|
86 | - public static function settings_link( $links ) { |
|
85 | + // Adds a settings link to the plugins page |
|
86 | + public static function settings_link( $links ) { |
|
87 | 87 | $settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">' . __( 'Settings', 'formidable' ) . '</a>'; |
88 | - array_unshift( $links, $settings ); |
|
88 | + array_unshift( $links, $settings ); |
|
89 | 89 | |
90 | - return $links; |
|
91 | - } |
|
90 | + return $links; |
|
91 | + } |
|
92 | 92 | |
93 | - public static function pro_get_started_headline() { |
|
94 | - // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
95 | - if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
96 | - return; |
|
97 | - } |
|
93 | + public static function pro_get_started_headline() { |
|
94 | + // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
95 | + if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
96 | + return; |
|
97 | + } |
|
98 | 98 | |
99 | 99 | if ( get_site_option( 'frmpro-authorized' ) && ! file_exists( FrmAppHelper::plugin_path() . '/pro/formidable-pro.php' ) ) { |
100 | - FrmAppHelper::load_admin_wide_js(); |
|
100 | + FrmAppHelper::load_admin_wide_js(); |
|
101 | 101 | |
102 | - // user is authorized, but running free version |
|
103 | - $inst_install_url = 'https://formidablepro.com/knowledgebase/install-formidable-forms/'; |
|
104 | - ?> |
|
102 | + // user is authorized, but running free version |
|
103 | + $inst_install_url = 'https://formidablepro.com/knowledgebase/install-formidable-forms/'; |
|
104 | + ?> |
|
105 | 105 | <div class="error" class="frm_previous_install"> |
106 | 106 | <?php |
107 | 107 | echo wp_kses_post( apply_filters( 'frm_pro_update_msg', |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | ) ); ?> |
114 | 114 | </div> |
115 | 115 | <?php |
116 | - } |
|
117 | - } |
|
116 | + } |
|
117 | + } |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * If there are CURL problems on this server, wp_remote_post won't work for installing |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | } |
157 | 157 | } |
158 | 158 | |
159 | - public static function admin_js() { |
|
159 | + public static function admin_js() { |
|
160 | 160 | $version = FrmAppHelper::plugin_version(); |
161 | 161 | FrmAppHelper::load_admin_wide_js( false ); |
162 | 162 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | 'bootstrap_tooltip', 'bootstrap-multiselect', |
168 | 168 | ), $version, true ); |
169 | 169 | wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version ); |
170 | - wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
170 | + wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
171 | 171 | |
172 | 172 | // load multselect js |
173 | 173 | wp_register_script( 'bootstrap-multiselect', FrmAppHelper::plugin_url() . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip' ), '0.9.8', true ); |
@@ -178,78 +178,78 @@ discard block |
||
178 | 178 | global $pagenow; |
179 | 179 | if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) { |
180 | 180 | |
181 | - wp_enqueue_script( 'admin-widgets' ); |
|
182 | - wp_enqueue_style( 'widgets' ); |
|
183 | - wp_enqueue_script( 'formidable' ); |
|
184 | - wp_enqueue_script( 'formidable_admin' ); |
|
181 | + wp_enqueue_script( 'admin-widgets' ); |
|
182 | + wp_enqueue_style( 'widgets' ); |
|
183 | + wp_enqueue_script( 'formidable' ); |
|
184 | + wp_enqueue_script( 'formidable_admin' ); |
|
185 | 185 | FrmAppHelper::localize_script( 'admin' ); |
186 | 186 | |
187 | - wp_enqueue_style( 'formidable-admin' ); |
|
188 | - add_thickbox(); |
|
187 | + wp_enqueue_style( 'formidable-admin' ); |
|
188 | + add_thickbox(); |
|
189 | 189 | |
190 | - wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
190 | + wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
191 | 191 | |
192 | - } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
193 | - if ( isset( $_REQUEST['post_type'] ) ) { |
|
194 | - $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
192 | + } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
193 | + if ( isset( $_REQUEST['post_type'] ) ) { |
|
194 | + $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
195 | 195 | } else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) { |
196 | 196 | $post = get_post( absint( $_REQUEST['post'] ) ); |
197 | - if ( ! $post ) { |
|
198 | - return; |
|
199 | - } |
|
200 | - $post_type = $post->post_type; |
|
201 | - } else { |
|
202 | - return; |
|
203 | - } |
|
204 | - |
|
205 | - if ( $post_type == 'frm_display' ) { |
|
206 | - wp_enqueue_script( 'jquery-ui-draggable' ); |
|
207 | - wp_enqueue_script( 'formidable_admin' ); |
|
208 | - wp_enqueue_style( 'formidable-admin' ); |
|
197 | + if ( ! $post ) { |
|
198 | + return; |
|
199 | + } |
|
200 | + $post_type = $post->post_type; |
|
201 | + } else { |
|
202 | + return; |
|
203 | + } |
|
204 | + |
|
205 | + if ( $post_type == 'frm_display' ) { |
|
206 | + wp_enqueue_script( 'jquery-ui-draggable' ); |
|
207 | + wp_enqueue_script( 'formidable_admin' ); |
|
208 | + wp_enqueue_style( 'formidable-admin' ); |
|
209 | 209 | FrmAppHelper::localize_script( 'admin' ); |
210 | - } |
|
211 | - } else if ( $pagenow == 'widgets.php' ) { |
|
212 | - FrmAppHelper::load_admin_wide_js(); |
|
213 | - } |
|
214 | - } |
|
215 | - |
|
216 | - public static function wp_admin_body_class( $classes ) { |
|
217 | - global $wp_version; |
|
218 | - //we need this class everywhere in the admin for the menu |
|
219 | - if ( version_compare( $wp_version, '3.7.2', '>' ) ) { |
|
220 | - $classes .= ' frm_38_trigger'; |
|
221 | - } |
|
222 | - |
|
223 | - return $classes; |
|
224 | - } |
|
225 | - |
|
226 | - public static function load_lang() { |
|
227 | - load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
228 | - } |
|
229 | - |
|
230 | - /** |
|
231 | - * Filter shortcodes in text widgets |
|
232 | - */ |
|
233 | - public static function widget_text_filter( $content ) { |
|
234 | - $regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/'; |
|
235 | - return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content ); |
|
236 | - } |
|
237 | - |
|
238 | - public static function widget_text_filter_callback( $matches ) { |
|
239 | - _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' ); |
|
240 | - return FrmAppHelper::widget_text_filter_callback( $matches ); |
|
241 | - } |
|
242 | - |
|
243 | - public static function front_head() { |
|
244 | - if ( is_multisite() ) { |
|
245 | - $old_db_version = get_option( 'frm_db_version' ); |
|
246 | - $pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false; |
|
247 | - if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) || |
|
248 | - ( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) { |
|
249 | - self::install( $old_db_version ); |
|
250 | - } |
|
251 | - } |
|
252 | - } |
|
210 | + } |
|
211 | + } else if ( $pagenow == 'widgets.php' ) { |
|
212 | + FrmAppHelper::load_admin_wide_js(); |
|
213 | + } |
|
214 | + } |
|
215 | + |
|
216 | + public static function wp_admin_body_class( $classes ) { |
|
217 | + global $wp_version; |
|
218 | + //we need this class everywhere in the admin for the menu |
|
219 | + if ( version_compare( $wp_version, '3.7.2', '>' ) ) { |
|
220 | + $classes .= ' frm_38_trigger'; |
|
221 | + } |
|
222 | + |
|
223 | + return $classes; |
|
224 | + } |
|
225 | + |
|
226 | + public static function load_lang() { |
|
227 | + load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
228 | + } |
|
229 | + |
|
230 | + /** |
|
231 | + * Filter shortcodes in text widgets |
|
232 | + */ |
|
233 | + public static function widget_text_filter( $content ) { |
|
234 | + $regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/'; |
|
235 | + return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content ); |
|
236 | + } |
|
237 | + |
|
238 | + public static function widget_text_filter_callback( $matches ) { |
|
239 | + _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' ); |
|
240 | + return FrmAppHelper::widget_text_filter_callback( $matches ); |
|
241 | + } |
|
242 | + |
|
243 | + public static function front_head() { |
|
244 | + if ( is_multisite() ) { |
|
245 | + $old_db_version = get_option( 'frm_db_version' ); |
|
246 | + $pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false; |
|
247 | + if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) || |
|
248 | + ( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) { |
|
249 | + self::install( $old_db_version ); |
|
250 | + } |
|
251 | + } |
|
252 | + } |
|
253 | 253 | |
254 | 254 | public static function localize_script( $location ) { |
255 | 255 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmAppHelper::localize_script' ); |
@@ -309,72 +309,72 @@ discard block |
||
309 | 309 | wp_die(); |
310 | 310 | } |
311 | 311 | |
312 | - public static function activation_install() { |
|
313 | - FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' ); |
|
314 | - FrmFormActionsController::actions_init(); |
|
315 | - self::install(); |
|
316 | - } |
|
312 | + public static function activation_install() { |
|
313 | + FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' ); |
|
314 | + FrmFormActionsController::actions_init(); |
|
315 | + self::install(); |
|
316 | + } |
|
317 | 317 | |
318 | - public static function install( $old_db_version = false ) { |
|
319 | - $frmdb = new FrmDb(); |
|
320 | - $frmdb->upgrade( $old_db_version ); |
|
321 | - } |
|
318 | + public static function install( $old_db_version = false ) { |
|
319 | + $frmdb = new FrmDb(); |
|
320 | + $frmdb->upgrade( $old_db_version ); |
|
321 | + } |
|
322 | 322 | |
323 | - public static function uninstall() { |
|
324 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
323 | + public static function uninstall() { |
|
324 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
325 | 325 | |
326 | - if ( current_user_can( 'administrator' ) ) { |
|
327 | - $frmdb = new FrmDb(); |
|
328 | - $frmdb->uninstall(); |
|
326 | + if ( current_user_can( 'administrator' ) ) { |
|
327 | + $frmdb = new FrmDb(); |
|
328 | + $frmdb->uninstall(); |
|
329 | 329 | |
330 | 330 | //disable the plugin and redirect after uninstall so the tables don't get added right back |
331 | 331 | deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false ); |
332 | 332 | echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) ); |
333 | - } else { |
|
334 | - $frm_settings = FrmAppHelper::get_settings(); |
|
335 | - wp_die( $frm_settings->admin_permission ); |
|
336 | - } |
|
337 | - wp_die(); |
|
338 | - } |
|
339 | - |
|
340 | - public static function drop_tables( $tables ) { |
|
341 | - global $wpdb; |
|
342 | - $tables[] = $wpdb->prefix . 'frm_fields'; |
|
343 | - $tables[] = $wpdb->prefix . 'frm_forms'; |
|
344 | - $tables[] = $wpdb->prefix . 'frm_items'; |
|
345 | - $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
346 | - return $tables; |
|
347 | - } |
|
348 | - |
|
349 | - // Routes for wordpress pages -- we're just replacing content here folks. |
|
350 | - public static function page_route( $content ) { |
|
351 | - global $post; |
|
352 | - |
|
353 | - $frm_settings = FrmAppHelper::get_settings(); |
|
354 | - if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) { |
|
355 | - $content = FrmFormsController::page_preview(); |
|
356 | - } |
|
357 | - |
|
358 | - return $content; |
|
359 | - } |
|
360 | - |
|
361 | - public static function deauthorize() { |
|
362 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
363 | - |
|
364 | - delete_option( 'frmpro-credentials' ); |
|
365 | - delete_option( 'frmpro-authorized' ); |
|
366 | - delete_site_option( 'frmpro-credentials' ); |
|
367 | - delete_site_option( 'frmpro-authorized' ); |
|
368 | - wp_die(); |
|
369 | - } |
|
370 | - |
|
371 | - public static function get_form_shortcode( $atts ) { |
|
372 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' ); |
|
373 | - return FrmFormsController::get_form_shortcode( $atts ); |
|
374 | - } |
|
375 | - |
|
376 | - public static function get_postbox_class() { |
|
377 | - _deprecated_function( __FUNCTION__, '2.0' ); |
|
378 | - return 'postbox-container'; |
|
379 | - } |
|
333 | + } else { |
|
334 | + $frm_settings = FrmAppHelper::get_settings(); |
|
335 | + wp_die( $frm_settings->admin_permission ); |
|
336 | + } |
|
337 | + wp_die(); |
|
338 | + } |
|
339 | + |
|
340 | + public static function drop_tables( $tables ) { |
|
341 | + global $wpdb; |
|
342 | + $tables[] = $wpdb->prefix . 'frm_fields'; |
|
343 | + $tables[] = $wpdb->prefix . 'frm_forms'; |
|
344 | + $tables[] = $wpdb->prefix . 'frm_items'; |
|
345 | + $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
346 | + return $tables; |
|
347 | + } |
|
348 | + |
|
349 | + // Routes for wordpress pages -- we're just replacing content here folks. |
|
350 | + public static function page_route( $content ) { |
|
351 | + global $post; |
|
352 | + |
|
353 | + $frm_settings = FrmAppHelper::get_settings(); |
|
354 | + if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) { |
|
355 | + $content = FrmFormsController::page_preview(); |
|
356 | + } |
|
357 | + |
|
358 | + return $content; |
|
359 | + } |
|
360 | + |
|
361 | + public static function deauthorize() { |
|
362 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
363 | + |
|
364 | + delete_option( 'frmpro-credentials' ); |
|
365 | + delete_option( 'frmpro-authorized' ); |
|
366 | + delete_site_option( 'frmpro-credentials' ); |
|
367 | + delete_site_option( 'frmpro-authorized' ); |
|
368 | + wp_die(); |
|
369 | + } |
|
370 | + |
|
371 | + public static function get_form_shortcode( $atts ) { |
|
372 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' ); |
|
373 | + return FrmFormsController::get_form_shortcode( $atts ); |
|
374 | + } |
|
375 | + |
|
376 | + public static function get_postbox_class() { |
|
377 | + _deprecated_function( __FUNCTION__, '2.0' ); |
|
378 | + return 'postbox-container'; |
|
379 | + } |
|
380 | 380 | } |
@@ -42,51 +42,51 @@ discard block |
||
42 | 42 | |
43 | 43 | if ( $f->type == 'data' ) { |
44 | 44 | //get all fields from linked form |
45 | - if ( isset($f->field_options['form_select']) && is_numeric($f->field_options['form_select']) ) { |
|
46 | - $linked_form = FrmDb::get_var( $wpdb->prefix .'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' ); |
|
47 | - if ( ! in_array( $linked_form, $linked_forms ) ) { |
|
48 | - $linked_forms[] = $linked_form; |
|
45 | + if ( isset($f->field_options['form_select']) && is_numeric($f->field_options['form_select']) ) { |
|
46 | + $linked_form = FrmDb::get_var( $wpdb->prefix .'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' ); |
|
47 | + if ( ! in_array( $linked_form, $linked_forms ) ) { |
|
48 | + $linked_forms[] = $linked_form; |
|
49 | 49 | $linked_fields = FrmField::getAll( array( 'fi.type not' => FrmField::no_save_fields(), 'fi.form_id' => $linked_form ) ); |
50 | - $ldfe = ''; |
|
50 | + $ldfe = ''; |
|
51 | 51 | if ( $linked_fields ) { |
52 | 52 | foreach ( $linked_fields as $linked_field ) { |
53 | - FrmAppHelper::insert_opt_html( array( 'id' => $f->id . ' show=' . $linked_field->id, 'key' => $f->field_key . ' show=' . $linked_field->field_key, 'name' => $linked_field->name, 'type' => $linked_field->type ) ); |
|
54 | - |
|
55 | - $ldfe = $linked_field->id; |
|
56 | - unset($linked_field); |
|
57 | - } |
|
58 | - } |
|
59 | - } |
|
60 | - } |
|
61 | - $dfe = $f->id; |
|
62 | - } |
|
63 | - unset($f); |
|
64 | - } |
|
65 | - } ?> |
|
53 | + FrmAppHelper::insert_opt_html( array( 'id' => $f->id . ' show=' . $linked_field->id, 'key' => $f->field_key . ' show=' . $linked_field->field_key, 'name' => $linked_field->name, 'type' => $linked_field->type ) ); |
|
54 | + |
|
55 | + $ldfe = $linked_field->id; |
|
56 | + unset($linked_field); |
|
57 | + } |
|
58 | + } |
|
59 | + } |
|
60 | + } |
|
61 | + $dfe = $f->id; |
|
62 | + } |
|
63 | + unset($f); |
|
64 | + } |
|
65 | + } ?> |
|
66 | 66 | </ul> |
67 | 67 | |
68 | 68 | <?php _e( 'Helpers', 'formidable' ) ?>: |
69 | 69 | <ul class="frm_code_list"> |
70 | 70 | <?php |
71 | - $col = 'one'; |
|
71 | + $col = 'one'; |
|
72 | 72 | foreach ( $entry_shortcodes as $skey => $sname ) { |
73 | 73 | if ( empty( $skey ) ) { |
74 | - $col = 'one'; |
|
75 | - echo '<li class="clear frm_block"></li>'; |
|
76 | - continue; |
|
77 | - } |
|
78 | - ?> |
|
74 | + $col = 'one'; |
|
75 | + echo '<li class="clear frm_block"></li>'; |
|
76 | + continue; |
|
77 | + } |
|
78 | + ?> |
|
79 | 79 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
80 | 80 | <a href="javascript:void(0)" class="frmbutton button <?php |
81 | 81 | echo ( in_array( $skey, array( 'siteurl', 'sitename', 'entry_count' ) ) ) ? 'show_before_content show_after_content' : ''; |
82 | - echo ( strpos( $skey, 'default-' ) === 0 ) ? 'hide_frm_not_email_subject' : ''; |
|
83 | - ?> frm_insert_code" data-code="<?php echo esc_attr( $skey ) ?>"><?php echo esc_html( $sname ) ?></a> |
|
82 | + echo ( strpos( $skey, 'default-' ) === 0 ) ? 'hide_frm_not_email_subject' : ''; |
|
83 | + ?> frm_insert_code" data-code="<?php echo esc_attr( $skey ) ?>"><?php echo esc_html( $sname ) ?></a> |
|
84 | 84 | </li> |
85 | 85 | <?php |
86 | - $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
87 | - unset($skey, $sname); |
|
88 | - } |
|
89 | - ?> |
|
86 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
87 | + unset($skey, $sname); |
|
88 | + } |
|
89 | + ?> |
|
90 | 90 | </ul> |
91 | 91 | </div> |
92 | 92 | |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | <ul class="alignleft"><li><?php _e( 'Fields from your form', 'formidable' ) ?>:</li></ul> |
100 | 100 | <ul class="frm_code_list frm_full_width"> |
101 | 101 | <?php if ( ! empty( $fields ) ) { |
102 | - foreach ( $fields as $f ) { |
|
102 | + foreach ( $fields as $f ) { |
|
103 | 103 | if ( FrmField::is_no_save_field( $f->type ) || ( $f->type == 'data' && ( ! isset( $f->field_options['data_type'] ) || $f->field_options['data_type'] == 'data' || $f->field_options['data_type'] == '' ) ) ) { |
104 | - continue; |
|
105 | - } |
|
106 | - ?> |
|
104 | + continue; |
|
105 | + } |
|
106 | + ?> |
|
107 | 107 | <li> |
108 | 108 | <a href="javascript:void(0)" class="frmids alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->id ) ?>]<?php esc_attr_e( 'Conditional text here', 'formidable' ) ?>[/if <?php echo esc_attr( $f->id ) ?>">[if <?php echo (int) $f->id ?>]</a> |
109 | 109 | <a href="javascript:void(0)" class="frmkeys alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->field_key ) ?>]something[/if <?php echo esc_attr( $f->field_key ) ?>">[if <?php echo FrmAppHelper::truncate($f->field_key, 10) ?>]</a> |
@@ -111,30 +111,30 @@ discard block |
||
111 | 111 | </li> |
112 | 112 | <?php |
113 | 113 | |
114 | - if ( $f->type == 'user_id' ) { |
|
115 | - $uid = $f; |
|
116 | - } else if ( $f->type == 'file' ) { |
|
117 | - $file = $f; |
|
118 | - } |
|
119 | - unset($f); |
|
120 | - } |
|
121 | - } ?> |
|
114 | + if ( $f->type == 'user_id' ) { |
|
115 | + $uid = $f; |
|
116 | + } else if ( $f->type == 'file' ) { |
|
117 | + $file = $f; |
|
118 | + } |
|
119 | + unset($f); |
|
120 | + } |
|
121 | + } ?> |
|
122 | 122 | </ul> |
123 | 123 | |
124 | 124 | <p class="howto"><?php _e( 'Click a button below to insert sample logic into your view', 'formidable' ) ?></p> |
125 | 125 | <ul class="frm_code_list"> |
126 | 126 | <?php |
127 | - $col = 'one'; |
|
127 | + $col = 'one'; |
|
128 | 128 | foreach ( $cond_shortcodes as $skey => $sname ) { |
129 | - ?> |
|
129 | + ?> |
|
130 | 130 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
131 | 131 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="if 125 <?php echo esc_attr($skey) ?>][/if 125"><?php echo esc_html( $sname ) ?></a> |
132 | 132 | </li> |
133 | 133 | <?php |
134 | - $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
135 | - unset($skey, $sname); |
|
136 | - } |
|
137 | - ?> |
|
134 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
135 | + unset($skey, $sname); |
|
136 | + } |
|
137 | + ?> |
|
138 | 138 | </ul> |
139 | 139 | </div> |
140 | 140 | <?php } ?> |
@@ -142,17 +142,17 @@ discard block |
||
142 | 142 | <div id="frm-adv-info-tab" class="tabs-panel"> |
143 | 143 | <ul class="frm_code_list"> |
144 | 144 | <?php |
145 | - $col = 'one'; |
|
145 | + $col = 'one'; |
|
146 | 146 | foreach ( $adv_shortcodes as $skey => $sname ) { |
147 | - ?> |
|
147 | + ?> |
|
148 | 148 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
149 | 149 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="125 <?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="'. esc_attr( $sname['title'] ) .'"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a> |
150 | 150 | </li> |
151 | 151 | <?php |
152 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
153 | - unset($skey, $sname); |
|
154 | - } |
|
155 | - ?> |
|
152 | + $col = ($col == 'one') ? 'two' : 'one'; |
|
153 | + unset($skey, $sname); |
|
154 | + } |
|
155 | + ?> |
|
156 | 156 | <?php if ( isset($file) ) { ?> |
157 | 157 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
158 | 158 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> size=thumbnail html=1"><?php _e( 'Image Size', 'formidable' ) ?></a> |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | <div class="clear"></div> |
170 | 170 | <?php |
171 | 171 | |
172 | - if ( isset($uid) && ! empty($user_fields) ) { |
|
173 | - $col = 'one'; ?> |
|
172 | + if ( isset($uid) && ! empty($user_fields) ) { |
|
173 | + $col = 'one'; ?> |
|
174 | 174 | <p class="howto"><?php _e( 'Insert user information', 'formidable' ) ?></p> |
175 | 175 | <ul class="frm_code_list"> |
176 | 176 | <?php foreach ( $user_fields as $uk => $uf ) { ?> |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $uid->id . ' show="' . $uk . '"' ) ?>"><?php echo esc_html( $uf ) ?></a> |
179 | 179 | </li> |
180 | 180 | <?php |
181 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
182 | - unset($uf, $uk); |
|
183 | - } |
|
184 | - unset($uid); ?> |
|
181 | + $col = ($col == 'one') ? 'two' : 'one'; |
|
182 | + unset($uf, $uk); |
|
183 | + } |
|
184 | + unset($uid); ?> |
|
185 | 185 | </ul> |
186 | 186 | <?php } |
187 | 187 | |
188 | - if ( isset($repeat_field) ) { ?> |
|
188 | + if ( isset($repeat_field) ) { ?> |
|
189 | 189 | <div class="clear"></div> |
190 | 190 | <p class="howto"><?php _e( 'Repeating field options', 'formidable' ) ?></p> |
191 | 191 | <ul class="frm_code_list"> |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | </li> |
195 | 195 | </ul> |
196 | 196 | <?php |
197 | - } |
|
197 | + } |
|
198 | 198 | |
199 | - if ( isset($dfe) ) { ?> |
|
199 | + if ( isset($dfe) ) { ?> |
|
200 | 200 | |
201 | 201 | <div class="clear"></div> |
202 | 202 | <p class="howto"><?php _e( 'Dynamic field options', 'formidable' ) ?></p> |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | </div> |
216 | 216 | |
217 | 217 | <?php |
218 | - if ( $settings_tab ) { |
|
219 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/mb_html_tab.php'); |
|
220 | - } |
|
221 | - ?> |
|
218 | + if ( $settings_tab ) { |
|
219 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/mb_html_tab.php'); |
|
220 | + } |
|
221 | + ?> |
|
222 | 222 | </div> |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | |
43 | 43 | if ( $f->type == 'data' ) { |
44 | 44 | //get all fields from linked form |
45 | - if ( isset($f->field_options['form_select']) && is_numeric($f->field_options['form_select']) ) { |
|
46 | - $linked_form = FrmDb::get_var( $wpdb->prefix .'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' ); |
|
45 | + if ( isset( $f->field_options['form_select'] ) && is_numeric( $f->field_options['form_select'] ) ) { |
|
46 | + $linked_form = FrmDb::get_var( $wpdb->prefix . 'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' ); |
|
47 | 47 | if ( ! in_array( $linked_form, $linked_forms ) ) { |
48 | 48 | $linked_forms[] = $linked_form; |
49 | 49 | $linked_fields = FrmField::getAll( array( 'fi.type not' => FrmField::no_save_fields(), 'fi.form_id' => $linked_form ) ); |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | FrmAppHelper::insert_opt_html( array( 'id' => $f->id . ' show=' . $linked_field->id, 'key' => $f->field_key . ' show=' . $linked_field->field_key, 'name' => $linked_field->name, 'type' => $linked_field->type ) ); |
54 | 54 | |
55 | 55 | $ldfe = $linked_field->id; |
56 | - unset($linked_field); |
|
56 | + unset( $linked_field ); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
61 | 61 | $dfe = $f->id; |
62 | 62 | } |
63 | - unset($f); |
|
63 | + unset( $f ); |
|
64 | 64 | } |
65 | 65 | } ?> |
66 | 66 | </ul> |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | </li> |
85 | 85 | <?php |
86 | 86 | $col = ( $col == 'one' ) ? 'two' : 'one'; |
87 | - unset($skey, $sname); |
|
87 | + unset( $skey, $sname ); |
|
88 | 88 | } |
89 | 89 | ?> |
90 | 90 | </ul> |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | ?> |
107 | 107 | <li> |
108 | 108 | <a href="javascript:void(0)" class="frmids alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->id ) ?>]<?php esc_attr_e( 'Conditional text here', 'formidable' ) ?>[/if <?php echo esc_attr( $f->id ) ?>">[if <?php echo (int) $f->id ?>]</a> |
109 | - <a href="javascript:void(0)" class="frmkeys alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->field_key ) ?>]something[/if <?php echo esc_attr( $f->field_key ) ?>">[if <?php echo FrmAppHelper::truncate($f->field_key, 10) ?>]</a> |
|
110 | - <a href="javascript:void(0)" class="frm_insert_code" data-code="<?php echo esc_attr($f->id) ?>"><?php echo FrmAppHelper::truncate($f->name, 60) ?></a> |
|
109 | + <a href="javascript:void(0)" class="frmkeys alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->field_key ) ?>]something[/if <?php echo esc_attr( $f->field_key ) ?>">[if <?php echo FrmAppHelper::truncate( $f->field_key, 10 ) ?>]</a> |
|
110 | + <a href="javascript:void(0)" class="frm_insert_code" data-code="<?php echo esc_attr( $f->id ) ?>"><?php echo FrmAppHelper::truncate( $f->name, 60 ) ?></a> |
|
111 | 111 | </li> |
112 | 112 | <?php |
113 | 113 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } else if ( $f->type == 'file' ) { |
117 | 117 | $file = $f; |
118 | 118 | } |
119 | - unset($f); |
|
119 | + unset( $f ); |
|
120 | 120 | } |
121 | 121 | } ?> |
122 | 122 | </ul> |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | foreach ( $cond_shortcodes as $skey => $sname ) { |
129 | 129 | ?> |
130 | 130 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
131 | - <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="if 125 <?php echo esc_attr($skey) ?>][/if 125"><?php echo esc_html( $sname ) ?></a> |
|
131 | + <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="if 125 <?php echo esc_attr( $skey ) ?>][/if 125"><?php echo esc_html( $sname ) ?></a> |
|
132 | 132 | </li> |
133 | 133 | <?php |
134 | 134 | $col = ( $col == 'one' ) ? 'two' : 'one'; |
135 | - unset($skey, $sname); |
|
135 | + unset( $skey, $sname ); |
|
136 | 136 | } |
137 | 137 | ?> |
138 | 138 | </ul> |
@@ -146,22 +146,22 @@ discard block |
||
146 | 146 | foreach ( $adv_shortcodes as $skey => $sname ) { |
147 | 147 | ?> |
148 | 148 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
149 | - <a href="javascript:void(0)" class="frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="125 <?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="'. esc_attr( $sname['title'] ) .'"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a> |
|
149 | + <a href="javascript:void(0)" class="frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="125 <?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="' . esc_attr( $sname['title'] ) . '"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a> |
|
150 | 150 | </li> |
151 | 151 | <?php |
152 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
153 | - unset($skey, $sname); |
|
152 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
153 | + unset( $skey, $sname ); |
|
154 | 154 | } |
155 | 155 | ?> |
156 | - <?php if ( isset($file) ) { ?> |
|
156 | + <?php if ( isset( $file ) ) { ?> |
|
157 | 157 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
158 | - <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> size=thumbnail html=1"><?php _e( 'Image Size', 'formidable' ) ?></a> |
|
158 | + <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $file->id ) ?> size=thumbnail html=1"><?php _e( 'Image Size', 'formidable' ) ?></a> |
|
159 | 159 | </li> |
160 | - <li class="frm_col_<?php echo $col = (($col == 'one') ? 'two' : 'one') ?>"> |
|
161 | - <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> show=id"><?php _e( 'Image ID', 'formidable' ) ?></a> |
|
160 | + <li class="frm_col_<?php echo $col = ( ( $col == 'one' ) ? 'two' : 'one' ) ?>"> |
|
161 | + <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $file->id ) ?> show=id"><?php _e( 'Image ID', 'formidable' ) ?></a> |
|
162 | 162 | </li> |
163 | - <li class="frm_col_<?php echo $col = (($col == 'one') ? 'two' : 'one') ?>"> |
|
164 | - <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> show=label"><?php _e( 'Image Name', 'formidable' ) ?></a> |
|
163 | + <li class="frm_col_<?php echo $col = ( ( $col == 'one' ) ? 'two' : 'one' ) ?>"> |
|
164 | + <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $file->id ) ?> show=label"><?php _e( 'Image Name', 'formidable' ) ?></a> |
|
165 | 165 | </li> |
166 | 166 | <?php } ?> |
167 | 167 | </ul> |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | <div class="clear"></div> |
170 | 170 | <?php |
171 | 171 | |
172 | - if ( isset($uid) && ! empty($user_fields) ) { |
|
172 | + if ( isset( $uid ) && ! empty( $user_fields ) ) { |
|
173 | 173 | $col = 'one'; ?> |
174 | 174 | <p class="howto"><?php _e( 'Insert user information', 'formidable' ) ?></p> |
175 | 175 | <ul class="frm_code_list"> |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $uid->id . ' show="' . $uk . '"' ) ?>"><?php echo esc_html( $uf ) ?></a> |
179 | 179 | </li> |
180 | 180 | <?php |
181 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
182 | - unset($uf, $uk); |
|
181 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
182 | + unset( $uf, $uk ); |
|
183 | 183 | } |
184 | - unset($uid); ?> |
|
184 | + unset( $uid ); ?> |
|
185 | 185 | </ul> |
186 | 186 | <?php } |
187 | 187 | |
188 | - if ( isset($repeat_field) ) { ?> |
|
188 | + if ( isset( $repeat_field ) ) { ?> |
|
189 | 189 | <div class="clear"></div> |
190 | 190 | <p class="howto"><?php _e( 'Repeating field options', 'formidable' ) ?></p> |
191 | 191 | <ul class="frm_code_list"> |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | <?php |
197 | 197 | } |
198 | 198 | |
199 | - if ( isset($dfe) ) { ?> |
|
199 | + if ( isset( $dfe ) ) { ?> |
|
200 | 200 | |
201 | 201 | <div class="clear"></div> |
202 | 202 | <p class="howto"><?php _e( 'Dynamic field options', 'formidable' ) ?></p> |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | <li class="frm_col_one"> |
205 | 205 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $dfe . ' show="created-at"' ) ?>"><?php _e( 'Creation Date', 'formidable' ) ?></a> |
206 | 206 | </li> |
207 | - <?php if ( isset($ldfe) ) { ?> |
|
207 | + <?php if ( isset( $ldfe ) ) { ?> |
|
208 | 208 | <li class="frm_col_two"> |
209 | 209 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $dfe . ' show="' . $ldfe . '"' ) ?>"><?php _e( 'Field From Entry', 'formidable' ) ?></a> |
210 | 210 | </li> |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | <?php |
218 | 218 | if ( $settings_tab ) { |
219 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/mb_html_tab.php'); |
|
219 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/mb_html_tab.php' ); |
|
220 | 220 | } |
221 | 221 | ?> |
222 | 222 | </div> |
@@ -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 ) { |
@@ -348,16 +348,16 @@ discard block |
||
348 | 348 | } |
349 | 349 | |
350 | 350 | public static function allow_mime( $mimes ) { |
351 | - if ( ! isset( $mimes['csv'] ) ) { |
|
352 | - // allow csv files |
|
353 | - $mimes['csv'] = 'text/csv'; |
|
354 | - } |
|
355 | - |
|
356 | - if ( ! isset( $mimes['xml'] ) ) { |
|
357 | - // allow xml |
|
358 | - $mimes['xml'] = 'text/xml'; |
|
359 | - } |
|
360 | - |
|
361 | - return $mimes; |
|
362 | - } |
|
351 | + if ( ! isset( $mimes['csv'] ) ) { |
|
352 | + // allow csv files |
|
353 | + $mimes['csv'] = 'text/csv'; |
|
354 | + } |
|
355 | + |
|
356 | + if ( ! isset( $mimes['xml'] ) ) { |
|
357 | + // allow xml |
|
358 | + $mimes['xml'] = 'text/xml'; |
|
359 | + } |
|
360 | + |
|
361 | + return $mimes; |
|
362 | + } |
|
363 | 363 | } |
@@ -310,7 +310,7 @@ |
||
310 | 310 | if ( ! is_array( $csv_fields ) ) { |
311 | 311 | $csv_fields = explode(',', $csv_fields); |
312 | 312 | } |
313 | - if ( ! empty($csv_fields) ) { |
|
313 | + if ( ! empty($csv_fields) ) { |
|
314 | 314 | $where['fi.id'] = $csv_fields; |
315 | 315 | } |
316 | 316 | } |
@@ -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 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | if ( ! is_array( $csv_fields ) ) { |
311 | 311 | $csv_fields = explode( ',', $csv_fields ); |
312 | 312 | } |
313 | - if ( ! empty($csv_fields) ) { |
|
313 | + if ( ! empty( $csv_fields ) ) { |
|
314 | 314 | $where['fi.id'] = $csv_fields; |
315 | 315 | } |
316 | 316 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | */ |
336 | 336 | $query = apply_filters( 'frm_csv_where', $query, compact( 'form_id', 'search', 'fid', 'item_id' ) ); |
337 | 337 | |
338 | - $entry_ids = FrmDb::get_col( $wpdb->prefix .'frm_items it', $query ); |
|
338 | + $entry_ids = FrmDb::get_col( $wpdb->prefix . 'frm_items it', $query ); |
|
339 | 339 | unset( $query ); |
340 | 340 | |
341 | 341 | if ( empty( $entry_ids ) ) { |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class FrmCSVExportHelper{ |
|
3 | +class FrmCSVExportHelper { |
|
4 | 4 | protected static $separator = ', '; |
5 | 5 | protected static $column_separator = ','; |
6 | 6 | protected static $line_break = 'return'; |
@@ -235,50 +235,50 @@ discard block |
||
235 | 235 | return $line; |
236 | 236 | } |
237 | 237 | |
238 | - $convmap = false; |
|
238 | + $convmap = false; |
|
239 | 239 | |
240 | 240 | switch ( self::$to_encoding ) { |
241 | - case 'macintosh': |
|
241 | + case 'macintosh': |
|
242 | 242 | // this map was derived from the differences between the MacRoman and UTF-8 Charsets |
243 | 243 | // Reference: |
244 | 244 | // - http://www.alanwood.net/demos/macroman.html |
245 | - $convmap = array( |
|
246 | - 256, 304, 0, 0xffff, |
|
247 | - 306, 337, 0, 0xffff, |
|
248 | - 340, 375, 0, 0xffff, |
|
249 | - 377, 401, 0, 0xffff, |
|
250 | - 403, 709, 0, 0xffff, |
|
251 | - 712, 727, 0, 0xffff, |
|
252 | - 734, 936, 0, 0xffff, |
|
253 | - 938, 959, 0, 0xffff, |
|
254 | - 961, 8210, 0, 0xffff, |
|
255 | - 8213, 8215, 0, 0xffff, |
|
256 | - 8219, 8219, 0, 0xffff, |
|
257 | - 8227, 8229, 0, 0xffff, |
|
258 | - 8231, 8239, 0, 0xffff, |
|
259 | - 8241, 8248, 0, 0xffff, |
|
260 | - 8251, 8259, 0, 0xffff, |
|
261 | - 8261, 8363, 0, 0xffff, |
|
262 | - 8365, 8481, 0, 0xffff, |
|
263 | - 8483, 8705, 0, 0xffff, |
|
264 | - 8707, 8709, 0, 0xffff, |
|
265 | - 8711, 8718, 0, 0xffff, |
|
266 | - 8720, 8720, 0, 0xffff, |
|
267 | - 8722, 8729, 0, 0xffff, |
|
268 | - 8731, 8733, 0, 0xffff, |
|
269 | - 8735, 8746, 0, 0xffff, |
|
270 | - 8748, 8775, 0, 0xffff, |
|
271 | - 8777, 8799, 0, 0xffff, |
|
272 | - 8801, 8803, 0, 0xffff, |
|
273 | - 8806, 9673, 0, 0xffff, |
|
274 | - 9675, 63742, 0, 0xffff, |
|
275 | - 63744, 64256, 0, 0xffff, |
|
276 | - ); |
|
277 | - break; |
|
278 | - case 'ISO-8859-1': |
|
279 | - $convmap = array( 256, 10000, 0, 0xffff ); |
|
280 | - break; |
|
281 | - } |
|
245 | + $convmap = array( |
|
246 | + 256, 304, 0, 0xffff, |
|
247 | + 306, 337, 0, 0xffff, |
|
248 | + 340, 375, 0, 0xffff, |
|
249 | + 377, 401, 0, 0xffff, |
|
250 | + 403, 709, 0, 0xffff, |
|
251 | + 712, 727, 0, 0xffff, |
|
252 | + 734, 936, 0, 0xffff, |
|
253 | + 938, 959, 0, 0xffff, |
|
254 | + 961, 8210, 0, 0xffff, |
|
255 | + 8213, 8215, 0, 0xffff, |
|
256 | + 8219, 8219, 0, 0xffff, |
|
257 | + 8227, 8229, 0, 0xffff, |
|
258 | + 8231, 8239, 0, 0xffff, |
|
259 | + 8241, 8248, 0, 0xffff, |
|
260 | + 8251, 8259, 0, 0xffff, |
|
261 | + 8261, 8363, 0, 0xffff, |
|
262 | + 8365, 8481, 0, 0xffff, |
|
263 | + 8483, 8705, 0, 0xffff, |
|
264 | + 8707, 8709, 0, 0xffff, |
|
265 | + 8711, 8718, 0, 0xffff, |
|
266 | + 8720, 8720, 0, 0xffff, |
|
267 | + 8722, 8729, 0, 0xffff, |
|
268 | + 8731, 8733, 0, 0xffff, |
|
269 | + 8735, 8746, 0, 0xffff, |
|
270 | + 8748, 8775, 0, 0xffff, |
|
271 | + 8777, 8799, 0, 0xffff, |
|
272 | + 8801, 8803, 0, 0xffff, |
|
273 | + 8806, 9673, 0, 0xffff, |
|
274 | + 9675, 63742, 0, 0xffff, |
|
275 | + 63744, 64256, 0, 0xffff, |
|
276 | + ); |
|
277 | + break; |
|
278 | + case 'ISO-8859-1': |
|
279 | + $convmap = array( 256, 10000, 0, 0xffff ); |
|
280 | + break; |
|
281 | + } |
|
282 | 282 | |
283 | 283 | if ( is_array( $convmap ) ) { |
284 | 284 | $line = mb_encode_numericentity( $line, $convmap, self::$charset ); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | return self::escape_csv( $line ); |
292 | - } |
|
292 | + } |
|
293 | 293 | |
294 | 294 | /** |
295 | 295 | * Escape a " in a csv with another " |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class FrmCSVExportHelper{ |
|
3 | +class FrmCSVExportHelper { |
|
4 | 4 | protected static $separator = ', '; |
5 | 5 | protected static $column_separator = ','; |
6 | 6 | protected static $line_break = 'return'; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | header( 'Content-Description: File Transfer' ); |
64 | 64 | header( 'Content-Disposition: attachment; filename="' . esc_attr( $filename ) . '"' ); |
65 | 65 | header( 'Content-Type: text/csv; charset=' . self::$charset, true ); |
66 | - header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', mktime( date( 'H' ) + 2, date( 'i' ), date( 's' ), date( 'm' ), date( 'd' ), date('Y' ) ) ) . ' GMT' ); |
|
66 | + header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', mktime( date( 'H' ) + 2, date( 'i' ), date( 's' ), date( 'm' ), date( 'd' ), date( 'Y' ) ) ) . ' GMT' ); |
|
67 | 67 | header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); |
68 | 68 | header( 'Cache-Control: no-cache, must-revalidate' ); |
69 | 69 | header( 'Pragma: no-cache' ); |
@@ -87,19 +87,19 @@ discard block |
||
87 | 87 | private static function csv_headings( &$headings ) { |
88 | 88 | foreach ( self::$fields as $col ) { |
89 | 89 | if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, array( 'user_id', 'file', 'data', 'date' ) ) ) { |
90 | - $headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
90 | + $headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
91 | 91 | } |
92 | 92 | |
93 | - $headings[ $col->id ] = strip_tags( $col->name ); |
|
93 | + $headings[$col->id] = strip_tags( $col->name ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | if ( self::$comment_count ) { |
97 | - for ( $i = 0; $i < self::$comment_count; $i++ ) { |
|
98 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
99 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
100 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
97 | + for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
|
98 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
99 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
100 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
101 | 101 | } |
102 | - unset($i); |
|
102 | + unset( $i ); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | $headings['created_at'] = __( 'Timestamp', 'formidable' ); |
@@ -146,45 +146,45 @@ discard block |
||
146 | 146 | continue; |
147 | 147 | } |
148 | 148 | |
149 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
150 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
151 | - } else if ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
149 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
150 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
151 | + } else if ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
152 | 152 | // if the data is here, it should be an array but if this field has collected data |
153 | 153 | // both while inside and outside of the repeating section, it's possible this is a string |
154 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
154 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | //add the repeated values |
158 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
158 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
159 | 159 | } |
160 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
160 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | // add the embedded form id |
164 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
165 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
164 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
165 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
166 | 166 | } |
167 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
167 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | private static function add_field_values_to_csv( &$row ) { |
171 | 171 | foreach ( self::$fields as $col ) { |
172 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
172 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
173 | 173 | |
174 | 174 | $field_value = maybe_unserialize( $field_value ); |
175 | - $field_value = apply_filters( 'frm_csv_value', $field_value, array( 'field' => $col, 'entry' => self::$entry, 'separator' => self::$separator, ) ); |
|
175 | + $field_value = apply_filters( 'frm_csv_value', $field_value, array( 'field' => $col, 'entry' => self::$entry, 'separator' => self::$separator,) ); |
|
176 | 176 | |
177 | 177 | if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] ) { |
178 | 178 | $sep_value = FrmEntriesHelper::display_value( $field_value, $col, array( |
179 | 179 | 'type' => $col->type, 'post_id' => self::$entry->post_id, 'show_icon' => false, |
180 | 180 | 'entry_id' => self::$entry->id, 'sep' => self::$separator, |
181 | - 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0, |
|
181 | + 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0, |
|
182 | 182 | ) ); |
183 | - $row[ $col->id . '_label' ] = $sep_value; |
|
183 | + $row[$col->id . '_label'] = $sep_value; |
|
184 | 184 | unset( $sep_value ); |
185 | 185 | } |
186 | 186 | |
187 | - $row[ $col->id ] = $field_value; |
|
187 | + $row[$col->id] = $field_value; |
|
188 | 188 | |
189 | 189 | unset( $col, $field_value ); |
190 | 190 | } |
@@ -205,9 +205,9 @@ discard block |
||
205 | 205 | $col_count = count( $rows ); |
206 | 206 | $this_col = 0; |
207 | 207 | foreach ( $rows as $k => $row ) { |
208 | - $this_col++; |
|
208 | + $this_col ++; |
|
209 | 209 | |
210 | - if ( ! isset( self::$headings[ $k ] ) ) { |
|
210 | + if ( ! isset( self::$headings[$k] ) ) { |
|
211 | 211 | // this column has been removed from the csv, so skip it |
212 | 212 | continue; |
213 | 213 | } |
@@ -87,9 +87,9 @@ |
||
87 | 87 | } else if ( $form->is_template ) { |
88 | 88 | echo ' ' . __( '(template)', 'formidable' ); |
89 | 89 | } |
90 | - ?></option> |
|
90 | + ?></option> |
|
91 | 91 | <?php |
92 | - } ?> |
|
92 | + } ?> |
|
93 | 93 | </select> |
94 | 94 | <p class="howto"><?php _e( 'Hold down the CTRL/Command button to select multiple forms', 'formidable' ); ?></p> |
95 | 95 | </td> |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | <div class="frmicon icon32"><br/></div> |
3 | 3 | <h2><?php _e( 'Import/Export', 'formidable' ); ?></h2> |
4 | 4 | |
5 | - <?php include(FrmAppHelper::plugin_path() .'/classes/views/shared/errors.php'); ?> |
|
5 | + <?php include( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); ?> |
|
6 | 6 | <div id="poststuff" class="metabox-holder"> |
7 | 7 | <div id="post-body"> |
8 | 8 | <div id="post-body-content"> |
@@ -10,16 +10,16 @@ discard block |
||
10 | 10 | <div class="postbox "> |
11 | 11 | <h3 class="hndle"><span><?php _e( 'Import', 'formidable' ) ?></span></h3> |
12 | 12 | <div class="inside"> |
13 | - <p class="howto"><?php echo apply_filters('frm_upload_instructions1', __( 'Upload your Formidable XML file to import forms into this site. If your imported form key and creation date match a form on your site, that form will be updated.', 'formidable' )) ?></p> |
|
13 | + <p class="howto"><?php echo apply_filters( 'frm_upload_instructions1', __( 'Upload your Formidable XML file to import forms into this site. If your imported form key and creation date match a form on your site, that form will be updated.', 'formidable' ) ) ?></p> |
|
14 | 14 | <br/> |
15 | 15 | <form enctype="multipart/form-data" method="post"> |
16 | 16 | <input type="hidden" name="frm_action" value="import_xml" /> |
17 | - <?php wp_nonce_field('import-xml-nonce', 'import-xml'); ?> |
|
18 | - <p><label><?php echo apply_filters('frm_upload_instructions2', __( 'Choose a Formidable XML file', 'formidable' )) ?> (<?php printf(__( 'Maximum size: %s', 'formidable' ), ini_get('upload_max_filesize')) ?>)</label> |
|
17 | + <?php wp_nonce_field( 'import-xml-nonce', 'import-xml' ); ?> |
|
18 | + <p><label><?php echo apply_filters( 'frm_upload_instructions2', __( 'Choose a Formidable XML file', 'formidable' ) ) ?> (<?php printf( __( 'Maximum size: %s', 'formidable' ), ini_get( 'upload_max_filesize' ) ) ?>)</label> |
|
19 | 19 | <input type="file" name="frm_import_file" size="25" /> |
20 | 20 | </p> |
21 | 21 | |
22 | - <?php do_action('frm_csv_opts', $forms) ?> |
|
22 | + <?php do_action( 'frm_csv_opts', $forms ) ?> |
|
23 | 23 | |
24 | 24 | <p class="submit"> |
25 | 25 | <input type="submit" value="<?php esc_attr_e( 'Upload file and import', 'formidable' ) ?>" class="button-primary" /> |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | <div class="inside with_frm_style"> |
35 | 35 | <form method="post" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" id="frm_export_xml"> |
36 | 36 | <input type="hidden" name="action" value="frm_export_xml" /> |
37 | - <?php wp_nonce_field('export-xml-nonce', 'export-xml'); ?> |
|
37 | + <?php wp_nonce_field( 'export-xml-nonce', 'export-xml' ); ?> |
|
38 | 38 | |
39 | 39 | <table class="form-table"> |
40 | 40 | <tr class="form-field"> |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | <td> |
43 | 43 | <select name="format"> |
44 | 44 | <?php foreach ( $export_format as $t => $type ) { ?> |
45 | - <option value="<?php echo esc_attr( $t ) ?>" data-support="<?php echo esc_attr( $type['support'] ) ?>" <?php echo isset( $type['count'] ) ? 'data-count="'. esc_attr( $type['count'] ) .'"' : ''; ?>><?php echo isset( $type['name'] ) ? $type['name'] : $t ?></option> |
|
45 | + <option value="<?php echo esc_attr( $t ) ?>" data-support="<?php echo esc_attr( $type['support'] ) ?>" <?php echo isset( $type['count'] ) ? 'data-count="' . esc_attr( $type['count'] ) . '"' : ''; ?>><?php echo isset( $type['name'] ) ? $type['name'] : $t ?></option> |
|
46 | 46 | <?php } ?> |
47 | 47 | </select> |
48 | 48 |