<?php
// Test Plugin Registration
define('INDEX_AUTH', '1');
require_once 'sysconfig.inc.php';

use SLiMS\Plugins;

$plugins = Plugins::getInstance();

echo "<h2>🔍 Debug Plugin Registration</h2>";

// Cek semua menu yang terdaftar
$allMenus = $plugins->getMenus();
echo "<h3>📋 All Registered Menus:</h3>";
echo "<pre>";
print_r($allMenus);
echo "</pre>";

// Cek spesifik menu 'member'
echo "<h3>🔍 Check 'member' menu:</h3>";
if (isset($allMenus['member'])) {
    echo "<pre>";
    print_r($allMenus['member']);
    echo "</pre>";
} else {
    echo "<span style='color:red;'>❌ Menu 'member' tidak terdaftar!</span>";
}

// Cek spesifik 'bebaspustaka'
echo "<h3>🔍 Check 'bebaspustaka':</h3>";
if (isset($allMenus['member']['bebaspustaka'])) {
    echo "<span style='color:green;'>✅ 'bebaspustaka' terdaftar di menu member!</span><br>";
    echo "Path: " . $allMenus['member']['bebaspustaka'];
} else {
    echo "<span style='color:red;'>❌ 'bebaspustaka' TIDAK terdaftar di menu member!</span>";
}

// Cek hook member_menu
echo "<h3>🔍 Check hook 'member_menu':</h3>";
$extraMenus = [];
try {
    $plugins->execute('member_menu', ['menu' => &$extraMenus]);
    echo "Hook berhasil dieksekusi!<br>";
    echo "Jumlah menu: " . count($extraMenus) . "<br>";
    if (!empty($extraMenus)) {
        echo "<pre>";
        print_r($extraMenus);
        echo "</pre>";
    }
} catch (Exception $e) {
    echo "❌ Error: " . $e->getMessage();
}
?>