public static function activate() { WP_REST_API_Log_Settings::create_default_settings(); // add an option so we can show the activated admin notice add_option(WP_REST_API_Log_Common::PLUGIN_NAME . '-plugin-activated', '1'); }
$classes = array($class_base . '_Common', $class_base . '_DB', $class_base . '_Post_Type', $class_base . '_i18n', $class_base . '_Controller', $class_base . '', $class_base . '_Admin', $class_base . '_Admin_List_Table'); /* Include classes */ foreach ($includes as $include) { require_once WP_REST_API_LOG_PATH . $include; } if (defined('WP_CLI') && WP_CLI) { require_once WP_REST_API_LOG_PATH . 'includes/wp-cli/setup.php'; } /* Record the start time so we can log total millisecons */ if (class_exists('WP_REST_API_Log_Common')) { global $wp_rest_api_log_start; $wp_rest_api_log_start = WP_REST_API_Log_Common::current_milliseconds(); } /* Instantiate classes and hook into WordPress */ foreach ($classes as $class) { $plugin = new $class(); if (method_exists($class, 'plugins_loaded')) { add_action('plugins_loaded', array($plugin, 'plugins_loaded'), 1); } } WP_REST_API_Log_ElasticPress::plugins_loaded(); WP_REST_API_Log_Settings::plugins_loaded(); WP_REST_API_Log_Settings_General::plugins_loaded(); WP_REST_API_Log_Settings_Routes::plugins_loaded(); WP_REST_API_Log_Settings_ElasticPress::plugins_loaded(); WP_REST_API_Log_Settings_Help::plugins_loaded(); /* Activation hook */ register_activation_hook(__FILE__, function () { require_once 'includes/class-wp-rest-api-log-activator.php'; WP_REST_API_Log_Activator::activate(); });