From 82e5cb1311d44442ea372ad38fc8a1b6745881c5 Mon Sep 17 00:00:00 2001 From: M_Viper Date: Tue, 25 Nov 2025 06:41:27 +0000 Subject: [PATCH] wp-rules.php aktualisiert --- wp-rules.php | 1461 ++++++++++++++++++++++++++------------------------ 1 file changed, 758 insertions(+), 703 deletions(-) diff --git a/wp-rules.php b/wp-rules.php index 207e071..485ce8a 100644 --- a/wp-rules.php +++ b/wp-rules.php @@ -1,704 +1,759 @@ - Sanfte Animationen für das Auf- und Zuklappen der Regeln aktivieren.'; -} -function mrp_enable_drag_drop_render() { - $options = get_option('mrp_settings'); - $enabled = isset($options['enable_drag_drop']) ? $options['enable_drag_drop'] : '1'; - echo ''; -} - -// Render-Funktion für die Checkbox des Willkommens-Tabs -function mrp_show_welcome_tab_render() { - $options = get_option('mrp_settings'); - if ($options === false || !is_array($options)) { - $is_checked = true; - } else { - $is_checked = isset($options['show_welcome_tab']); - } - echo ''; -} - -// Render-Funktion für den Willkommens-Tab -function mrp_welcome_tab_render() { - $options = get_option('mrp_settings'); - $welcome_content = isset($options['welcome_tab_content']) ? $options['welcome_tab_content'] : ''; - - echo '
'; // Abstand zur Checkbox - - $editor_id = 'mrp_welcome_tab_editor'; - $settings = array( - 'textarea_name' => 'mrp_settings[welcome_tab_content]', - 'media_buttons' => true, - 'textarea_rows' => 15, - 'teeny' => true, - ); - wp_editor($welcome_content, $editor_id, $settings); -} - -// NEU: Render-Funktion für die Hintergrundfarbe des Willkommens-Tabs -function mrp_welcome_tab_bg_color_render() { - $options = get_option('mrp_settings'); - $bg_color = isset($options['welcome_tab_bg_color']) ? $options['welcome_tab_bg_color'] : '#f0f0f0'; - echo ""; - echo "

Wählen Sie eine Hintergrundfarbe. Diese wird automatisch mit 50% Transparenz im Frontend angezeigt.

"; -} - -// 4. Render-Funktionen für die Styling-Felder -function mrp_tab_title_font_size_render() { - $options = get_option('mrp_settings'); $font_size = isset($options['tab_title_font_size']) ? $options['tab_title_font_size'] : '15'; - echo " px"; -} -function mrp_tab_title_font_color_render() { - $options = get_option('mrp_settings'); $font_color = isset($options['tab_title_font_color']) ? $options['tab_title_font_color'] : '#2c3e50'; - echo ""; -} -function mrp_rule_title_font_size_render() { - $options = get_option('mrp_settings'); $font_size = isset($options['rule_title_font_size']) ? $options['rule_title_font_size'] : '16'; - echo " px"; -} -function mrp_rule_title_font_color_render() { - $options = get_option('mrp_settings'); $font_color = isset($options['rule_title_font_color']) ? $options['rule_title_font_color'] : '#2c3e50'; - echo ""; -} -function mrp_rule_content_font_size_render() { - $options = get_option('mrp_settings'); $font_size = isset($options['rule_content_font_size']) ? $options['rule_content_font_size'] : '15'; - echo " px"; -} -function mrp_rule_content_font_color_render() { - $options = get_option('mrp_settings'); $font_color = isset($options['rule_content_font_color']) ? $options['rule_content_font_color'] : '#6c757d'; - echo ""; -} - -// NEU: Hilfsfunktion zur Umwandlung von Hex zu RGBA -if (!function_exists('hex_to_rgba')) { - function hex_to_rgba($hex, $alpha) { - $hex = str_replace("#", "", $hex); - if (strlen($hex) == 3) { - $r = hexdec(substr($hex, 0, 1).substr($hex, 0, 1)); - $g = hexdec(substr($hex, 1, 1).substr($hex, 1, 1)); - $b = hexdec(substr($hex, 2, 1).substr($hex, 2, 1)); - } else { - $r = hexdec(substr($hex, 0, 2)); - $g = hexdec(substr($hex, 2, 2)); - $b = hexdec(substr($hex, 4, 2)); - } - return "rgba({$r}, {$g}, {$b}, {$alpha})"; - } -} - -// 5. HTML für die Einstellungsseite -function mrp_options_page_html() { - if (!current_user_can('manage_options')) return; - - // Lade Einstellungen für die Live-Vorschau - $options = get_option('mrp_settings'); - - // Lade jQuery UI Sortable, falls Drag-and-Drop aktiv ist - $enable_drag_drop = isset($options['enable_drag_drop']) ? $options['enable_drag_drop'] : '1'; - if ($enable_drag_drop === '1') { - wp_enqueue_script('jquery-ui-sortable'); - } - - ?> -
-

- -
- - - -
-
-
-

-
- - - -
-
-
- -
-
-

-
-
-
-
- - -
-
- - -
-
- -
-
- - -
-
- - -
-
- -
-
- - -
-
- - -
-
-
-
-
-
-
- -
-

-
- -
-
- -
-

-
-
-
- - - $tab) : ?> -
-
-

-
- - -
-
-
-

-

Regeln für diesen Tab

-
- - $rule) : ?> -
-
- - - -
-
-

-

-
-
- - -
- -
-
- - -
-

-
-
-
- -
-

-
-

Hier können Sie Ihre Einstellungen und Regeln exportieren, um sie zu sichern oder auf einer anderen Seite zu importieren.

-

- -

-

- - - -

-
-
- - -
-
- - - - - - - - - - - Keine Regeln wurden im Backend konfiguriert.

'; - } - - // Frontend-Script und Style registrieren - wp_enqueue_style('mrp-frontend-style', plugin_dir_url(__FILE__) . 'style.css', array(), '8.0'); - wp_enqueue_script('mrp-frontend-script', plugin_dir_url(__FILE__) . 'script.js', array('jquery'), '8.0', true); - - // Daten an das Frontend-Script übergeben - wp_localize_script('mrp-frontend-script', 'mrp_frontend_vars', [ - 'enable_animations' => $enable_animations, - ]); - - // Beginne die Ausgabepufferung - ob_start(); - ?> - -
-
- Willkommen'; - $is_first_tab = false; - } - - // Benutzerdefinierte Tabs hinzufügen - if (!empty($tabs)) { - foreach ($tabs as $index => $tab) { - $active_class = $is_first_tab ? 'active' : ''; - $nav_buttons_html .= ''; - $is_first_tab = false; - } - } - - // Alle Buttons auf einmal ausgeben - echo $nav_buttons_html; - ?> -
-
- -
- $tab): ?> -
- -
- -
-
-
-
- -

Für diesen Tab wurden noch keine Regeln erstellt.

- -
- -
-
- Sanfte Animationen für das Auf- und Zuklappen der Regeln aktivieren.'; +} +function mrp_enable_drag_drop_render() { + $options = get_option('mrp_settings'); + $enabled = ($options === false || !is_array($options)) ? '1' : (isset($options['enable_drag_drop']) ? $options['enable_drag_drop'] : '0'); + echo ''; +} +function mrp_show_last_updated_render() { + $options = get_option('mrp_settings'); + $is_checked = ($options === false || !is_array($options)) ? '1' : (isset($options['show_last_updated']) ? $options['show_last_updated'] : '0'); + echo '