logger = new AtkActionLogger(); // Check if we're during plugin activation/deactivation if ($this->is_plugin_activation_or_deactivation()) { // Only load plugin activity during activation/deactivation include(plugin_dir_path(ATKAI_PLUGIN_FILE) . '/activities/activity-plugin.php'); if (class_exists('AtkActivityPlugin')) { new AtkActivityPlugin($this->logger); } return; } // Load actions. $activity_files = [ 'theme' => 'activity-theme.php', 'menu' => 'activity-menu.php', 'user' => 'activity-user.php', 'content' => 'activity-post.php', 'comment' => 'activity-comment.php', 'email' => 'activity-email.php', 'plugin' => 'activity-plugin.php', 'media' => 'activity-media.php', 'widget' => 'activity-widget.php', 'api' => 'activity-api.php', 'settings' => 'activity-settings.php', 'woocommerce' => 'activity-woocommerce.php' ]; // Retrieve the saved options data $atk_options = Option::get('options', false); if ($atk_options === false) { return; } foreach ($activity_files as $type => $file) { // Load only activities selected in the settings if (isset($atk_options['activity_types'][$type]) && $atk_options['activity_types'][$type] == 1) { include(plugin_dir_path(ATKAI_PLUGIN_FILE) . '/activities/' . $file); $className = 'AtkActivity' . ucfirst($type); if (class_exists($className)) { new $className($this->logger); } } } } private function is_plugin_activation_or_deactivation() { return ( is_admin() && ( (isset($_GET['action']) && in_array($_GET['action'], ['activate', 'deactivate'])) || (isset($_POST['action']) && in_array($_POST['action'], ['activate-selected', 'deactivate-selected'])) ) ); } } return new AtkActivities();