| 1 |
<?php |
| 2 |
|
| 3 |
namespace QuadLayers\QuadMenu\Integrations; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
die( '-1' ); |
| 7 |
} |
| 8 |
|
| 9 |
use QuadLayers\QuadMenu\Integrations\Beaver\Module; |
| 10 |
|
| 11 |
/** |
| 12 |
* Beaver ex QuadMenu_Beaver Class |
| 13 |
*/ |
| 14 |
class Beaver { |
| 15 |
|
| 16 |
private static $instance; |
| 17 |
|
| 18 |
public function __construct() { |
| 19 |
// add_filter('wp_nav_menu_args', array($this, 'beaver'), 10, 1); |
| 20 |
add_filter( 'fl_get_wp_widgets_exclude', array( $this, 'exclude' ) ); |
| 21 |
add_action( 'init', array( $this, 'module' ) ); |
| 22 |
add_action( 'wp_footer', array( $this, 'footer' ) ); |
| 23 |
} |
| 24 |
|
| 25 |
function exclude( $exclude ) { |
| 26 |
$exclude[] = '\\QuadLayers\\QuadMenu\\Widget'; |
| 27 |
|
| 28 |
return $exclude; |
| 29 |
} |
| 30 |
|
| 31 |
function module() { |
| 32 |
if ( class_exists( '\\FLBuilderModule' ) ) { |
| 33 |
Module::instance(); |
| 34 |
require_once 'beaver/module.php'; |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
function footer() { |
| 39 |
if ( ! class_exists( '\\FLBuilderModel' ) ) { |
| 40 |
return; |
| 41 |
} |
| 42 |
if ( ! \FLBuilderModel::is_builder_active() ) { |
| 43 |
return; |
| 44 |
} |
| 45 |
?> |
| 46 |
<script> |
| 47 |
jQuery(function ($) { |
| 48 |
|
| 49 |
$(document).ajaxComplete(function (event, xhr, settings) { |
| 50 |
|
| 51 |
var document = this, |
| 52 |
response = JSON.parse(xhr.responseText); |
| 53 |
|
| 54 |
if ($('nav#quadmenu', $(response.html)).length) { |
| 55 |
|
| 56 |
setTimeout(function () { |
| 57 |
$('nav#quadmenu', $(document)).quadmenu(); |
| 58 |
}, 100); |
| 59 |
|
| 60 |
} |
| 61 |
|
| 62 |
}); |
| 63 |
}); |
| 64 |
</script> |
| 65 |
<?php |
| 66 |
} |
| 67 |
|
| 68 |
public static function instance() { |
| 69 |
if ( ! isset( self::$instance ) ) { |
| 70 |
self::$instance = new self(); |
| 71 |
} |
| 72 |
return self::$instance; |
| 73 |
} |
| 74 |
|
| 75 |
/* |
| 76 |
function beaver($args) { |
| 77 |
|
| 78 |
if (class_exists('FLBuilder') && class_exists('FLTheme')) { |
| 79 |
|
| 80 |
if (empty($args['theme_location'])) { |
| 81 |
|
| 82 |
$args['theme_location'] = 'header'; |
| 83 |
|
| 84 |
$header_layout = FLTheme::get_setting('fl-header-layout'); |
| 85 |
|
| 86 |
$args['layout'] = 'inherit'; |
| 87 |
$args['layout_classes'] = 'js'; |
| 88 |
|
| 89 |
if (in_array($header_layout, array('vertical-right', 'vertical-left'))) { |
| 90 |
$args['layout'] = 'inherit'; |
| 91 |
} |
| 92 |
|
| 93 |
if (in_array($header_layout, array('right', 'left'))) { |
| 94 |
$args['layout_align'] = $header_layout; |
| 95 |
} |
| 96 |
|
| 97 |
if ($header_layout == 'centered') { |
| 98 |
$args['layout_align'] = 'center'; |
| 99 |
} |
| 100 |
} |
| 101 |
} |
| 102 |
|
| 103 |
return $args; |
| 104 |
} |
| 105 |
*/ |
| 106 |
} |
| 107 |
|