<?php

/**
 * file for holding dashboard welcome page for theme
 */
if (!function_exists('nexum_is_plugin_installed')) {
    function nexum_is_plugin_installed($plugin_slug)
    {
        $plugin_path = WP_PLUGIN_DIR . '/' . $plugin_slug;
        return file_exists($plugin_path);
    }
}
if (!function_exists('nexum_is_plugin_activated')) {
    function nexum_is_plugin_activated($plugin_slug)
    {
        return is_plugin_active($plugin_slug);
    }
}
if (!function_exists('nexum_welcome_notice')) :
    function nexum_welcome_notice()
    {
        global $pagenow;
        $meta            = get_option('nexum-welcome-notice');
        $current_screen  = get_current_screen();

        if (is_admin() && !$meta) {
            if ($current_screen->id !== 'dashboard' && $current_screen->id !== 'themes') {
                return;
            }
            if (is_network_admin()) {
                return;
            }
            if (!current_user_can('manage_options')) {
                return;
            }
            $theme = wp_get_theme();

            if (is_child_theme()) {
                $theme = wp_get_theme()->parent();
            }
            $nexum_version = $theme->get('Version');
?>
            <div class="nexum-admin-notice notice notice-info is-dismissible content-install-plugin theme-info-notice">
                <div class="info-content">
                    <h5><span class="theme-name"><span><?php esc_html_e('Welcome to Nexum', 'nexum'); ?></span></h5>
                    <h1><?php esc_html_e('Congratulations! Nexum has been installed and ready to build your website!', 'nexum'); ?></h1>
                    <p><?php esc_html_e('Explore and enhance your website building experience with Nexum. Please install and activate all recommended plugins to ensure everything works properly.', 'nexum') ?></p>
                    <div class='admin-btn'>
                        <a href="<?php echo admin_url(); ?>themes.php?page=about-nexum" class="button admin-button info-button"><?php esc_html_e('Explore Nexum', 'nexum'); ?></a>
                    </div>
                </div>
            </div>
    <?php
        }
    }
endif;
add_action('admin_notices', 'nexum_welcome_notice');

if (!function_exists('nexum_ignore_admin_notice')) :
    function nexum_ignore_admin_notice()
    {
        if (isset($_GET['nexum']) && $_GET['nexum-welcome-notice'] = 'true') {
            update_option('nexum-welcome-notice', true);
        }
    }
endif;
add_action('admin_init', 'nexum_ignore_admin_notice');
function nexum_dashboard_menu()
{
    add_theme_page(esc_html__('Nexum', 'nexum'), esc_html__('Nexum', 'nexum'), 'edit_theme_options', 'about-nexum', 'nexum_theme_info_display');
}
add_action('admin_menu', 'nexum_dashboard_menu');
function nexum_theme_info_display()
{ ?>
    <div class="dashboard-about-nexum">
        <h1> <?php echo __('Welcome to the Nexum - FSE WordPress Theme', 'nexum') ?></h1>
        <p><?php echo __("Nexum is the ultimate WordPress theme designed for blogs, news portals, and magazine websites. It features full site editing, offering complete customization with ease. With over 20 pre-built home page sections and a powerful drag-and-drop builder, creating a stunning and professional-looking site has never been easier. The one-click demo importer ensures a quick and effortless setup, allowing you to focus on delivering quality content to your audience. Explore more at https://walkerwp.com/nexum-news-wordpress-theme/", 'nexum') ?></p>

        <h3 class="nexum-baisc-guideline-header"><?php echo __('Basic Theme Setup', 'nexum') ?></h3>
        <div class="nexum-baisc-guideline">
            <div class="featured-box">
                <ul>
                    <li><strong><?php echo __('Setup Header Layout:', 'nexum') ?></strong>
                        <ul>
                            <li> - <?php echo __('Go to Appearance -> Editor -> Template Parts -> Header:', 'nexum') ?></li>
                            <li> - <?php echo __('Click on Header -> Click on Edit (Icon) > Add or Remove Required block/content as your requirement.:', 'nexum') ?></li>
                            <li> - <?php echo __('Click on save to update your layout', 'nexum') ?></li>
                        </ul>
                    </li>
                </ul>
            </div>
            <div class="featured-box">
                <ul>
                    <li><strong><?php echo __('Setup Footer Layout:', 'nexum') ?></strong>
                        <ul>
                            <li> - <?php echo __('Go to Appearance -> Editor -> Template Parts -> Footer:', 'nexum') ?></li>
                            <li> - <?php echo __('Click on Footer > Click on Edit (Icon) > Add or Remove Required block/content as your requirement.:', 'nexum') ?></li>
                            <li> - <?php echo __('Click on save to update your layout', 'nexum') ?></li>
                        </ul>
                    </li>
                </ul>
            </div>
            <div class="featured-box">
                <ul>
                    <li><strong><?php echo __('Setup Templates like Homepage/404/Search/Page/Single and more templates Layout:', 'nexum') ?></strong>
                        <ul>
                            <li> - <?php echo __('Go to Appearance -> Editor -> Templates:', 'nexum') ?></li>
                            <li> - <?php echo __('Click on Template(You need to edit/update) > Click on Edit (Icon) > Add or Remove Required block/content as your requirement.:', 'nexum') ?></li>
                            <li> - <?php echo __('Click on save to update your layout', 'nexum') ?></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
        <h3><?php echo __('Required Plugins', 'nexum'); ?></h3>
        <p class="notice-text"><?php echo __('Please install and activate all recommended pluign to import the demo with "one click demo import" feature and unlock premium features!(For Pro version)', 'nexum') ?></p>
        <ul class="nexum-required-plugin">
            <li>
                <h4><?php echo __('1.  Walker Core', 'nexum'); ?>
                    <?php
                    if (nexum_is_plugin_activated('walker-core/walker-core.php')) {
                        echo __(': Plugin has been already activated!', 'nexum');
                    } elseif (nexum_is_plugin_installed('walker-core/walker-core.php')) {
                        echo __(': Plugin does not activated, Activate the plugin to use one click demo import and unlock premium features.', 'nexum');
                    } else {
                        echo ': <a href="' . get_admin_url() . 'plugin-install.php?tab=plugin-information&plugin=walker-core&TB_iframe=true&width=600&height=550">' . esc_html__('Install and Activate', 'nexum') . '</a>';
                    }
                    ?>
                </h4>
            </li>
            <li>
                <h4><?php echo __('2. Advanced Import - Need only to use "one click demo import" features', 'nexum'); ?>
                    <?php
                    if (nexum_is_plugin_activated('advanced-import/advanced-import.php')) {
                        echo __(': Plugin has been already activated!', 'nexum');
                    } elseif (nexum_is_plugin_installed('advanced-import/advanced-import.php')) {
                        echo __(': Plugin does not activated, Activate the plugin to use one click demo import feature.', 'nexum');
                    } else {
                        echo ': <a href="' . get_admin_url() . 'plugin-install.php?tab=plugin-information&plugin=advanced-import&TB_iframe=true&width=600&height=550">' . esc_html__('Install and Activate', 'nexum') . '</a>';
                    }
                    ?>
                </h4>
            </li>
        </ul>
        <div class="featured-list">
            <div class="half-col free-features">
                <h3><?php echo __('Nexum Features (Free)', 'nexum') ?></h3>
                <ul>
                    <li><strong> - <?php echo __('Home Sections and Patterns', 'nexum') ?></strong>
                        <ul>
                            <li> <?php echo __('404 - Page Not Found pattern', 'nexum') ?></li>
                            <li> <?php echo __('Ads Banner section pattern', 'nexum') ?></li>
                            <li> <?php echo __('Blog section pattern - 10', 'nexum') ?></li>
                            <li> <?php echo __('Sidebar pattern', 'nexum') ?></li>
                            <li> <?php echo __('Slider patterns - 3', 'nexum') ?></li>
                        </ul>
                    </li>
                    <li> <strong>- <?php echo __('Our FSE Templates Ready', 'nexum') ?></strong>
                        <ul>
                            <li> <?php echo __('404 Template', 'nexum') ?></li>
                            <li> <?php echo __('Archive Template', 'nexum') ?></li>
                            <li> <?php echo __('Blank Template', 'nexum') ?></li>
                            <li> <?php echo __('Front Page Template', 'nexum') ?></li>
                            <li> <?php echo __('Left Sidebar Page Template', 'nexum') ?></li>
                            <li> <?php echo __('Page Template', 'nexum') ?></li>
                            <li> <?php echo __('Right Sidebar Page Template', 'nexum') ?></li>
                            <li> <?php echo __('Search Template', 'nexum') ?></li>
                            <li> <?php echo __('Left Sidebar Single Template', 'nexum') ?></li>
                            <li> <?php echo __('Single Template', 'nexum') ?></li>
                            <li> <?php echo __('Right Sidebar Single Template', 'nexum') ?></li>
                            <li> <?php echo __('Sitemap Template', 'nexum') ?></li>
                        </ul>
                    <li>
                    <li><strong> - <?php echo __('Header Layouts', 'nexum') ?></strong></li>
                    <li> <strong>- <?php echo __('Footer Layouts', 'nexum') ?></strong></li>
                    <li><strong> - <?php echo __('Multiple Beautiful Fonts Option', 'nexum') ?></strong></li>
                    <li> <strong>- <?php echo __('Multiple Styles Variations', 'nexum') ?></strong></li>
                </ul>
            </div>
            <div class="half-col pro-features">
                <h3><?php echo __('Premium Features', 'nexum') ?></h3>
                <ul>
                    <li><?php echo __('Including all free features and 10+ Premium patterns (25+ Patterns and 10+ Templates)', 'nexum') ?></strong></li>
                    <li><?php echo __('Blog Pattern - 13', 'nexum') ?></li>
                    <li><?php echo __('Blog Slider - 5', 'nexum') ?></li>
                    <li><?php echo __('Blog Card Carousel - 3', 'nexum') ?></li>
                </ul>
            </div>
        </div>
    </div>
<?php
}
