PluginProbe
QuadMenu – Mega Menu / trunk
QuadMenu – Mega Menu vtrunk
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 / divi / class-module.php

class-module.php in QuadMenu – Mega Menu trunk, at lib/integrations/divi/class-module.php

65 lines 1.8 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\Divi;
4
5 /**
6 * Module Class Ex QuadmenuDiviModule
7 */
8
9 class Module extends \DiviExtension {
10 public static $instance;
11
12 public $gettext_domain = 'quadmenu-quadmenu-divi-module';
13 public $name = 'quadmenu-divi-module';
14 public $version = '1.0.0';
15
16 function ajax_quadmenu_divi_module() {
17
18 if ( ! empty( $_REQUEST['menu_id'] ) && ! empty( $_REQUEST['menu_theme'] ) ) {
19 $menu = quadmenu(
20 array(
21 'echo' => false,
22 'menu' => $_REQUEST['menu_id'],
23 'theme' => $_REQUEST['menu_theme'],
24 'layout_classes' => 'js',
25 )
26 );
27 wp_send_json_success( $menu );
28 } else {
29 wp_send_json_error( 'Unknown error.', 'quadmenu' );
30 }
31 }
32
33 function _dequeue_bundles() {
34 wp_dequeue_style( "{$this->name}-styles" );
35 }
36
37 function fullwidth_menu( $args ) {
38
39 if ( class_exists( 'ET_Builder_Module' ) ) {
40 if ( isset( $args['menu_class'] ) && strpos( $args['menu_class'], 'fullwidth-menu' ) !== false ) {
41 $args['theme_location'] = false;
42 }
43 }
44
45 return $args;
46 }
47
48 public function __construct( $name = 'quadmenu-divi-module', $args = array() ) {
49 $this->plugin_dir = plugin_dir_path( __FILE__ );
50 $this->plugin_dir_url = plugin_dir_url( $this->plugin_dir . 'divi/' );
51 add_action( 'wp_ajax_ajax_quadmenu_divi_module', array( $this, 'ajax_quadmenu_divi_module' ) );
52 add_action( 'wp_ajax_nopriv_ajax_quadmenu_divi_module', array( $this, 'ajax_quadmenu_divi_module' ) );
53 add_action( 'wp_enqueue_scripts', array( $this, '_dequeue_bundles' ), 100 );
54 add_filter( 'wp_nav_menu_args', array( $this, 'fullwidth_menu' ), 100000, 1 );
55 parent::__construct( $name, $args );
56 }
57
58 public static function instance() {
59 if ( ! isset( self::$instance ) ) {
60 self::$instance = new self();
61 }
62 return self::$instance;
63 }
64 }
65