예제 #1
0
 /**
  * Generate arguments depends on location and menu
  */
 function get_args($args)
 {
     $this->profile_id = WR_Megamenu_Helpers_Functions::get_profile_by_location($args['theme_location']);
     if ($this->profile_id) {
         // Show only once in one location
         if ($this->echo == $args['theme_location']) {
             $args['echo'] = FALSE;
         }
         $this->echo = $args['theme_location'];
         $args['profile_id'] = $this->profile_id;
         $this->settings = WR_Megamenu_Helpers_Builder::get_megamenu_data($this->profile_id);
         // load assets for a profile
         $this->load_profile_assets();
         $menu_type = $this->settings['menu_type'];
         $location = $this->settings['location'];
         // Get the nav menu based on the requested menu
         $menu = wp_get_nav_menu_object($menu_type);
         $locations = get_nav_menu_locations();
         if (!$menu && $location && isset($locations[$location])) {
             // Get the nav menu based on the theme_location
             $menu = wp_get_nav_menu_object($locations[$location]);
         }
         if ($menu && $menu->term_id == $menu_type && isset($locations[$location])) {
             $args['menu_type'] = $menu_type;
             $args['theme_location'] = $location;
             $helper = new WR_Megamenu_Helpers_Frontend();
             return $helper->get_args($args);
         } else {
             return $args;
         }
     } else {
         return $args;
     }
     return $args;
 }
예제 #2
0
파일: walker.php 프로젝트: WP-Panda/m.video
 /**
  * Starting build menu element
  * @param string $output Passed by reference. Used to append additional content.
  * @param object $item Menu item data object.
  * @param int $depth Depth of menu item. Used for padding.
  * @param int $current_page Menu item ID.
  * @param object $args
  */
 function start_el(&$output, $item, $depth = 0, $args = array(), $current_object_id = 0)
 {
     $el_styles = array();
     $item_output = '<a href="' . $item->url . '" class="menu-item-link">';
     if (isset($item->icon) && $item->icon != '') {
         $item_output .= ' <i class="' . $item->icon . '"></i>';
     }
     $item_output .= '<span class="menu_title">' . $item->title . '</span></a>';
     $classes = empty($item->classes) ? array() : (array) $item->classes;
     $classes[] = 'wr-megamenu-item';
     $classes[] = 'level-' . $depth;
     $data = WR_Megamenu_Helpers_Builder::get_megamenu_data($args->profile_id, $item->ID);
     if ($depth == 0) {
         if (count($data) && $data['is_mega'] == 'true') {
             $this->is_mega = true;
             $classes[] = 'mega-item';
             $settings = $data['setting_menu'];
             if (isset($settings['full_width_value']) && $settings['full_width_value'] == '1') {
                 // min width
                 $this->mega_wrapper_width = '100%;';
                 $el_styles[] = 'position:static !important';
             } else {
                 $this->mega_wrapper_width = @$settings['container_width'] ? $settings['container_width'] . 'px' : '100%';
                 $classes[] = 'wr-megamenu-fixed';
             }
             $this->style = 'style="width:' . $this->mega_wrapper_width . '; left:0;"';
             if ($this->is_mega) {
                 $item_output .= '<div class="wr-megamenu-inner" ' . $this->style . ' data-container="940">';
                 $shortcode_content = urldecode($data['shortcode_content']);
                 if (!empty($shortcode_content)) {
                     $shortcode_content = preg_replace_callback('/\\[wr_megamenu_widget\\s+([A-Za-z0-9_-]+=\\"[^"\']*\\"\\s*)*\\s*\\](.*)\\[\\/wr_megamenu_widget\\]/Us', array('WR_Megamenu_Helpers_Shortcode', 'widget_content'), $shortcode_content);
                     $item_output .= do_shortcode($shortcode_content);
                 }
                 $item_output .= '</div>';
             }
         } else {
             $classes[] = 'menu-default';
             $this->is_mega = false;
             $this->style = '';
             $this->mega_wrapper_width = 'auto';
         }
     }
     // Generate class and style attribute
     $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args));
     $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : '';
     $el_styles = $el_styles ? ' style="' . esc_attr(join(';', $el_styles)) . '"' : '';
     if ($depth != 0 && $this->is_mega) {
         $output .= '';
         $item_output = '';
     } else {
         $output .= '<li ' . $class_names . ' ' . $el_styles . '>';
     }
     $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
 }
예제 #3
0
 function get_widget_content()
 {
     if (isset($_GET['wr_preview_widget'])) {
         if (!isset($_GET[WR_MEGAMENU_NONCE]) || !wp_verify_nonce($_GET[WR_MEGAMENU_NONCE], WR_MEGAMENU_NONCE)) {
             return;
         }
         $widget_id = mysql_real_escape_string($_GET['widget_id']);
         $widget_params = urldecode($_POST['widget_options']);
         $object = new $widget_id();
         $options_index = WR_Megamenu_Helpers_Widget::get_widget_base_name($object);
         $options = WR_Megamenu_Helpers_Builder::parse_menu_widget_options($widget_params);
         if (count($options) && isset($options[$options_index])) {
             $widget_instance = $options[$options_index][0];
         }
         $content = WR_Megamenu_Helpers_Widget::get_widget_content(get_class($object), $widget_instance);
         $html = '<div class="widget_inner_wrapper jsn-bootstrap3">';
         $html .= $content;
         $html .= '</div>';
         echo balanceTags($html);
     }
 }
예제 #4
0
<?php

/**
 * @version    $Id$
 * @package    WR MegaMenu
 * @author     WooRockets Team <*****@*****.**>
 * @copyright  Copyright (C) 2014 WooRockets.com All Rights Reserved.
 * @license    GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
 *
 * Websites: http://www.woorockets.com
 * Technical Support:  Feedback - http://www.woorockets.com
 */
wp_nonce_field('wr_mm_builder', WR_MEGAMENU_NONCE . '_builder');
$locations = get_registered_nav_menus();
$menus = wp_get_nav_menus();
$data = WR_Megamenu_Helpers_Builder::get_megamenu_data($profile->ID);
$menu_type = isset($data['menu_type']) ? $data['menu_type'] : (isset($menus[0]->term_id) ? $menus[0]->term_id : '');
$tab_contents = array('menu_bar' => 'Menu Bar', 'submenu_panel' => 'Submenu Panel');
$styling_fields = array();
$styling_fields['menu_bar'] = array(array('name' => __('Menu layout', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'menu-bar-menu_layout', 'type' => 'radio_button_group', 'std' => 'horizontal', 'icons' => 'wr-icon-horizontal_#_wr-icon-vertical', 'options' => array('horizontal' => __('Horizontal', WR_MEGAMENU_TEXTDOMAIN), 'vertical' => __('Vertical', WR_MEGAMENU_TEXTDOMAIN))), array('name' => __('Stick menu to top', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'menu-bar-stick_menu', 'type' => 'radio_group', 'std' => 'no', 'options' => array('no' => __('No', WR_MEGAMENU_TEXTDOMAIN), 'yes' => __('Yes', WR_MEGAMENU_TEXTDOMAIN)), 'tooltip' => __('Stick menu to top when scroll down', WR_MEGAMENU_TEXTDOMAIN)), array('name' => __('Font', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'menu-bar-font', 'type' => 'select', 'class' => 'input-sm', 'std' => __('inherit', WR_MEGAMENU_TEXTDOMAIN), 'options' => array('inherit' => 'Inherit', 'custom' => 'Custom'), 'has_depend' => '1'), array('name' => __('Font Face', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'menu-bar-font_family', 'type' => array(array('id' => 'menu-bar-font_type', 'type' => 'select', 'class' => 'font-type ', 'std' => 'Standard Font', 'options' => array('Standard Font' => 'Standard Font', 'Google Font' => 'Google Font')), array('id' => 'menu-bar-font_face', 'type' => 'select', 'class' => 'font-face', 'std' => 'Arial', 'options' => array('Arial' => 'Arial', 'Verdana' => 'Verdana', 'Times New Roman' => 'Times New Roman'))), 'dependency' => array('menu-bar-font', '=', 'custom')), array('name' => __('Font Attributes', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'menu-bar-font_attributes', 'type' => array(array('id' => 'menu-bar-font_weight', 'type' => 'select', 'class' => 'form-control pull-left', 'std' => 'normal', 'options' => array('bold' => 'Bold', 'light' => 'Light', 'normal' => 'Normal', 'thin' => 'Thin')), array('id' => 'menu-bar-font_size', 'type' => 'select', 'class' => 'form-control pull-left', 'std' => '10', 'options' => array('10' => '10', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20')), array('id' => 'menu-bar-menu_color', 'type' => 'color_picker2', 'std' => '#000', 'hide_value' => 'true', 'wrap_color_class' => '')), 'dependency' => array('menu-bar-font', '=', 'custom')), array('name' => __('Background Color', WR_MEGAMENU_TEXTDOMAIN), 'type' => array(array('id' => 'menu-bar-bg', 'type' => 'color_picker2', 'std' => '#ffffff')), 'container_class' => 'combo-group'), array('name' => __('Background On Hover', WR_MEGAMENU_TEXTDOMAIN), 'type' => array(array('id' => 'menu-bar-on_hover', 'type' => 'color_picker2', 'std' => '#ffffff')), 'container_class' => 'combo-group'), array('name' => __('Icon', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'menu-bar-icon_spacer', 'class' => 'wr_spacer', 'blank_output' => '1', 'type' => 'spacer', 'tooltip' => __('To add icon for menu item, access to WP Menu management', WR_MEGAMENU_TEXTDOMAIN)), array('name' => __('Display Mode', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'menu-bar-icon_display_mode', 'type' => 'radio_button_group', 'std' => 'text_only', 'icons' => 'wr-icon-text-only_#_wr-icon-icon-only_#_wr-icon-icon-text', 'options' => array('text_only' => __('Text Only', WR_MEGAMENU_TEXTDOMAIN), 'icon_only' => __('Icon Only', WR_MEGAMENU_TEXTDOMAIN), 'icon_text' => __('Icon vs Text', WR_MEGAMENU_TEXTDOMAIN)), 'has_depend' => '1'), array('name' => __('Icon Position', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'menu-bar-icon_position', 'type' => 'radio_group', 'std' => 'left', 'options' => array('left' => __('Left', WR_MEGAMENU_TEXTDOMAIN), 'top' => __('Top', WR_MEGAMENU_TEXTDOMAIN)), 'tooltip' => __('the position of icon', WR_MEGAMENU_TEXTDOMAIN), 'dependency' => array('menu-bar-icon_display_mode', '=', 'icon_text')), array('name' => __('Icon Size', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'menu-bar-icon_size', 'type' => 'text_number', 'exclude_class' => array('form-control'), 'std' => '16', 'dependency' => array('menu-bar-icon_display_mode', '!=', 'text_only')));
$styling_fields['submenu_panel'] = array(array('name' => __('Heading Text', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'heading-text-font', 'type' => 'select', 'class' => 'input-sm', 'std' => __('inherit', WR_MEGAMENU_TEXTDOMAIN), 'options' => array('inherit' => 'Inherit', 'custom' => 'Custom'), 'has_depend' => '1'), array('name' => __('Font Face', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'heading-text-font_family', 'type' => array(array('id' => 'heading-text-font_type', 'type' => 'select', 'class' => 'font-type', 'std' => 'Standard Font', 'options' => array('Standard Font' => 'Standard Font', 'Google Font' => 'Google Font')), array('id' => 'heading-text-font_face', 'type' => 'select', 'class' => 'font-face', 'std' => __('Arial', WR_MEGAMENU_TEXTDOMAIN), 'role' => 'title', 'options' => array('Arial' => 'Arial', 'Verdana' => 'Verdana', 'Times New Roman' => 'Times New Roman'))), 'dependency' => array('heading-text-font', '=', 'custom')), array('name' => __('Font Attributes', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'heading-text-font_attributes', 'type' => array(array('id' => 'heading-text-font_weight', 'type' => 'select', 'class' => 'form-control', 'std' => 'bold', 'options' => array('bold' => 'Bold', 'light' => 'Light', 'normal' => 'Normal', 'thin' => 'Thin')), array('id' => 'heading-text-font_size', 'type' => 'select', 'class' => 'form-control', 'std' => '10', 'options' => array('10' => '10', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20')), array('id' => 'heading-text-menu_color', 'type' => 'color_picker2', 'hide_value' => 'true', 'std' => '#000', 'wrap_color_class' => '')), 'dependency' => array('heading-text-font', '=', 'custom')), array('name' => __('Normal Text', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'normal-text-font', 'type' => 'select', 'class' => 'input-sm', 'std' => __('inherit', WR_MEGAMENU_TEXTDOMAIN), 'options' => array('inherit' => 'Inherit', 'custom' => 'Custom'), 'has_depend' => '1'), array('name' => __('Font Face', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'normal-text-font_family', 'type' => array(array('id' => 'normal-text-font_type', 'type' => 'select', 'class' => 'font-type', 'std' => 'Standard Font', 'options' => array('Standard Font' => 'Standard Font', 'Google Font' => 'Google Font')), array('id' => 'normal-text-font_face', 'type' => 'select', 'class' => 'font-face', 'std' => 'Arial', 'role' => 'title', 'options' => array('Arial' => 'Arial', 'Verdana' => 'Verdana', 'Times New Roman' => 'Times New Roman'))), 'dependency' => array('normal-text-font', '=', 'custom')), array('name' => __('Font Attributes', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'normal-text-font_attributes', 'type' => array(array('id' => 'normal-text-font_weight', 'type' => 'select', 'class' => 'form-control', 'std' => 'bold', 'role' => 'title', 'options' => array('bold' => 'Bold', 'light' => 'Light', 'normal' => 'Normal', 'thin' => 'Thin')), array('id' => 'normal-text-font_size', 'type' => 'select', 'class' => 'form-control', 'std' => '10', 'role' => 'title', 'options' => array('10' => '10', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20')), array('id' => 'normal-text-menu_color', 'class' => 'form-control', 'hide_value' => 'true', 'type' => 'color_picker2', 'std' => '#000', 'wrap_color_class' => '')), 'dependency' => array('normal-text-font', '=', 'custom')), array('name' => __('Enable Bullet Icon', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'submenu-panel-bullet_icon', 'type' => 'radio_group', 'std' => 'yes', 'options' => array('no' => __('No', WR_MEGAMENU_TEXTDOMAIN), 'yes' => __('Yes', WR_MEGAMENU_TEXTDOMAIN))));
?>
<div id="wr-megamenu-builder" class="jsn-master">
	<div class="wr-megamenu-builder-container jsn-section-content jsn-style-light jsn-bootstrap3">
		<div id="wr-menu-controls" class="">
			<div id="wr-menu-top-options">

				<div class="control-group">
					<label class="control-label" for="locations"><?php 
_e('Location', WR_MEGAMENU_TEXTDOMAIN);
?>