AlkantarClanX12

Your IP : 216.73.216.59


Current Path : /www/capitalgmcbuickregina_830/public/wp-content/themes/lbx-egypt/app/Hooks/
Upload File :
Current File : /www/capitalgmcbuickregina_830/public/wp-content/themes/lbx-egypt/app/Hooks/ReleaseNotesAdmin.php

<?php

namespace App\Hooks;

class ReleaseNotesAdmin extends Hook
{
    protected $actions = [
        'wp_dashboard_setup',
    ];

    protected $priority = 999;

    public function __invoke()
    {
        // Only show if the parent theme is LBX Egypt (check Theme Name, not directory)
        $parentTheme = wp_get_theme(get_template());
        $themeName = $parentTheme->get('Name');
        if (stripos($themeName, 'LBX Egypt') === false) {
            return;
        }

        // Remove the original Leadbox widget
        remove_meta_box('leadbox-widget', 'dashboard', 'normal');

        // Register combined widget
        wp_add_dashboard_widget(
            'lbx_combined_dashboard',
            'Leadbox',
            [$this, 'render']
        );

        // Force this widget to the very top of the dashboard above all others
        global $wp_meta_boxes;

        // Find and remove our widget from wherever it was placed
        $widget = null;
        foreach (['core', 'high', 'default', 'low'] as $priority) {
            if (isset($wp_meta_boxes['dashboard']['normal'][$priority]['lbx_combined_dashboard'])) {
                $widget = $wp_meta_boxes['dashboard']['normal'][$priority]['lbx_combined_dashboard'];
                unset($wp_meta_boxes['dashboard']['normal'][$priority]['lbx_combined_dashboard']);
                break;
            }
        }

        // Prepend it to 'high' priority so it renders before 'core' widgets
        if ($widget) {
            if (!isset($wp_meta_boxes['dashboard']['normal']['high'])) {
                $wp_meta_boxes['dashboard']['normal']['high'] = [];
            }
            $wp_meta_boxes['dashboard']['normal']['high'] = ['lbx_combined_dashboard' => $widget]
                + $wp_meta_boxes['dashboard']['normal']['high'];
        }
    }

    public function render()
    {
        $releases = $this->getReleases();

        echo '<div style="display: flex; gap: 0; margin: -11px -12px -12px;">';

        // Leadbox iframe
        echo '<div style="flex: 1; min-width: 0;">';
        echo '<iframe src="https://leadboxhq.com/internal/website-dashboard/" style="width: 100%; min-height: 1000px; border: none;"></iframe>';
        echo '</div>';

        // Release Notes
        echo '<div style="flex: 0 0 420px; border-left: 1px solid #ddd; overflow-y: auto; max-height: 1000px; background: #f9f9f9;">';
        echo '<div style="padding: 16px 18px 8px; border-bottom: 1px solid #e2e2e2; background: #fff; position: sticky; top: 0; z-index: 1;">';
        echo '<h3 style="margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px;">';
        echo '<span class="dashicons dashicons-clipboard" style="font-size: 20px; color: #2271b1;"></span>';
        echo 'Release Notes</h3></div>';

        echo '<div style="padding: 12px 18px;">';

        if (empty($releases)) {
            echo '<p style="color: #888; text-align: center; padding: 20px 0;">No release notes found.</p>';
        } else {
            foreach ($releases as $i => $release) {
                $isFirst = $i === 0;
                $borderLeft = $isFirst ? 'border-left: 3px solid #2271b1;' : '';
                $badgeBg = $isFirst ? '#f0f6fc' : '#f0f0f1';

                echo '<div style="margin-bottom: 14px; padding: 14px 16px; background: #fff; border: 1px solid #e2e2e2; border-radius: 6px; ' . $borderLeft . '">';

                echo '<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;">';
                echo '<span style="font-size: 13px; font-weight: 700; color: #1d2327; background: ' . $badgeBg . '; padding: 2px 10px; border-radius: 10px;">v' . esc_html($release['version']) . '</span>';
                if ($release['date']) {
                    echo '<span style="color: #999; font-size: 11px;">' . esc_html($release['date']) . '</span>';
                }
                echo '</div>';

                if ($isFirst) {
                    echo '<span style="display: inline-block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #fff; background: #2271b1; padding: 1px 8px; border-radius: 3px; margin-bottom: 8px;">Latest</span>';
                }

                echo '<div style="font-size: 12.5px; line-height: 1.6; color: #3c434a;">' . $release['content'] . '</div>';
                echo '</div>';
            }
        }

        echo '</div></div></div>';
    }

    private function getReleases(): array
    {
        $jsonFile = get_parent_theme_file_path('app/release-notes.json');
        if (!file_exists($jsonFile)) {
            $jsonFile = get_template_directory() . '/app/release-notes.json';
        }

        if (!file_exists($jsonFile)) {
            return [];
        }

        $data = json_decode(file_get_contents($jsonFile), true);
        if (!is_array($data)) {
            return [];
        }

        $releases = [];
        foreach (array_slice($data, 0, 5) as $entry) {
            $html = '<ul style="margin: 2px 0 8px 20px; padding: 0; list-style: none;">';
            foreach ($entry['notes'] as $note) {
                $html .= '<li style="padding: 1px 0; position: relative; padding-left: 12px;">';
                $html .= '<span style="position: absolute; left: 0; color: #c3c4c7;">&#8250;</span>';
                $html .= esc_html($note);
                $html .= '</li>';
            }
            $html .= '</ul>';

            $releases[] = [
                'version' => $entry['version'],
                'date' => $entry['date'] ?? '',
                'content' => $html,
            ];
        }

        return $releases;
    }
}

Home - Capital GMC Buick Regina

No data

Welcome to Capital GMC BUICK – REGINA

Thank you for choosing Capital GMC Buick | Regina, your premier certified Buick and GMC dealership proudly serving drivers in Regina and the surrounding communities. Whether you’re searching for a brand-new Buick or GMC vehicle or a meticulously inspected pre-owned model, we have a diverse selection to match your needs and lifestyle.

Beyond our impressive inventory, we offer a seamless and stress-free financing experience through our well-connected finance centre, where our team of experts is dedicated to securing the best loan or lease options for you, quickly, transparently, and hassle-free.

But our commitment to you doesn’t stop at the sale. Our state-of-the-art service centre is staffed with skilled Buick and GMC technicians who use the latest equipment and genuine OEM parts to keep your vehicle running at its best. From routine maintenance to complex repairs, we’ve got you covered.

Experience top-tier customer service, quality vehicles, and expert care, all in one place. Visit Capital GMC Buick | Regina today or call us at 306-205-8072 with any questions. We’re here to help!

Ask a Question