@@ -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 | 11 | $menu_name = FrmAppHelper::get_menu_name(); |
12 | 12 | add_menu_page( 'Formidable', $menu_name, 'frm_view_forms', 'formidable', 'FrmFormsController::route', '', self::get_menu_position() ); |
13 | - } |
|
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,15 +19,15 @@ 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 | 27 | $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' ); |
28 | - if ( empty( $show_nav ) || ! $form ) { |
|
29 | - return; |
|
30 | - } |
|
28 | + if ( empty( $show_nav ) || ! $form ) { |
|
29 | + return; |
|
30 | + } |
|
31 | 31 | |
32 | 32 | FrmForm::maybe_get_form( $form ); |
33 | 33 | if ( ! is_object( $form ) ) { |
@@ -85,28 +85,28 @@ discard block |
||
85 | 85 | return $nav_items; |
86 | 86 | } |
87 | 87 | |
88 | - // Adds a settings link to the plugins page |
|
89 | - public static function settings_link( $links ) { |
|
88 | + // Adds a settings link to the plugins page |
|
89 | + public static function settings_link( $links ) { |
|
90 | 90 | $settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">' . __( 'Settings', 'formidable' ) . '</a>'; |
91 | - array_unshift( $links, $settings ); |
|
91 | + array_unshift( $links, $settings ); |
|
92 | 92 | |
93 | - return $links; |
|
94 | - } |
|
93 | + return $links; |
|
94 | + } |
|
95 | 95 | |
96 | - public static function pro_get_started_headline() { |
|
96 | + public static function pro_get_started_headline() { |
|
97 | 97 | self::maybe_show_upgrade_bar(); |
98 | 98 | |
99 | - // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
100 | - if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
101 | - return; |
|
102 | - } |
|
99 | + // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
100 | + if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
101 | + return; |
|
102 | + } |
|
103 | 103 | |
104 | 104 | if ( get_site_option( 'frmpro-authorized' ) && ! file_exists( FrmAppHelper::plugin_path() . '/pro/formidable-pro.php' ) ) { |
105 | - FrmAppHelper::load_admin_wide_js(); |
|
105 | + FrmAppHelper::load_admin_wide_js(); |
|
106 | 106 | |
107 | - // user is authorized, but running free version |
|
108 | - $inst_install_url = 'https://formidableforms.com/knowledgebase/install-formidable-forms/'; |
|
109 | - ?> |
|
107 | + // user is authorized, but running free version |
|
108 | + $inst_install_url = 'https://formidableforms.com/knowledgebase/install-formidable-forms/'; |
|
109 | + ?> |
|
110 | 110 | <div class="error" class="frm_previous_install"> |
111 | 111 | <?php |
112 | 112 | echo wp_kses_post( apply_filters( 'frm_pro_update_msg', |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | ) ); ?> |
119 | 119 | </div> |
120 | 120 | <?php |
121 | - } |
|
122 | - } |
|
121 | + } |
|
122 | + } |
|
123 | 123 | |
124 | 124 | private static function maybe_show_upgrade_bar() { |
125 | 125 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | - public static function admin_js() { |
|
227 | + public static function admin_js() { |
|
228 | 228 | $version = FrmAppHelper::plugin_version(); |
229 | 229 | FrmAppHelper::load_admin_wide_js( false ); |
230 | 230 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | 'bootstrap_tooltip', 'bootstrap-multiselect', |
236 | 236 | ), $version, true ); |
237 | 237 | wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version ); |
238 | - wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
238 | + wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
239 | 239 | wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version ); |
240 | 240 | |
241 | 241 | // load multselect js |
@@ -247,54 +247,54 @@ discard block |
||
247 | 247 | global $pagenow; |
248 | 248 | if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) { |
249 | 249 | |
250 | - wp_enqueue_script( 'admin-widgets' ); |
|
251 | - wp_enqueue_style( 'widgets' ); |
|
252 | - wp_enqueue_script( 'formidable' ); |
|
253 | - wp_enqueue_script( 'formidable_admin' ); |
|
250 | + wp_enqueue_script( 'admin-widgets' ); |
|
251 | + wp_enqueue_style( 'widgets' ); |
|
252 | + wp_enqueue_script( 'formidable' ); |
|
253 | + wp_enqueue_script( 'formidable_admin' ); |
|
254 | 254 | FrmAppHelper::localize_script( 'admin' ); |
255 | 255 | |
256 | - wp_enqueue_style( 'formidable-admin' ); |
|
256 | + wp_enqueue_style( 'formidable-admin' ); |
|
257 | 257 | wp_enqueue_style( 'formidable-grids' ); |
258 | 258 | wp_enqueue_style( 'formidable-dropzone' ); |
259 | - add_thickbox(); |
|
259 | + add_thickbox(); |
|
260 | 260 | |
261 | - wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
261 | + wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
262 | 262 | |
263 | - } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
264 | - if ( isset( $_REQUEST['post_type'] ) ) { |
|
265 | - $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
263 | + } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
264 | + if ( isset( $_REQUEST['post_type'] ) ) { |
|
265 | + $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
266 | 266 | } else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) { |
267 | 267 | $post = get_post( absint( $_REQUEST['post'] ) ); |
268 | - if ( ! $post ) { |
|
269 | - return; |
|
270 | - } |
|
271 | - $post_type = $post->post_type; |
|
272 | - } else { |
|
273 | - return; |
|
274 | - } |
|
275 | - |
|
276 | - if ( $post_type == 'frm_display' ) { |
|
277 | - wp_enqueue_script( 'jquery-ui-draggable' ); |
|
278 | - wp_enqueue_script( 'formidable_admin' ); |
|
279 | - wp_enqueue_style( 'formidable-admin' ); |
|
268 | + if ( ! $post ) { |
|
269 | + return; |
|
270 | + } |
|
271 | + $post_type = $post->post_type; |
|
272 | + } else { |
|
273 | + return; |
|
274 | + } |
|
275 | + |
|
276 | + if ( $post_type == 'frm_display' ) { |
|
277 | + wp_enqueue_script( 'jquery-ui-draggable' ); |
|
278 | + wp_enqueue_script( 'formidable_admin' ); |
|
279 | + wp_enqueue_style( 'formidable-admin' ); |
|
280 | 280 | FrmAppHelper::localize_script( 'admin' ); |
281 | - } |
|
282 | - } else if ( $pagenow == 'widgets.php' ) { |
|
283 | - FrmAppHelper::load_admin_wide_js(); |
|
284 | - } |
|
285 | - } |
|
286 | - |
|
287 | - public static function load_lang() { |
|
288 | - load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
289 | - } |
|
290 | - |
|
291 | - /** |
|
292 | - * Filter shortcodes in text widgets |
|
293 | - */ |
|
294 | - public static function widget_text_filter( $content ) { |
|
295 | - $regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/'; |
|
296 | - return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content ); |
|
297 | - } |
|
281 | + } |
|
282 | + } else if ( $pagenow == 'widgets.php' ) { |
|
283 | + FrmAppHelper::load_admin_wide_js(); |
|
284 | + } |
|
285 | + } |
|
286 | + |
|
287 | + public static function load_lang() { |
|
288 | + load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
289 | + } |
|
290 | + |
|
291 | + /** |
|
292 | + * Filter shortcodes in text widgets |
|
293 | + */ |
|
294 | + public static function widget_text_filter( $content ) { |
|
295 | + $regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/'; |
|
296 | + return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content ); |
|
297 | + } |
|
298 | 298 | |
299 | 299 | /** |
300 | 300 | * Deprecated in favor of wpmu_upgrade_site |
@@ -359,20 +359,20 @@ discard block |
||
359 | 359 | wp_die(); |
360 | 360 | } |
361 | 361 | |
362 | - public static function activation_install() { |
|
363 | - FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' ); |
|
364 | - FrmFormActionsController::actions_init(); |
|
365 | - self::install(); |
|
366 | - } |
|
362 | + public static function activation_install() { |
|
363 | + FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' ); |
|
364 | + FrmFormActionsController::actions_init(); |
|
365 | + self::install(); |
|
366 | + } |
|
367 | 367 | |
368 | - public static function install( $old_db_version = false ) { |
|
369 | - $frmdb = new FrmDb(); |
|
370 | - $frmdb->upgrade( $old_db_version ); |
|
371 | - } |
|
368 | + public static function install( $old_db_version = false ) { |
|
369 | + $frmdb = new FrmDb(); |
|
370 | + $frmdb->upgrade( $old_db_version ); |
|
371 | + } |
|
372 | 372 | |
373 | - public static function uninstall() { |
|
373 | + public static function uninstall() { |
|
374 | 374 | FrmAppHelper::permission_check('administrator'); |
375 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
375 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
376 | 376 | |
377 | 377 | $frmdb = new FrmDb(); |
378 | 378 | $frmdb->uninstall(); |
@@ -381,43 +381,43 @@ discard block |
||
381 | 381 | deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false ); |
382 | 382 | echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) ); |
383 | 383 | |
384 | - wp_die(); |
|
385 | - } |
|
384 | + wp_die(); |
|
385 | + } |
|
386 | 386 | |
387 | - public static function drop_tables( $tables ) { |
|
388 | - global $wpdb; |
|
389 | - $tables[] = $wpdb->prefix . 'frm_fields'; |
|
390 | - $tables[] = $wpdb->prefix . 'frm_forms'; |
|
391 | - $tables[] = $wpdb->prefix . 'frm_items'; |
|
392 | - $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
393 | - return $tables; |
|
394 | - } |
|
387 | + public static function drop_tables( $tables ) { |
|
388 | + global $wpdb; |
|
389 | + $tables[] = $wpdb->prefix . 'frm_fields'; |
|
390 | + $tables[] = $wpdb->prefix . 'frm_forms'; |
|
391 | + $tables[] = $wpdb->prefix . 'frm_items'; |
|
392 | + $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
393 | + return $tables; |
|
394 | + } |
|
395 | 395 | |
396 | - // Routes for wordpress pages -- we're just replacing content here folks. |
|
397 | - public static function page_route( $content ) { |
|
398 | - global $post; |
|
396 | + // Routes for wordpress pages -- we're just replacing content here folks. |
|
397 | + public static function page_route( $content ) { |
|
398 | + global $post; |
|
399 | 399 | |
400 | - $frm_settings = FrmAppHelper::get_settings(); |
|
401 | - if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) { |
|
402 | - $content = FrmFormsController::page_preview(); |
|
403 | - } |
|
400 | + $frm_settings = FrmAppHelper::get_settings(); |
|
401 | + if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) { |
|
402 | + $content = FrmFormsController::page_preview(); |
|
403 | + } |
|
404 | 404 | |
405 | - return $content; |
|
406 | - } |
|
405 | + return $content; |
|
406 | + } |
|
407 | 407 | |
408 | - public static function deauthorize() { |
|
408 | + public static function deauthorize() { |
|
409 | 409 | FrmAppHelper::permission_check('frm_change_settings'); |
410 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
411 | - |
|
412 | - delete_option( 'frmpro-credentials' ); |
|
413 | - delete_option( 'frmpro-authorized' ); |
|
414 | - delete_site_option( 'frmpro-credentials' ); |
|
415 | - delete_site_option( 'frmpro-authorized' ); |
|
416 | - wp_die(); |
|
417 | - } |
|
418 | - |
|
419 | - public static function get_form_shortcode( $atts ) { |
|
420 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' ); |
|
421 | - return FrmFormsController::get_form_shortcode( $atts ); |
|
422 | - } |
|
410 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
411 | + |
|
412 | + delete_option( 'frmpro-credentials' ); |
|
413 | + delete_option( 'frmpro-authorized' ); |
|
414 | + delete_site_option( 'frmpro-credentials' ); |
|
415 | + delete_site_option( 'frmpro-authorized' ); |
|
416 | + wp_die(); |
|
417 | + } |
|
418 | + |
|
419 | + public static function get_form_shortcode( $atts ) { |
|
420 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' ); |
|
421 | + return FrmFormsController::get_form_shortcode( $atts ); |
|
422 | + } |
|
423 | 423 | } |
@@ -1,89 +1,89 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | class FrmHooksController { |
4 | - /** |
|
5 | - * Trigger plugin-wide hook loading |
|
6 | - */ |
|
7 | - public static function trigger_load_hook( $hooks = 'load_hooks' ) { |
|
8 | - $controllers = apply_filters( 'frm_load_controllers', array( 'FrmHooksController' ) ); |
|
9 | - |
|
10 | - $trigger_hooks = $hooks; |
|
11 | - $hooks = (array) $hooks; |
|
12 | - |
|
13 | - if ( 'load_hooks' == $trigger_hooks ) { |
|
14 | - if ( is_admin() ) { |
|
15 | - $hooks[] = 'load_admin_hooks'; |
|
16 | - if ( defined( 'DOING_AJAX' ) ) { |
|
17 | - $hooks[] = 'load_ajax_hooks'; |
|
18 | - $hooks[] = 'load_form_hooks'; |
|
19 | - } |
|
20 | - } |
|
21 | - |
|
22 | - if ( is_multisite() ) { |
|
23 | - $hooks[] = 'load_multisite_hooks'; |
|
24 | - } |
|
25 | - } else { |
|
26 | - // Make sure the hooks are only triggered once |
|
27 | - add_filter( 'frm' . str_replace( 'load', '', $trigger_hooks ) . '_loaded', '__return_true' ); |
|
28 | - } |
|
29 | - unset( $trigger_hooks ); |
|
30 | - |
|
31 | - // Instansiate Controllers |
|
32 | - foreach ( $controllers as $c ) { |
|
33 | - foreach ( $hooks as $hook ) { |
|
4 | + /** |
|
5 | + * Trigger plugin-wide hook loading |
|
6 | + */ |
|
7 | + public static function trigger_load_hook( $hooks = 'load_hooks' ) { |
|
8 | + $controllers = apply_filters( 'frm_load_controllers', array( 'FrmHooksController' ) ); |
|
9 | + |
|
10 | + $trigger_hooks = $hooks; |
|
11 | + $hooks = (array) $hooks; |
|
12 | + |
|
13 | + if ( 'load_hooks' == $trigger_hooks ) { |
|
14 | + if ( is_admin() ) { |
|
15 | + $hooks[] = 'load_admin_hooks'; |
|
16 | + if ( defined( 'DOING_AJAX' ) ) { |
|
17 | + $hooks[] = 'load_ajax_hooks'; |
|
18 | + $hooks[] = 'load_form_hooks'; |
|
19 | + } |
|
20 | + } |
|
21 | + |
|
22 | + if ( is_multisite() ) { |
|
23 | + $hooks[] = 'load_multisite_hooks'; |
|
24 | + } |
|
25 | + } else { |
|
26 | + // Make sure the hooks are only triggered once |
|
27 | + add_filter( 'frm' . str_replace( 'load', '', $trigger_hooks ) . '_loaded', '__return_true' ); |
|
28 | + } |
|
29 | + unset( $trigger_hooks ); |
|
30 | + |
|
31 | + // Instansiate Controllers |
|
32 | + foreach ( $controllers as $c ) { |
|
33 | + foreach ( $hooks as $hook ) { |
|
34 | 34 | call_user_func( array( $c, $hook ) ); |
35 | 35 | unset( $hook ); |
36 | - } |
|
36 | + } |
|
37 | 37 | unset( $c ); |
38 | - } |
|
38 | + } |
|
39 | 39 | |
40 | - } |
|
40 | + } |
|
41 | 41 | |
42 | - public static function trigger_load_form_hooks() { |
|
43 | - self::trigger_load_hook( 'load_form_hooks' ); |
|
44 | - } |
|
42 | + public static function trigger_load_form_hooks() { |
|
43 | + self::trigger_load_hook( 'load_form_hooks' ); |
|
44 | + } |
|
45 | 45 | |
46 | 46 | public static function load_hooks() { |
47 | - if ( ! is_admin() ) { |
|
48 | - add_filter( 'the_content', 'FrmAppController::page_route', 10 ); |
|
49 | - } |
|
47 | + if ( ! is_admin() ) { |
|
48 | + add_filter( 'the_content', 'FrmAppController::page_route', 10 ); |
|
49 | + } |
|
50 | 50 | |
51 | - add_action( 'plugins_loaded', 'FrmAppController::load_lang' ); |
|
52 | - add_filter( 'widget_text', 'FrmAppController::widget_text_filter', 8 ); |
|
51 | + add_action( 'plugins_loaded', 'FrmAppController::load_lang' ); |
|
52 | + add_filter( 'widget_text', 'FrmAppController::widget_text_filter', 8 ); |
|
53 | 53 | |
54 | - // Entries controller |
|
55 | - add_action( 'wp_loaded', 'FrmEntriesController::process_entry', 10, 0 ); |
|
56 | - add_filter( 'frm_redirect_url', 'FrmEntriesController::delete_entry_before_redirect', 50, 3 ); |
|
57 | - add_action( 'frm_after_entry_processed', 'FrmEntriesController::delete_entry_after_save', 100 ); |
|
54 | + // Entries controller |
|
55 | + add_action( 'wp_loaded', 'FrmEntriesController::process_entry', 10, 0 ); |
|
56 | + add_filter( 'frm_redirect_url', 'FrmEntriesController::delete_entry_before_redirect', 50, 3 ); |
|
57 | + add_action( 'frm_after_entry_processed', 'FrmEntriesController::delete_entry_after_save', 100 ); |
|
58 | 58 | |
59 | - // Form Actions Controller |
|
60 | - add_action( 'init', 'FrmFormActionsController::register_post_types', 1 ); |
|
59 | + // Form Actions Controller |
|
60 | + add_action( 'init', 'FrmFormActionsController::register_post_types', 1 ); |
|
61 | 61 | add_action( 'frm_after_create_entry', 'FrmFormActionsController::trigger_create_actions', 20, 3 ); |
62 | 62 | |
63 | - // Forms Controller |
|
64 | - add_action( 'widgets_init', 'FrmFormsController::register_widgets' ); |
|
63 | + // Forms Controller |
|
64 | + add_action( 'widgets_init', 'FrmFormsController::register_widgets' ); |
|
65 | 65 | add_action( 'init', 'FrmFormsController::front_head' ); |
66 | - add_filter( 'frm_content', 'FrmFormsController::filter_content', 10, 3 ); |
|
67 | - add_filter( 'frm_replace_content_shortcodes', 'FrmFormsController::replace_content_shortcodes', 20, 3 ); |
|
68 | - add_action( 'admin_bar_init', 'FrmFormsController::admin_bar_css' ); |
|
66 | + add_filter( 'frm_content', 'FrmFormsController::filter_content', 10, 3 ); |
|
67 | + add_filter( 'frm_replace_content_shortcodes', 'FrmFormsController::replace_content_shortcodes', 20, 3 ); |
|
68 | + add_action( 'admin_bar_init', 'FrmFormsController::admin_bar_css' ); |
|
69 | 69 | add_action( 'wp_footer', 'FrmFormsController::footer_js', 1, 0 ); |
70 | 70 | |
71 | 71 | add_action( 'wp_scheduled_delete', 'FrmForm::scheduled_delete' ); |
72 | 72 | |
73 | - // Form Shortcodes |
|
74 | - add_shortcode( 'formidable', 'FrmFormsController::get_form_shortcode' ); |
|
73 | + // Form Shortcodes |
|
74 | + add_shortcode( 'formidable', 'FrmFormsController::get_form_shortcode' ); |
|
75 | 75 | |
76 | - // Styles Controller |
|
77 | - add_action( 'init', 'FrmStylesController::register_post_types', 0 ); |
|
78 | - add_filter( 'frm_get_style_opts', 'FrmStylesController::get_style_opts' ); |
|
79 | - add_filter( 'frm_add_form_style_class', 'FrmStylesController::get_form_style_class', 10, 2 ); |
|
80 | - add_filter( 'frm_show_entry_styles', 'FrmStylesController::show_entry_styles' ); |
|
81 | - } |
|
76 | + // Styles Controller |
|
77 | + add_action( 'init', 'FrmStylesController::register_post_types', 0 ); |
|
78 | + add_filter( 'frm_get_style_opts', 'FrmStylesController::get_style_opts' ); |
|
79 | + add_filter( 'frm_add_form_style_class', 'FrmStylesController::get_form_style_class', 10, 2 ); |
|
80 | + add_filter( 'frm_show_entry_styles', 'FrmStylesController::show_entry_styles' ); |
|
81 | + } |
|
82 | 82 | |
83 | 83 | public static function load_admin_hooks() { |
84 | - add_action( 'admin_menu', 'FrmAppController::menu', 1 ); |
|
85 | - add_action( 'admin_enqueue_scripts', 'FrmAppController::load_wp_admin_style' ); |
|
86 | - add_action( 'admin_notices', 'FrmAppController::pro_get_started_headline' ); |
|
84 | + add_action( 'admin_menu', 'FrmAppController::menu', 1 ); |
|
85 | + add_action( 'admin_enqueue_scripts', 'FrmAppController::load_wp_admin_style' ); |
|
86 | + add_action( 'admin_notices', 'FrmAppController::pro_get_started_headline' ); |
|
87 | 87 | add_action( 'admin_init', 'FrmAppController::admin_init', 11 ); |
88 | 88 | add_filter( 'plugin_action_links_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::settings_link' ); |
89 | 89 | register_activation_hook( FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::activation_install' ); |
@@ -92,119 +92,119 @@ discard block |
||
92 | 92 | add_action( 'admin_menu', 'FrmAddonsController::menu', 100 ); |
93 | 93 | add_filter( 'upgrader_pre_download', 'FrmAddonsController::add_shorten_edd_filename_filter', 10, 4 ); |
94 | 94 | |
95 | - // Entries Controller |
|
96 | - add_action( 'admin_menu', 'FrmEntriesController::menu', 12 ); |
|
97 | - add_filter( 'contextual_help', 'FrmEntriesController::contextual_help', 10, 3 ); |
|
98 | - add_filter( 'set-screen-option', 'FrmEntriesController::save_per_page', 10, 3 ); |
|
99 | - add_filter( 'update_user_metadata', 'FrmEntriesController::check_hidden_cols', 10, 5 ); |
|
100 | - add_action( 'updated_user_meta', 'FrmEntriesController::update_hidden_cols', 10, 4 ); |
|
95 | + // Entries Controller |
|
96 | + add_action( 'admin_menu', 'FrmEntriesController::menu', 12 ); |
|
97 | + add_filter( 'contextual_help', 'FrmEntriesController::contextual_help', 10, 3 ); |
|
98 | + add_filter( 'set-screen-option', 'FrmEntriesController::save_per_page', 10, 3 ); |
|
99 | + add_filter( 'update_user_metadata', 'FrmEntriesController::check_hidden_cols', 10, 5 ); |
|
100 | + add_action( 'updated_user_meta', 'FrmEntriesController::update_hidden_cols', 10, 4 ); |
|
101 | 101 | |
102 | - // Fields Controller |
|
103 | - add_filter( 'frm_display_field_options', 'FrmFieldsController::display_field_options' ); |
|
102 | + // Fields Controller |
|
103 | + add_filter( 'frm_display_field_options', 'FrmFieldsController::display_field_options' ); |
|
104 | 104 | |
105 | - // Form Actions Controller |
|
106 | - if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
|
107 | - add_action( 'frm_before_update_form_settings', 'FrmFormActionsController::update_settings' ); |
|
108 | - } |
|
109 | - add_action( 'frm_after_duplicate_form', 'FrmFormActionsController::duplicate_form_actions', 20, 3 ); |
|
105 | + // Form Actions Controller |
|
106 | + if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
|
107 | + add_action( 'frm_before_update_form_settings', 'FrmFormActionsController::update_settings' ); |
|
108 | + } |
|
109 | + add_action( 'frm_after_duplicate_form', 'FrmFormActionsController::duplicate_form_actions', 20, 3 ); |
|
110 | 110 | |
111 | - // Forms Controller |
|
112 | - add_action( 'admin_menu', 'FrmFormsController::menu', 10 ); |
|
113 | - add_action( 'admin_head-toplevel_page_formidable', 'FrmFormsController::head' ); |
|
111 | + // Forms Controller |
|
112 | + add_action( 'admin_menu', 'FrmFormsController::menu', 10 ); |
|
113 | + add_action( 'admin_head-toplevel_page_formidable', 'FrmFormsController::head' ); |
|
114 | 114 | |
115 | - add_filter( 'set-screen-option', 'FrmFormsController::save_per_page', 10, 3 ); |
|
116 | - add_action( 'admin_footer', 'FrmFormsController::insert_form_popup' ); |
|
115 | + add_filter( 'set-screen-option', 'FrmFormsController::save_per_page', 10, 3 ); |
|
116 | + add_action( 'admin_footer', 'FrmFormsController::insert_form_popup' ); |
|
117 | 117 | add_action( 'media_buttons', 'FrmFormsController::insert_form_button' ); |
118 | 118 | |
119 | - // Forms Model |
|
120 | - add_action( 'frm_after_duplicate_form', 'FrmForm::after_duplicate', 10, 2 ); |
|
119 | + // Forms Model |
|
120 | + add_action( 'frm_after_duplicate_form', 'FrmForm::after_duplicate', 10, 2 ); |
|
121 | 121 | |
122 | - // Settings Controller |
|
123 | - add_action( 'admin_menu', 'FrmSettingsController::menu', 45 ); |
|
124 | - add_action( 'frm_before_settings', 'FrmSettingsController::license_box' ); |
|
122 | + // Settings Controller |
|
123 | + add_action( 'admin_menu', 'FrmSettingsController::menu', 45 ); |
|
124 | + add_action( 'frm_before_settings', 'FrmSettingsController::license_box' ); |
|
125 | 125 | |
126 | - // Styles Controller |
|
127 | - add_action( 'admin_menu', 'FrmStylesController::menu', 14 ); |
|
128 | - add_action( 'admin_init', 'FrmStylesController::admin_init' ); |
|
126 | + // Styles Controller |
|
127 | + add_action( 'admin_menu', 'FrmStylesController::menu', 14 ); |
|
128 | + add_action( 'admin_init', 'FrmStylesController::admin_init' ); |
|
129 | 129 | |
130 | - // XML Controller |
|
131 | - add_action( 'admin_menu', 'FrmXMLController::menu', 41 ); |
|
132 | - } |
|
130 | + // XML Controller |
|
131 | + add_action( 'admin_menu', 'FrmXMLController::menu', 41 ); |
|
132 | + } |
|
133 | 133 | |
134 | 134 | public static function load_ajax_hooks() { |
135 | 135 | add_action( 'wp_ajax_frm_silent_upgrade', 'FrmAppController::ajax_install' ); |
136 | 136 | add_action( 'wp_ajax_nopriv_frm_silent_upgrade', 'FrmAppController::ajax_install' ); |
137 | 137 | add_action( 'wp_ajax_frm_install', 'FrmAppController::ajax_install' ); |
138 | - add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' ); |
|
139 | - add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' ); |
|
138 | + add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' ); |
|
139 | + add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' ); |
|
140 | 140 | |
141 | 141 | // Addons |
142 | 142 | add_action('wp_ajax_frm_addon_activate', 'FrmAddon::activate' ); |
143 | 143 | add_action('wp_ajax_frm_addon_deactivate', 'FrmAddon::deactivate' ); |
144 | 144 | add_action( 'wp_ajax_frm_fill_licenses', 'FrmAddonsController::get_licenses' ); |
145 | 145 | |
146 | - // Fields Controller |
|
147 | - add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' ); |
|
148 | - add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' ); |
|
149 | - add_action( 'wp_ajax_frm_field_name_in_place_edit', 'FrmFieldsController::edit_name' ); |
|
150 | - add_action( 'wp_ajax_frm_update_ajax_option', 'FrmFieldsController::update_ajax_option' ); |
|
151 | - add_action( 'wp_ajax_frm_duplicate_field', 'FrmFieldsController::duplicate' ); |
|
152 | - add_action( 'wp_ajax_frm_delete_field', 'FrmFieldsController::destroy' ); |
|
153 | - add_action( 'wp_ajax_frm_add_field_option', 'FrmFieldsController::add_option' ); |
|
154 | - add_action( 'wp_ajax_frm_import_choices', 'FrmFieldsController::import_choices' ); |
|
155 | - add_action( 'wp_ajax_frm_import_options', 'FrmFieldsController::import_options' ); |
|
156 | - add_action( 'wp_ajax_frm_update_field_order', 'FrmFieldsController::update_order' ); |
|
157 | - |
|
158 | - // Form Actions Controller |
|
159 | - add_action( 'wp_ajax_frm_add_form_action', 'FrmFormActionsController::add_form_action' ); |
|
160 | - add_action( 'wp_ajax_frm_form_action_fill', 'FrmFormActionsController::fill_action' ); |
|
161 | - |
|
162 | - // Forms Controller |
|
146 | + // Fields Controller |
|
147 | + add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' ); |
|
148 | + add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' ); |
|
149 | + add_action( 'wp_ajax_frm_field_name_in_place_edit', 'FrmFieldsController::edit_name' ); |
|
150 | + add_action( 'wp_ajax_frm_update_ajax_option', 'FrmFieldsController::update_ajax_option' ); |
|
151 | + add_action( 'wp_ajax_frm_duplicate_field', 'FrmFieldsController::duplicate' ); |
|
152 | + add_action( 'wp_ajax_frm_delete_field', 'FrmFieldsController::destroy' ); |
|
153 | + add_action( 'wp_ajax_frm_add_field_option', 'FrmFieldsController::add_option' ); |
|
154 | + add_action( 'wp_ajax_frm_import_choices', 'FrmFieldsController::import_choices' ); |
|
155 | + add_action( 'wp_ajax_frm_import_options', 'FrmFieldsController::import_options' ); |
|
156 | + add_action( 'wp_ajax_frm_update_field_order', 'FrmFieldsController::update_order' ); |
|
157 | + |
|
158 | + // Form Actions Controller |
|
159 | + add_action( 'wp_ajax_frm_add_form_action', 'FrmFormActionsController::add_form_action' ); |
|
160 | + add_action( 'wp_ajax_frm_form_action_fill', 'FrmFormActionsController::fill_action' ); |
|
161 | + |
|
162 | + // Forms Controller |
|
163 | 163 | add_action( 'wp_ajax_frm_create_from_template', 'FrmFormsController::_create_from_template' ); |
164 | 164 | add_action( 'wp_ajax_frm_save_form', 'FrmFormsController::route' ); |
165 | 165 | add_action( 'wp_ajax_frm_form_key_in_place_edit', 'FrmFormsController::edit_key' ); |
166 | 166 | add_action( 'wp_ajax_frm_form_desc_in_place_edit', 'FrmFormsController::edit_description' ); |
167 | - add_action( 'wp_ajax_frm_get_default_html', 'FrmFormsController::get_email_html' ); |
|
168 | - add_action( 'wp_ajax_frm_get_shortcode_opts', 'FrmFormsController::get_shortcode_opts' ); |
|
169 | - add_action( 'wp_ajax_frm_forms_preview', 'FrmFormsController::preview' ); |
|
170 | - add_action( 'wp_ajax_nopriv_frm_forms_preview', 'FrmFormsController::preview' ); |
|
171 | - |
|
172 | - // Styles Controller |
|
173 | - add_action( 'wp_ajax_frm_settings_reset', 'FrmStylesController::reset_styling' ); |
|
174 | - add_action( 'wp_ajax_frm_change_styling', 'FrmStylesController::change_styling' ); |
|
175 | - add_action( 'wp_ajax_frmpro_load_css', 'FrmStylesController::load_css' ); |
|
176 | - add_action( 'wp_ajax_nopriv_frmpro_load_css', 'FrmStylesController::load_css' ); |
|
167 | + add_action( 'wp_ajax_frm_get_default_html', 'FrmFormsController::get_email_html' ); |
|
168 | + add_action( 'wp_ajax_frm_get_shortcode_opts', 'FrmFormsController::get_shortcode_opts' ); |
|
169 | + add_action( 'wp_ajax_frm_forms_preview', 'FrmFormsController::preview' ); |
|
170 | + add_action( 'wp_ajax_nopriv_frm_forms_preview', 'FrmFormsController::preview' ); |
|
171 | + |
|
172 | + // Styles Controller |
|
173 | + add_action( 'wp_ajax_frm_settings_reset', 'FrmStylesController::reset_styling' ); |
|
174 | + add_action( 'wp_ajax_frm_change_styling', 'FrmStylesController::change_styling' ); |
|
175 | + add_action( 'wp_ajax_frmpro_load_css', 'FrmStylesController::load_css' ); |
|
176 | + add_action( 'wp_ajax_nopriv_frmpro_load_css', 'FrmStylesController::load_css' ); |
|
177 | 177 | add_action( 'wp_ajax_frmpro_css', 'FrmStylesController::load_saved_css' ); |
178 | 178 | add_action( 'wp_ajax_nopriv_frmpro_css', 'FrmStylesController::load_saved_css' ); |
179 | 179 | |
180 | - // XML Controller |
|
180 | + // XML Controller |
|
181 | 181 | add_action( 'wp_ajax_frm_entries_csv', 'FrmXMLController::csv' ); |
182 | 182 | add_action( 'wp_ajax_nopriv_frm_entries_csv', 'FrmXMLController::csv' ); |
183 | - add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' ); |
|
184 | - } |
|
183 | + add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' ); |
|
184 | + } |
|
185 | 185 | |
186 | 186 | public static function load_form_hooks() { |
187 | - // Fields Controller |
|
188 | - add_filter( 'frm_field_type', 'FrmFieldsController::change_type' ); |
|
189 | - add_action( 'frm_field_input_html', 'FrmFieldsController::input_html' ); |
|
190 | - add_filter( 'frm_field_value_saved', 'FrmFieldsController::check_value', 50, 3 ); |
|
191 | - add_filter( 'frm_field_label_seen', 'FrmFieldsController::check_label' ); |
|
187 | + // Fields Controller |
|
188 | + add_filter( 'frm_field_type', 'FrmFieldsController::change_type' ); |
|
189 | + add_action( 'frm_field_input_html', 'FrmFieldsController::input_html' ); |
|
190 | + add_filter( 'frm_field_value_saved', 'FrmFieldsController::check_value', 50, 3 ); |
|
191 | + add_filter( 'frm_field_label_seen', 'FrmFieldsController::check_label' ); |
|
192 | 192 | |
193 | 193 | // Forms Controller |
194 | 194 | add_filter( 'frm_form_classes', 'FrmFormsController::form_classes' ); |
195 | 195 | |
196 | - // Styles Controller |
|
197 | - add_filter( 'frm_use_important_width', 'FrmStylesController::important_style', 10, 2 ); |
|
198 | - } |
|
196 | + // Styles Controller |
|
197 | + add_filter( 'frm_use_important_width', 'FrmStylesController::important_style', 10, 2 ); |
|
198 | + } |
|
199 | 199 | |
200 | 200 | public static function load_view_hooks() { |
201 | - // Hooks go here when a view is loaded |
|
202 | - } |
|
201 | + // Hooks go here when a view is loaded |
|
202 | + } |
|
203 | 203 | |
204 | 204 | public static function load_multisite_hooks() { |
205 | 205 | add_action( 'wpmu_upgrade_site', 'FrmAppController::network_upgrade_site' ); |
206 | 206 | |
207 | - // drop tables when mu site is deleted |
|
208 | - add_filter( 'wpmu_drop_tables', 'FrmAppController::drop_tables' ); |
|
209 | - } |
|
207 | + // drop tables when mu site is deleted |
|
208 | + add_filter( 'wpmu_drop_tables', 'FrmAppController::drop_tables' ); |
|
209 | + } |
|
210 | 210 | } |