Exemple #1
0
extract($_POST);
$submodal = !empty($submodal) ? 'submodal_frame' : '';
if (!isset($params)) {
    exit;
}
if (!empty($shortcode)) {
    $script = '';
    if (isset($init_tab) && $init_tab == 'appearance') {
        // Auto move to Styling tab if previous action
        // is coping style from other element.
        $script .= "\n\t\t\t(function (\$) {\n\t\t\t\t\$(document).ready(function (){\n\t\t\t\t\tsetTimeout(function (){\n\t\t\t\t\t\t\$('[href=\"#appearance\"]').click();\n\t\t\t\t\t}, 500);\n\n\t\t\t\t});\n\t\t\t})(jQuery);";
    }
    if (@$_REQUEST['form_only']) {
        $script .= ' var wr_mm_modal_ajax = true;';
    }
    WR_Megamenu_Init_Assets::print_inline('js', $script, true);
    ?>

	<div id="wr-element-<?php 
    echo esc_attr(WR_Megamenu_Helpers_Shortcode::shortcode_name($shortcode));
    ?>
">
		<div class="wr-mm-form-container jsn-bootstrap3">
			<div id="modalOptions" class="form-horizontal <?php 
    echo esc_attr($submodal);
    ?>
">
	<?php 
    if (!empty($params)) {
        $params = stripslashes($params);
        $params = urldecode($params);
Exemple #2
0
    public function load_profile_assets()
    {
        $profile_selector = $this->settings['location'] . '_' . $this->profile_id;
        $theme_style = isset($this->settings['theme_style']) ? $this->settings['theme_style'] : '';
        $themes_options = get_post_meta($this->profile_id, WR_MEGAMENU_META_KEY . '_themes_options', true);
        $themes_options = json_decode($themes_options, true);
        // Load profile theme
        $default = isset($theme_style) && $theme_style != '' ? $theme_style . '/' . $theme_style . '.css' : 'default/default.css';
        $profile_theme_url = WR_MEGAMENU_ROOT_URL . 'themes/' . $default;
        wp_enqueue_style("wr-{$this->profile_id}", $profile_theme_url, array(), '1.0');
        if (isset($themes_options[$theme_style])) {
            $theme_options = $themes_options[$theme_style];
            $setting = json_decode($theme_options, true);
            $style = '';
            // Menu bar
            $style .= '.wr-megamenu-container.' . $profile_selector . ' {background: ' . $setting['menu-bar-bg'] . ' !important;}';
            $style .= '.' . $profile_selector . ' .wr-mega-menu > li:hover > a, .' . $profile_selector . ' .wr-mega-menu > li.focus > a {background: ' . $setting['menu-bar-on_hover'] . ' !important;}';
            if ($setting['menu-bar-font'] != 'inherit') {
                $style .= '.' . $profile_selector . ' .wr-mega-menu > li > a {
							 color: ' . $setting['menu-bar-menu_color'] . ' !important;
							 font-family: ' . $setting['menu-bar-font_face'] . ' !important;
							 font-size:' . $setting['menu-bar-font_size'] . 'px !important;
							 font-weight:' . $setting['menu-bar-font_weight'] . ' !important;
						 }';
            }
            if ($setting['menu-bar-icon_display_mode'] == 'icon_only') {
                $style .= ".{$profile_selector} .wr-mega-menu > li > a .menu_title, .{$profile_selector} .wr-mega-menu .sub-menu a .menu_title, .{$profile_selector} .wr-mega-menu .block-sub-menu a .ig-menu-title {display:none;}";
            } else {
                if ($setting['menu-bar-icon_display_mode'] == 'text_only') {
                    $style .= ".{$profile_selector} .wr-mega-menu > li > a > i, .{$profile_selector} .wr-mega-menu .sub-menu a i {display:none !important;}";
                }
            }
            $style .= ".{$profile_selector} .wr-mega-menu > li > a > i {font-size: " . $setting['menu-bar-icon_size'] . 'px !important;}';
            if ($setting['menu-bar-icon_position'] == 'top') {
                $style .= ".{$profile_selector} .wr-mega-menu > li > a > i {display:block !important;}";
                $style .= ".{$profile_selector} .wr-mega-menu > li > a > i {text-align: center; width: 100% !important ;}";
            }
            if ($setting['heading-text-font'] != 'inherit') {
                $style .= '.' . $profile_selector . ' .wr-mega-menu a.caption {
							 color: ' . $setting['heading-text-menu_color'] . ' !important;
							 font-family: ' . $setting['heading-text-font_face'] . ' !important;
							 font-size:' . $setting['heading-text-font_size'] . 'px !important;
							 font-weight:' . $setting['heading-text-font_weight'] . ' !important;
						 }';
            }
            if ($setting['normal-text-font'] != 'inherit') {
                $style .= '.' . $profile_selector . ' ul.sub-menu li a,
							ul.submenu-items li a {
							 color: ' . $setting['normal-text-menu_color'] . ' !important;
							 font-family: ' . $setting['normal-text-font_face'] . ' !important;
							 font-size:' . $setting['normal-text-font_size'] . 'px !important;
							 font-weight:' . $setting['normal-text-font_weight'] . ' !important;
						 }';
            }
            WR_Megamenu_Init_Assets::print_inline('css', $style);
            $script = ' ';
            if ($setting['menu-bar-menu_layout'] == 'vertical') {
                $script .= " \$( '.wr-megamenu-container.{$profile_selector}' ).addClass( 'vertical' );";
            }
            if ($setting['submenu-panel-bullet_icon'] == 'yes') {
                $script .= "\$( '.{$profile_selector} ul.sub-menu li a, .{$profile_selector} ul.submenu-items li a' ).prepend( '<i class=\"glyphicon glyphicon-chevron-right\"></i>' );";
            }
            if ($setting['menu-bar-stick_menu'] == 'yes') {
                $script .= "\$(document).scroll(function () {\n\t\t\t\t\t\t\t\tvar y = \$(document).scrollTop(),\n\t\t\t\t\t\t\t\tmega_container = \$( '.wr-megamenu-container.{$profile_selector}' );\n\t\t\t\t\t\t\t\tresponsive = \$( '.it-responsive-mega' );\n\t\t\t\t\t\t\t\tif (y > mega_container.parent().offset().top) {\n\t\t\t\t\t\t\t\t\tmega_container.addClass( 'stick' );\n\t\t\t\t\t\t\t\t\tresponsive.addClass( 'stick' );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmega_container.removeClass( 'stick' );\n\t\t\t\t\t\t\t\t\tresponsive.removeClass( 'stick' );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});";
            }
            WR_Megamenu_Init_Assets::inline('js', $script);
        }
        $script = "\n\n\t\t\t\$( '.{$profile_selector} .mega-item.wr-megamenu-fixed, .{$profile_selector} .menu-item-has-children.menu-default' ).on( 'hover', function () {\n\n\t\t\t\tvar\n\t\t\t\t\tmega_inner = null,\n\t\t\t\t\tmega_menu = \$(this).find( ' > .wr-megamenu-inner' ),\n\t\t\t\t\tsub_menu = \$(this).find( ' > .sub-menu' ),\n\t\t\t\t\tis_mega_inner = false\n\t\t\t\t\t;\n\n\t\t\t\tif (sub_menu.length > 0) {\n\t\t\t\t\tmega_inner = sub_menu;\n\t\t\t\t} else if (mega_menu.length > 0) {\n\t\t\t\t\tmega_inner = mega_menu;\n\t\t\t\t\tis_mega_inner = true;\n\t\t\t\t}\n\t\t\t\tif (mega_inner != null) {\n\t\t\t\t\tif (mega_inner.outerWidth() > (\$(window).outerWidth() - mega_inner.offset().left ) ) {\n\t\t\t\t\t\tif (!is_mega_inner) {\n\t\t\t\t\t\t\tmega_inner.addClass( 'wr-megamenu-rtl' );\n\t\t\t\t\t\t\t\$( '.{$profile_selector} ul.sub-menu li.wr-megamenu-item' ).css({'text-align': 'right', 'background': 'inherit'});\n\t\t\t\t\t\t\t\$( '.{$profile_selector} ul.wr-mega-menu ul ul.sub-menu' ).css( 'right', '99%' );\n\t\t\t\t\t\t\t\$( '.{$profile_selector} ul.wr-mega-menu ul li' ).on( 'hover', function () {\n\t\t\t\t\t\t\t\t\$(this).find( '> ul.sub-menu' ).css({'right': '100%'});\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\$( '.wr-megamenu-container.{$profile_selector} ul ul' ).addClass('pull-right');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmega_inner.addClass('wr-megamenu-left-inner');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t";
        WR_Megamenu_Init_Assets::inline('js', $script);
        // Custom css
        $custom_css_data = WR_Megamenu_Helpers_Functions::custom_css_data(isset($this->profile_id) ? $this->profile_id : NULL);
        extract($custom_css_data);
        $css_files = stripslashes($css_files);
        if (!empty($css_files)) {
            $css_files = json_decode($css_files);
            $data = $css_files->data;
            foreach ($data as $idx => $file_info) {
                $checked = $file_info->checked;
                $url = $file_info->url;
                // if file is checked to load, enqueue it
                if ($checked) {
                    echo balanceTags("<link rel='stylesheet' id='wr-mg-custom-file-{$this->profile_id}-{$idx}'  href='/{$url}' type='text/css' media='all' />");
                }
            }
        }
        $css_custom = stripslashes($css_custom);
        if (!empty($css_custom)) {
            WR_Megamenu_Init_Assets::print_inline('css', $css_custom);
        }
    }