PluginProbe
MotoPress Hotel Booking for Divi / 1.1.0
MotoPress Hotel Booking for Divi v1.1.0
trunk 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 2.0.0
mphb-divi / includes / mphb.php

mphb.php in MotoPress Hotel Booking for Divi 1.1.0, at includes/mphb.php

89 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 $this->plugin_dir = plugin_dir_path( __FILE__ );
32 $this->plugin_dir_url = plugin_dir_url( $this->plugin_dir );
33
34 $this->addActions();
35 $this->loadIncludes();
36
37 $pluginData = get_plugin_data( plugin_dir_path( dirname( __FILE__ ) ) . 'mphb-divi.php' );
38 $this->version = isset( $pluginData[ 'Version' ] ) ? $pluginData[ 'Version' ] : '';
39 $this->gettext_domain = isset( $pluginData[ 'TextDomain' ] ) ? $pluginData[ 'TextDomain' ] : '';
40
41 parent::__construct( $name, $args );
42 }
43
44 /**
45 * Add actions
46 */
47 public function addActions () {
48
49 add_action( 'wp_enqueue_scripts', array( $this, 'enqueueScripts' ) );
50 add_action( 'customize_preview_init', array( $this, 'enqueueCustomizerScripts' ) );
51 add_action( 'et_fb_enqueue_assets', function () {
52 wp_enqueue_script( 'mphb-flexslider' );
53 wp_enqueue_style( 'mphb-flexslider-css' );
54 } );
55 }
56
57 /**
58 * Enqueue scripts & styles
59 */
60 public function enqueueScripts () {
61
62 wp_enqueue_style( 'mphb-divi-style', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/style.css', array(), $this->version );
63 }
64
65 /**
66 * Enqueue customizer scripts
67 */
68 public function enqueueCustomizerScripts () {
69
70 wp_enqueue_script( 'mphb-divi-customize-preview', plugin_dir_url( dirname( __FILE__ ) ) . 'assets/customize-preview.js', array( 'jquery', 'customize-preview' ), $this->version );
71 }
72
73 /**
74 * Load plugin includes
75 */
76 private function loadIncludes () {
77
78 include plugin_dir_path( dirname( __FILE__ ) ) . 'includes/functions.php';
79 }
80
81 public function hook_et_builder_modules_loaded() {
82
83 if ( file_exists( plugin_dir_path( dirname( __FILE__ ) ) . 'includes/loader.php' ) ) {
84 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/loader.php';
85 }
86 }
87 }
88
89 MPHB_Divi::getInstance();