HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1017-azure #17~24.04.1-Ubuntu SMP Mon Dec 1 20:10:50 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/dreamspos-uk/wp-content/plugins/dreamslanding-widgets/plugin.php
<?php
namespace Dreamslandingelementor;
  
use Dreamslandingelementor\Widgets\DTS_dl_hero_section;
use Dreamslandingelementor\Widgets\DTS_dl_why_choose;
use Dreamslandingelementor\Widgets\DTS_dl_trust;
use Dreamslandingelementor\Widgets\DTS_dl_build_section;
use Dreamslandingelementor\Widgets\DTS_dl_benefits;
use Dreamslandingelementor\Widgets\DTS_dl_feature;
use Dreamslandingelementor\Widgets\DTS_dl_glow;
use Dreamslandingelementor\Widgets\DTS_dl_technology_leadership;
use Dreamslandingelementor\Widgets\DTS_dl_case_study_home;
use Dreamslandingelementor\Widgets\DTS_dl_commitment;
use Dreamslandingelementor\Widgets\DTS_dl_faq;
   
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
 * Main Plugin Class
 *
 * Register new elementor widget.
 *
 * @since 1.0.0
 */
class Plugin {
	/**
	 * Constructor
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 */
	public function __construct() {
		$this->add_actions();
	}
	/**
	 * Add Actions
	 *
	 * @since 1.0.0
	 *
	 * @access private
	 */
	private function add_actions() {
		\add_action( 'elementor/widgets/register', [ $this, 'on_widgets_registered' ] );
		\add_action( 'elementor/frontend/after_register_scripts', function() {
			\wp_register_script( 'dreamslandingelementor-elementor', \plugins_url( '/assets/js/dreamslandingelementor-elementor.js', ELEMENTOR_DREAMSLANDINGELEMENTOR__FILE__ ), [ 'jquery' ], false, true );
			\wp_localize_script( 'dreamslandingelementor-elementor', 'ajax_object', array( 'ajax_url' => \admin_url( 'admin-ajax.php' ) ) );
			\wp_register_script( 'markerclusterer', \plugins_url( '/assets/js/markerclusterer.js', ELEMENTOR_DREAMSLANDINGELEMENTOR__FILE__ ), [ 'jquery' ], false, true );
		} );

		// Register script handle in Elementor editor context as well (no enqueue here)
		\add_action( 'elementor/editor/after_register_scripts', function() {
			\wp_register_script( 'dreamslandingelementor-elementor', \plugins_url( '/assets/js/dreamslandingelementor-elementor.js', ELEMENTOR_DREAMSLANDINGELEMENTOR__FILE__ ), [ 'jquery' ], false, true );
		} );

		// Frontend enqueue
		\add_action( 'elementor/frontend/before_enqueue_scripts', function() {
			\wp_enqueue_script( 'dreamslandingelementor-elementor' );
		} );

		// Enqueue our (now minimal) JS inside the preview iframe to force visibility + observer
		\add_action( 'elementor/preview/enqueue_scripts', function() {
			if ( ! \wp_script_is( 'dreamslandingelementor-elementor', 'registered' ) ) {
				\wp_register_script( 'dreamslandingelementor-elementor', \plugins_url( '/assets/js/dreamslandingelementor-elementor.js', ELEMENTOR_DREAMSLANDINGELEMENTOR__FILE__ ), [ 'jquery' ], false, true );
			}
			\wp_enqueue_script( 'dreamslandingelementor-elementor' );
		} );

		// Editor safeguard CSS to keep AOS-visible
		\add_action( 'elementor/editor/after_enqueue_styles', function() {
			$css = 'html body [data-aos],html body .aos-init,html body .aos-init[data-aos]{opacity:1!important;transform:none!important;visibility:visible!important;transition:none!important}';
			\wp_register_style( 'dreamslandingelementor-editor-inline', false );
			\wp_enqueue_style( 'dreamslandingelementor-editor-inline' );
			\wp_add_inline_style( 'dreamslandingelementor-editor-inline', $css );
		} );

		// Also inject the same CSS into the preview iframe (canvas)
		\add_action( 'elementor/preview/enqueue_styles', function() {
			$css = 'html body [data-aos],html body .aos-init,html body .aos-init[data-aos]{opacity:1!important;transform:none!important;visibility:visible!important;transition:none!important}';
			\wp_register_style( 'dreamslandingelementor-preview-inline', false );
			\wp_enqueue_style( 'dreamslandingelementor-preview-inline' );
			\wp_add_inline_style( 'dreamslandingelementor-preview-inline', $css );
		} );
	}
	/**
	 * On Widgets Registered
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 */
	public function on_widgets_registered() {
		$this->includes();
		$this->register_widget();
	}

	/**
	 * Includes
	 *
	 * @since 1.0.0
	 *
	 * @access private
	 */
	private function includes() {
  		 
		require __DIR__ . '/widgets/class-dl-hero-section.php';
		require __DIR__ . '/widgets/class-dl-why-choose.php';
		require __DIR__ . '/widgets/class-dl-trust.php';
		require __DIR__ . '/widgets/class-dl-build-section.php';
		require __DIR__ . '/widgets/class-dl-benefits.php';
		require __DIR__ . '/widgets/class-dl-feature.php';
		require __DIR__ . '/widgets/class-dl-glow.php';
 		require __DIR__ . '/widgets/class-dl-technology-leadership.php';
		require __DIR__ . '/widgets/class-dl-case-study-home.php';
		require __DIR__ . '/widgets/class-dl-commitment.php';
		require __DIR__ . '/widgets/class-dl-faq.php';
		 
	 	}

	/**
	 * Register Widget
	 *
	 * @since 1.0.0
	 *
	 * @access private
	 */
	private function register_widget() {
  		 
		\Elementor\Plugin::instance()->widgets_manager->register( new DTS_dl_hero_section() );
		\Elementor\Plugin::instance()->widgets_manager->register( new DTS_dl_why_choose() );
		\Elementor\Plugin::instance()->widgets_manager->register( new DTS_dl_trust() );
		\Elementor\Plugin::instance()->widgets_manager->register( new DTS_dl_build_section() );
		\Elementor\Plugin::instance()->widgets_manager->register( new DTS_dl_benefits() );
		\Elementor\Plugin::instance()->widgets_manager->register( new DTS_dl_feature() );
		\Elementor\Plugin::instance()->widgets_manager->register( new DTS_dl_glow() );
 		\Elementor\Plugin::instance()->widgets_manager->register( new DTS_dl_technology_leadership() );
		\Elementor\Plugin::instance()->widgets_manager->register( new DTS_dl_case_study_home() );
		\Elementor\Plugin::instance()->widgets_manager->register( new DTS_dl_commitment() );
		\Elementor\Plugin::instance()->widgets_manager->register( new DTS_dl_faq() );
		 
		 	}
}

new Plugin();