HEX
Server: Apache
System: Linux sg2plmcpnl492417.prod.sin2.secureserver.net 4.18.0-553.58.1.lve.el8.x86_64 #1 SMP Fri Jul 4 12:07:06 UTC 2025 x86_64
User: nyiet8349bzl (9207396)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/nyiet8349bzl/public_html/ducoa.org/wp-content/plugins/dustrial-master/elementor/plugin.php
<?php
namespace DustrialMaster;

/**
 * Class Plugin
 *
 * Main Plugin class
 * @since 1.2.0
 */
class Elementor_Plugin {

    /**
     * Instance
     *
     * @since 1.2.0
     * @access private
     * @static
     *
     * @var Plugin The single instance of the class.
     */
    private static $_instance = null;

    /**
     * Instance
     *
     * Ensures only one instance of the class is loaded or can be loaded.
     *
     * @since 1.2.0
     * @access public
     *
     * @return Plugin An instance of the class.
     */
    public static function instance() {
        if ( is_null( self::$_instance ) ) {
            self::$_instance = new self();
        }
        return self::$_instance;
    }

    /**
     * Add Category
     */

    public function dustrial_master_elementor_category($manager)
    {
        $manager->add_category(
            'dustrialaddons',
            array(
                'title' => esc_html__('Dustrial Addons', 'dustrialcore'),
                'icon' => 'eicon-banner',
            )
        );
    }

    /**
     * widget_scripts
     *
     * Load required plugin core files.
     *
     * @since 1.2.0
     * @access public
     */
    public function widget_scripts() {
        wp_register_script( 'dustrialcore', plugins_url( '/assets/js/hello-world.js', __FILE__ ), [ 'jquery' ], false, true );
    }

    /**
     * Editor scripts
     *
     * Enqueue plugin javascripts integrations for Elementor editor.
     *
     * @since 1.2.1
     * @access public
     */
    public function editor_scripts() {
        add_filter( 'script_loader_tag', [ $this, 'editor_scripts_as_a_module' ], 10, 2 );

        wp_enqueue_script(
            'dustrialcore-editor',
            plugins_url( '/assets/js/editor/editor.js', __FILE__ ),
            [
                'elementor-editor',
            ],
            '1.2.1',
            true
        );
    }

    /**
     * dustrial_master_enqueue_editor_scripts
     */
    function dustrial_master_enqueue_editor_scripts() {
        wp_enqueue_style('rtech-element-addons-editor', DUSTRIAL_PLG_DIR . 'assets/css/editor.css', null, '1.0');
    }

    /**
     * Force load editor script as a module
     *
     * @since 1.2.1
     *
     * @param string $tag
     * @param string $handle
     *
     * @return string
     */
    public function editor_scripts_as_a_module( $tag, $handle ) {
        if ( 'dustrialcore-editor' === $handle ) {
            $tag = str_replace( '<script', '<script type="module"', $tag );
        }
        return $tag;
    }

    /**
     * Register Widgets
     *
     * Register new Elementor widgets.
     *
     * @since 1.2.0
     * @access public
     *
     * @param Widgets_Manager $widgets_manager Elementor widgets manager.
     */
    public function register_widgets( $widgets_manager ) {
        foreach ( $this->dustrialcore_widget_list() as $widget_file_name ) {
            $file = DUSTRIAL_ELEMENTS_PATH . "/{$widget_file_name}.php";
            
            if ( file_exists( $file ) ) {
                require_once $file;
            } else {
                error_log("Widget file not found: " . $file); // Debug log
            }
        }
    }

    public function dustrialcore_widget_list() {
        return [
            'rt-header',
            'rt-heading',
            'rt-hover-card',
            'rt-tab-list',
            'rt-video-card',
            'rt-section-title',
            'rt-why-choose',
            'rt-countdown',
            'rt-team',
            'rt-team-post',
            'rt-services-box',
            'rt-button',
            'rt-video-popup',
            'rt-portfolio-card',
            'rt-blog-post',
            'rt-brand',
            'rt-hero-slider',
            'rt-countdown-card',
            'rt-portfolio-slider',
            'rt-testimonial-vertical',
            'rt-team-slider',   
            'rt-animate-scroll',
            'rt-pricing',
            'rt-brand-animate',
            'rt-service-slider',
            'rt-case-study-slider',
            'rt-funfact',
            'rt-faqs',
            'rt-testimonial',
            'rt-tab-vertical',
            'rt-pricing-tab',
            'rt-faq-tab',
            'rt-pricing-toggle',
            'rt-portfolio-menu',
            'rt-nav-arrow',
            'rt-service',
            'rt-project',
            'rt-gallery',
        ];
    }

    /**
     *  Plugin class constructor
     *
     * Register plugin action hooks and filters
     *
     * @since 1.2.0
     * @access public
     */
    public function __construct() {

        // Register widget scripts
        add_action( 'elementor/frontend/after_register_scripts', [ $this, 'widget_scripts' ] );

        // Register widgets
        add_action( 'elementor/widgets/register', [ $this, 'register_widgets' ] );

        // Register editor scripts
        add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'editor_scripts' ] );

        add_action('elementor/elements/categories_registered', [$this, 'dustrial_master_elementor_category']);

        // Register custom controls

        add_action('elementor/editor/after_enqueue_scripts', [$this, 'dustrial_master_enqueue_editor_scripts'] );

    }
}

// Instantiate Plugin Class
Elementor_Plugin::instance();