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