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/dustrial-master.php
<?php 
/*
Plugin Name: Dustrial Master
Plugin URI: https://pluginspoint.com/dustrialwp/
Author: Johanspond
Description: After installing the Dustrial Theme, you need to install the "Dustrial Master" plugin first to get all features.
Author URI: https://pluginspoint.com/
Version: 5.0.2
Text Domain: dustrial-master
Domain Path: /languages
*/

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

/*------------------------------------------------------------------------------------------------------------------*/
/*  Plugin define.
/*------------------------------------------------------------------------------------------------------------------*/
define( 'DUSTRIAL_PLG_URL', plugin_dir_url( __FILE__ ) );
define( 'DUSTRIAL_PLG_DIR', dirname( __FILE__ ) );
define( 'DUSTRIAL_ELEMENTS_PATH', DUSTRIAL_PLG_DIR . '/elementor/widgets');
define( 'DUSTRIAL_PLG_DEMO_PATH', dirname( __FILE__ ) . '/demo-importer/' );
define( 'DUSTRIAL_PLG_DEMO_URL', plugin_dir_url( __FILE__ ) . 'demo-importer/' );

# load plugin textdomain
function dustrial_master_load_textdomain(){
  load_plugin_textdomain('dustrial-master', false, dirname(plugin_basename( __FILE__ )) . '/languages/');
}
add_action('plugins_loaded', 'dustrial_master_load_textdomain');

/*------------------------------------------------------------------------------------------------------------------*/
/*  Plugin action and filter hook.
/*------------------------------------------------------------------------------------------------------------------*/
add_action( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'dustrial_plugin_action_links' );
add_filter( 'plugin_row_meta', 'custom_plugin_row_meta', 10, 2 );

/*------------------------------------------------------------------------------------------------------------------*/
/*  Plugin include files.
/*------------------------------------------------------------------------------------------------------------------*/
require_once DUSTRIAL_PLG_DIR . '/inc/custom-style.php';
require_once DUSTRIAL_PLG_DIR . '/inc/custom-widgets.php';
require_once DUSTRIAL_PLG_DIR . '/inc/custom-posttype.php';
require_once DUSTRIAL_PLG_DIR . '/inc/helper.php';

// require_once DUSTRIAL_PLG_DIR . '/elementor/plugin.php';

/*------------------------------------------------------------------------------------------------------------------*/
/*  Theme option framework.
/*------------------------------------------------------------------------------------------------------------------*/
require_once DUSTRIAL_PLG_DIR . '/framework/dustrial-framework.php';

/* Visual composer addons style
=====================================================*/
function dustrial_extra_master_scripts() {
  // Css
  wp_enqueue_style('viewer', DUSTRIAL_PLG_URL . 'assets/css/viewer.css' , array(), '' );
  wp_enqueue_style('dustrial-master-css', DUSTRIAL_PLG_URL . 'assets/css/dustrial-master.css' , array(), '' );

  // Js
  wp_enqueue_script('imagesloaded');
  wp_enqueue_script('viewer', DUSTRIAL_PLG_URL . 'assets/js/viewer.js', array('jquery'), '1.0.0', true);
  wp_enqueue_script('isotope', DUSTRIAL_PLG_URL . 'assets/js/isotope.pkgd.min.js', array('jquery'), '1.0.0', true);
  wp_enqueue_script('dustrial-master', DUSTRIAL_PLG_URL . 'assets/js/dustrial-master.js', array('jquery'), '1.0.0', true);
}
add_action( 'wp_enqueue_scripts', 'dustrial_extra_master_scripts' );

/* Visual composer addons style
=====================================================*/
function dustrial_master_scripts() {
  wp_enqueue_style('dustrial-admin-style', DUSTRIAL_PLG_URL . 'assets/admin/dustrial-admin-style.css' , array(), '' );
  wp_enqueue_style('dustrial-flaticon', DUSTRIAL_PLG_URL . '/assets/css/flaticon.css');
}
add_action( 'admin_enqueue_scripts', 'dustrial_master_scripts' );

/*------------------------------------------------------------------------------------------------------------------*/
/* Dustrial Demo Import
/*------------------------------------------------------------------------------------------------------------------*/ 
require_once DUSTRIAL_PLG_DIR . '/demo-importer/demo-import.php';

// Hook it early
add_action( 'plugins_loaded', [ 'Dustrial_Page_Builder_Loader', 'init' ] );

class Dustrial_Page_Builder_Loader {

    public static function init() {
        $instance = new self();
        $instance->load_builder();
    }

    protected function load_builder() {
        $elementor_active = did_action( 'elementor/loaded' );
        $wpbakery_active  = defined( 'WPB_VC_VERSION' );

        if ( $elementor_active && $wpbakery_active ) {
            // Both builders are active, show the conflict message
            add_action( 'admin_notices', [ $this, 'both_builders_active_notice' ] );
            return;
        }

        if ( $elementor_active ) {
            $this->load_elementor_support();
            return;
        }

        if ( $wpbakery_active ) {
            $this->load_wpbakery_support();
            return;
        }

        add_action( 'admin_notices', [ $this, 'no_builder_active_notice' ] );
    }

    protected function load_elementor_support() {
        require_once DUSTRIAL_PLG_DIR . '/elementor/class-elementor-init.php';

        if ( class_exists( '\DustrialMaster\Dustrial_Elementor_Init' ) ) {
            $elementor = new \DustrialMaster\Dustrial_Elementor_Init();
            $elementor->init(); // 👈 Call it directly
        }
    }

    protected function load_wpbakery_support() {
        require_once DUSTRIAL_PLG_DIR . '/wpbakery/class-wpbakery-init.php';
        if ( class_exists( 'Dustrial_WPBakery_Init' ) ) {
            new Dustrial_WPBakery_Init();
        }
    }

    public function no_builder_active_notice() {
        echo '<div class="notice notice-warning is-dismissible"><p>';
        echo esc_html__( 'Please install and activate either Elementor or WPBakery Page Builder to use Dustrial plugin features. You can install them from the WordPress plugins page.', 'dustrial-master' );
        echo '</p></div>';
    }

    public function both_builders_active_notice() {
        echo '<div class="notice notice-error is-dismissible"><p>';
        echo esc_html__( 'Both Elementor and WPBakery Page Builder are active. Please deactivate one of them to avoid conflicts with the Dustrial plugin.', 'dustrial-master' );
        echo '</p><p>';
        echo esc_html__( 'You can manage your installed plugins from the WordPress plugins page. To resolve the conflict, please deactivate one of the following:', 'dustrial-master' );
        echo '</p>';
        echo '</div>';
    }

}