@@ -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,120 +92,120 @@ 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 | add_action( 'wp_ajax_frm_settings_tab', 'FrmSettingsController::load_settings_tab' ); |
| 126 | 126 | |
| 127 | - // Styles Controller |
|
| 128 | - add_action( 'admin_menu', 'FrmStylesController::menu', 14 ); |
|
| 129 | - add_action( 'admin_init', 'FrmStylesController::admin_init' ); |
|
| 127 | + // Styles Controller |
|
| 128 | + add_action( 'admin_menu', 'FrmStylesController::menu', 14 ); |
|
| 129 | + add_action( 'admin_init', 'FrmStylesController::admin_init' ); |
|
| 130 | 130 | |
| 131 | - // XML Controller |
|
| 132 | - add_action( 'admin_menu', 'FrmXMLController::menu', 41 ); |
|
| 133 | - } |
|
| 131 | + // XML Controller |
|
| 132 | + add_action( 'admin_menu', 'FrmXMLController::menu', 41 ); |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | 135 | public static function load_ajax_hooks() { |
| 136 | 136 | add_action( 'wp_ajax_frm_silent_upgrade', 'FrmAppController::ajax_install' ); |
| 137 | 137 | add_action( 'wp_ajax_nopriv_frm_silent_upgrade', 'FrmAppController::ajax_install' ); |
| 138 | 138 | add_action( 'wp_ajax_frm_install', 'FrmAppController::ajax_install' ); |
| 139 | - add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' ); |
|
| 140 | - add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' ); |
|
| 139 | + add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' ); |
|
| 140 | + add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' ); |
|
| 141 | 141 | |
| 142 | 142 | // Addons |
| 143 | 143 | add_action('wp_ajax_frm_addon_activate', 'FrmAddon::activate' ); |
| 144 | 144 | add_action('wp_ajax_frm_addon_deactivate', 'FrmAddon::deactivate' ); |
| 145 | 145 | add_action( 'wp_ajax_frm_fill_licenses', 'FrmAddonsController::get_licenses' ); |
| 146 | 146 | |
| 147 | - // Fields Controller |
|
| 148 | - add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' ); |
|
| 149 | - add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' ); |
|
| 150 | - add_action( 'wp_ajax_frm_field_name_in_place_edit', 'FrmFieldsController::edit_name' ); |
|
| 151 | - add_action( 'wp_ajax_frm_update_ajax_option', 'FrmFieldsController::update_ajax_option' ); |
|
| 152 | - add_action( 'wp_ajax_frm_duplicate_field', 'FrmFieldsController::duplicate' ); |
|
| 153 | - add_action( 'wp_ajax_frm_delete_field', 'FrmFieldsController::destroy' ); |
|
| 154 | - add_action( 'wp_ajax_frm_add_field_option', 'FrmFieldsController::add_option' ); |
|
| 155 | - add_action( 'wp_ajax_frm_import_choices', 'FrmFieldsController::import_choices' ); |
|
| 156 | - add_action( 'wp_ajax_frm_import_options', 'FrmFieldsController::import_options' ); |
|
| 157 | - add_action( 'wp_ajax_frm_update_field_order', 'FrmFieldsController::update_order' ); |
|
| 158 | - |
|
| 159 | - // Form Actions Controller |
|
| 160 | - add_action( 'wp_ajax_frm_add_form_action', 'FrmFormActionsController::add_form_action' ); |
|
| 161 | - add_action( 'wp_ajax_frm_form_action_fill', 'FrmFormActionsController::fill_action' ); |
|
| 162 | - |
|
| 163 | - // Forms Controller |
|
| 147 | + // Fields Controller |
|
| 148 | + add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' ); |
|
| 149 | + add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' ); |
|
| 150 | + add_action( 'wp_ajax_frm_field_name_in_place_edit', 'FrmFieldsController::edit_name' ); |
|
| 151 | + add_action( 'wp_ajax_frm_update_ajax_option', 'FrmFieldsController::update_ajax_option' ); |
|
| 152 | + add_action( 'wp_ajax_frm_duplicate_field', 'FrmFieldsController::duplicate' ); |
|
| 153 | + add_action( 'wp_ajax_frm_delete_field', 'FrmFieldsController::destroy' ); |
|
| 154 | + add_action( 'wp_ajax_frm_add_field_option', 'FrmFieldsController::add_option' ); |
|
| 155 | + add_action( 'wp_ajax_frm_import_choices', 'FrmFieldsController::import_choices' ); |
|
| 156 | + add_action( 'wp_ajax_frm_import_options', 'FrmFieldsController::import_options' ); |
|
| 157 | + add_action( 'wp_ajax_frm_update_field_order', 'FrmFieldsController::update_order' ); |
|
| 158 | + |
|
| 159 | + // Form Actions Controller |
|
| 160 | + add_action( 'wp_ajax_frm_add_form_action', 'FrmFormActionsController::add_form_action' ); |
|
| 161 | + add_action( 'wp_ajax_frm_form_action_fill', 'FrmFormActionsController::fill_action' ); |
|
| 162 | + |
|
| 163 | + // Forms Controller |
|
| 164 | 164 | add_action( 'wp_ajax_frm_create_from_template', 'FrmFormsController::_create_from_template' ); |
| 165 | 165 | add_action( 'wp_ajax_frm_save_form', 'FrmFormsController::route' ); |
| 166 | 166 | add_action( 'wp_ajax_frm_form_key_in_place_edit', 'FrmFormsController::edit_key' ); |
| 167 | 167 | add_action( 'wp_ajax_frm_form_desc_in_place_edit', 'FrmFormsController::edit_description' ); |
| 168 | - add_action( 'wp_ajax_frm_get_default_html', 'FrmFormsController::get_email_html' ); |
|
| 169 | - add_action( 'wp_ajax_frm_get_shortcode_opts', 'FrmFormsController::get_shortcode_opts' ); |
|
| 170 | - add_action( 'wp_ajax_frm_forms_preview', 'FrmFormsController::preview' ); |
|
| 171 | - add_action( 'wp_ajax_nopriv_frm_forms_preview', 'FrmFormsController::preview' ); |
|
| 172 | - |
|
| 173 | - // Styles Controller |
|
| 174 | - add_action( 'wp_ajax_frm_settings_reset', 'FrmStylesController::reset_styling' ); |
|
| 175 | - add_action( 'wp_ajax_frm_change_styling', 'FrmStylesController::change_styling' ); |
|
| 176 | - add_action( 'wp_ajax_frmpro_load_css', 'FrmStylesController::load_css' ); |
|
| 177 | - add_action( 'wp_ajax_nopriv_frmpro_load_css', 'FrmStylesController::load_css' ); |
|
| 168 | + add_action( 'wp_ajax_frm_get_default_html', 'FrmFormsController::get_email_html' ); |
|
| 169 | + add_action( 'wp_ajax_frm_get_shortcode_opts', 'FrmFormsController::get_shortcode_opts' ); |
|
| 170 | + add_action( 'wp_ajax_frm_forms_preview', 'FrmFormsController::preview' ); |
|
| 171 | + add_action( 'wp_ajax_nopriv_frm_forms_preview', 'FrmFormsController::preview' ); |
|
| 172 | + |
|
| 173 | + // Styles Controller |
|
| 174 | + add_action( 'wp_ajax_frm_settings_reset', 'FrmStylesController::reset_styling' ); |
|
| 175 | + add_action( 'wp_ajax_frm_change_styling', 'FrmStylesController::change_styling' ); |
|
| 176 | + add_action( 'wp_ajax_frmpro_load_css', 'FrmStylesController::load_css' ); |
|
| 177 | + add_action( 'wp_ajax_nopriv_frmpro_load_css', 'FrmStylesController::load_css' ); |
|
| 178 | 178 | add_action( 'wp_ajax_frmpro_css', 'FrmStylesController::load_saved_css' ); |
| 179 | 179 | add_action( 'wp_ajax_nopriv_frmpro_css', 'FrmStylesController::load_saved_css' ); |
| 180 | 180 | |
| 181 | - // XML Controller |
|
| 181 | + // XML Controller |
|
| 182 | 182 | add_action( 'wp_ajax_frm_entries_csv', 'FrmXMLController::csv' ); |
| 183 | 183 | add_action( 'wp_ajax_nopriv_frm_entries_csv', 'FrmXMLController::csv' ); |
| 184 | - add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' ); |
|
| 185 | - } |
|
| 184 | + add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' ); |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | 187 | public static function load_form_hooks() { |
| 188 | - // Fields Controller |
|
| 189 | - add_filter( 'frm_field_type', 'FrmFieldsController::change_type' ); |
|
| 190 | - add_action( 'frm_field_input_html', 'FrmFieldsController::input_html' ); |
|
| 191 | - add_filter( 'frm_field_value_saved', 'FrmFieldsController::check_value', 50, 3 ); |
|
| 192 | - add_filter( 'frm_field_label_seen', 'FrmFieldsController::check_label' ); |
|
| 188 | + // Fields Controller |
|
| 189 | + add_filter( 'frm_field_type', 'FrmFieldsController::change_type' ); |
|
| 190 | + add_action( 'frm_field_input_html', 'FrmFieldsController::input_html' ); |
|
| 191 | + add_filter( 'frm_field_value_saved', 'FrmFieldsController::check_value', 50, 3 ); |
|
| 192 | + add_filter( 'frm_field_label_seen', 'FrmFieldsController::check_label' ); |
|
| 193 | 193 | |
| 194 | 194 | // Forms Controller |
| 195 | 195 | add_filter( 'frm_form_classes', 'FrmFormsController::form_classes' ); |
| 196 | 196 | |
| 197 | - // Styles Controller |
|
| 198 | - add_filter( 'frm_use_important_width', 'FrmStylesController::important_style', 10, 2 ); |
|
| 199 | - } |
|
| 197 | + // Styles Controller |
|
| 198 | + add_filter( 'frm_use_important_width', 'FrmStylesController::important_style', 10, 2 ); |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | 201 | public static function load_view_hooks() { |
| 202 | - // Hooks go here when a view is loaded |
|
| 203 | - } |
|
| 202 | + // Hooks go here when a view is loaded |
|
| 203 | + } |
|
| 204 | 204 | |
| 205 | 205 | public static function load_multisite_hooks() { |
| 206 | 206 | add_action( 'wpmu_upgrade_site', 'FrmAppController::network_upgrade_site' ); |
| 207 | 207 | |
| 208 | - // drop tables when mu site is deleted |
|
| 209 | - add_filter( 'wpmu_drop_tables', 'FrmAppController::drop_tables' ); |
|
| 210 | - } |
|
| 208 | + // drop tables when mu site is deleted |
|
| 209 | + add_filter( 'wpmu_drop_tables', 'FrmAppController::drop_tables' ); |
|
| 210 | + } |
|
| 211 | 211 | } |
@@ -2,26 +2,26 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | class FrmSettingsController { |
| 4 | 4 | |
| 5 | - public static function menu() { |
|
| 5 | + public static function menu() { |
|
| 6 | 6 | // Make sure admins can see the menu items |
| 7 | 7 | FrmAppHelper::force_capability( 'frm_change_settings' ); |
| 8 | 8 | |
| 9 | - add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); |
|
| 10 | - } |
|
| 9 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); |
|
| 10 | + } |
|
| 11 | 11 | |
| 12 | - public static function license_box() { |
|
| 12 | + public static function license_box() { |
|
| 13 | 13 | $a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); |
| 14 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' ); |
|
| 15 | - } |
|
| 14 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' ); |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - public static function display_form( $errors = array(), $message = '' ) { |
|
| 18 | - global $frm_vars; |
|
| 17 | + public static function display_form( $errors = array(), $message = '' ) { |
|
| 18 | + global $frm_vars; |
|
| 19 | 19 | |
| 20 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 21 | - $frm_roles = FrmAppHelper::frm_capabilities(); |
|
| 20 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 21 | + $frm_roles = FrmAppHelper::frm_capabilities(); |
|
| 22 | 22 | |
| 23 | - $uploads = wp_upload_dir(); |
|
| 24 | - $target_path = $uploads['basedir'] . '/formidable/css'; |
|
| 23 | + $uploads = wp_upload_dir(); |
|
| 24 | + $target_path = $uploads['basedir'] . '/formidable/css'; |
|
| 25 | 25 | |
| 26 | 26 | $sections = self::get_settings_tabs(); |
| 27 | 27 | |
@@ -64,47 +64,47 @@ discard block |
||
| 64 | 64 | wp_die(); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - public static function process_form( $stop_load = false ) { |
|
| 68 | - global $frm_vars; |
|
| 67 | + public static function process_form( $stop_load = false ) { |
|
| 68 | + global $frm_vars; |
|
| 69 | 69 | |
| 70 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 70 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 71 | 71 | |
| 72 | 72 | $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' ); |
| 73 | 73 | if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) { |
| 74 | - wp_die( $frm_settings->admin_permission ); |
|
| 75 | - } |
|
| 74 | + wp_die( $frm_settings->admin_permission ); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - $errors = array(); |
|
| 78 | - $message = ''; |
|
| 77 | + $errors = array(); |
|
| 78 | + $message = ''; |
|
| 79 | 79 | |
| 80 | - if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) { |
|
| 81 | - $errors = $frm_settings->validate( $_POST, array() ); |
|
| 80 | + if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) { |
|
| 81 | + $errors = $frm_settings->validate( $_POST, array() ); |
|
| 82 | 82 | |
| 83 | - $frm_settings->update( stripslashes_deep( $_POST ) ); |
|
| 83 | + $frm_settings->update( stripslashes_deep( $_POST ) ); |
|
| 84 | 84 | |
| 85 | - if ( empty( $errors ) ) { |
|
| 86 | - $frm_settings->store(); |
|
| 87 | - $message = __( 'Settings Saved', 'formidable' ); |
|
| 88 | - } |
|
| 89 | - } else { |
|
| 90 | - $message = __( 'Settings Saved', 'formidable' ); |
|
| 91 | - } |
|
| 85 | + if ( empty( $errors ) ) { |
|
| 86 | + $frm_settings->store(); |
|
| 87 | + $message = __( 'Settings Saved', 'formidable' ); |
|
| 88 | + } |
|
| 89 | + } else { |
|
| 90 | + $message = __( 'Settings Saved', 'formidable' ); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | 93 | if ( $stop_load == 'stop_load' ) { |
| 94 | - $frm_vars['settings_routed'] = true; |
|
| 95 | - return; |
|
| 96 | - } |
|
| 94 | + $frm_vars['settings_routed'] = true; |
|
| 95 | + return; |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - self::display_form( $errors, $message ); |
|
| 99 | - } |
|
| 98 | + self::display_form( $errors, $message ); |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - public static function route( $stop_load = false ) { |
|
| 102 | - $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
| 101 | + public static function route( $stop_load = false ) { |
|
| 102 | + $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
| 103 | 103 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
| 104 | - if ( $action == 'process-form' ) { |
|
| 104 | + if ( $action == 'process-form' ) { |
|
| 105 | 105 | self::process_form( $stop_load ); |
| 106 | - } else if ( $stop_load != 'stop_load' ) { |
|
| 106 | + } else if ( $stop_load != 'stop_load' ) { |
|
| 107 | 107 | self::display_form(); |
| 108 | - } |
|
| 109 | - } |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | 110 | } |
@@ -45,16 +45,16 @@ |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public static function load_settings_tab() { |
| 48 | - FrmAppHelper::permission_check('frm_change_settings'); |
|
| 48 | + FrmAppHelper::permission_check( 'frm_change_settings' ); |
|
| 49 | 49 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 50 | 50 | |
| 51 | 51 | $section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' ); |
| 52 | 52 | $sections = self::get_settings_tabs(); |
| 53 | - if ( ! isset( $sections[ $section ] ) ) { |
|
| 53 | + if ( ! isset( $sections[$section] ) ) { |
|
| 54 | 54 | wp_die(); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $section = $sections[ $section ]; |
|
| 57 | + $section = $sections[$section]; |
|
| 58 | 58 | |
| 59 | 59 | if ( isset( $section['class'] ) ) { |
| 60 | 60 | call_user_func( array( $section['class'], $section['function'] ) ); |
@@ -191,10 +191,10 @@ |
||
| 191 | 191 | } else { |
| 192 | 192 | call_user_func( ( isset( $section['function'] ) ? $section['function'] : $section ) ); |
| 193 | 193 | } |
| 194 | - } ?> |
|
| 194 | + } ?> |
|
| 195 | 195 | </div> |
| 196 | 196 | <?php |
| 197 | - } ?> |
|
| 197 | + } ?> |
|
| 198 | 198 | |
| 199 | 199 | <p class="alignright frm_uninstall"> |
| 200 | 200 | <a href="javascript:void(0)" id="frm_uninstall_now"><?php _e( 'Uninstall Formidable', 'formidable' ) ?></a> |
@@ -27,14 +27,14 @@ discard block |
||
| 27 | 27 | </ul> |
| 28 | 28 | </div> |
| 29 | 29 | |
| 30 | - <?php do_action('frm_before_settings'); ?> |
|
| 30 | + <?php do_action( 'frm_before_settings' ); ?> |
|
| 31 | 31 | |
| 32 | 32 | <form name="frm_settings_form" method="post" class="frm_settings_form" action="?page=formidable-settings<?php echo ( $a ? '&t=' . $a : '' ); ?>"> |
| 33 | 33 | <input type="hidden" name="frm_action" value="process-form" /> |
| 34 | 34 | <input type="hidden" name="action" value="process-form" /> |
| 35 | - <?php wp_nonce_field('process_form_nonce', 'process_form'); ?> |
|
| 35 | + <?php wp_nonce_field( 'process_form_nonce', 'process_form' ); ?> |
|
| 36 | 36 | |
| 37 | - <div class="general_settings tabs-panel <?php echo ($a == 'general_settings') ? 'frm_block' : 'frm_hidden'; ?>"> |
|
| 37 | + <div class="general_settings tabs-panel <?php echo ( $a == 'general_settings' ) ? 'frm_block' : 'frm_hidden'; ?>"> |
|
| 38 | 38 | <p class="submit"> |
| 39 | 39 | <input class="button-primary" type="submit" value="<?php esc_attr_e( 'Update Options', 'formidable' ) ?>" /> |
| 40 | 40 | </p> |
@@ -43,20 +43,20 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | <p><label class="frm_left_label"><?php _e( 'Load form styling', 'formidable' ) ?></label> |
| 45 | 45 | <select id="frm_load_style" name="frm_load_style"> |
| 46 | - <option value="all" <?php selected($frm_settings->load_style, 'all') ?>><?php _e( 'on every page of your site', 'formidable' ) ?></option> |
|
| 47 | - <option value="dynamic" <?php selected($frm_settings->load_style, 'dynamic') ?>><?php _e( 'only on applicable pages', 'formidable' ) ?></option> |
|
| 48 | - <option value="none" <?php selected($frm_settings->load_style, 'none') ?>><?php _e( 'Don\'t use form styling on any page', 'formidable' ) ?></option> |
|
| 46 | + <option value="all" <?php selected( $frm_settings->load_style, 'all' ) ?>><?php _e( 'on every page of your site', 'formidable' ) ?></option> |
|
| 47 | + <option value="dynamic" <?php selected( $frm_settings->load_style, 'dynamic' ) ?>><?php _e( 'only on applicable pages', 'formidable' ) ?></option> |
|
| 48 | + <option value="none" <?php selected( $frm_settings->load_style, 'none' ) ?>><?php _e( 'Don\'t use form styling on any page', 'formidable' ) ?></option> |
|
| 49 | 49 | </select> |
| 50 | 50 | </p> |
| 51 | 51 | |
| 52 | 52 | <p> |
| 53 | 53 | <label for="frm_use_html"> |
| 54 | - <input type="checkbox" id="frm_use_html" name="frm_use_html" value="1" <?php checked($frm_settings->use_html, 1) ?> > <?php _e( 'Use HTML5 in forms', 'formidable' ) ?> |
|
| 54 | + <input type="checkbox" id="frm_use_html" name="frm_use_html" value="1" <?php checked( $frm_settings->use_html, 1 ) ?> > <?php _e( 'Use HTML5 in forms', 'formidable' ) ?> |
|
| 55 | 55 | </label> |
| 56 | 56 | <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'We recommend using HTML 5 for your forms. It adds some nifty options like placeholders, patterns, and autocomplete.', 'formidable' ) ?>"></span> |
| 57 | 57 | </p> |
| 58 | 58 | |
| 59 | - <?php do_action('frm_style_general_settings', $frm_settings); ?> |
|
| 59 | + <?php do_action( 'frm_style_general_settings', $frm_settings ); ?> |
|
| 60 | 60 | |
| 61 | 61 | <h3><?php _e( 'User Permissions', 'formidable' ); ?> |
| 62 | 62 | <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Select users that are allowed access to Formidable. Without access to View Forms, users will be unable to see the Formidable menu.', 'formidable' ) ?>"></span> |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | </p> |
| 81 | 81 | |
| 82 | 82 | <p><label class="frm_left_label"><?php _e( 'Site Key', 'formidable' ) ?></label> |
| 83 | - <input type="text" name="frm_pubkey" id="frm_pubkey" size="42" value="<?php echo esc_attr($frm_settings->pubkey) ?>" placeholder="<?php esc_attr_e( 'Optional', 'formidable' ) ?>" /></p> |
|
| 83 | + <input type="text" name="frm_pubkey" id="frm_pubkey" size="42" value="<?php echo esc_attr( $frm_settings->pubkey ) ?>" placeholder="<?php esc_attr_e( 'Optional', 'formidable' ) ?>" /></p> |
|
| 84 | 84 | |
| 85 | 85 | <p><label class="frm_left_label"><?php _e( 'Secret Key', 'formidable' ) ?></label> |
| 86 | - <input type="text" name="frm_privkey" id="frm_privkey" size="42" value="<?php echo esc_attr($frm_settings->privkey) ?>" placeholder="<?php esc_attr_e( 'Optional', 'formidable' ) ?>" /></p> |
|
| 86 | + <input type="text" name="frm_privkey" id="frm_privkey" size="42" value="<?php echo esc_attr( $frm_settings->privkey ) ?>" placeholder="<?php esc_attr_e( 'Optional', 'formidable' ) ?>" /></p> |
|
| 87 | 87 | |
| 88 | 88 | <p><label class="frm_left_label"><?php _e( 'reCAPTCHA Type', 'formidable' ) ?></label> |
| 89 | 89 | <select name="frm_re_type" id="frm_re_type"> |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | <select name="frm_re_lang" id="frm_re_lang"> |
| 100 | 100 | <option value="" <?php selected( $frm_settings->re_lang, '' ) ?>><?php esc_html_e( 'Browser Default', 'formidable' ); ?></option> |
| 101 | 101 | <?php foreach ( $captcha_lang as $lang => $lang_name ) { ?> |
| 102 | - <option value="<?php echo esc_attr($lang) ?>" <?php selected($frm_settings->re_lang, $lang) ?>><?php echo esc_html( $lang_name ) ?></option> |
|
| 102 | + <option value="<?php echo esc_attr( $lang ) ?>" <?php selected( $frm_settings->re_lang, $lang ) ?>><?php echo esc_html( $lang_name ) ?></option> |
|
| 103 | 103 | <?php } ?> |
| 104 | 104 | </select></p> |
| 105 | 105 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | <label class="frm_left_label"><?php _e( 'Success Message', 'formidable' ); ?> |
| 153 | 153 | <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'The default message seen after a form is submitted.', 'formidable' ) ?>" ></span> |
| 154 | 154 | </label> |
| 155 | - <input type="text" id="frm_success_msg" name="frm_success_msg" class="frm_with_left_label" value="<?php echo esc_attr($frm_settings->success_msg) ?>" /> |
|
| 155 | + <input type="text" id="frm_success_msg" name="frm_success_msg" class="frm_with_left_label" value="<?php echo esc_attr( $frm_settings->success_msg ) ?>" /> |
|
| 156 | 156 | </p> |
| 157 | 157 | |
| 158 | 158 | <p> |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | <input type="text" value="<?php echo esc_attr( $frm_settings->submit_value ) ?>" id="frm_submit_value" name="frm_submit_value" class="frm_with_left_label" /> |
| 161 | 161 | </p> |
| 162 | 162 | |
| 163 | - <?php do_action('frm_settings_form', $frm_settings); ?> |
|
| 163 | + <?php do_action( 'frm_settings_form', $frm_settings ); ?> |
|
| 164 | 164 | |
| 165 | 165 | <?php if ( ! FrmAppHelper::pro_is_installed() ) { ?> |
| 166 | 166 | <div class="clear"></div> |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | <?php } ?> |
| 171 | 171 | |
| 172 | 172 | <p><label class="frm_left_label"><?php _e( 'Preview Page', 'formidable' ); ?></label> |
| 173 | - <?php FrmAppHelper::wp_pages_dropdown('frm-preview-page-id', $frm_settings->preview_page_id ) ?> |
|
| 173 | + <?php FrmAppHelper::wp_pages_dropdown( 'frm-preview-page-id', $frm_settings->preview_page_id ) ?> |
|
| 174 | 174 | </p> |
| 175 | 175 | |
| 176 | 176 | </div> |