From 3d08d57d644d263f3862c54f8be78215628993d5 Mon Sep 17 00:00:00 2001
From: M_Viper
Date: Thu, 19 Mar 2026 23:51:55 +0100
Subject: [PATCH] Update from Git Manager GUI
---
Minecraft-Modern-Theme/inc/customizer.php | 724 +++++++------------
Minecraft-Modern-Theme/inc/theme-updater.php | 259 +++----
2 files changed, 389 insertions(+), 594 deletions(-)
diff --git a/Minecraft-Modern-Theme/inc/customizer.php b/Minecraft-Modern-Theme/inc/customizer.php
index cb53060..4525b40 100644
--- a/Minecraft-Modern-Theme/inc/customizer.php
+++ b/Minecraft-Modern-Theme/inc/customizer.php
@@ -1,478 +1,325 @@
direkt in wp_head
+ * - slider_loop Setting ergänzt (war in slider-init.js referenziert, aber nie definiert)
+ * - Scroll-to-Top Toggle ergänzt
+ * - footer_copyright Default mit aktuellem Jahr zur Laufzeit
+ * - Import_Export_Control Klasse aus dem Callback extrahiert
*/
+// =========================================================================
+// Import/Export Control – außerhalb des Callbacks definiert
+// =========================================================================
+if ( class_exists('WP_Customize_Control') && ! class_exists('MM_Import_Export_Control') ) :
+class MM_Import_Export_Control extends WP_Customize_Control {
+ public $type = 'mm_import_export';
+
+ public function render_content() {
+ $export_url = admin_url('admin-post.php?action=export_theme_settings');
+ $nonce = wp_create_nonce('theme-import-nonce');
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ⚠️
+
+
+
+
+ add_section( 'header_slider', array(
- 'title' => 'Header Slider',
+ 'title' => __('Header Slider', 'minecraft-modern-theme'),
'priority' => 20,
- 'description' => 'Konfiguriere den großen Slider auf der Startseite.',
+ 'description' => __('Konfiguriere den großen Slider auf der Startseite.', 'minecraft-modern-theme'),
) );
- // Checkbox zum Aktivieren des Sliders
- $wp_customize->add_setting( 'slider_enabled', array(
- 'default' => false,
- 'transport' => 'refresh',
- 'sanitize_callback' => 'wp_validate_boolean',
- ) );
- $wp_customize->add_control( 'slider_enabled', array(
- 'label' => 'Header Slider aktivieren',
+ $wp_customize->add_setting( 'slider_enabled', array( 'default' => false, 'transport' => 'refresh', 'sanitize_callback' => 'wp_validate_boolean' ) );
+ $wp_customize->add_control( 'slider_enabled', array( 'label' => __('Header Slider aktivieren', 'minecraft-modern-theme'), 'section' => 'header_slider', 'type' => 'checkbox' ) );
+
+ // FIX: slider_loop war in slider-init.js als sliderSettings.loop referenziert, aber nie definiert
+ $wp_customize->add_setting( 'slider_loop', array( 'default' => true, 'transport' => 'refresh', 'sanitize_callback' => 'wp_validate_boolean' ) );
+ $wp_customize->add_control( 'slider_loop', array(
+ 'label' => __('Slider Endlos-Loop aktivieren', 'minecraft-modern-theme'),
+ 'description' => __('Der Slider springt nach dem letzten Slide wieder zum ersten zurück.', 'minecraft-modern-theme'),
'section' => 'header_slider',
- 'settings' => 'slider_enabled',
'type' => 'checkbox',
) );
- // Dynamische Slider-Bilder, Titel und Untertitel
- for ($i = 1; $i <= 5; $i++) {
+ for ( $i = 1; $i <= 5; $i++ ) {
$wp_customize->add_setting( 'slider_image_' . $i, array( 'sanitize_callback' => 'esc_url_raw' ) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'slider_image_' . $i, array(
- 'label' => sprintf( 'Banner %d - Bild', $i ),
- 'section' => 'header_slider',
- 'settings' => 'slider_image_' . $i,
+ 'label' => sprintf( __('Banner %d - Bild', 'minecraft-modern-theme'), $i ), 'section' => 'header_slider',
) ) );
-
$wp_customize->add_setting( 'slider_title_' . $i, array( 'sanitize_callback' => 'sanitize_text_field' ) );
- $wp_customize->add_control( 'slider_title_' . $i, array(
- 'label' => sprintf( 'Banner %d - Titel', $i ),
- 'section' => 'header_slider',
- 'settings' => 'slider_title_' . $i,
- 'type' => 'text',
- ) );
-
+ $wp_customize->add_control( 'slider_title_' . $i, array( 'label' => sprintf( __('Banner %d - Titel', 'minecraft-modern-theme'), $i ), 'section' => 'header_slider', 'type' => 'text' ) );
$wp_customize->add_setting( 'slider_subtitle_' . $i, array( 'sanitize_callback' => 'sanitize_text_field' ) );
- $wp_customize->add_control( 'slider_subtitle_' . $i, array(
- 'label' => sprintf( 'Banner %d - Untertitel', $i ),
- 'section' => 'header_slider',
- 'settings' => 'slider_subtitle_' . $i,
- 'type' => 'text',
- ) );
+ $wp_customize->add_control( 'slider_subtitle_' . $i, array( 'label' => sprintf( __('Banner %d - Untertitel', 'minecraft-modern-theme'), $i ), 'section' => 'header_slider', 'type' => 'text' ) );
}
- // Slider Text- & Stil-Einstellungen
$wp_customize->add_setting( 'slider_font_family', array( 'default' => 'Raleway', 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control( 'slider_font_family', array(
- 'label' => 'Schriftart', 'section' => 'header_slider', 'settings' => 'slider_font_family', 'type' => 'select',
- 'choices' => array( 'Raleway' => 'Raleway', 'Poppins' => 'Poppins', 'Montserrat' => 'Montserrat', 'Oswald' => 'Oswald', 'Roboto' => 'Roboto', 'Lato' => 'Lato' ),
+ 'label' => __('Schriftart', 'minecraft-modern-theme'), 'section' => 'header_slider', 'type' => 'select',
+ 'choices' => array( 'Raleway' => 'Raleway', 'Poppins' => 'Poppins', 'Montserrat' => 'Montserrat', 'Oswald' => 'Oswald', 'Roboto' => 'Roboto', 'Lato' => 'Lato' ),
) );
+
$wp_customize->add_setting( 'slider_font_size', array( 'default' => 'mittel', 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control( 'slider_font_size', array(
- 'label' => 'Schriftgröße', 'section' => 'header_slider', 'settings' => 'slider_font_size', 'type' => 'select',
- 'choices' => array( 'klein' => 'Klein', 'mittel' => 'Mittel', 'gross' => 'Groß', 'extra-gross' => 'Extra Groß' ),
+ 'label' => __('Schriftgröße', 'minecraft-modern-theme'), 'section' => 'header_slider', 'type' => 'select',
+ 'choices' => array( 'klein' => __('Klein', 'minecraft-modern-theme'), 'mittel' => __('Mittel', 'minecraft-modern-theme'), 'gross' => __('Groß', 'minecraft-modern-theme'), 'extra-gross' => __('Extra Groß', 'minecraft-modern-theme') ),
) );
+
$wp_customize->add_setting( 'slider_font_color', array( 'default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color' ) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'slider_font_color', array(
- 'label' => 'Schriftfarbe', 'section' => 'header_slider', 'settings' => 'slider_font_color',
+ 'label' => __('Schriftfarbe', 'minecraft-modern-theme'), 'section' => 'header_slider',
) ) );
-
- // Header-Höhe
+
$wp_customize->add_setting( 'header_height', array( 'default' => 'mittel', 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control( 'header_height', array(
- 'label' => 'Header-Höhe', 'section' => 'header_slider', 'settings' => 'header_height', 'type' => 'select',
- 'choices' => array( 'klein' => 'Klein', 'mittel' => 'Mittel', 'gross' => 'Groß' ),
+ 'label' => __('Header-Höhe', 'minecraft-modern-theme'), 'section' => 'header_slider', 'type' => 'select',
+ 'choices' => array( 'klein' => __('Klein', 'minecraft-modern-theme'), 'mittel' => __('Mittel', 'minecraft-modern-theme'), 'gross' => __('Groß', 'minecraft-modern-theme') ),
) );
$wp_customize->add_setting( 'slider_hide_arrows', array( 'default' => false, 'sanitize_callback' => 'wp_validate_boolean' ) );
- $wp_customize->add_control( 'slider_hide_arrows', array(
- 'label' => 'Pfeile ausblenden', 'section' => 'header_slider', 'settings' => 'slider_hide_arrows', 'type' => 'checkbox',
- ) );
+ $wp_customize->add_control( 'slider_hide_arrows', array( 'label' => __('Pfeile ausblenden', 'minecraft-modern-theme'), 'section' => 'header_slider', 'type' => 'checkbox' ) );
+
$wp_customize->add_setting( 'slider_hide_pagination', array( 'default' => false, 'sanitize_callback' => 'wp_validate_boolean' ) );
- $wp_customize->add_control( 'slider_hide_pagination', array(
- 'label' => 'Paginierung (Punkte) ausblenden', 'section' => 'header_slider', 'settings' => 'slider_hide_pagination', 'type' => 'checkbox',
- ) );
+ $wp_customize->add_control( 'slider_hide_pagination', array( 'label' => __('Paginierung (Punkte) ausblenden', 'minecraft-modern-theme'), 'section' => 'header_slider', 'type' => 'checkbox' ) );
- // --- Sektion: Startseiten-Hero (Fallback) ---
+
+ // =========================================================================
+ // 2. HERO SECTION (Fallback)
+ // =========================================================================
$wp_customize->add_section( 'hero_section', array(
- 'title' => 'Startseiten-Hero (wenn Slider deaktiviert)',
- 'priority' => 21,
- 'description' => 'Diese Inhalte werden angezeigt, wenn der Slider ausgeschaltet ist.',
+ 'title' => __('Startseiten-Hero (wenn Slider deaktiviert)', 'minecraft-modern-theme'),
+ 'priority' => 21,
) );
- $wp_customize->add_setting( 'hero_title', array( 'default' => 'Willkommen auf unserem Server', 'sanitize_callback' => 'sanitize_text_field' ) );
- $wp_customize->add_control( 'hero_title', array( 'label' => 'Haupttitel', 'section' => 'hero_section', 'settings' => 'hero_title', 'type' => 'text' ) );
- $wp_customize->add_setting( 'hero_subtitle', array( 'default' => 'Trete einer Community voller Abenteuer bei.', 'sanitize_callback' => 'sanitize_text_field' ) );
- $wp_customize->add_control( 'hero_subtitle', array( 'label' => 'Untertitel', 'section' => 'hero_section', 'settings' => 'hero_subtitle', 'type' => 'text' ) );
+
+ $wp_customize->add_setting( 'hero_title', array( 'default' => __('Willkommen auf unserem Server', 'minecraft-modern-theme'), 'sanitize_callback' => 'sanitize_text_field' ) );
+ $wp_customize->add_control( 'hero_title', array( 'label' => __('Haupttitel', 'minecraft-modern-theme'), 'section' => 'hero_section', 'type' => 'text' ) );
+ $wp_customize->add_setting( 'hero_subtitle', array( 'default' => __('Trete einer Community voller Abenteuer bei.', 'minecraft-modern-theme'), 'sanitize_callback' => 'sanitize_text_field' ) );
+ $wp_customize->add_control( 'hero_subtitle', array( 'label' => __('Untertitel', 'minecraft-modern-theme'), 'section' => 'hero_section', 'type' => 'text' ) );
$wp_customize->add_setting( 'hero_bg_image', array( 'sanitize_callback' => 'esc_url_raw' ) );
- $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'hero_bg_image', array(
- 'label' => 'Hintergrundbild', 'section' => 'hero_section', 'settings' => 'hero_bg_image',
- ) ) );
- $wp_customize->add_setting( 'hero_button_1_text', array( 'default' => 'Zum Forum', 'sanitize_callback' => 'sanitize_text_field' ) );
- $wp_customize->add_control( 'hero_button_1_text', array( 'label' => 'Button 1 Text', 'section' => 'hero_section', 'settings' => 'hero_button_1_text', 'type' => 'text' ) );
- $wp_customize->add_setting( 'hero_button_1_url', array( 'default' => '#', 'sanitize_callback' => 'esc_url_raw' ) );
- $wp_customize->add_control( 'hero_button_1_url', array( 'label' => 'Button 1 URL', 'section' => 'hero_section', 'settings' => 'hero_button_1_url', 'type' => 'url' ) );
- $wp_customize->add_setting( 'hero_button_2_text', array( 'default' => 'Zum Teamspeak', 'sanitize_callback' => 'sanitize_text_field' ) );
- $wp_customize->add_control( 'hero_button_2_text', array( 'label' => 'Button 2 Text', 'section' => 'hero_section', 'settings' => 'hero_button_2_text', 'type' => 'text' ) );
- $wp_customize->add_setting( 'hero_button_2_url', array( 'default' => '#', 'sanitize_callback' => 'esc_url_raw' ) );
- $wp_customize->add_control( 'hero_button_2_url', array( 'label' => 'Button 2 URL', 'section' => 'hero_section', 'settings' => 'hero_button_2_url', 'type' => 'url' ) );
-
- // --- Checkbox: Seitentitel auf Startseite verstecken ---
- $wp_customize->add_setting( 'show_home_title', array(
- 'default' => false,
- 'sanitize_callback' => 'wp_validate_boolean',
- ) );
- $wp_customize->add_control( 'show_home_title', array(
- 'label' => 'Seitentitel "Home" anzeigen',
- 'description' => 'Aktiviere diese Option, wenn der Titel "Home" über dem Slider/Inhalt angezeigt werden soll.',
- 'section' => 'hero_section',
- 'settings' => 'show_home_title',
- 'type' => 'checkbox',
- ) );
+ $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'hero_bg_image', array( 'label' => __('Hintergrundbild', 'minecraft-modern-theme'), 'section' => 'hero_section' ) ) );
+ $wp_customize->add_setting( 'hero_button_1_text', array( 'default' => __('Zum Forum', 'minecraft-modern-theme'), 'sanitize_callback' => 'sanitize_text_field' ) );
+ $wp_customize->add_control( 'hero_button_1_text', array( 'label' => __('Button 1 Text', 'minecraft-modern-theme'), 'section' => 'hero_section', 'type' => 'text' ) );
+ $wp_customize->add_setting( 'hero_button_1_url', array( 'default' => '#', 'sanitize_callback' => 'esc_url_raw' ) );
+ $wp_customize->add_control( 'hero_button_1_url', array( 'label' => __('Button 1 URL', 'minecraft-modern-theme'), 'section' => 'hero_section', 'type' => 'url' ) );
+ $wp_customize->add_setting( 'hero_button_2_text', array( 'default' => __('Zum Teamspeak', 'minecraft-modern-theme'), 'sanitize_callback' => 'sanitize_text_field' ) );
+ $wp_customize->add_control( 'hero_button_2_text', array( 'label' => __('Button 2 Text', 'minecraft-modern-theme'), 'section' => 'hero_section', 'type' => 'text' ) );
+ $wp_customize->add_setting( 'hero_button_2_url', array( 'default' => '#', 'sanitize_callback' => 'esc_url_raw' ) );
+ $wp_customize->add_control( 'hero_button_2_url', array( 'label' => __('Button 2 URL', 'minecraft-modern-theme'), 'section' => 'hero_section', 'type' => 'url' ) );
+ $wp_customize->add_setting( 'show_home_title', array( 'default' => false, 'sanitize_callback' => 'wp_validate_boolean' ) );
+ $wp_customize->add_control( 'show_home_title', array( 'label' => __('Seitentitel "Home" anzeigen', 'minecraft-modern-theme'), 'section' => 'hero_section', 'type' => 'checkbox' ) );
// =========================================================================
- // === 2. FARBEN & DARSTELLUNG (KOMBINIERT) ================================
+ // 3. FARBEN & DARSTELLUNG
// =========================================================================
-
- // --- Sektion: Farben & Darstellung ---
$wp_customize->add_section( 'theme_appearance_settings', array(
- 'title' => 'Farben & Darstellung',
- 'priority' => 30,
- ) );
-
- // =========================================================================
- // === NEU: THEME PRESETS (VOREINSTELLUNGEN) ==============================
- // =========================================================================
-
- $wp_customize->add_setting( 'theme_color_preset', array(
- 'default' => 'classic',
- 'sanitize_callback' => 'sanitize_key',
- 'transport' => 'refresh',
+ 'title' => __('Farben & Darstellung', 'minecraft-modern-theme'), 'priority' => 30,
) );
+ $wp_customize->add_setting( 'theme_color_preset', array( 'default' => 'classic', 'sanitize_callback' => 'sanitize_key', 'transport' => 'refresh' ) );
$wp_customize->add_control( 'theme_color_preset', array(
- 'label' => 'Theme Preset (Farbschema)',
- 'description' => 'Wähle ein voreingestelltes Farbschema (z. B. für Nether oder End Dimension).',
- 'section' => 'theme_appearance_settings',
- 'settings' => 'theme_color_preset',
- 'type' => 'select',
- 'priority' => 1, // Zeig es ganz oben in dieser Sektion an
- 'choices' => array(
- 'classic' => 'Classic Minecraft (Diamant-Blau)',
- 'nether' => 'Nether (Lava-Rot)',
- 'end' => 'The End (Ender-Purpur)',
+ 'label' => __('Theme Preset (Farbschema)', 'minecraft-modern-theme'),
+ 'section' => 'theme_appearance_settings',
+ 'type' => 'select',
+ 'priority' => 1,
+ 'choices' => array(
+ 'classic' => __('Classic Minecraft (Diamant-Blau)', 'minecraft-modern-theme'),
+ 'nether' => __('Nether (Lava-Rot)', 'minecraft-modern-theme'),
+ 'end' => __('The End (Ender-Purpur)', 'minecraft-modern-theme'),
),
) );
- // =========================================================================
- // === ENDE THEME PRESETS ==================================================
- // =========================================================================
-
- // Akzentfarbe
$wp_customize->add_setting( 'primary_accent_color', array( 'default' => '#00d4ff', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'refresh' ) );
- $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_accent_color', array(
- 'label' => 'Akzentfarbe', 'section' => 'theme_appearance_settings', 'settings' => 'primary_accent_color',
- ) ) );
+ $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_accent_color', array( 'label' => __('Akzentfarbe', 'minecraft-modern-theme'), 'section' => 'theme_appearance_settings' ) ) );
- // Hintergrundfarbe
- $wp_customize->add_setting( 'background_color', array(
- 'default' => '#ffffff',
- 'sanitize_callback' => 'sanitize_hex_color',
- 'transport' => 'refresh',
- ) );
- $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'background_color', array(
- 'label' => 'Hintergrundfarbe',
- 'section' => 'theme_appearance_settings',
- 'settings' => 'background_color',
- ) ) );
-
- // Dark / Light Mode
$wp_customize->add_setting( 'default_theme_mode', array( 'default' => 'dark', 'sanitize_callback' => 'sanitize_key' ) );
$wp_customize->add_control( 'default_theme_mode', array(
- 'label' => 'Standard-Theme-Modus', 'section' => 'theme_appearance_settings', 'type' => 'radio',
- 'choices' => array( 'dark' => 'Dark Mode (Standard)', 'light' => 'Light Mode' ),
+ 'label' => __('Standard-Theme-Modus', 'minecraft-modern-theme'),
+ 'section' => 'theme_appearance_settings',
+ 'type' => 'radio',
+ 'choices' => array( 'dark' => __('Dark Mode', 'minecraft-modern-theme'), 'light' => __('Light Mode', 'minecraft-modern-theme') ),
) );
-
- // =========================================================================
- // === 3. SIDEBAR EINSTELLUNGEN ============================================
- // =========================================================================
-
- $wp_customize->add_section( 'sidebar_settings', array(
- 'title' => 'Sidebar Einstellungen',
- 'priority' => 35,
- 'description' => 'Konfiguriere die Sidebar auf der Startseite.',
- ) );
-
- // Sidebar aktivieren
- $wp_customize->add_setting( 'homepage_sidebar_enabled', array(
- 'default' => false,
- 'sanitize_callback' => 'wp_validate_boolean',
- ) );
- $wp_customize->add_control( 'homepage_sidebar_enabled', array(
- 'label' => 'Sidebar auf Startseite aktivieren',
- 'description' => 'Zeigt eine Sidebar neben dem Hauptinhalt an.',
- 'section' => 'sidebar_settings',
- 'settings' => 'homepage_sidebar_enabled',
+ // FIX: Scroll-to-Top war nie im Customizer steuerbar
+ $wp_customize->add_setting( 'show_scroll_to_top', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
+ $wp_customize->add_control( 'show_scroll_to_top', array(
+ 'label' => __('Scroll-to-Top Button anzeigen', 'minecraft-modern-theme'),
+ 'description' => __('Zeigt einen Button unten rechts zum Hochscrollen an.', 'minecraft-modern-theme'),
+ 'section' => 'theme_appearance_settings',
'type' => 'checkbox',
) );
- // Sidebar Position
- $wp_customize->add_setting( 'homepage_sidebar_position', array(
- 'default' => 'right',
- 'sanitize_callback' => 'sanitize_key',
- ) );
+
+ // =========================================================================
+ // 4. SIDEBAR
+ // =========================================================================
+ $wp_customize->add_section( 'sidebar_settings', array( 'title' => __('Sidebar Einstellungen', 'minecraft-modern-theme'), 'priority' => 35 ) );
+ $wp_customize->add_setting( 'homepage_sidebar_enabled', array( 'default' => false, 'sanitize_callback' => 'wp_validate_boolean' ) );
+ $wp_customize->add_control( 'homepage_sidebar_enabled', array( 'label' => __('Sidebar auf Startseite aktivieren', 'minecraft-modern-theme'), 'section' => 'sidebar_settings', 'type' => 'checkbox' ) );
+ $wp_customize->add_setting( 'homepage_sidebar_position', array( 'default' => 'right', 'sanitize_callback' => 'sanitize_key' ) );
$wp_customize->add_control( 'homepage_sidebar_position', array(
- 'label' => 'Sidebar Position',
- 'section' => 'sidebar_settings',
- 'settings' => 'homepage_sidebar_position',
- 'type' => 'select',
- 'choices' => array(
- 'left' => 'Links',
- 'right' => 'Rechts',
- ),
+ 'label' => __('Sidebar Position', 'minecraft-modern-theme'), 'section' => 'sidebar_settings', 'type' => 'select',
+ 'choices' => array( 'left' => __('Links', 'minecraft-modern-theme'), 'right' => __('Rechts', 'minecraft-modern-theme') ),
) );
// =========================================================================
- // === 4. SOCIAL MEDIA =====================================================
+ // 5. SOCIAL MEDIA
// =========================================================================
-
- $wp_customize->add_section( 'social_links', array( 'title' => 'Social Media Links', 'priority' => 40 ) );
- $social_platforms = array( 'discord' => 'Discord', 'youtube' => 'YouTube', 'twitter' => 'Twitter (X)', 'facebook' => 'Facebook', 'instagram' => 'Instagram', 'tiktok' => 'TikTok', 'twitch' => 'Twitch', 'steam' => 'Steam', 'github' => 'GitHub', 'linkedin' => 'LinkedIn', 'pinterest' => 'Pinterest', 'reddit' => 'Reddit', 'teamspeak' => 'Teamspeak', 'spotify' => 'Spotify' );
- foreach ($social_platforms as $key => $label) {
+ $wp_customize->add_section( 'social_links', array( 'title' => __('Social Media Links', 'minecraft-modern-theme'), 'priority' => 40 ) );
+ $social_platforms = array(
+ 'discord' => 'Discord', 'youtube' => 'YouTube', 'twitter' => 'Twitter (X)',
+ 'facebook' => 'Facebook', 'instagram' => 'Instagram', 'tiktok' => 'TikTok',
+ 'twitch' => 'Twitch', 'steam' => 'Steam', 'github' => 'GitHub',
+ 'linkedin' => 'LinkedIn', 'pinterest' => 'Pinterest', 'reddit' => 'Reddit',
+ 'teamspeak' => 'Teamspeak', 'spotify' => 'Spotify',
+ );
+ foreach ( $social_platforms as $key => $label ) {
$wp_customize->add_setting( 'social_' . $key, array( 'sanitize_callback' => 'esc_url_raw' ) );
- $wp_customize->add_control( 'social_' . $key, array(
- 'label' => $label . ' URL', 'section' => 'social_links', 'settings' => 'social_' . $key, 'type' => 'url',
- ) );
+ $wp_customize->add_control( 'social_' . $key, array( 'label' => $label . ' URL', 'section' => 'social_links', 'type' => 'url' ) );
}
// =========================================================================
- // === 5. FOOTER-BEREICH ==================================================
+ // 6. FOOTER
// =========================================================================
+ $wp_customize->add_section( 'footer_settings', array( 'title' => __('Footer-Einstellungen', 'minecraft-modern-theme'), 'priority' => 50 ) );
- $wp_customize->add_section( 'footer_settings', array( 'title' => 'Footer-Einstellungen', 'priority' => 50 ) );
-
- // Copyright-Text
- $wp_customize->add_setting( 'footer_copyright', array( 'default' => '© ' . date('Y') . ' ' . get_bloginfo('name'), 'sanitize_callback' => 'wp_kses_post' ) );
+ // FIX: Default mit aktuellem Jahr zur Laufzeit auswerten, nicht bei class-load
+ $wp_customize->add_setting( 'footer_copyright', array(
+ 'default' => '', // Leer = dynamisch berechnet in footer.php
+ 'sanitize_callback' => 'wp_kses_post',
+ ) );
$wp_customize->add_control( 'footer_copyright', array(
- 'label' => 'Copyright-Text', 'section' => 'footer_settings', 'settings' => 'footer_copyright', 'type' => 'textarea',
+ 'label' => __('Copyright-Text', 'minecraft-modern-theme'),
+ 'description' => __('Leer lassen für automatischen Text mit aktuellem Jahr.', 'minecraft-modern-theme'),
+ 'section' => 'footer_settings',
+ 'type' => 'textarea',
) );
- // Impressum & Datenschutz Links
- $wp_customize->add_setting( 'footer_impressum_url', array( 'sanitize_callback' => 'esc_url_raw' ) );
- $wp_customize->add_control( 'footer_impressum_url', array(
- 'label' => 'URL für Impressum', 'section' => 'footer_settings', 'settings' => 'footer_impressum_url', 'type' => 'url',
- ) );
+ $wp_customize->add_setting( 'footer_impressum_url', array( 'sanitize_callback' => 'esc_url_raw' ) );
+ $wp_customize->add_control( 'footer_impressum_url', array( 'label' => __('URL für Impressum', 'minecraft-modern-theme'), 'section' => 'footer_settings', 'type' => 'url' ) );
$wp_customize->add_setting( 'footer_datenschutz_url', array( 'sanitize_callback' => 'esc_url_raw' ) );
- $wp_customize->add_control( 'footer_datenschutz_url', array(
- 'label' => 'URL für Datenschutz', 'section' => 'footer_settings', 'settings' => 'footer_datenschutz_url', 'type' => 'url',
- ) );
-
- // Footer-Credit
+ $wp_customize->add_control( 'footer_datenschutz_url', array( 'label' => __('URL für Datenschutz', 'minecraft-modern-theme'), 'section' => 'footer_settings', 'type' => 'url' ) );
$wp_customize->add_setting( 'show_footer_credit', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
- $wp_customize->add_control( 'show_footer_credit', array(
- 'label' => 'Footer-Credit ("Minecraft Theme Erstellt von...") anzeigen', 'section' => 'footer_settings', 'settings' => 'show_footer_credit', 'type' => 'checkbox',
- ) );
+ $wp_customize->add_control( 'show_footer_credit', array( 'label' => __('Footer-Credit anzeigen', 'minecraft-modern-theme'), 'section' => 'footer_settings', 'type' => 'checkbox' ) );
// =========================================================================
- // === 6. ZUSÄTZLICHE FUNKTIONEN ==========================================
+ // 7. FAQ & TEAM
// =========================================================================
+ $wp_customize->add_section( 'faq_settings', array( 'title' => __('FAQ Einstellungen', 'minecraft-modern-theme'), 'priority' => 60 ) );
+ $wp_customize->add_setting( 'faq_enabled', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
+ $wp_customize->add_control( 'faq_enabled', array( 'label' => __('FAQ System aktivieren', 'minecraft-modern-theme'), 'section' => 'faq_settings', 'type' => 'checkbox' ) );
- // --- Sektion: FAQ Einstellungen ---
- $wp_customize->add_section( 'faq_settings', array( 'title' => 'FAQ Einstellungen', 'priority' => 60 ) );
- $wp_customize->add_setting( 'faq_enabled', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
- $wp_customize->add_control( 'faq_enabled', array(
- 'label' => 'FAQ System aktivieren', 'section' => 'faq_settings', 'settings' => 'faq_enabled', 'type' => 'checkbox',
- ) );
+ $wp_customize->add_section( 'team_settings', array( 'title' => __('Team Einstellungen', 'minecraft-modern-theme'), 'priority' => 65 ) );
+ $wp_customize->add_setting( 'team_enabled', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
+ $wp_customize->add_control( 'team_enabled', array( 'label' => __('Team Showcase aktivieren', 'minecraft-modern-theme'), 'section' => 'team_settings', 'type' => 'checkbox' ) );
- // --- Sektion: Team Einstellungen ---
- $wp_customize->add_section( 'team_settings', array( 'title' => 'Team Einstellungen', 'priority' => 65 ) );
- $wp_customize->add_setting( 'team_enabled', array( 'default' => true, 'sanitize_callback' => 'wp_validate_boolean' ) );
- $wp_customize->add_control( 'team_enabled', array(
- 'label' => 'Team Showcase aktivieren', 'section' => 'team_settings', 'settings' => 'team_enabled', 'type' => 'checkbox',
- ) );
// =========================================================================
- // === 7. LOGIN-BEREICH ====================================================
+ // 8. LOGIN
// =========================================================================
+ $wp_customize->add_section( 'login_settings', array( 'title' => __('Login-Einstellungen', 'minecraft-modern-theme'), 'priority' => 70 ) );
+ $wp_customize->add_setting( 'login_background_image', array( 'sanitize_callback' => 'esc_url_raw', 'transport' => 'refresh' ) );
+ $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'login_background_image', array( 'label' => __('Login-Hintergrundbild', 'minecraft-modern-theme'), 'section' => 'login_settings' ) ) );
+ $wp_customize->add_setting( 'login_logo', array( 'sanitize_callback' => 'esc_url_raw', 'transport' => 'refresh' ) );
+ $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'login_logo', array( 'label' => __('Login-Logo', 'minecraft-modern-theme'), 'section' => 'login_settings' ) ) );
- $wp_customize->add_section( 'login_settings', array(
- 'title' => 'Login-Einstellungen',
- 'priority' => 70,
- 'description' => 'Passe das Aussehen der wp-admin Login-Seite an.',
- ) );
-
- // Login-Hintergrundbild
- $wp_customize->add_setting( 'login_background_image', array(
- 'sanitize_callback' => 'esc_url_raw',
- 'transport' => 'refresh',
- ) );
- $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'login_background_image', array(
- 'label' => 'Login-Hintergrundbild',
- 'section' => 'login_settings',
- 'settings' => 'login_background_image',
- ) ) );
-
- // Login-Logo
- $wp_customize->add_setting( 'login_logo', array(
- 'sanitize_callback' => 'esc_url_raw',
- 'transport' => 'refresh',
- ) );
- $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'login_logo', array(
- 'label' => 'Login-Logo (ersetzt das WordPress-Logo)',
- 'section' => 'login_settings',
- 'settings' => 'login_logo',
- ) ) );
-
- // Multi-Avatar UUIDs
- for ($i = 1; $i <= 5; $i++) {
- $wp_customize->add_setting( 'login_avatar_uuid_' . $i, array(
- 'sanitize_callback' => 'sanitize_text_field',
- 'transport' => 'refresh',
- ) );
+ for ( $i = 1; $i <= 5; $i++ ) {
+ $wp_customize->add_setting( 'login_avatar_uuid_' . $i, array( 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'refresh' ) );
$wp_customize->add_control( 'login_avatar_uuid_' . $i, array(
- 'label' => sprintf( 'Avatar %d UUID', $i ),
- 'description' => sprintf( 'Gib die UUID für den %d. Avatar an. (Leer lassen, um zu deaktivieren)', $i ),
- 'section' => 'login_settings',
- 'settings' => 'login_avatar_uuid_' . $i,
- 'type' => 'text',
+ 'label' => sprintf( __('Avatar %d UUID', 'minecraft-modern-theme'), $i ),
+ 'section' => 'login_settings',
+ 'type' => 'text',
) );
}
- // Slider-Geschwindigkeit
- $wp_customize->add_setting( 'login_avatar_slider_speed', array(
- 'default' => 4,
- 'sanitize_callback' => 'absint',
- 'transport' => 'refresh',
- ) );
+ $wp_customize->add_setting( 'login_avatar_slider_speed', array( 'default' => 4, 'sanitize_callback' => 'absint', 'transport' => 'refresh' ) );
$wp_customize->add_control( 'login_avatar_slider_speed', array(
- 'label' => 'Avatar-Wechsel (in Sekunden)',
- 'description' => 'Wie viele Sekunden soll ein Avatar angezeigt werden?',
+ 'label' => __('Avatar-Wechsel (Sekunden)', 'minecraft-modern-theme'),
'section' => 'login_settings',
- 'settings' => 'login_avatar_slider_speed',
'type' => 'number',
'input_attrs' => array( 'min' => 2, 'max' => 10, 'step' => 1 ),
) );
+
// =========================================================================
- // === 8. EXPORT / IMPORT SECTION =========================================
+ // 9. EXPORT / IMPORT
// =========================================================================
-
$wp_customize->add_section( 'theme_mods_import_export', array(
- 'title' => __( 'Einstellungen sichern', 'minecraft-modern-theme' ),
- 'priority' => 999,
- 'description' => '',
+ 'title' => __('Einstellungen sichern', 'minecraft-modern-theme'),
+ 'priority' => 999,
) );
-
- // Füge ein Custom Control mit HTML hinzu
- $wp_customize->add_setting( 'import_export_placeholder', array(
- 'sanitize_callback' => 'sanitize_text_field',
- ) );
-
- // Custom Control Class für Export/Import
- class Import_Export_Control extends WP_Customize_Control {
- public $type = 'import_export';
-
- public function render_content() {
- $export_url = admin_url('admin-post.php?action=export_theme_settings');
- $nonce = wp_create_nonce('theme-import-nonce');
- ?>
-
-
- Hinweis: Hier kannst du alle deine Theme-Einstellungen sichern und wiederherstellen.
-
-
-
- Einstellungen Exportieren
-
-
-
-
-
-
-
-
-
- ⚠️ Warnung: Beim Import werden alle aktuellen Einstellungen überschrieben!
-
-
-
-
-
-
- add_control( new Import_Export_Control( $wp_customize, 'import_export_placeholder', array(
+ $wp_customize->add_setting( 'import_export_placeholder', array( 'sanitize_callback' => 'sanitize_text_field' ) );
+ $wp_customize->add_control( new MM_Import_Export_Control( $wp_customize, 'import_export_placeholder', array(
'section' => 'theme_mods_import_export',
) ) );
}
@@ -480,110 +327,81 @@ add_action( 'customize_register', 'minecraft_modern_customize_register' );
// =========================================================================
-// === DYNAMISCHES CSS =====================================================
+// DYNAMISCHES CSS – FIX: Google Font via wp_enqueue_style(), nicht in wp_head
// =========================================================================
+function minecraft_modern_enqueue_dynamic_styles() {
+ $font = get_theme_mod( 'slider_font_family', 'Raleway' );
-function minecraft_modern_dynamic_css_output() {
- $accent_color = get_theme_mod( 'primary_accent_color', '#00d4ff' );
- $slider_font = get_theme_mod( 'slider_font_family', 'Raleway' );
- $slider_color = get_theme_mod( 'slider_font_color', '#ffffff' );
- $slider_size_setting = get_theme_mod( 'slider_font_size', 'mittel' );
+ // Google Font sauber einbinden
+ $font_url = 'https://fonts.googleapis.com/css2?family=' . urlencode($font) . ':wght@400;600;700&display=swap';
+ wp_enqueue_style( 'minecraft-modern-google-font', $font_url, array(), null );
+
+ // Dynamisches CSS als inline style
+ $accent_color = get_theme_mod( 'primary_accent_color', '#00d4ff' );
+ $slider_color = get_theme_mod( 'slider_font_color', '#ffffff' );
+ $slider_size_setting = get_theme_mod( 'slider_font_size', 'mittel' );
$header_height_setting = get_theme_mod( 'header_height', 'mittel' );
- // Header-Höhe umwandeln
- $header_height_value = '300px';
- if ( $header_height_setting === 'klein' ) {
- $header_height_value = '200px';
- } elseif ( $header_height_setting === 'gross' ) {
- $header_height_value = '400px';
- }
+ $height_map = array( 'klein' => '200px', 'mittel' => '300px', 'gross' => '400px' );
+ $header_height_value = isset($height_map[$header_height_setting]) ? $height_map[$header_height_setting] : '300px';
- // Schriftgrößen umwandeln
$font_sizes = array(
'klein' => array( 'title' => '2.5rem', 'subtitle' => '1.2rem' ),
'mittel' => array( 'title' => '3.5rem', 'subtitle' => '1.4rem' ),
'gross' => array( 'title' => '4.5rem', 'subtitle' => '1.6rem' ),
'extra-gross' => array( 'title' => '5.5rem', 'subtitle' => '1.8rem' ),
);
- $chosen_sizes = isset( $font_sizes[$slider_size_setting] ) ? $font_sizes[$slider_size_setting] : $font_sizes['mittel'];
+ $sizes = isset($font_sizes[$slider_size_setting]) ? $font_sizes[$slider_size_setting] : $font_sizes['mittel'];
- $fonts_to_load = array($slider_font);
- $fonts_url = 'https://fonts.googleapis.com/css2?family=' . implode( ':wght@400;600;700&family=', $fonts_to_load ) . '&display=swap';
- ?>
-
-
-
-
-
- parent();
- if ( $parent && $parent->exists() ) {
- $parent_version = $parent->get( 'Version' );
- if ( ! empty( $parent_version ) ) {
- return $parent_version;
+ private $theme_slug = 'Minecraft-Modern-Theme';
+ private $repo = 'M_Viper/Minecraft-Modern-Theme';
+ private $transient_key = 'mm_theme_update_check';
+
+ public function __construct() {
+ // Update-Prüfung und Benachrichtigung
+ add_action( 'admin_notices', [ $this, 'display_update_notice' ] );
+
+ // Dashboard Widget
+ add_action( 'wp_dashboard_setup', [ $this, 'add_dashboard_widget' ] );
+
+ // Refresh Logik
+ add_action( 'admin_init', [ $this, 'handle_refresh_request' ] );
+ }
+
+ /**
+ * Holt die API-Daten von Gitea
+ */
+ private function get_latest_release() {
+ $update_data = get_transient( $this->transient_key );
+
+ if ( false === $update_data ) {
+ $api_url = "https://git.viper.ipv64.net/api/v1/repos/{$this->repo}/releases/latest";
+ $response = wp_remote_get( $api_url, [ 'timeout' => 10 ] );
+
+ if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ) {
+ set_transient( $this->transient_key, [ 'error' => true ], 2 * HOUR_IN_SECONDS );
+ return [ 'error' => true ];
+ }
+
+ $data = json_decode( wp_remote_retrieve_body( $response ) );
+ $new_version = ltrim( $data->tag_name, 'vV' );
+
+ $update_data = [
+ 'version' => $new_version,
+ 'url' => "https://git.viper.ipv64.net/{$this->repo}/releases"
+ ];
+
+ set_transient( $this->transient_key, $update_data, 12 * HOUR_IN_SECONDS );
+ }
+
+ return $update_data;
+ }
+
+ /**
+ * Zeigt die gelbe Info-Box oben im Admin-Bereich
+ */
+ public function display_update_notice() {
+ if ( ! current_user_can( 'update_themes' ) ) return;
+
+ $latest = $this->get_latest_release();
+ if ( isset( $latest['error'] ) ) return;
+
+ $current_version = wp_get_theme( $this->theme_slug )->get( 'Version' );
+
+ if ( version_compare( $current_version, $latest['version'], '<' ) ) {
+ ?>
+
+
+
+ Minecraft Modern Update verfügbar: Version ist bereit zum Download.
+ Zum Download →
+
+
+ get( 'Version' );
-}
-
-// === THEME UPDATE NOTIFICATION SYSTEM ===
-
-// Funktion zum Leeren des Caches (wenn man auf "Update prüfen" klickt)
-function minecraft_modern_clear_cache() {
- if ( isset( $_GET['mm_clear_cache'] ) && current_user_can( 'manage_options' ) ) {
- check_admin_referer( 'mm_clear_cache_action' );
- delete_transient( 'minecraft_modern_latest_release' );
- wp_redirect( admin_url( 'index.php' ) );
- exit;
- }
-}
-add_action( 'admin_init', 'minecraft_modern_clear_cache' );
-
-// Funktion zum Abrufen der neuesten Release-Informationen
-function minecraft_modern_get_latest_release_info( $force_refresh = false ) {
- $transient_key = 'minecraft_modern_latest_release';
-
- // Wenn erzwungen wird (oder Cache leer), frische Daten holen
- if ( $force_refresh ) {
- delete_transient( $transient_key );
- }
-
- $release_info = get_transient( $transient_key );
-
- if ( false === $release_info ) {
- // Timeout auf 10 Sekunden erhöht für langsame Verbindungen
- $response = wp_remote_get(
- 'https://git.viper.ipv64.net/api/v1/repos/M_Viper/Minecraft-Modern-Theme/releases/latest',
- array( 'timeout' => 10 )
+ /**
+ * Fügt das Widget zum Dashboard hinzu
+ */
+ public function add_dashboard_widget() {
+ wp_add_dashboard_widget(
+ 'mm_theme_status_widget',
+ 'Minecraft Modern Theme Status',
+ [ $this, 'render_widget_content' ]
);
-
- if ( ! is_wp_error( $response ) && 200 === wp_remote_retrieve_response_code( $response ) ) {
- $body = wp_remote_retrieve_body( $response );
- $release_data = json_decode( $body, true );
-
- if ( $release_data && isset( $release_data['tag_name'] ) ) {
- // Tag bereinigen (falls 'v' davor steht, z.B. v1.6 -> 1.6)
- $tag_name = $release_data['tag_name'];
- if ( strpos( $tag_name, 'v' ) === 0 ) {
- $tag_name = ltrim( $tag_name, 'v' );
- }
+ }
- $release_info = array(
- 'version' => $tag_name,
- 'download_url' => $release_data['zipball_url'],
- 'release_notes' => isset( $release_data['body'] ) ? $release_data['body'] : '',
- 'published_at' => isset( $release_data['published_at'] ) ? $release_data['published_at'] : ''
- );
-
- // Cache für 6 Stunden
- set_transient( $transient_key, $release_info, 6 * HOUR_IN_SECONDS );
+ /**
+ * HTML-Inhalt des Widgets
+ */
+ public function render_widget_content() {
+ $current_version = wp_get_theme( $this->theme_slug )->get( 'Version' );
+ $latest = $this->get_latest_release();
+
+ echo '';
+ }
+
+ /**
+ * Verarbeitet den Klick auf "Jetzt prüfen"
+ */
+ public function handle_refresh_request() {
+ if ( isset( $_GET['mm_refresh_check'] ) && check_admin_referer( 'mm_refresh_action' ) ) {
+ delete_transient( $this->transient_key );
+ wp_redirect( admin_url( 'index.php' ) );
+ exit;
}
}
-
- return $release_info;
}
-// === BENACHRICHTIGUNG IM ADMIN-BEREICH ===
-function minecraft_modern_show_update_notification() {
- if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
- return;
- }
-
- $current_version = minecraft_modern_get_theme_version();
- $latest_release = minecraft_modern_get_latest_release_info();
-
- if ( ! empty( $latest_release ) && isset( $latest_release['version'] ) && version_compare( $current_version, $latest_release['version'], '<' ) ) {
- ?>
-
-
-
- ' . esc_html( $current_version ) . '',
- '' . esc_html( $latest_release['version'] ) . ''
- );
- ?>
-
-
-
-
-
-
-
-
-
-
- ' . __( 'Current Version:', 'minecraft-modern-theme' ) . ' ' . esc_html( $current_version ) . '
';
-
- if ( ! empty( $latest_release ) && isset( $latest_release['version'] ) ) {
- echo '' . __( 'Latest Version:', 'minecraft-modern-theme' ) . ' ' . esc_html( $latest_release['version'] ) . '
';
-
- if ( version_compare( $current_version, $latest_release['version'], '<' ) ) {
- echo '' . __( 'Status:', 'minecraft-modern-theme' ) . ' ' . __( 'Update Available', 'minecraft-modern-theme' ) . '
';
- echo '' . __( 'Download Update', 'minecraft-modern-theme' ) . '
';
- } else {
- echo '' . __( 'Status:', 'minecraft-modern-theme' ) . ' ' . __( 'Up to Date', 'minecraft-modern-theme' ) . '
';
- }
- } else {
- echo '' . __( 'Status:', 'minecraft-modern-theme' ) . ' ' . __( 'Unable to check for updates', 'minecraft-modern-theme' ) . '
';
- }
-
- // Link für "Jetzt prüfen"
- $refresh_url = wp_nonce_url( admin_url( 'index.php?mm_clear_cache=1' ), 'mm_clear_cache_action' );
- echo '' . __( 'Check for Updates Now', 'minecraft-modern-theme' ) . '
';
-
- echo '' . __( 'View All Releases', 'minecraft-modern-theme' ) . '
';
-}
+// Initialisierung
+new Minecraft_Modern_Theme_Manager();
\ No newline at end of file