diff --git a/assets/style.css b/assets/style.css index 714b211..27730f5 100755 --- a/assets/style.css +++ b/assets/style.css @@ -49,6 +49,126 @@ width: 100px; } +/* bbPress Support Toolkit Admin Styles - Updated to match multisite-settings-sync.php */ +.card { + background: #fff; + border: 1px solid #ccd0d4; + border-radius: 4px; + max-width: unset; + margin-top: 20px; + padding: 20px; +} + +.bbps-settings-tabs { + display: flex; + flex-wrap: wrap; + gap: 5px; + border-bottom: 1px solid #c3c4c7; + margin-bottom: 20px; +} + +.bbps-tab { + padding: 8px 16px; + border: none; + background: none; + cursor: pointer; + font-size: 14px; + border-bottom: 2px solid transparent; + transition: all 0.2s ease; +} + +.bbps-tab.active { + border-bottom: 2px solid #007cba; + font-weight: 600; + background: #f0f0f1; +} + +.bbps-tab:hover:not(.active) { + background: #f0f0f1; + border-bottom-color: #dcdcde; +} + +.bbps-settings-content { + flex: 1; +} + +.bbps-section { + padding: 0; +} + +.bbps-section .card { + margin: 0; + border: 1px solid #ccd0d4; + border-radius: 4px; + background: #fff; + padding: 20px; +} + +.bbps-section .card h2 { + margin-top: 0; + padding-bottom: 10px; + border-bottom: 1px solid #e1e1e1; + color: #23282d; + font-size: 18px; + font-weight: 600; +} + +.bbps-section .form-table { + margin-top: 20px; +} + +.bbps-section .form-table th { + width: 200px; + padding: 15px 10px 15px 0; + vertical-align: top; +} + +.bbps-section .form-table td { + padding: 15px 10px; + vertical-align: top; +} + +.bbps-section .description { + color: #666; + font-style: italic; + margin-top: 5px; +} + + +.bbps-settings-content .submit .button-primary { + background: #2271b1; + border-color: #2271b1; + color: #fff; + text-decoration: none; + text-shadow: none; + font-size: 14px; + line-height: 2.15384615; + min-height: 32px; + padding: 0 12px; + border-radius: 3px; + cursor: pointer; +} + +.bbps-settings-content .submit .button-primary:hover { + background: #135e96; + border-color: #135e96; +} + +/* Notice styles */ +.notice { + border-radius: 3px; +} + +.notice-success { + background-color: #dff0d8; + border-left: 4px solid #46b450; +} + +.notice-error { + background-color: #f2dede; + border-left: 4px solid #dc3232; +} + .clear { clear: both; } diff --git a/bbpress-support-toolkit.php b/bbpress-support-toolkit.php index e03a731..bcaca94 100755 --- a/bbpress-support-toolkit.php +++ b/bbpress-support-toolkit.php @@ -5,7 +5,7 @@ * Author: Cyberforums.com * Author URI: https://cyberforums.com * Description: Transform your bbPress forums into comprehensive support forums with status management, user ranking, and premium features - * Version: 1.1.0 + * Version: 1.2.0 * Requires at least: 5.0 * Tested up to: 6.8 * Requires PHP: 7.4 @@ -39,7 +39,7 @@ final class BBPress_Support_Toolkit private function define_constants() { - define("BBPS_VERSION", "1.1.0"); + define("BBPS_VERSION", "1.2.0"); define("BBPS_PLUGIN_FILE", __FILE__); define("BBPS_PLUGIN_PATH", plugin_dir_path(__FILE__)); define("BBPS_PLUGIN_URL", plugin_dir_url(__FILE__)); @@ -54,6 +54,7 @@ final class BBPress_Support_Toolkit register_uninstall_hook(__FILE__, ["BBPress_Support_Toolkit", "uninstall"]); add_action("plugins_loaded", [$this, "load_textdomain"]); add_action("wp_enqueue_scripts", [$this, "enqueue_styles"]); + add_action("admin_enqueue_scripts", [$this, "enqueue_admin_scripts"]); add_action("widgets_init", [$this, "register_widgets"]); } @@ -206,6 +207,22 @@ final class BBPress_Support_Toolkit ); } + public function enqueue_admin_scripts($hook) + { + // Only load on our plugin's admin page + if ($hook !== 'settings_page_bbpress-support-toolkit') { + return; + } + + wp_enqueue_script('jquery'); + wp_enqueue_style( + "bbps-admin-style", + BBPS_ASSETS_URL . "style.css", + [], + BBPS_VERSION + ); + } + public function register_widgets() { register_widget("BBPS_Support_Hours_Widget"); diff --git a/includes/admin.php b/includes/admin.php index c780838..ea6989f 100755 --- a/includes/admin.php +++ b/includes/admin.php @@ -15,6 +15,7 @@ function bbps_extend_forum_attributes_mb($forum_id) $checked1 = $support_forum ? "checked" : ""; ?>
+

-

- - - -

+

+ + + +

@@ -568,76 +576,155 @@ function bbps_admin_page()

- - + +
-
- - -
- -
- -
- -
- -
- -
+
+ + + +
-
- -
+
+ +
+ +
+ +
-
- -
- -
- -
- -
- -
- -
- -
- -
- -
+
- - +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + +

+ + +

+ +
+ + $fields) { + foreach ($fields as $field_id => $field) { + if (strpos($field_id, 'bbps_') === 0) { + $settings_to_save[] = $field_id; + } + } + } + } + + foreach ($settings_to_save as $setting_name) { + $value = isset($parsed_data[$setting_name]) ? $parsed_data[$setting_name] : ''; + + // 基本验证 + if (strpos($setting_name, '_count') !== false || strpos($setting_name, '_enable') !== false) { + $value = intval($value); + } else { + $value = sanitize_text_field($value); + } + + update_option($setting_name, $value); + $saved_count++; + } + + wp_send_json_success(array( + 'message' => __('Settings saved successfully!', 'bbpress-support-toolkit'), + 'saved_count' => $saved_count + )); +} + +// 加载管理脚本 +function bbps_enqueue_admin_scripts($hook) { + if ($hook !== 'settings_page_bbpress-support-toolkit') { + return; + } + + wp_enqueue_script('jquery'); + wp_localize_script('jquery', 'bbps_ajax', array( + 'ajax_url' => admin_url('admin-ajax.php'), + 'nonce' => wp_create_nonce('bbps_settings_nonce'), + 'saving_text' => __('Saving...', 'bbpress-support-toolkit'), + 'saved_text' => __('Settings saved successfully!', 'bbpress-support-toolkit'), + 'error_text' => __('Error saving settings. Please try again.', 'bbpress-support-toolkit') + )); } \ No newline at end of file diff --git a/languages/.DS_Store b/languages/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/languages/.DS_Store differ