| 1 |
<?php |
| 2 |
|
| 3 |
class MPHB_Divi extends DiviExtension { |
| 4 |
|
| 5 |
public $name = 'mphb-divi'; |
| 6 |
public $gettext_domain; |
| 7 |
public $version; |
| 8 |
|
| 9 |
private static $instance = null; |
| 10 |
|
| 11 |
/** |
| 12 |
* @return MPHB_Divi|null |
| 13 |
*/ |
| 14 |
public static function getInstance() { |
| 15 |
|
| 16 |
if ( ! isset( self::$instance ) ) { |
| 17 |
self::$instance = new self(); |
| 18 |
} |
| 19 |
|
| 20 |
return self::$instance; |
| 21 |
} |
| 22 |
|
| 23 |
/** |
| 24 |
* MPHB_Divi constructor. |
| 25 |
* |
| 26 |
* @param string $name |
| 27 |
* @param array $args |
| 28 |
*/ |
| 29 |
public function __construct( $name = 'mphb-divi', $args = array() ) { |
| 30 |
|
| 31 |
$divi_4_dir = plugin_dir_path( __DIR__ ); |
| 32 |
$plugin_root = trailingslashit( dirname( $divi_4_dir ) ); |
| 33 |
|
| 34 |
$this->plugin_dir = $divi_4_dir; |
| 35 |
$this->plugin_dir_url = plugin_dir_url( __DIR__ ); |
| 36 |
|
| 37 |
$plugin_data = get_plugin_data( $plugin_root . 'mphb-divi.php' ); |
| 38 |
$this->version = isset( $plugin_data['Version'] ) ? $plugin_data['Version'] : ''; |
| 39 |
$this->gettext_domain = isset( $plugin_data['TextDomain'] ) ? $plugin_data['TextDomain'] : ''; |
| 40 |
|
| 41 |
add_action( 'et_fb_enqueue_assets', array( $this, 'enqueue_builder_assets' ) ); |
| 42 |
|
| 43 |
parent::__construct( $name, $args ); |
| 44 |
} |
| 45 |
|
| 46 |
public function hook_et_builder_ready() { |
| 47 |
|
| 48 |
if ( file_exists( trailingslashit( $this->plugin_dir ) . 'includes/loader.php' ) ) { |
| 49 |
require_once trailingslashit( $this->plugin_dir ) . 'includes/loader.php'; |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
public function enqueue_builder_assets() { |
| 54 |
wp_enqueue_script( 'mphb-flexslider' ); |
| 55 |
wp_enqueue_style( 'mphb-flexslider-css' ); |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
MPHB_Divi::getInstance(); |
| 60 |
|