context = new Plugin_Context( $main_file ); } /** * Returns the Plugin Context. * * @since 1.0.0 * * @return Plugin_Context */ public function context() { return $this->context; } /** * Registers WordPress hooks for the plugin. * * @since 1.0.0 * * @global Plugin_Context $context The plugin context instance. */ public function add_hooks() { // Initialize AI Client on init hook if the class exists. if ( class_exists( '\WordPress\AI_Client\AI_Client' ) ) { add_action( 'init', array( '\WordPress\AI_Client\AI_Client', 'init' ) ); } if ( defined( 'WP_CLI' ) && WP_CLI ) { global $context; // Setup the CLI command. $context = $this->context(); require_once WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'cli.php'; } $admin_ajax = new Admin_AJAX(); // Create the Admin page. $admin_page = new Admin_Page( $admin_ajax ); $admin_page->add_hooks(); // Create the Settings page. $settings_page = new Settings_Page(); $settings_page->add_hooks(); // Create the Plugin Check Namer tool page. $namer_page_class = '\\WordPress\\Plugin_Check\\Admin\\Namer_Page'; $namer_page = new $namer_page_class(); $namer_page->add_hooks(); // Create the SVN Checker page. $svn_checker_page = new SVN_Checker_Page(); $svn_checker_page->add_hooks(); } }