esc_html__('You do not have permission to do this.', 'ai-content-guide-llms-text-generator'))); } // Regenerate file $content_analyzer = new FULGID_AICOGU_Content_Analyzer(); $file_manager = new FULGID_AICOGU_File_Manager(); // Get content $content = $content_analyzer->analyze_site_content(); // Generate and save file $result = $file_manager->generate_file($content); // Generate full file if enabled $settings = get_option('fulgid_aicogu_settings', array()); if (!empty($settings['generate_full_file']) && 'yes' === $settings['generate_full_file']) { $file_manager->generate_full_file($content); } // Update last updated time update_option('fulgid_aicogu_file_updated', time()); if ($result) { wp_send_json_success(array( 'message' => esc_html__('File regenerated successfully!', 'ai-content-guide-llms-text-generator'), 'timestamp' => date_i18n(get_option('date_format') . ' ' . get_option('time_format'), time()), )); } else { wp_send_json_error(array('message' => esc_html__('Error regenerating file. Please check your settings.', 'ai-content-guide-llms-text-generator'))); } } /** * Handle AJAX request to preview file. */ public function ajax_preview_file() { // Check nonce check_ajax_referer('fulgid-aicogu-nonce', 'nonce'); // Check permissions if (!current_user_can('manage_options')) { wp_send_json_error(array('message' => esc_html__('You do not have permission to do this.', 'ai-content-guide-llms-text-generator'))); } // Generate preview content $content_analyzer = new FULGID_AICOGU_Content_Analyzer(); $content = $content_analyzer->analyze_site_content(); wp_send_json_success(array('content' => $content)); } } // Initialize admin new FULGID_AICOGU_Admin();