<?php
namespace NeoDrawFull\NeoConsoleGreeting; if (!defined("ABSPATH")) { die("neoWP direct access not allowed"); }




\NeoDrawFull\NeoGlobal\add_action_hook("init", function() {
    if (!str_starts_with(get_locale(), "de")) { return; }
    if (!\NeoDrawFull\NeoGlobal\current_user_can__neo_console_greeting()) { return; }
    if (\NeoDrawFull\NeoGlobal\option__neo_console_greeting__hide()) { return; }

    \NeoDrawFull\NeoGlobal\add_action_hook("wp_footer", "admin_footer", function () {
        ?><script data-neo-console-greeting--hide-url="<?php echo esc_url(\NeoDrawFull\NeoGlobal\get_backend_page_url("neo-console-greeting--hide"))?>">
            if (window.self === window.top) {

                console.log(
                    '%c🙋‍♂️ Hey! Wenn du diese Nachricht liest, dann bist du als Admin angemeldet und verfügst über besondere technische Fähigkeiten. Bist du begeistert von neoPlugins und möchtest mitwirken? Wir laden dich ein uns kennenzulernen und freuen uns auf deine Nachricht! 💌 hallo@neo-wp.com Um diese Meldung für immer auszublenden, klicke hier: ' +
                    document.currentScript.getAttribute('data-neo-console-greeting--hide-url'),
                    'background: linear-gradient(to bottom, <?php echo esc_attr(\NeoDrawFull\NeoGlobal\transform_colors("#ff00ff")) ?>, <?php echo esc_attr(\NeoDrawFull\NeoGlobal\transform_colors("#00ff00")) ?>), linear-gradient(to bottom, <?php echo esc_attr(\NeoDrawFull\NeoGlobal\transform_colors("#ff00ff")) ?>, <?php echo esc_attr(\NeoDrawFull\NeoGlobal\transform_colors("#00ff00")) ?>);background-size: 3px 100%, 3px 100%;background-repeat: no-repeat; background-position: left, right; padding: 0 8px;');
            }
        </script><?php
    });
});

\NeoDrawFull\NeoGlobal\register_backend_page("neo-console-greeting--hide", fn () => \NeoDrawFull\NeoGlobal\current_user_can__neo_console_greeting(), function () {
    \NeoDrawFull\NeoGlobal\option__neo_console_greeting__hide(true);
    ?>
    <html style="height:100%;">
        <head><title><?php \NeoDrawFull\NeoGlobal\echo_neo__("Success!", "Erfolg!") ?></title></head>
        <body style="font-family: sans-serif;">
            <script type="module">
                import Swal from "<?php echo esc_url(\NeoDrawFull\NeoGlobal\plugin_url()) ?>/_global-sweetalert2.js";
                import { reloadPage } from "<?php echo esc_url(\NeoDrawFull\NeoGlobal\plugin_url()) ?>/_global-reload-page.js";
                await Swal.fire({
                    icon: "success",
                    title: "<?php \NeoDrawFull\NeoGlobal\echo_neo__("Success!", "Erfolg!") ?>",
                    text: "<?php \NeoDrawFull\NeoGlobal\echo_neo__("The message won't be shown again.", "Die Nachricht wird nicht mehr angezeigt.") ?>",
                    confirmButtonText: '<?php \NeoDrawFull\NeoGlobal\echo_neo__("OK", "OK") ?>',
                    allowOutsideClick: false,
                    allowEscapeKey: false,
                });
                reloadPage("<?php echo esc_url(admin_url()) ?>");
            </script>
        </body>
    </html><?php
});
