doAction('uam_init', [$userAccessManager]); //install if (function_exists('register_activation_hook') === true) { register_activation_hook($file, [$setupHandler, 'install']); } //uninstall if (function_exists('register_uninstall_hook')) { function uninstallUserAccessManager() { $file = str_replace('init.php', 'user-access-manager.php', __FILE__); $php = new Php(); $wordpress = new Wordpress(); $util = new Util($php); $database = new Database($wordpress); $configFactory = new ConfigFactory($wordpress); $configParameterFactory = new ConfigParameterFactory(); $cacheProviderFactory = new CacheProviderFactory( $php, $wordpress, $util, $configFactory, $configParameterFactory ); $cache = new Cache($wordpress, $cacheProviderFactory); $objectMapHandler = new ObjectMapHandler($database, $cache); $assignmentInformationFactory = new AssignmentInformationFactory(); $membershipHandlerFactory = new ObjectMembershipHandlerFactory( $php, $wordpress, $database, $objectMapHandler, $assignmentInformationFactory ); $objectHandler = new ObjectHandler($php, $wordpress, $membershipHandlerFactory); $wordpressConfig = new WordpressConfig($wordpress, $file); $mainConfig = new MainConfig($wordpress, $objectHandler, $cache, $configParameterFactory); $fileProtectionFactory = new FileProtectionFactory( $php, $wordpress, $wordpressConfig, $mainConfig, $util ); $fileHandler = new FileHandler( $php, $wordpress, $wordpressConfig, $mainConfig, $fileProtectionFactory ); $updateFactory = new UpdateFactory($database, $objectHandler); $setupHandler = new SetupHandler( $wordpress, $database, $objectHandler, $fileHandler, $updateFactory ); $setupHandler->uninstall(); } register_uninstall_hook($file, 'uninstallUserAccessManager'); } //deactivation if (function_exists('register_deactivation_hook')) { register_deactivation_hook($file, [$setupHandler, 'deactivate']); } $userAccessManager->addActionsAndFilters(); //Add the cli interface to the known commands if (defined('WP_CLI') === true && WP_CLI === true) { $cliWrapper = new \UserAccessManager\Wrapper\WordpressCli(); $groupCommand = new \UserAccessManager\Command\GroupCommand($cliWrapper, $accessHandler, $userGroupFactory); \WP_CLI::add_command('uam groups', $groupCommand); $objectCommand = new \UserAccessManager\Command\ObjectCommand($cliWrapper, $accessHandler); \WP_CLI::add_command('uam objects', $objectCommand); } return $userAccessManager; }