diff --git a/festive-seasons-pro.php b/festive-seasons-pro.php index 6452d20..09e4736 100644 --- a/festive-seasons-pro.php +++ b/festive-seasons-pro.php @@ -2,7 +2,7 @@ /* Plugin Name: Festive Seasons Pro Description: Zeigt saisonale Effekte (Schnee, Eier, Spinnen, Ballons, Feuerwerk) für feste Feiertage und individuelle Geburtstage an. -Version: 1.0 +Version: 1.1 Author: M_Viper */ @@ -21,10 +21,44 @@ class Festive_Seasons_Pro { add_action('wp_footer', [$this, 'render_music_consent']); add_action('admin_menu', [$this, 'add_admin_menu_page']); add_action('admin_init', [$this, 'register_settings']); + add_action('admin_enqueue_scripts', [$this, 'enqueue_admin_scripts']); add_action('widgets_init', [$this, 'register_widget']); add_shortcode('festive_event', [$this, 'render_shortcode']); } + // Admin-Scripts laden + public function enqueue_admin_scripts($hook) { + // Nur auf der Plugin-Einstellungsseite laden + if ($hook !== 'settings_page_festive-seasons-pro') { + return; + } + + // jQuery ist standardmäßig in WordPress verfügbar + wp_enqueue_script('jquery'); + + // Inline-Script für Event-Verwaltung + wp_add_inline_script('jquery', ' + jQuery(document).ready(function($) { + // Neues Ereignis hinzufügen + $("#fsp-add-event").on("click", function() { + var index = $("#fsp-events-container .fsp-event-row").length; + var newRow = \'
\' + + \'\' + + \'\' + + \'\' + + \'\' + + \'
\'; + $("#fsp-events-container").append(newRow); + }); + + // Ereignis entfernen + $(document).on("click", ".fsp-remove-event", function() { + $(this).closest(".fsp-event-row").remove(); + }); + }); + '); + } + public function get_active_events() { if (isset($_GET['fsp_test_date'])) { $today = sanitize_text_field($_GET['fsp_test_date']); @@ -56,7 +90,7 @@ class Festive_Seasons_Pro { return [ 'advent' => ['name' => 'Adventszeit', 'start' => "$year-12-01", 'end' => "$year-12-23", 'class' => 'festive-advent', 'effects' => ['snow']], - 'christmas' => ['name' => 'Weihnachten', 'start' => "$year-12-24", 'end' => "$year-12-26", 'class' => 'festive-christmas', 'effects' => ['snow', 'music', 'star', 'santa']], // NEU: Santa-Animation + 'christmas' => ['name' => 'Weihnachten', 'start' => "$year-12-24", 'end' => "$year-12-26", 'class' => 'festive-christmas', 'effects' => ['snow', 'music', 'star', 'santa']], 'newyear' => ['name' => 'Silvester', 'start' => "$year-12-31", 'end' => ($year + 1) . "-01-01", 'class' => 'festive-newyear', 'effects' => ['newyear_fireworks']], 'halloween' => ['name' => 'Halloween', 'start' => "$year-10-31", 'end' => "$year-10-31", 'class' => 'festive-halloween', 'effects' => ['spiders']], 'easter' => ['name' => 'Ostern', 'start' => date('Y-m-d', strtotime($easter_date . ' -1 day')), 'end' => date('Y-m-d', strtotime($easter_date)), 'class' => 'festive-easter', 'effects' => ['eggs']], @@ -133,7 +167,7 @@ class Festive_Seasons_Pro { case 'star': wp_enqueue_script('fsp-star', plugin_dir_url(__FILE__) . 'assets/js/christmas-star.js', ['jquery'], '3.4', true); break; - case 'santa': // NEU: Santa-Animation + case 'santa': wp_enqueue_script('fsp-santa', plugin_dir_url(__FILE__) . 'assets/js/santa-sleigh.js', ['jquery'], '3.4', true); break; case 'newyear_fireworks': @@ -250,12 +284,12 @@ jQuery(document).ready(function($) { $events = get_option('fsp_events', []); ?>
-

Festive Seasons Pro Einstellungen

+

🎉 Festive Seasons Pro Einstellungen

-

Allgemeine Einstellungen

+

⚙️ Allgemeine Einstellungen

@@ -267,7 +301,7 @@ jQuery(document).ready(function($) { -

Feste Feiertage

+

🎄 Feste Feiertage

get_fixed_events() as $key => $event): ?> @@ -279,10 +313,11 @@ jQuery(document).ready(function($) { -

Geburtstage & Jubiläe

+

🎂 Geburtstage & Jubiläen

Hier können Sie beliebige Ereignisse hinzufügen. Das Datum wird im Format TT-MM (z.B. 24-12) oder JJJJ-MM-TT (z.B. 2024-05-10) angegeben.

-
- + +
+ $event) : ?>
@@ -293,24 +328,14 @@ jQuery(document).ready(function($) {
- + + - +
- - -

Weihnachtsmusik abspielen?

+

🎵 Weihnachtsmusik abspielen?

@@ -416,4 +441,4 @@ class FSP_Widget extends WP_Widget { } } - $festive_seasons_pro_instance = new Festive_Seasons_Pro(); \ No newline at end of file +$festive_seasons_pro_instance = new Festive_Seasons_Pro(); \ No newline at end of file