<?php
/**
 * Sticky Elementor - Widget Loader
 *
 * Adds sticky controls to Elementor containers.
 *
 * @package StickyElementor
 */

use Elementor\Controls_Manager;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Border;

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

/**
 * Sticky Widgets Loader.
 *
 * @since 1.0.1
 */
class Wplta_Plugin_Loader {

	/**
	 * Singleton instance.
	 *
	 * @since 1.0.1
	 *
	 * @var Wplta_Plugin_Loader|null
	 */
	private static $instance = null;

	/**
	 * Get singleton instance.
	 *
	 * @since 1.0.1
	 *
	 * @return Wplta_Plugin_Loader
	 */
	public static function get_instance() {
		if ( null === self::$instance ) {
			self::$instance = new self();
		}
		return self::$instance;
	}

	/**
	 * Constructor - hook into Elementor and enqueue assets.
	 *
	 * @since 1.0.1
	 * @version 1.1.2
	 */
	public function __construct() {
		add_action( 'admin_menu', array( $this, 'wplta_register_admin_menu' ) );
		$this->plugin_file_loader();

	}

	 /**
	 * Register admin menu.
	 *
	 * @return void
	 */
	function wplta_register_admin_menu() {
		add_menu_page(
			__( 'Live Traffic Analytics', 'live-traffic-analytics' ),
			__( 'Traffic Analytics', 'live-traffic-analytics' ),
			'manage_options',
			'wplta-dashboard',
			array( $this, 'wplta_render_dashboard_page' ),
			'dashicons-chart-line',
			25
		);
	}

	/**
	 * Render the dashboard page.
	 *
	 * @return void
	 */
	function wplta_render_dashboard_page() {
		echo '<div id="live-traffic-analytics-app"></div>';
	}

	function plugin_file_loader() {

		add_action( 'plugins_loaded', function() {
		 include WPLTA_INCLUDES_PATH . 'admin.php';
		} );
		
	}
}

Wplta_Plugin_Loader::get_instance();

