<?php
/**
 * More Plugins admin tab for Titanium User Roles.
 *
 * @package TitaniumAdvancedUserRoles
 */

if (!defined('ABSPATH')) {
    exit;
}

final class TIAUR_More_Plugins_Page {
    /**
     * Render the cross-promotion page.
     *
     * @return void
     */
    public static function render() {
        $asset_url = defined('TIAUR_PLUGIN_URL') ? TIAUR_PLUGIN_URL . 'assets/more-plugins/' : '';
        $plugins   = array(
            array(
                'title'       => __('Titanium Nav Menu Roles & Visibility Rules', 'titanium-advanced-user-roles'),
                'description' => __('Turn normal WordPress menus into smart navigation without replacing your theme menu system. Show or hide menu items by logged-in status, logged-out visitors, user roles, selected pages, selected posts and membership-aware conditions. Hidden menu items are removed before the menu HTML is printed, instead of being hidden with CSS.', 'titanium-advanced-user-roles'),
                'badge'       => __('Smart server-side menu visibility', 'titanium-advanced-user-roles'),
                'url'         => 'https://wordpress.org/plugins/titanium-advanced-menu-rules/',
                'image'       => $asset_url . 'advanced-menu-rules-icon.png',
                'highlights'  => array(
                    __('Works inside the standard WordPress menu editor.', 'titanium-advanced-user-roles'),
                    __('Great for member areas, account links, dashboards, downloads and cleaner navigation.', 'titanium-advanced-user-roles'),
                ),
                'features'    => array(
                    __('Logged-in / logged-out rules', 'titanium-advanced-user-roles'),
                    __('Role is / role is not logic', 'titanium-advanced-user-roles'),
                    __('Page and post targeting', 'titanium-advanced-user-roles'),
                    __('Server-side menu filtering', 'titanium-advanced-user-roles'),
                    __('Menu diagnostics', 'titanium-advanced-user-roles'),
                ),
            ),
        );
        ?>
        <div class="tiaur-more-plugins-page">
            <section class="tiaur-more-plugins-hero" aria-labelledby="tiaur-more-plugins-title">
                <div class="tiaur-more-plugins-hero-copy">
                    <span class="tiaur-more-plugins-kicker"><?php esc_html_e('More Plugins', 'titanium-advanced-user-roles'); ?></span>
                    <h2 id="tiaur-more-plugins-title"><?php esc_html_e('Free WordPress tools from AdminPlugins.', 'titanium-advanced-user-roles'); ?></h2>
                    <p><?php esc_html_e('Build a cleaner WordPress admin setup with focused tools for roles, permissions, menus, navigation and content access. Each plugin is designed to solve one admin problem properly instead of adding another heavy all-in-one suite.', 'titanium-advanced-user-roles'); ?></p>
                </div>
                <div class="tiaur-more-plugins-brand-card" aria-hidden="true">
                    <span class="dashicons dashicons-admin-plugins"></span>
                    <strong><?php esc_html_e('ADMINPLUGINS', 'titanium-advanced-user-roles'); ?></strong>
                </div>
            </section>

            <div class="tiaur-more-plugins-list">
                <?php foreach ($plugins as $plugin): ?>
                    <article class="tiaur-more-plugin-card">
                        <div class="tiaur-more-plugin-image-panel" aria-hidden="true">
                            <span class="tiaur-more-plugin-orb tiaur-more-plugin-orb-top"></span>
                            <img src="<?php echo esc_url($plugin['image']); ?>" alt="" loading="lazy" />
                            <span class="tiaur-more-plugin-orb tiaur-more-plugin-orb-bottom"></span>
                        </div>
                        <div class="tiaur-more-plugin-main">
                            <span class="tiaur-more-plugin-badge"><?php echo esc_html($plugin['badge']); ?></span>
                            <h3><?php echo esc_html($plugin['title']); ?></h3>
                            <p><?php echo esc_html($plugin['description']); ?></p>

                            <div class="tiaur-more-plugin-highlights">
                                <?php foreach ($plugin['highlights'] as $highlight): ?>
                                    <span><?php echo esc_html($highlight); ?></span>
                                <?php endforeach; ?>
                            </div>

                            <div class="tiaur-more-plugin-features" aria-label="<?php esc_attr_e('Plugin features', 'titanium-advanced-user-roles'); ?>">
                                <?php foreach ($plugin['features'] as $feature): ?>
                                    <span><?php echo esc_html($feature); ?></span>
                                <?php endforeach; ?>
                            </div>

                            <a class="tiaur-more-plugin-button" href="<?php echo esc_url($plugin['url']); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e('View on WordPress.org', 'titanium-advanced-user-roles'); ?></a>
                        </div>
                    </article>
                <?php endforeach; ?>
            </div>
        </div>
        <?php
    }
}
