changelogService = $changelogService; $this->settingsService = $settingsService; } /** * Get changelog data with translated strings * * @param WP_REST_Request $data * * @return WP_REST_Response * * @throws ForbiddenException */ public function handle(WP_REST_Request $data): WP_REST_Response { // Verify the nonce Sanitizer::verifyNonce($data->get_header('X-WP-Nonce')); $oldVersion = $this->settingsService->getSetting('general', 'changelog_version'); $shouldShow = $oldVersion !== IVYFORMS_VERSION; if ($shouldShow) { $this->settingsService->setSetting('general', 'changelog_version', IVYFORMS_VERSION); } $changelogData = $this->changelogService->getChangelogData(); return new WP_REST_Response([ 'message' => __('Changelog retrieved successfully', 'ivyforms'), 'data' => [ 'oldVersion' => $oldVersion, 'version' => IVYFORMS_VERSION, 'release_date' => $changelogData['release_date'], 'features' => $changelogData['features'], 'improvements' => $changelogData['improvements'], 'bugfixes' => $changelogData['bugfixes'], 'shouldShow' => $shouldShow, ] ], 200); } }