errors[] = __('1 Click Form Sync requires PHP version 7.4.0 or higher. Your server is running PHP version', '1-click-form-sync') . ' ' . PHP_VERSION . '.'; } // Check WordPress Version global $wp_version; $current_wp_version = $wp_version ?? '0.0.0'; if (version_compare($current_wp_version, '6.4.0', '<')) { $this->errors[] = __('1 Click Form Sync requires WordPress version 6.4.0 or higher. Your site is running version', '1-click-form-sync') . ' ' . esc_html($current_wp_version) . '.'; } // Check OpenSSL or Sodium if (!extension_loaded('openssl') && !extension_loaded('sodium')) { $this->errors[] = __('1 Click Form Sync requires either the PHP "openssl" or "sodium" extension for secure token encryption.', '1-click-form-sync'); } return empty($this->errors); } /** * Get the list of errors. * * @return array */ public function getErrors(): array { return $this->errors; } /** * Register hook to display admin notices for unsatisfied requirements. */ public function displayAdminNotices(): void { if (empty($this->errors)) { return; } add_action('admin_notices', function () { foreach ($this->errors as $error) { printf( '

%s

', esc_html($error) ); } }); } }