HEX
Server: Apache
System: Linux webm013.cluster123.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: lesanew (165608)
PHP: 8.3.31
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/lesanew/www/wp-content/plugins/qode-framework/inc/widgets/class-qodeframeworkwidgets.php
<?php

class QodeFrameworkWidgets {
	private $widgets;

	public function __construct() {
		$this->widgets = array();

		add_action( 'widgets_init', array( $this, 'register' ) );

		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_dashboard_framework_scripts' ), 5 ); // 5 is set to be same permission as Gutenberg plugin have
	}

	public function get_widgets() {
		return $this->widgets;
	}

	public function get_widget( $base ) {
		return $this->widgets[ $base ];
	}

	private function set_widget( QodeFrameworkWidget $widget ) {
		$key                   = $widget->get_base();
		$this->widgets[ $key ] = $widget;
	}

	public function widget_exists( $base ) {
		return array_key_exists( $base, $this->widgets );
	}

	public function add_widget( QodeFrameworkWidget $widget ) {
		if ( '' !== $widget->get_base() ) {
			$this->set_widget( $widget );

			return $widget;
		}

		return false;
	}

	public function register() {
		do_action( 'qode_framework_action_before_widgets_register' );

		foreach ( $this->widgets as $widget ) {
			$widget->register();
		}

		do_action( 'qode_framework_action_after_widgets_register' );
	}

	public function enqueue_dashboard_framework_scripts( $hook ) {
		if ( 'widgets.php' === $hook ) {
			// Widgets css scripts
			wp_enqueue_style( 'qode-framework-widgets', QODE_FRAMEWORK_INC_URL_PATH . '/widgets/assets/css/widgets.min.css' );
			wp_enqueue_style( 'wp-color-picker' );

			// Widgets js scripts
			wp_enqueue_script( 'jquery-ui-sortable' );
			wp_enqueue_style( 'fonticonpicker', QODE_FRAMEWORK_INC_URL_PATH . '/common/assets/plugins/fonticonpicker/jquery.fonticonpicker.min.css' );
			wp_enqueue_script( 'fonticonpicker', QODE_FRAMEWORK_INC_URL_PATH . '/common/assets/plugins/fonticonpicker/jquery.fonticonpicker.min.js', array(), false, true );
			wp_enqueue_script( 'wp-color-picker' );
			wp_enqueue_script( 'wp-color-picker-alpha' );

			// Hook to include additional scripts before dashboard widgets scripts
			do_action( 'qode_framework_action_before_dashboard_widgets_scripts' );

			// Main dashboard js scripts
			wp_enqueue_script( 'qode-framework-script', QODE_FRAMEWORK_INC_URL_PATH . '/common/assets/js/dashboard.min.js', array( 'jquery' ), false, true );
		}
	}
}