@@ -635,6 +653,9 @@ final class Plugin {
case 'metrics':
$this->render_metrics_settings();
break;
+ case 'api':
+ $this->render_api_settings();
+ break;
default:
$this->render_general_settings();
break;
@@ -1433,6 +1454,157 @@ final class Plugin {
+
+ save_metrics_settings();
break;
+ case 'api':
+ $this->save_api_settings();
+ break;
default:
$this->save_general_settings();
break;
@@ -1649,6 +1824,22 @@ final class Plugin {
settings_errors( 'wp_bnb_settings' );
}
+ /**
+ * Save API settings.
+ *
+ * @return void
+ */
+ private function save_api_settings(): void {
+ $api_enabled = isset( $_POST['wp_bnb_api_enabled'] ) ? 'yes' : 'no';
+ $rate_limiting = isset( $_POST['wp_bnb_api_rate_limiting'] ) ? 'yes' : 'no';
+
+ update_option( 'wp_bnb_api_enabled', $api_enabled );
+ update_option( 'wp_bnb_api_rate_limiting', $rate_limiting );
+
+ add_settings_error( 'wp_bnb_settings', 'settings_saved', __( 'API settings saved.', 'wp-bnb' ), 'success' );
+ settings_errors( 'wp_bnb_settings' );
+ }
+
/**
* AJAX handler for checking room availability.
*
diff --git a/wp-bnb.php b/wp-bnb.php
index b1b6caf..7985b7e 100644
--- a/wp-bnb.php
+++ b/wp-bnb.php
@@ -3,7 +3,7 @@
* Plugin Name: WP BnB Management
* Plugin URI: https://src.bundespruefstelle.ch/magdev/wp-bnb
* Description: A comprehensive Bed & Breakfast management system for WordPress. Manage buildings, rooms, bookings, and guests.
- * Version: 0.9.0
+ * Version: 0.10.0
* Requires at least: 6.0
* Requires PHP: 8.3
* Author: Marco Graetsch
@@ -24,7 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
// Plugin version constant - MUST match Version in header above.
-define( 'WP_BNB_VERSION', '0.9.0' );
+define( 'WP_BNB_VERSION', '0.10.0' );
// Plugin path constants.
define( 'WP_BNB_PATH', plugin_dir_path( __FILE__ ) );