is_logging_allowed() ); }; $twofas_container['integration_name'] = function ( $c ) { /** @var Environment $environment */ $environment = $c['environment']; return new Integration_Name( $environment->get_wordpress_app_url() ); }; $twofas_container['parser'] = function ( $c ) { return new Parser(); }; $twofas_container['downloader'] = function ( $c ) { return new Downloader( $c['parser'] ); }; $twofas_container['scheduler'] = function ( $c ) { return new Scheduler(); }; $twofas_container['plugin_version'] = function ( $c ) { return new Plugin_Version( $c['options_storage'] ); }; $twofas_container['plugin_status'] = function ( $c ) { return new Plugin_Status( $c['options_storage'], $c['oauth_storage'] ); }; $twofas_container['plugin_checker'] = function ( $c ) { return new Plugin_Checker( $c['plugin_status'], $c['storage'], $c['request'], $c['flash'], $c['legacy_mode_checker'] ); }; $twofas_container['plugin_compatibility'] = function ( $c ) { return new Plugin_Compatibility(); }; $twofas_container['legacy_mode_checker'] = function ( $c ) { return new Legacy_Mode_Checker( $c['user_storage'], $c['options_storage'] ); }; /** * -------------------------------------------------------------------------------------------------------------------- * Migrations * -------------------------------------------------------------------------------------------------------------------- */ $twofas_container['updater'] = function ( $c ) { return new Updater( $c['request'], $c['plugin_version'], $c['migrator'] ); }; $twofas_container['migrator'] = function ( $c ) { return new Migrator( $c['db'], $c['plugin_version'], $c['api_wrapper'], $c['storage'] ); }; /** * -------------------------------------------------------------------------------------------------------------------- * QR * -------------------------------------------------------------------------------------------------------------------- */ $twofas_container['qr_code_generator'] = function ( $c ) { return QR_Code_Generator_Factory::create(); }; $twofas_container['qr_code_message'] = function ( $c ) { return new QR_Code_Message( $c['environment'], $c['user_storage'] ); }; /** * -------------------------------------------------------------------------------------------------------------------- * Storage * -------------------------------------------------------------------------------------------------------------------- */ $twofas_container['storage'] = function ( $c ) { return new Storage( $c['cookie'], $c['options_storage'], $c['user_storage'], $c['oauth_storage'], $c['session_storage'], $c['authentication_storage'], $c['trusted_devices_storage'] ); }; $twofas_container['options_storage'] = function ( $c ) { return new Options_Storage(); }; $twofas_container['user_storage'] = function ( $c ) { $storage = new User_Storage( $c['db'] ); if ( function_exists( 'wp_get_current_user' ) ) { $wp_user = wp_get_current_user(); if ( $wp_user->ID > 0 ) { $storage->set_wp_user( $wp_user ); } } return $storage; }; $twofas_container['oauth_storage'] = function ( $c ) { return new OAuth_Storage(); }; $twofas_container['session_storage'] = function ( $c ) { $factory = new Session_Storage_Factory( $c['db'], $c['request'] ); return $factory->create(); }; $twofas_container['authentication_storage'] = function ( $c ) { return new Authentication_Storage( $c['user_storage'] ); }; $twofas_container['trusted_devices_storage'] = function ( $c ) { return new Trusted_Devices_Storage( $c['db'], $c['request'] ); }; /** * -------------------------------------------------------------------------------------------------------------------- * API * -------------------------------------------------------------------------------------------------------------------- */ $twofas_container['api_wrapper'] = function ( $c ) { return new API_Wrapper( $c['account_factory'], $c['api_factory'], $c['options_storage'], $c['integration_name'] ); }; /** * -------------------------------------------------------------------------------------------------------------------- * Factories * -------------------------------------------------------------------------------------------------------------------- */ $twofas_container['api_factory'] = function ( $c ) { return new API_Factory( $c['environment'], $c['config'], $c['storage'], $c['browser'] ); }; $twofas_container['account_factory'] = function ( $c ) { return new Account_Factory( $c['environment'], $c['config'], $c['storage'], $c['browser'] ); }; $twofas_container['controller_factory'] = function ( $c ) { return new Controller_Factory( $c ); }; $twofas_container['user_factory'] = function ( $c ) { return new User_Factory( $c['step_token'] ); }; $twofas_container['rsa_cryptographer_factory'] = function ( $c ) { return new RsaCryptographer_Factory(); };