run(); $app->get_updater()->update_if_needed( TWOFAS_LIGHT_PLUGIN_VERSION ); } // Different application contexts // Doing it that way, in order to separate WP functions from plugin logic function twofas_light_enqueue_scripts() { wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'twofas-light-js', TWOFAS_LIGHT_URL . '/includes/js/twofas_light.js', array( 'jquery' ), TWOFAS_LIGHT_PLUGIN_VERSION, true ); wp_localize_script( 'twofas-light-js', 'twofas_light', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'twofas_light_menu_page' => Router::TWOFASLIGHT_ADMIN_PAGE_SLUG ) ); } function twofas_light_login_footer() { $app = new Generic_App(); $app->run(); $login_footer_renderer = new Login_Footer_Renderer( $app->get_view_renderer(), $app->get_request() ); $login_footer_renderer->render_footer(); } function twofas_light_login() { $app = new Login_App(); $app->run(); } function twofas_light_init() { $app = new Init_App(); $app->run(); } function twofas_light_ajax() { $app = new Ajax_App(); $app->run(); } /** * @param WP_User|WP_Error|null $user * * @return WP_User|WP_Error|null */ function twofas_light_authenticate( $user ) { $action = new Authenticate( $user ); $app = new Authenticate_App( $action ); $result = $app->run(); if ( $result ) { return $result; } return $user; }