init_actions(); $this->init_classes(); } /** * Initialize action hooks * * @return void */ public function init_actions() { $this->action( 'init', 'includes' ); $this->action( 'admin_init', 'admin_redirects' ); add_action( 'admin_footer', 'erp_include_popup_markup' ); //$this->action( 'admin_notices', 'promotional_offer' ); } /** * Include required files * * @return void */ public function includes() { // Setup/welcome if ( ! empty( $_GET['page'] ) ) { if ( 'erp-setup' == $_GET['page'] ) { include_once dirname( __FILE__ ) . '/class-setup-wizard.php'; } } } /** * Initialize required classes * * @return void */ public function init_classes() { new Form_Handler(); new Ajax(); } /** * Handle redirects to setup/welcome page after install and updates. * * @return void */ public function admin_redirects() { if ( ! get_transient( '_erp_activation_redirect' ) ) { return; } delete_transient( '_erp_activation_redirect' ); if ( ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'erp-setup', 'erp-welcome' ) ) ) || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_options' ) ) { return; } // If it's the first time if ( get_option( 'erp_setup_wizard_ran' ) != '1' ) { wp_safe_redirect( admin_url( 'index.php?page=erp-setup' ) ); exit; // Otherwise, the welcome page } else { wp_safe_redirect( admin_url( 'index.php?page=erp-welcome' ) ); exit; } } /** * Promotional offer notice * * @since 1.1.15 * * @return void */ public function promotional_offer() { // Show only to Admins if ( ! current_user_can( 'manage_options' ) ) { return; } // check if it has already been dismissed $hide_notice = get_option( 'erp_promotional_offer_notice_quiz-aug17', 'no' ); if ( 'hide' == $hide_notice ) { return; } ?>
|
|