PluginProbe
QuadMenu – Mega Menu / 3.3.4
QuadMenu – Mega Menu v3.3.4
3.3.7 3.3.6 trunk 1.8.4 1.8.5 1.8.7 1.8.8 1.8.9 1.9.0 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 All 87 releases
quadmenu / lib / integrations / class-elementor.php

class-elementor.php in QuadMenu – Mega Menu 3.3.4, at lib/integrations/class-elementor.php

95 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace QuadLayers\QuadMenu\Integrations;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 die( '-1' );
7 }
8
9 use QuadLayers\QuadMenu\Integrations\Elementor\Module;
10
11 /**
12 * Elementor ex QuadMenu_Elementor Class
13 */
14 class Elementor {
15
16 private static $instance;
17
18 public function __construct() {
19 // add_filter('wp_nav_menu_args', array($this, 'elementor'), 10, 1);
20 add_action( 'elementor/widgets/widgets_registered', array( $this, 'module' ) );
21 add_action( 'elementor/widgets/widgets_registered', array( $this, 'exclude' ) );
22 add_action( 'wp_footer', array( $this, 'footer' ) );
23 }
24
25 function exclude( $elementor ) {
26
27 if ( ! class_exists( '\\Elementor\\Plugin', false ) ) {
28 return;
29 }
30
31 $elementor->unregister_widget_type( 'wp-widget-quadmenu_widget' );
32 }
33
34 function module( $elementor ) {
35
36 if ( ! class_exists( '\\Elementor\\Plugin', false ) ) {
37 return;
38 }
39
40 $elementor->register_widget_type( new Module() );
41 }
42
43 function footer() {
44
45 if ( ! class_exists( '\\Elementor\\Plugin', false ) ) {
46 return;
47 }
48 // if (!Elementor\Plugin::$instance->editor->is_edit_mode() && !Elementor\Plugin::$instance->preview->is_preview_mode()) {
49 // return;
50 // }
51
52 if ( ! property_exists( '\\Elementor\\Plugin', 'instance' ) ) {
53 return;
54 }
55
56 if ( ! @\Elementor\Plugin::$instance->preview ) {
57 return;
58 }
59
60 if ( ! @\Elementor\Plugin::$instance->preview->is_preview_mode() ) {
61 return;
62 }
63 ?>
64 <script>
65 jQuery(function ($) {
66 if (window.elementorFrontend) {
67
68 elementorFrontend.hooks.addAction('frontend/element_ready/global', function (response) {
69
70 var $quadmenu = $('nav#quadmenu', $(response));
71
72 if ($quadmenu.length) {
73
74 setTimeout(function () {
75 $quadmenu.quadmenu();
76 }, 100);
77
78 }
79
80 });
81 }
82 });
83 </script>
84 <?php
85 }
86
87 public static function instance() {
88 if ( ! isset( self::$instance ) ) {
89 self::$instance = new self();
90 }
91 return self::$instance;
92 }
93 }
94
95