<?php
// Require widget files
require plugin_dir_path(__FILE__) . '/forum-info/Forum_Information.php';
require plugin_dir_path(__FILE__) . '/Forumax_Topic_Info.php';
require plugin_dir_path(__FILE__) . '/Forumax_Forums_List.php';
require plugin_dir_path(__FILE__) . '/Forumax_Active_Members.php';

// Register Widgets
add_action( 'widgets_init', function() {

    // Register only Forumax-specific widgets
    register_widget( 'Forumax\WpWidgets\Forumax_Forum_Information');
    register_widget( 'Forumax\WpWidgets\Forumax_Topic_Info');
    register_widget( 'Forumax\WpWidgets\Forumax_Active_Members');
    

    if ( class_exists('bbPress') ) {
        unregister_widget( 'BBP_Forums_Widget' );
        
        register_widget( 'Forumax\WpWidgets\Forumax_Forums_List');
    }

    // Enqueue widget styles
    add_action('admin_enqueue_scripts', function($hook){
        if ( $hook === 'widgets.php' ) {
            wp_enqueue_style( 'forumax-wp-widget', FORUMAX_ASSETS . 'admin/css/wp-widget.css' );
        }
    });
}, 11 ); // Priority 20

