PluginProbe
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits / 3.1.2
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits v3.1.2
3.2.2 3.2.3 3.2.1 3.2.0 3.1.9 3.1.8 3.1.7 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.9 trunk 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.3 1.1.4 1.1.5 All 174 releases
master-addons / inc / modules / display / mega-menu / mega-menu.php

mega-menu.php in Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits 3.1.2, at inc/modules/display/mega-menu/mega-menu.php

115 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace MasterAddons\Modules\Display;
4
5 defined('ABSPATH') || exit;
6
7 if (!class_exists('MasterAddons\Modules\Display\MegaMenu')) {
8 class MegaMenu
9 {
10
11 public $dir;
12
13 public $url;
14
15 private static $plugin_path;
16
17 private static $plugin_url;
18
19 private static $_instance = null;
20
21 public function __construct()
22 {
23
24 // Current Path
25 $this->dir = dirname(__FILE__) . '/';
26
27 $this->url = self::plugin_url() . '/mega-menu/';
28
29 add_action('init', [$this, 'jltma_include_files']);
30 }
31
32
33 public function jltma_include_files()
34 {
35 include $this->dir . '/inc/cpt.php';
36 include $this->dir . '/inc/megamenu-assets.php';
37 include $this->dir . '/inc/rest-api.php';
38 include $this->dir . '/inc/api.php';
39 include $this->dir . '/inc/options.php';
40 include $this->dir . '/inc/walker-nav-menu.php';
41 include $this->dir . '/inc/cpt-api.php';
42
43 $this->jltma_megamenu_init();
44 }
45
46
47
48 public function jltma_megamenu_init(){
49
50 // Call functions from MegaMenu sub-namespace
51 MegaMenu\jltma_megamenu_assets();
52 MegaMenu\jltma_megamenu_options();
53
54 MegaMenu\jltma_megamenu_api()->init();
55 MegaMenu\jltma_megamenu_cpt_api()->init();
56
57 if (is_admin()) {
58 if(!function_exists('\MasterAddons\Modules\Display\MegaMenu\jltma_megamenu_cpt')){
59 new MegaMenu\JLTMA_Megamenu_Cpt();
60 }else{
61 MegaMenu\jltma_megamenu_cpt();
62 }
63 }
64 }
65
66 public static function plugin_url()
67 {
68 if (self::$plugin_url) {
69 return self::$plugin_url;
70 }
71 return self::$plugin_url = untrailingslashit(plugins_url('/', __FILE__));
72 }
73
74 public static function plugin_path()
75 {
76 if (self::$plugin_path) {
77 return self::$plugin_path;
78 }
79 return self::$plugin_path = untrailingslashit(plugin_dir_path(__FILE__));
80 }
81
82 public static function get_instance()
83 {
84 if (is_null(self::$_instance)) {
85 self::$_instance = new self();
86 }
87 return self::$_instance;
88 }
89 }
90 }
91
92 /*
93 * Returns Instanse of the Master Mega Menu
94 */
95 if (!function_exists('MasterAddons\Modules\Display\jltma_megamenu')) {
96 function jltma_megamenu()
97 {
98 if (class_exists('MasterAddons\Modules\Display\MegaMenu')) {
99 return MegaMenu::get_instance();
100 }
101 }
102 }
103
104 jltma_megamenu();
105
106 /* Re-write flus */
107 register_activation_hook(__FILE__, 'jltma_flush_rewrites');
108 register_deactivation_hook(__FILE__, 'jltma_flush_rewrites');
109 if (!function_exists('MasterAddons\Modules\Display\jltma_flush_rewrites')) {
110 function jltma_flush_rewrites()
111 {
112 flush_rewrite_rules();
113 }
114 }
115