HEX
Server: LiteSpeed
System: Linux s787.bom1.mysecurecloudhost.com 4.18.0-477.13.1.lve.el8.x86_64 #1 SMP Thu Jun 1 16:40:47 EDT 2023 x86_64
User: mobilech (5348)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/mobilech/alliancelaptoptraining.com.np/wp-content/plugins/html5-video-player/inc/admin.php
<?php
if (!defined('ABSPATH'))
	exit;

if (!class_exists('H5VPAdmin')) {
	class H5VPAdmin
	{
		protected static $_instance = null;
		function __construct()
		{
			add_action('admin_enqueue_scripts', [$this, 'adminEnqueueScripts']);
			add_action('admin_menu', [$this, 'adminMenu'], 20);
		}

		public static function getInstance()
		{
			if (null === self::$_instance) {
				self::$_instance = new self;
			}
			return self::$_instance;
		}

		function adminEnqueueScripts($hook)
		{
			if (strpos($hook, 'html5-video-player') !== false) {
				wp_enqueue_style('h5vp-admin-style', H5VP_PLUGIN_DIR . 'build/dashboard.css', [], H5VP_VER);

				wp_enqueue_script('h5vp-admin-script', H5VP_PLUGIN_DIR . 'build/dashboard.js', ['react', 'react-dom', 'wp-components', 'wp-i18n', 'wp-api', 'wp-util', 'lodash', 'wp-media-utils', 'wp-data', 'wp-core-data', 'wp-api-request'], H5VP_VER, true);
				wp_localize_script('h5vp-admin-script', 'h5vpDashboard', [
					'dir' => H5VP_PLUGIN_DIR,
				]);
			}
		}

		function adminMenu()
		{
			add_submenu_page(
				'edit.php?post_type=videoplayer',
				__('Demo & Help', 'html5-video-player'),
				'<span style="color: #f18500;">' . __('Demo & Help', 'html5-video-player') . '</span>',
				'manage_options',
				'html5-video-player',
				[$this, 'dashboardPage'],
				20
			);
		}

		function dashboardPage()
		{ ?>
			<div id='h5vpAdminDashboard' data-info="<?php echo esc_attr(wp_json_encode([
				'version' => H5VP_VER,
				'adminUrl' => admin_url(),
				'nonce' => wp_create_nonce('h5vp_dashboard')
			])); ?>">
			</div>
		<?php }

	}
	H5VPAdmin::getInstance();
}