plugin_path = WPCF7_PRO_REDIRECT_BASE_PATH; $this->version = WPCF7_PRO_REDIRECT_PLUGIN_VERSION; $this->load_dependencies(); $this->init_plugin_dependencies(); $this->post_types(); $this->add_action_hooks(); $this->add_ajax_hooks(); } /** * Create instances of all required objects */ public function init_plugin_dependencies() { $this->wpcf_settings = new WPCF7r_Settings(); $this->wpcf7_redirect = new WPCF7r_Form_Helper(); $this->wpcf7_utils = new WPCF7r_Utils(); $this->wpcf7_submission = new WPCF7r_Submission(); $this->wpcf7_user_panel = new WPCF7R_User(); } /** * Register the post type required for the action managment */ public function post_types() { new WPCF7R_Post_Types(); } /** * Get a singelton */ public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } /** * Some general plugin hooks */ public function add_action_hooks() { // display banner on the redirect settings page // the banner will be used to the premium version // add_action( 'before_redirect_settings_tab_title' , array( $this->wpcf7_utils , 'get_banner' ) , 10 );. add_action( 'before_settings_fields', array( $this->wpcf7_utils, 'show_admin_notices' ), 10 ); add_action( 'admin_notices', array( $this, 'show_admin_notices' ), 10 ); add_action( 'admin_init', array( $this, 'dismiss_admin_notice' ) ); // form submission hook. add_action( 'wpcf7_before_send_mail', array( $this->wpcf7_submission, 'handle_valid_actions' ) ); // validation actions. add_filter( 'wpcf7_validate', array( $this->wpcf7_submission, 'handle_validation_actions' ), 10, 2 ); // handle contact form response. add_filter( 'wpcf7_feedback_response', array( $this->wpcf7_submission, 'manipulate_cf7_response_object' ), 10, 2 ); add_action( 'init', function() { if ( ! is_admin() ) { // handle form rendering. add_filter( 'wpcf7_contact_form_properties', array( $this->wpcf7_utils, 'render_actions_elements' ), 10, 2 ); } } ); // support for browsers that does not support ajax. add_action( 'wpcf7_submit', array( $this->wpcf7_submission, 'non_ajax_redirection' ) ); // add_action( 'after_plugin_row_' . WPCF7_PRO_REDIRECT_BASE_NAME , array( $this->wpcf7_utils , 'license_details_message' ), 10, 2 ); // handle form duplication. add_action( 'wpcf7_after_create', array( $this->wpcf7_utils, 'duplicate_form_support' ) ); // handle form deletion. add_action( 'before_delete_post', array( $this->wpcf7_utils, 'delete_all_form_actions' ) ); // catch submission for early $_POST manupulations. add_action( 'wpcf7_contact_form', array( $this->wpcf7_submission, 'after_cf7_object_created' ) ); // handle poppup preview. add_action( 'init', array( $this->wpcf7_utils, 'show_action_preview' ) ); // handle affiliate extensions. add_action( 'init', array( $this, 'start_affiliate_extensions' ) ); // add filter by form on leads list. if ( class_exists( 'WPCF7R_Leads_Manager' ) && class_exists( 'WPCF7R_Action_Save_Lead' ) ) { add_action( 'restrict_manage_posts', array( 'WPCF7R_Leads_Manager', 'add_form_filter' ) ); add_filter( 'parse_query', array( 'WPCF7R_Leads_Manager', 'filter_request_query' ), 10 ); add_action( 'admin_init', array( 'WPCF7R_Leads_Manager', 'admin_init_scripts' ) ); add_action( 'admin_init', array( 'WPCF7R_Leads_Manager', 'export_current_filtered_view' ), 10, 2 ); } } /** * Initialize affiliate extensions */ public function start_affiliate_extensions() { } /** * Dismiss admin notice * * @return void */ public function dismiss_admin_notice() { if ( isset( $_REQUEST['dismiss-cf7r-notices'] ) ) { delete_option( 'wpcf7_redirect_notifications' ); } } /** * Display admin notifications * * @return void */ public function show_admin_notices() { $notices = get_option( 'wpcf7_redirect_notifications' ); add_action( 'admin_footer', function() { ?> $notice ) : ?>

wpcf7_utils, 'send_debug_info' ) ); add_action( 'wp_ajax_close_ad_banner', array( $this->wpcf7_utils, 'close_banner' ) ); add_action( 'wp_ajax_wpcf7r_delete_action', array( $this->wpcf7_utils, 'delete_action_post' ) ); add_action( 'wp_ajax_wpcf7r_duplicate_action', array( $this->wpcf7_utils, 'duplicate_action' ) ); add_action( 'wp_ajax_wpcf7r_add_action', array( $this->wpcf7_utils, 'add_action_post' ) ); // save actions order. add_action( 'wp_ajax_wpcf7r_set_action_menu_order', array( $this->wpcf7_utils, 'set_action_menu_order' ) ); // make an api test. add_action( 'wp_ajax_wpcf7r_make_api_test', array( $this->wpcf7_utils, 'make_api_test' ) ); // get popup template. add_action( 'wp_ajax_wpcf7r_get_action_template', array( $this->wpcf7_utils, 'get_action_template' ) ); // run the migration process. add_action( 'wp_ajax_wpcf7r_migrate_all_forms', array( $this, 'migrate_all_forms' ) ); // reset plugin settings add_action( 'wp_ajax_wpcf7r_reset_settings', array( $this, 'wpcf7r_reset_settings' ) ); } /** * Get files required to run the plugin */ public function load_dependencies() { require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-list-table.php'; require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-leads-manager.php'; require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-lead.php'; require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-settings.php'; require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-submission.php'; $this->include_conditional_logic_file(); require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-utils.php'; require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-form-helper.php'; require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-post-types.php'; require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-actions.php'; require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-form.php'; require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-html.php'; require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-qs-api.php'; require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-action.php'; require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-user.php'; require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-extensions.php'; require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-extension.php'; require_once WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-module.php'; // Load all actions. foreach ( glob( WPCF7_PRO_REDIRECT_CLASSES_PATH . 'actions/*.php' ) as $filename ) { require_once $filename; } // Load all addons. if ( is_dir( WPCF7_PRO_REDIRECT_ADDONS_PATH ) ) { foreach ( glob( WPCF7_PRO_REDIRECT_ADDONS_PATH . '*.php' ) as $filename ) { require_once $filename; } } } /** * Check and include the conditional logic files if exists */ private function include_conditional_logic_file() { $paths = array( WPCF7_PRO_REDIRECT_CLASSES_PATH . 'class-wpcf7r-conditions.php', WPCF7_PRO_REDIRECT_ADDONS_PATH . 'class-wpcf7r-conditions.php', ); foreach ( $paths as $path ) { if ( file_exists( $path ) ) { require_once $path; } } } }