PluginProbe
MotoPress Hotel Booking for Divi / 1.0.3
MotoPress Hotel Booking for Divi v1.0.3
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 / plugin.php

plugin.php in MotoPress Hotel Booking for Divi 1.0.3, at plugin.php

92 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 class MPHB_Divi extends DiviExtension {
3
4 public $name = 'mphb-divi';
5 public $gettext_domain;
6 public $version;
7
8 private static $instance = null;
9
10 /**
11 * @return MPHB_Divi|null
12 */
13 public static function getInstance () {
14
15 if( ! isset ( self::$instance ) ) {
16 self::$instance = new self();
17 }
18
19 return self::$instance;
20
21 }
22
23 /**
24 * MPHB_Divi constructor.
25 */
26 public function __construct ( $name = 'mphb-divi', $args = array() ) {
27
28 $this->plugin_dir = plugin_dir_path( __FILE__ );
29 $this->plugin_dir_url = plugin_dir_url( __FILE__ );
30 $this->addActions();
31 $this->loadIncludes();
32
33 $pluginData = get_plugin_data("{$this->plugin_dir}/mphb-divi.php");
34 $this->version = isset( $pluginData['Version'] ) ? $pluginData['Version'] : '';
35 $this->gettext_domain = isset( $pluginData['TextDomain'] ) ? $pluginData['TextDomain'] : '';
36
37 parent::__construct($name,$args);
38
39 }
40
41 /**
42 * Load plugin includes
43 */
44 private function loadIncludes () {
45
46 include $this->plugin_dir. 'includes/functions.php';
47
48 }
49
50 /**
51 * Add actions
52 */
53 public function addActions () {
54
55 add_action( 'wp_enqueue_scripts', array( $this, 'enqueueScripts' ) );
56 add_action( 'customize_preview_init', array( $this, 'enqueueCustomizerScripts' ) );
57 add_action( 'et_fb_enqueue_assets', function (){
58 wp_enqueue_script( 'mphb-flexslider' );
59 wp_enqueue_style( 'mphb-flexslider-css' );
60 });
61
62 }
63
64 /**
65 * Enqueue scripts & styles
66 */
67 public function enqueueScripts () {
68
69 wp_enqueue_style( 'mphb-divi-style', $this->plugin_dir_url . 'assets/style.css', array(), $this->version );
70
71 }
72
73 /**
74 * Enqueue customizer scripts
75 */
76 public function enqueueCustomizerScripts () {
77
78 wp_enqueue_script( 'mphb-divi-customize-preview', $this->plugin_dir_url . 'assets/customize-preview.js', array( 'jquery', 'customize-preview' ), $this->version );
79
80 }
81
82 public function hook_et_builder_modules_loaded() {
83
84 if ( file_exists( "{$this->plugin_dir}/includes/loader.php" ) ) {
85 require_once "{$this->plugin_dir}/includes/loader.php";
86 }
87
88 }
89
90 }
91
92 MPHB_Divi::getInstance();